aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-06-09 20:37:34 +0200
committerMarek Olšák <[email protected]>2017-06-22 01:48:30 +0200
commitc2408838c83719cb133332c7adac71ef50503259 (patch)
treee09e430dd0678f4398b500824966ce16114bde51 /src/mesa/swrast
parentd28cc798bdf10c7e85189dc2dc3461d63e2fbfc7 (diff)
mesa: replace _mesa_update_stencil() with helper functions
The idea is to remove the dependency on _mesa_update_state_locked, so that st/mesa can skip it for stencil state updates, and then stop setting _NEW_STENCIL in mesa/main if the driver is st/mesa. The main motivation is to stop invoking _mesa_update_state_locked for certain state groups. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_context.c3
-rw-r--r--src/mesa/swrast/s_span.c5
-rw-r--r--src/mesa/swrast/s_triangle.c3
3 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 9cb03b38c01..71389c698f2 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -29,6 +29,7 @@
#include "main/bufferobj.h"
#include "main/mtypes.h"
#include "main/samplerobj.h"
+#include "main/stencil.h"
#include "main/teximage.h"
#include "program/prog_parameter.h"
#include "program/prog_statevars.h"
@@ -61,7 +62,7 @@ _swrast_update_rasterflags( struct gl_context *ctx )
if (ctx->Depth.Test) rasterMask |= DEPTH_BIT;
if (swrast->_FogEnabled) rasterMask |= FOG_BIT;
if (ctx->Scissor.EnableFlags) rasterMask |= CLIP_BIT;
- if (ctx->Stencil._Enabled) rasterMask |= STENCIL_BIT;
+ if (_mesa_stencil_is_enabled(ctx)) rasterMask |= STENCIL_BIT;
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
if (!ctx->Color.ColorMask[i][0] ||
!ctx->Color.ColorMask[i][1] ||
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 49fc580fb1d..81835636a57 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -39,6 +39,7 @@
#include "main/imports.h"
#include "main/image.h"
#include "main/samplerobj.h"
+#include "main/stencil.h"
#include "main/teximage.h"
#include "s_atifragshader.h"
@@ -1213,14 +1214,14 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
}
/* Stencil and Z testing */
- if (ctx->Stencil._Enabled || ctx->Depth.Test) {
+ if (_mesa_stencil_is_enabled(ctx) || ctx->Depth.Test) {
if (!(span->arrayMask & SPAN_Z))
_swrast_span_interpolate_z(ctx, span);
if (ctx->Transform.DepthClamp)
_swrast_depth_clamp_span(ctx, span);
- if (ctx->Stencil._Enabled) {
+ if (_mesa_stencil_is_enabled(ctx)) {
/* Combined Z/stencil tests */
if (!_swrast_stencil_and_ztest_span(ctx, span)) {
/* all fragments failed test */
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 876a74b0863..9e4f81e0e0a 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -36,6 +36,7 @@
#include "main/mtypes.h"
#include "main/state.h"
#include "main/samplerobj.h"
+#include "main/stencil.h"
#include "main/teximage.h"
#include "program/prog_instruction.h"
@@ -1023,7 +1024,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
ctx->Depth.Test &&
ctx->Depth.Mask == GL_FALSE &&
ctx->Depth.Func == GL_LESS &&
- !ctx->Stencil._Enabled &&
+ !_mesa_stencil_is_enabled(ctx) &&
depthRb &&
depthRb->Format == MESA_FORMAT_Z_UNORM16) {
if (ctx->Color.ColorMask[0][0] == 0 &&