<p dir="ltr"><br>
On Aug 24, 2015 1:25 AM, "Tapani Pälli" <<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a>> wrote:<br>
><br>
><br>
><br>
> On 08/24/2015 08:17 AM, Ilia Mirkin wrote:<br>
>><br>
>><br>
>> On Aug 24, 2015 1:07 AM, "Tapani Pälli" <<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a><br>
>> <mailto:<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a>>> wrote:<br>
>>  ><br>
>>  ><br>
>>  ><br>
>>  > On 08/21/2015 05:14 PM, Ilia Mirkin wrote:<br>
>>  >><br>
>>  >> On Fri, Aug 21, 2015 at 3:22 AM, Tapani Pälli<br>
>> <<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a> <mailto:<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a>>> wrote:<br>
>>  >>><br>
>>  >>> Patch refactors existing parameters check to first check common enums<br>
>>  >>> between desktop GL and GLES 3.1 and modifies<br>
>> get_tex_level_parameter_image<br>
>>  >>> to be compatible with enums specified in 3.1.<br>
>>  >>><br>
>>  >>> Signed-off-by: Tapani Pälli <<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a><br>
>> <mailto:<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a>>><br>
>><br>
>>  >>> ---<br>
>>  >>>   src/mesa/main/texparam.c | 34 +++++++++++++++++++++++-----------<br>
>>  >>>   1 file changed, 23 insertions(+), 11 deletions(-)<br>
>>  >>><br>
>>  >>> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c<br>
>>  >>> index 16739f1..947a2a1 100644<br>
>>  >>> --- a/src/mesa/main/texparam.c<br>
>>  >>> +++ b/src/mesa/main/texparam.c<br>
>>  >>> @@ -1208,20 +1208,34 @@ static GLboolean<br>
>>  >>>   legal_get_tex_level_parameter_target(struct gl_context *ctx,<br>
>> GLenum target,<br>
>>  >>>                                        bool dsa)<br>
>>  >>>   {<br>
>>  >>> +   /* Common targets for desktop GL and GLES 3.1. */<br>
>>  >>>      switch (target) {<br>
>>  >>> -   case GL_TEXTURE_1D:<br>
>>  >>> -   case GL_PROXY_TEXTURE_1D:<br>
>>  >>>      case GL_TEXTURE_2D:<br>
>>  >>> -   case GL_PROXY_TEXTURE_2D:<br>
>>  >>>      case GL_TEXTURE_3D:<br>
>>  >>> -   case GL_PROXY_TEXTURE_3D:<br>
>>  >>>         return GL_TRUE;<br>
>>  >>> +   case GL_TEXTURE_2D_ARRAY_EXT:<br>
>>  >>> +      return (_mesa_is_gles31(ctx) ||<br>
>> ctx->Extensions.EXT_texture_array);<br>
>>  >>>      case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:<br>
>>  >>>      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:<br>
>>  >>>      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:<br>
>>  >>>      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:<br>
>>  >>>      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:<br>
>>  >>>      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:<br>
>>  >>> +      return (_mesa_is_gles31(ctx) ||<br>
>> ctx->Extensions.ARB_texture_cube_map);<br>
>>  >>> +   case GL_TEXTURE_2D_MULTISAMPLE:<br>
>>  >>> +      return (_mesa_is_gles31(ctx) ||<br>
>> ctx->Extensions.ARB_texture_multisample);<br>
>>  >>> +   }<br>
>>  >>> +<br>
>>  >>> +   if (!_mesa_is_desktop_gl(ctx))<br>
>>  >>> +      return GL_FALSE;<br>
>>  >>> +<br>
>>  >>> +   /* Rest of the desktop GL targets. */<br>
>>  >>> +   switch (target) {<br>
>>  >>> +   case GL_TEXTURE_1D:<br>
>>  >>> +   case GL_PROXY_TEXTURE_1D:<br>
>>  >>> +   case GL_PROXY_TEXTURE_2D:<br>
>>  >>> +   case GL_PROXY_TEXTURE_3D:<br>
>>  >>> +      return GL_TRUE;<br>
>>  >>>      case GL_PROXY_TEXTURE_CUBE_MAP_ARB:<br>
>>  >>>         return ctx->Extensions.ARB_texture_cube_map;<br>
>>  >>>      case GL_TEXTURE_CUBE_MAP_ARRAY_ARB:<br>
>>  >>> @@ -1232,7 +1246,6 @@ legal_get_tex_level_parameter_target(struct<br>
>> gl_context *ctx, GLenum target,<br>
>>  >>>         return ctx->Extensions.NV_texture_rectangle;<br>
>>  >>>      case GL_TEXTURE_1D_ARRAY_EXT:<br>
>>  >>>      case GL_PROXY_TEXTURE_1D_ARRAY_EXT:<br>
>>  >>> -   case GL_TEXTURE_2D_ARRAY_EXT:<br>
>>  >>>      case GL_PROXY_TEXTURE_2D_ARRAY_EXT:<br>
>>  >>>         return ctx->Extensions.EXT_texture_array;<br>
>>  >>>      case GL_TEXTURE_BUFFER:<br>
>>  >>> @@ -1254,7 +1267,6 @@ legal_get_tex_level_parameter_target(struct<br>
>> gl_context *ctx, GLenum target,<br>
>>  >>>          * "target may also be TEXTURE_BUFFER, indicating the<br>
>> texture buffer."<br>
>>  >>>          */<br>
>>  >>>         return ctx->API == API_OPENGL_CORE && ctx->Version >= 31;<br>
>>  >>> -   case GL_TEXTURE_2D_MULTISAMPLE:<br>
>>  >>>      case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:<br>
>>  >>>      case GL_PROXY_TEXTURE_2D_MULTISAMPLE:<br>
>>  >>>      case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:<br>
>>  >>> @@ -1381,8 +1393,8 @@ get_tex_level_parameter_image(struct<br>
>> gl_context *ctx,<br>
>>  >>>            *params = _mesa_get_format_bits(texFormat, pname);<br>
>>  >>>            break;<br>
>>  >>>         case GL_TEXTURE_SHARED_SIZE:<br>
>>  >>> -         if (ctx->Version < 30 &&<br>
>>  >>> -             !ctx->Extensions.EXT_texture_shared_exponent)<br>
>>  >>> +         if (!_mesa_is_gles31(ctx) && (ctx->Version < 30 &&<br>
>>  >>> +             !ctx->Extensions.EXT_texture_shared_exponent))<br>
>>  >>>               goto invalid_pname;<br>
>>  >>>            *params = texFormat == MESA_FORMAT_R9G9B9E5_FLOAT ? 5 : 0;<br>
>>  >>>            break;<br>
>>  >>> @@ -1415,7 +1427,7 @@ get_tex_level_parameter_image(struct<br>
>> gl_context *ctx,<br>
>>  >>>         case GL_TEXTURE_BLUE_TYPE_ARB:<br>
>>  >>>         case GL_TEXTURE_ALPHA_TYPE_ARB:<br>
>>  >>>         case GL_TEXTURE_DEPTH_TYPE_ARB:<br>
>>  >>> -         if (!ctx->Extensions.ARB_texture_float)<br>
>>  >>> +         if (!_mesa_is_gles31(ctx) &&<br>
>> !ctx->Extensions.ARB_texture_float)<br>
>>  >>>               goto invalid_pname;<br>
>>  >>>           if (_mesa_base_format_has_channel(img->_BaseFormat, pname))<br>
>>  >>>              *params = _mesa_get_format_datatype(texFormat);<br>
>>  >>> @@ -1425,13 +1437,13 @@ get_tex_level_parameter_image(struct<br>
>> gl_context *ctx,<br>
>>  >>><br>
>>  >>>         /* GL_ARB_texture_multisample */<br>
>>  >>>         case GL_TEXTURE_SAMPLES:<br>
>>  >>> -         if (!ctx->Extensions.ARB_texture_multisample)<br>
>>  >>> +         if (!_mesa_is_gles31(ctx) &&<br>
>> !ctx->Extensions.ARB_texture_multisample)<br>
>>  >>>               goto invalid_pname;<br>
>>  >>>            *params = img->NumSamples;<br>
>>  >>>            break;<br>
>>  >>><br>
>>  >>>         case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS:<br>
>>  >>> -         if (!ctx->Extensions.ARB_texture_multisample)<br>
>>  >>> +         if (!_mesa_is_gles31(ctx) &&<br>
>> !ctx->Extensions.ARB_texture_multisample)<br>
>>  >><br>
>>  >><br>
>>  >> I think you guys have gone a little nuts with sticking _mesa_is_gles31<br>
>>  >> all over the place... This is accounting for drivers which want to<br>
>>  >> expose gles3.1 but don't have ARB_texture_multisample supported. Are<br>
>>  >> there any such drivers? Are all these changes really worthwhile?<br>
>>  ><br>
>>  ><br>
>>  > This particular patch was to address<br>
>>  ><br>
>>  > "glGetTexLevelParameter[fi]v - needs updates to restrict to GLES enums"<br>
>>  ><br>
>>  > in docs/GL3.txt GLES3.1 section.<br>
>>  ><br>
>>  > I do understand your worry about sticking is_gles31() here and there<br>
>> but remember that most (if not all) these changes will apply also for<br>
>> gles32. In Mesa there are 232 instances of is_gles(), 156 of is_gles3()<br>
>> and only 34 instances of is_gles31() so I think the overall changes are<br>
>> still quite small, not so intrusive as it may look.<br>
>><br>
>> I think you may have misunderstood my comment.<br>
>><br>
>> Old code: if not texture ms<br>
>> New code: if not gles31 and not texture ms<br>
>><br>
>> Aka "not (gles31 or texture ms)"<br>
>><br>
>> I posit that the situation where gles31 and not texture ms will never<br>
>> ever happen.<br>
>><br>
>> So you haven't changed the outcome of that conditional for any<br>
>> reasonable circumstances. Why are you adding that code?<br>
><br>
><br>
> There are some differences between ARB_texture_multisample and GLES 31, at least multisample array textures. Agreeably this is 'academical' and may not happen in real life (like many other error checks in Mesa though). I guess these could be removed if others also feel like this.</p>
<p dir="ltr">Sure, but are you ever going to get a driver that supports gles31 but does not have that bit set in extensions? I don't think so.</p>
<p dir="ltr">I'm concerned that tons and tons of these needless checks are being added all over.</p>
<p dir="ltr">I'm all for api correctness, but this seems to be about totally academic situations. The code literally has no effect for any actual drivers in Mesa, nor any that I can imagine in the future.</p>
<p dir="ltr">That's what I meant about it being ok for compute, since its a practical issue -- its not supported, but you want it to still be faked in es31. Fine. But here? What's the usecase?</p>
<p dir="ltr">><br>
><br>
>>  ><br>
>>  ><br>
>>  >> The original argument was that you wanted to pass some CTS tests<br>
>>  >> before you actually had compute/etc shaders going... which seems<br>
>>  >> reasonable. This all feels like going overboard though.<br>
>>  ><br>
>>  ><br>
>>  > For the question if changes are worthwhile, we have gone from 0<br>
>> passing CTS tests (+ a few crashes) to > 200 passing tests, personally I<br>
>> think this is good progress, thanks to you and others who have corrected<br>
>> errors in our changes.<br>
>>  ><br>
>>  > Our goal is to pass the whole suite when rest of the missing<br>
>> extensions are integrated. There are still things to do, API differences<br>
>> here and there. Nothing major but important to get done.<br>
>>  ><br>
>>  ><br>
>>  ><br>
>>  ><br>
>>  >>    -ilia<br>
>>  >><br>
>>  >>>               goto invalid_pname;<br>
>>  >>>            *params = img->FixedSampleLocations;<br>
>>  >>>            break;<br>
>>  >>> --<br>
>>  >>> 2.4.3<br>
>>  >>><br>
>>  >>> _______________________________________________<br>
>>  >>> mesa-dev mailing list<br>
>>  >>> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a> <mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>><br>
>>  >>> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
>>  ><br>
>>  ><br>
>>  ><br>
>>  > // Tapani<br>
>><br>
</p>