Skip to content

Commit

Permalink
Use float2Const instead of vec2 in shader generation code
Browse files Browse the repository at this point in the history
Signed-off-by: Rémi Achard <[email protected]>
  • Loading branch information
remia committed Aug 21, 2024
1 parent 86f7d29 commit 6585f18
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/OpenColorIO/ops/fixedfunction/FixedFunctionOpGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,8 @@ std::string _Add_Reach_table(
}
else
{
ss.newLine() << ss.floatDecl("lo") << " = " << ss.sampleTex2D(name, "vec2((i_lo + 0.5f) / 360.f, 0.5f)") << ".r;";
ss.newLine() << ss.floatDecl("hi") << " = " << ss.sampleTex2D(name, "vec2((i_hi + 0.5f) / 360.f, 0.5f)") << ".r;";
ss.newLine() << ss.floatDecl("lo") << " = " << ss.sampleTex2D(name, ss.float2Const("(i_lo + 0.5f) / 360.f", "0.5f")) << ".r;";
ss.newLine() << ss.floatDecl("hi") << " = " << ss.sampleTex2D(name, ss.float2Const("(i_hi + 0.5f) / 360.f", "0.5f")) << ".r;";
}

ss.newLine() << ss.floatDecl("t") << " = (h - i_lo) / (i_hi - i_lo);";
Expand Down Expand Up @@ -802,8 +802,8 @@ std::string _Add_Cusp_table(
}
else
{
ss.newLine() << ss.float3Decl("lo") << " = " << ss.sampleTex2D(name, std::string("vec2((i_hi -1 + 0.5f) / ") + std::to_string(g.gamut_cusp_table.total_size)) + std::string(", 0.5f)") << ".rgb;";
ss.newLine() << ss.float3Decl("hi") << " = " << ss.sampleTex2D(name, std::string("vec2((i_hi + 0.5f) / ") + std::to_string(g.gamut_cusp_table.total_size)) + std::string(", 0.5f)") << ".rgb;";
ss.newLine() << ss.float3Decl("lo") << " = " << ss.sampleTex2D(name, ss.float2Const(std::string("(i_hi - 1 + 0.5f) / ") + std::to_string(g.gamut_cusp_table.total_size), "0.5f")) << ".rgb;";
ss.newLine() << ss.float3Decl("hi") << " = " << ss.sampleTex2D(name, ss.float2Const(std::string("(i_hi + 0.5f) / ") + std::to_string(g.gamut_cusp_table.total_size), "0.5f")) << ".rgb;";
}

ss.newLine() << ss.floatDecl("t") << " = (h - lo.b) / (hi.b - lo.b);";
Expand Down Expand Up @@ -893,8 +893,8 @@ std::string _Add_Gamma_table(
}
else
{
ss.newLine() << ss.floatDecl("lo") << " = " << ss.sampleTex2D(name, std::string("vec2((i_lo + 0.5f) / ") + std::to_string(g.upper_hull_gamma_table.total_size) + std::string(", 0.5f)")) << ".r;";
ss.newLine() << ss.floatDecl("hi") << " = " << ss.sampleTex2D(name, std::string("vec2((i_hi + 0.5f) / ") + std::to_string(g.upper_hull_gamma_table.total_size) + std::string(", 0.5f)")) << ".r;";
ss.newLine() << ss.floatDecl("lo") << " = " << ss.sampleTex2D(name, ss.float2Const(std::string("(i_lo + 0.5f) / ") + std::to_string(g.upper_hull_gamma_table.total_size), "0.5f")) << ".r;";
ss.newLine() << ss.floatDecl("hi") << " = " << ss.sampleTex2D(name, ss.float2Const(std::string("(i_hi + 0.5f) / ") + std::to_string(g.upper_hull_gamma_table.total_size), "0.5f")) << ".r;";
}

ss.newLine() << ss.floatDecl("t") << " = hwrap - base_hue;";
Expand Down

0 comments on commit 6585f18

Please sign in to comment.