[Mesa-dev] [PATCH v2 22/82] glsl: Do not kill dead assignments to buffer variables or SSBO declarations.
Jordan Justen
jordan.l.justen at intel.com
Wed Jun 17 12:24:12 PDT 2015
On 2015-06-03 00:01:12, Iago Toral Quiroga wrote:
> If we kill dead assignments we lose the buffer writes.
>
> Also, we never kill UBO declarations even if they are never referenced
> by the shader, they are always considered active. Although the spec
> does not seem say this specifically for SSBOs, it is probably implied
> since SSBOs are pretty much the same as UBOs, only that you can write
> to them.
> ---
> src/glsl/opt_dead_code.cpp | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp
> index f45bf5d..1bb5f32 100644
> --- a/src/glsl/opt_dead_code.cpp
> +++ b/src/glsl/opt_dead_code.cpp
> @@ -77,11 +77,13 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
>
> if (entry->assign) {
> /* Remove a single dead assignment to the variable we found.
> - * Don't do so if it's a shader or function output, though.
> + * Don't do so if it's a shader or function output or a buffer
> + * variable though.
buffer => shader storage
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
> */
> if (entry->var->data.mode != ir_var_function_out &&
> entry->var->data.mode != ir_var_function_inout &&
> - entry->var->data.mode != ir_var_shader_out) {
> + entry->var->data.mode != ir_var_shader_out &&
> + entry->var->data.mode != ir_var_shader_storage) {
> entry->assign->remove();
> progress = true;
>
> @@ -99,7 +101,8 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
> * stage. Also, once uniform locations have been assigned, the
> * declaration cannot be deleted.
> */
> - if (entry->var->data.mode == ir_var_uniform) {
> + if (entry->var->data.mode == ir_var_uniform ||
> + entry->var->data.mode == ir_var_shader_storage) {
> if (uniform_locations_assigned || entry->var->constant_value)
> continue;
>
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list