Skip to content

Bug: Type Mismatch in GLES 3.0 Shader Code of _Add_Reach_table() and _Add_Cusp_table() #2269

@ufolyah

Description

@ufolyah

This is the code I generated for ACES 2.0 ODT from ACEScg to SDR 100 nit Rec.709 on Android platform. The compile complains that there are int/float type mismatch:

float _ocio_res_reach_m_table_0_sample(float h)
{
  float i_base = floor(h);
  float i_lo = i_base + 1;
  float i_hi = i_lo + 1;
  float lo = texture(_ocio_res_reach_m_table_0Sampler, vec2((i_lo + 0.5) / 363, 0.0)).r;
  float hi = texture(_ocio_res_reach_m_table_0Sampler, vec2((i_hi + 0.5) / 363, 0.5)).r;
  float t = h - i_base;
  return mix(lo, hi, t);
}

Here, the compiler complains around +1 and /363.

vec3 _ocio_res_gamut_cusp_table_0_sample(float h)
{
  int i = int(h) + 1;
  int i_lo = int(max(float(0), float(i + 0)));
  int i_hi = int(min(float(361), float(i + 2)));
  while (i_lo + 1 < i_hi)
  {
    float hcur = _ocio_res_gamut_cusp_table_0_hues_array[i];
    if (h > hcur)
    {
      i_lo = i;
    }
    else
    {
      i_hi = i;
    }
    i = (i_lo + i_hi) / 2;
  }
  vec3 lo = texture(_ocio_res_gamut_cusp_table_0Sampler, vec2((i_hi - 1 + 0.5) / 363, 0.5)).rgb;
  vec3 hi = texture(_ocio_res_gamut_cusp_table_0Sampler, vec2((i_hi + 0.5) / 363, 0.5)).rgb;
  float t = (h - _ocio_res_gamut_cusp_table_0_hues_array[i_hi - 1]) / (_ocio_res_gamut_cusp_table_0_hues_array[i_hi] - _ocio_res_gamut_cusp_table_0_hues_array[i_hi - 1]);
  return mix(lo, hi, t);
}

Here, the compiler complains around + 0.5.

For now, I can make some simple change to the code to make it work, but I have two concerns:

  1. Is there a GLSL ES 3.0 test for this codebase's CI?
  2. Is it a correct fix to simply change the constants to float type?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions