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

Kenneth Graunke kenneth at whitecape.org
Mon May 13 13:42:30 PDT 2013


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

--Ken


More information about the mesa-dev mailing list