[Mesa-dev] [PATCH 1/3] mesa: only check errors when the state change in glDepthBoundsEXT()

Nicolai Hähnle nhaehnle at gmail.com
Thu Aug 24 08:26:55 UTC 2017


On 23.08.2017 17:21, Samuel Pitoiset wrote:
> 
> 
> On 08/23/2017 04:53 PM, Ilia Mirkin wrote:
>> This is a functional change, e.g. what if
>>
>> glDepthBoundsEXT(2, 1)
>>
>> is called? Either way, I suspect it's fine, but just pointing it out
>> in case it wasn't considered.
> 
> The spec doesn't seem to explain if the INVALID_VALUE error should be 
> reported before or after the values are clamped.

That's true. For some odd reason, that error isn't listed as part of an 
Errors section. However, the usual pattern is that errors apply to the 
unmodified parameters, so I'd prefer to leave it as-is.

Cheers,
Nicolai

> 
>>
>> On Wed, Aug 23, 2017 at 10:43 AM, Samuel Pitoiset
>> <samuel.pitoiset at gmail.com> wrote:
>>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>>> ---
>>>   src/mesa/main/depth.c | 10 +++++-----
>>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
>>> index 930f5e816f..ddd91481cd 100644
>>> --- a/src/mesa/main/depth.c
>>> +++ b/src/mesa/main/depth.c
>>> @@ -146,17 +146,17 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd 
>>> zmax )
>>>      if (MESA_VERBOSE & VERBOSE_API)
>>>         _mesa_debug(ctx, "glDepthBounds(%f, %f)\n", zmin, zmax);
>>>
>>> -   if (zmin > zmax) {
>>> -      _mesa_error(ctx, GL_INVALID_VALUE, "glDepthBoundsEXT(zmin > 
>>> zmax)");
>>> -      return;
>>> -   }
>>> -
>>>      zmin = CLAMP(zmin, 0.0, 1.0);
>>>      zmax = CLAMP(zmax, 0.0, 1.0);
>>>
>>>      if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax)
>>>         return;
>>>
>>> +   if (zmin > zmax) {
>>> +      _mesa_error(ctx, GL_INVALID_VALUE, "glDepthBoundsEXT(zmin > 
>>> zmax)");
>>> +      return;
>>> +   }
>>> +
>>>      FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
>>>      ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
>>>      ctx->Depth.BoundsMin = (GLfloat) zmin;
>>> -- 
>>> 2.14.1
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list