aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/rasterizer
diff options
context:
space:
mode:
authorTim Rowley <timothy.o.rowley@intel.com>2016-09-30 15:18:13 -0500
committerTim Rowley <timothy.o.rowley@intel.com>2016-10-03 09:57:31 -0500
commit114f7a92c6a5ea796a4fea9a7b71188fdb243950 (patch)
tree72284495c31e908b24ee5b2d55e6470eb6afb4d1 /src/gallium/drivers/swr/rasterizer
parent4198520a82463aa392762ec156231b95bf2685ac (diff)
swr: [rasterizer jitter] canonicalize blend compile state
Canonicalize to prevent unnecessary JIT compiles. Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer')
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/blend_jit.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.h b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.h
index af317cc5fe3..ddb7374d406 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.h
@@ -89,4 +89,41 @@ struct BLEND_COMPILE_STATE
{
return memcmp(this, &other, sizeof(BLEND_COMPILE_STATE)) == 0;
}
+
+ // Canonicalize state to reduce unnecessary JIT compiles
+ void Canonicalize()
+ {
+ if (!desc.alphaTestEnable)
+ {
+ alphaTestFormat = (ALPHA_TEST_FORMAT)0;
+ alphaTestFunction = (SWR_ZFUNCTION)0;
+ }
+
+ if (!blendState.blendEnable)
+ {
+ blendState.sourceAlphaBlendFactor = (SWR_BLEND_FACTOR)0;
+ blendState.destAlphaBlendFactor = (SWR_BLEND_FACTOR)0;
+ blendState.sourceBlendFactor = (SWR_BLEND_FACTOR)0;
+ blendState.destBlendFactor = (SWR_BLEND_FACTOR)0;
+ blendState.colorBlendFunc = (SWR_BLEND_OP)0;
+ blendState.alphaBlendFunc = (SWR_BLEND_OP)0;
+ }
+
+ if (!blendState.logicOpEnable)
+ {
+ blendState.logicOpFunc = (SWR_LOGIC_OP)0;
+ }
+
+ if (!blendState.blendEnable && !blendState.logicOpEnable)
+ {
+ format = (SWR_FORMAT)0;
+ }
+
+ if (!desc.independentAlphaBlendEnable)
+ {
+ blendState.sourceAlphaBlendFactor = (SWR_BLEND_FACTOR)0;
+ blendState.destAlphaBlendFactor = (SWR_BLEND_FACTOR)0;
+ blendState.alphaBlendFunc = (SWR_BLEND_OP)0;
+ }
+ }
};