<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>