aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2020-04-24 18:32:02 +0200
committerPierre-Eric Pelloux-Prayer <[email protected]>2020-05-05 12:26:02 +0200
commitea289d1502dc5739ec9bf69328c037b72dc02789 (patch)
tree6940b2864756497f0ed34b4fd3dd06c18ec4f919 /src/mesa/state_tracker
parent679421628bf89067b4cbfa85530f196ca2835717 (diff)
mesa: extend GLSLZeroInit semantics
This commit introduces a new way to zero-init variables but keep the old one to not break any existing behavior. With this change GLSLZeroInit becomes an integer, with the following possible values: - 0: no 0 init - 1: current behavior - 2: new behavior. Similar to 1, except ir_var_function_out type are 0 initialized but ir_var_shader_out. The rationale behind 2 is: zero initializing ir_var_shader_out can prevent some optimization where out variables are completely eliminated when not written to. On the other hand, zero initializing "ir_var_function_out" has no effect on correct shaders but typically helps shadertoy since the main function is: void mainImage(out vec4 fragColor) { ... } So with this change we're sure that fragColor will always get a value. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4607>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_extensions.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 6b102074bfb..2403bd60a8c 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -1203,7 +1203,9 @@ void st_init_extensions(struct pipe_screen *screen,
extensions->EXT_texture_integer = GL_FALSE;
}
- consts->GLSLZeroInit = options->glsl_zero_init;
+ if (options->glsl_zero_init) {
+ consts->GLSLZeroInit = 1;
+ }
consts->ForceIntegerTexNearest = options->force_integer_tex_nearest;