[Mesa-dev] [PATCH 3/8] intel: Use accessor for stencil reference values

Eric Anholt eric at anholt.net
Mon May 13 19:11:32 PDT 2013


Kenneth Graunke <kenneth at whitecape.org> writes:

> On 05/13/2013 11:00 AM, Eric Anholt wrote:
>> Chris Forbes <chrisf at ijw.co.nz> writes:
>>
>>> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
>>> ---
>>>   src/mesa/drivers/dri/i915/i915_state.c | 9 +++++----
>>>   src/mesa/drivers/dri/i965/brw_cc.c     | 5 +++--
>>>   src/mesa/drivers/dri/i965/gen6_cc.c    | 5 +++--
>>>   3 files changed, 11 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
>>> index 98eac8d..2fd0bf1 100644
>>> --- a/src/mesa/drivers/dri/i915/i915_state.c
>>> +++ b/src/mesa/drivers/dri/i915/i915_state.c
>>
>>> diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c
>>> index 988b85e..71f9366 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_cc.c
>>> +++ b/src/mesa/drivers/dri/i965/brw_cc.c
>>> @@ -35,6 +35,7 @@
>>>   #include "brw_defines.h"
>>>   #include "brw_util.h"
>>>   #include "main/macros.h"
>>> +#include "main/stencil.h"
>>>   #include "intel_batchbuffer.h"
>>>
>>>   static void
>>> @@ -116,7 +117,7 @@ static void upload_cc_unit(struct brw_context *brw)
>>>   	 intel_translate_stencil_op(ctx->Stencil.ZFailFunc[0]);
>>>         cc->cc0.stencil_pass_depth_pass_op =
>>>   	 intel_translate_stencil_op(ctx->Stencil.ZPassFunc[0]);
>>> -      cc->cc1.stencil_ref = ctx->Stencil.Ref[0];
>>> +      cc->cc1.stencil_ref = _mesa_get_stencil_ref(ctx, 0);
>>
>> I'm not sure all these driver changes are necessary -- they're under
>> Stencil._Enabled, which is checking whether you have 0 or 8 bits of
>> stencil, and otherwise they'll all be truncated to their lower 8 bits
>> because of the size of these fields, right?
>
> Truncated, yes, but not clamped (saturated) to [0, 255] as the spec 
> requires...

Ah, ok.  I'd always thought it was masked off, and didn't even check.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130513/bbd78b71/attachment.pgp>


More information about the mesa-dev mailing list