glsl-optimizer: Fixed MSAA texelFetch.

This commit is contained in:
Branimir Karadžić 2016-04-20 21:38:58 -07:00
parent 26e098f42c
commit 2385b87804
1 changed files with 9 additions and 4 deletions

View File

@ -825,6 +825,7 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
glsl_sampler_dim sampler_dim = (glsl_sampler_dim)ir->sampler->type->sampler_dimensionality; glsl_sampler_dim sampler_dim = (glsl_sampler_dim)ir->sampler->type->sampler_dimensionality;
const bool is_shadow = ir->sampler->type->sampler_shadow; const bool is_shadow = ir->sampler->type->sampler_shadow;
const bool is_array = ir->sampler->type->sampler_array; const bool is_array = ir->sampler->type->sampler_array;
const bool is_msaa = ir->op == ir_txf_ms;
const glsl_type* uv_type = ir->coordinate->type; const glsl_type* uv_type = ir->coordinate->type;
const int uv_dim = uv_type->vector_elements; const int uv_dim = uv_type->vector_elements;
int sampler_uv_dim = tex_sampler_dim_size[sampler_dim]; int sampler_uv_dim = tex_sampler_dim_size[sampler_dim];
@ -832,6 +833,8 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
sampler_uv_dim += 1; sampler_uv_dim += 1;
if (is_array) if (is_array)
sampler_uv_dim += 1; sampler_uv_dim += 1;
if (is_msaa)
sampler_uv_dim += 1;
const bool is_proj = (uv_dim > sampler_uv_dim); const bool is_proj = (uv_dim > sampler_uv_dim);
const bool is_lod = (ir->op == ir_txl); const bool is_lod = (ir->op == ir_txl);
@ -876,8 +879,10 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
} }
else else
{ {
if (ir->op == ir_txf) if (ir->op == ir_txf
|| ir->op == ir_txf_ms) {
buffer.asprintf_append ("texelFetch"); buffer.asprintf_append ("texelFetch");
}
else else
buffer.asprintf_append ("texture"); buffer.asprintf_append ("texture");
} }
@ -885,7 +890,7 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
if (is_array && state->EXT_texture_array_enable) if (is_array && state->EXT_texture_array_enable)
buffer.asprintf_append ("Array"); buffer.asprintf_append ("Array");
if (is_proj) if (ir->op == ir_tex && is_proj)
buffer.asprintf_append ("Proj"); buffer.asprintf_append ("Proj");
if (ir->op == ir_txl) if (ir->op == ir_txl)
buffer.asprintf_append ("Lod"); buffer.asprintf_append ("Lod");
@ -921,7 +926,7 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
ir->coordinate->accept(this); ir->coordinate->accept(this);
// lod // lod
if (ir->op == ir_txl || ir->op == ir_txf) if (ir->op == ir_txl || ir->op == ir_txf || ir->op == ir_txf_ms)
{ {
buffer.asprintf_append (", "); buffer.asprintf_append (", ");
ir->lod_info.lod->accept(this); ir->lod_info.lod->accept(this);