summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-05-18 20:28:07 -0700
committerJason Ekstrand <[email protected]>2016-05-23 19:12:34 -0700
commit27b9481d03959a7bee6d906c62b4a519b6b1dc38 (patch)
tree4578aca510eef5c8e2e27a00f83d7791377e3dd4 /src/mesa
parentac242aac3d2c38fd6843d85363a455271b1348c2 (diff)
glsl: Add an option to clamp block indices when lowering UBO/SSBOs
This prevents array overflow when the block is actually an array of UBOs or SSBOs. On some hardware such as i965, such overflows can cause GPU hangs. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_compiler.c1
-rw-r--r--src/mesa/main/mtypes.h3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_compiler.c b/src/mesa/drivers/dri/i965/brw_compiler.c
index 82131db9a8f..3f175892286 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.c
+++ b/src/mesa/drivers/dri/i965/brw_compiler.c
@@ -188,6 +188,7 @@ brw_compiler_create(void *mem_ctx, const struct brw_device_info *devinfo)
}
compiler->glsl_compiler_options[i].LowerBufferInterfaceBlocks = true;
+ compiler->glsl_compiler_options[i].ClampBlockIndicesToArrayBounds = true;
}
compiler->glsl_compiler_options[MESA_SHADER_TESS_CTRL].EmitNoIndirectInput = false;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 6cd30e8c10c..b7b3ede57f1 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2951,6 +2951,9 @@ struct gl_shader_compiler_options
GLboolean LowerBufferInterfaceBlocks; /**< Lower UBO and SSBO access to intrinsics. */
+ /** Clamp UBO and SSBO block indices so they don't go out-of-bounds. */
+ GLboolean ClampBlockIndicesToArrayBounds;
+
GLboolean LowerShaderSharedVariables; /**< Lower compute shader shared
* variable access to intrinsics. */