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

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Aug 23 15:21:24 UTC 2017



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.

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


More information about the mesa-dev mailing list