<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 22, 2016 at 10:49 AM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 01/21/2016 12:15 PM, Jason Ekstrand wrote:<br>
><br>
> On Jan 21, 2016 10:30 AM, "Ian Romanick" <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a><br>
</span><span class="">> <mailto:<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>>> wrote:<br>
>><br>
>> On 01/20/2016 08:29 PM, Jason Ekstrand wrote:<br>
>> ><br>
>> > On Jan 20, 2016 6:20 PM, "Ian Romanick" <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a><br>
> <mailto:<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>><br>
</span><span class="">>> > <mailto:<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a> <mailto:<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>>>> wrote:<br>
>> >><br>
>> >> From: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a><br>
> <mailto:<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
</span>>> > <mailto:<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a> <mailto:<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>>>><br>
<span class="">>> >><br>
>> >> Add a big spec quotation justifying the error generated, which has<br>
>> >> changed over the GL versions.<br>
>> >><br>
>> >> Signed-off-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a><br>
> <mailto:<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
</span>>> > <mailto:<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a> <mailto:<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>>>><br>
<div><div class="h5">>> >> ---<br>
>> >><br>
>> >> I intended to send this out with the other four, but I selected the<br>
>> >> wrong SHA from the list.<br>
>> >><br>
>> >> src/mesa/main/texparam.c | 31 ++++++++++++++++++++++++-------<br>
>> >> 1 file changed, 24 insertions(+), 7 deletions(-)<br>
>> >><br>
>> >> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c<br>
>> >> index 89f286c..ee50b5a 100644<br>
>> >> --- a/src/mesa/main/texparam.c<br>
>> >> +++ b/src/mesa/main/texparam.c<br>
>> >> @@ -369,8 +369,31 @@ set_tex_parameteri(struct gl_context *ctx,<br>
>> >> if (texObj->BaseLevel == params[0])<br>
>> >> return GL_FALSE;<br>
>> >><br>
>> >> + /* Section 8.10 (Texture Parameters) of the OpenGL 4.5 Core<br>
>> > Profile spec<br>
>> >> + * says:<br>
>> >> + *<br>
>> >> + * "An INVALID_OPERATION error is generated if the<br>
>> > effective target<br>
>> >> + * is either TEXTURE_2D_MULTISAMPLE or<br>
>> > TEXTURE_2D_MULTISAMPLE_ARRAY,<br>
>> >> + * and pname TEXTURE_BASE_LEVEL is set to a value other<br>
>> > than zero.<br>
>> >> + *<br>
>> >> + * ...<br>
>> >> + *<br>
>> >> + * An INVALID_OPERATION error is generated if the effective<br>
>> > target<br>
>> >> + * is TEXTURE_RECTANGLE and pname TEXTURE_BASE_LEVEL is set<br>
>> > to any<br>
>> >> + * value other than zero."<br>
>> ><br>
>> > Do we really need the "pname"s? IMHO, they make it harder to read.<br>
>><br>
>> I'm not sure what you mean. The pnames in the spec quote or ... ?<br>
><br>
> Yes. Some versions of the spec have them and some don't. The quote<br>
> below, for instance, doesn't.<br>
<br>
</div></div>From 4.1 to 4.2 the format of the spec was completely changed. In 4.1<br>
an earlier, the errors were mixed with the prose. There was a lot of<br>
inconsistency and missing errors as a result. In 4.2 and later, the<br>
errors are listed in a break-out box at the end of the section. Having<br>
had to scrape through the spec countless times to find all the possible<br>
error cases for a new command over the years, this is a very welcome change.<br>
<br>
In truth, I should have quoted a bit more text below because it doesn't<br>
qualify the conditions in which the old error code were generated. It's<br>
just some text buried in the paragraph about TEXTURE_RECTANGLE. For<br>
clarity, I probably should have quoted more context.<br>
<br>
"When target is TEXTURE_RECTANGLE, certain texture parameter<br>
values may not be specified.... The error INVALID_VALUE is<br>
generated if TEXTURE_BASE_LEVEL is set to any value other than<br>
zero."<br>
<br>
TEXTURE_2D_MULTISAMPLE and TEXTURE_2D_MULTISAMPLE_ARRAY did not exist in<br>
3.3, so they are not mentioned. I didn't quote additional context only<br>
because I was only trying to highlight that the error had changed from<br>
INVALID_VALUE to INVALID_OPERATION since 3.3.<br>
<br>
What I think makes the 4.5 quotation unfortunate is that the two nearly<br>
identical errors are listed in separate bullets. This is compounded by<br>
the slight differences in language ("a value" vs "any value"). I have<br>
submitted a Khronos bug with a patch for this issue. My compacted<br>
wording is:<br>
<span class=""><br>
An INVALID_OPERATION error is generated if the effective target<br>
</span> is TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY, or<br>
TEXTURE_RECTANGLE, and pname TEXTURE_BASE_LEVEL is set to a value<br>
other than zero.<br>
<br>
The existing TEXTURE_RECTANGLE bullet is removed.<br>
<br>
The whole point of quoting the spec is to justify the code. For that to<br>
be effective, the quotation has to have enough context. I'm not sure<br>
what we'd trim without weakening that justification. If we remove one<br>
of the bullets, why is the error generated for the other cases? If we<br>
remove the pnames from the bullets, why aren't we generating the error<br>
for other cases?<br>
<br>
We're trying to reduce the amount of time our future selves have to look<br>
back through the specs when a bug is submitted for a buggy application<br>
or conformance test. :)<br>
<br>
I'm not in a big hurry on this patch, so I'm willing to wait until<br>
there's some response on the spec bug. Assuming the response is<br>
positive, is using the amended wording in the quotation a good compromise?<br></blockquote><div><br></div><div>seems fine<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
>> > Other than that, the series looks good.<br>
>> ><br>
>> > Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a><br>
> <mailto:<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br>
</span>>> > <mailto:<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a> <mailto:<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>>>><br>
<div><div class="h5">>> ><br>
>> >> + *<br>
>> >> + * Note that section 3.8.8 (Texture Parameters) of the OpenGL<br>
>> > 3.3 Core<br>
>> >> + * Profile spec said:<br>
>> >> + *<br>
>> >> + * "The error INVALID_VALUE is generated if<br>
>> > TEXTURE_BASE_LEVEL is<br>
>> >> + * set to any value other than zero."<br>
>> >> + *<br>
>> >> + * We take the 4.5 language as a correction to the 3.3, and we<br>
>> > implement<br>
>> >> + * that on all GL versions.<br>
>> >> + */<br>
>> >> if ((texObj->Target == GL_TEXTURE_2D_MULTISAMPLE ||<br>
>> >> - texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) &&<br>
>> > params[0] != 0)<br>
>> >> + texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY ||<br>
>> >> + texObj->Target == GL_TEXTURE_RECTANGLE) && params[0] != 0)<br>
>> >> goto invalid_operation;<br>
>> >><br>
>> >> if (params[0] < 0) {<br>
>> >> @@ -378,12 +401,6 @@ set_tex_parameteri(struct gl_context *ctx,<br>
>> >> "glTex%sParameter(param=%d)", suffix, params[0]);<br>
>> >> return GL_FALSE;<br>
>> >> }<br>
>> >> - if (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0]<br>
> != 0) {<br>
>> >> - _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> >> - "glTex%sParameter(target=%s, param=%d)", suffix,<br>
>> >> - _mesa_enum_to_string(texObj->Target), params[0]);<br>
>> >> - return GL_FALSE;<br>
>> >> - }<br>
>> >> incomplete(ctx, texObj);<br>
>> >><br>
>> >> /** See note about ARB_texture_storage below */<br>
>> >> --<br>
>> >> 2.5.0<br>
>> >><br>
>> >> _______________________________________________<br>
>> >> mesa-dev mailing list<br>
>> >> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>><br>
</div></div>> <mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <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" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<br>
</blockquote></div><br></div></div>