mirror of https://github.com/bkaradzic/bgfx
glsl-optimizer: Fixed MSAA texelFetch.
This commit is contained in:
parent
26e098f42c
commit
2385b87804
|
@ -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;
|
||||
const bool is_shadow = ir->sampler->type->sampler_shadow;
|
||||
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 int uv_dim = uv_type->vector_elements;
|
||||
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;
|
||||
if (is_array)
|
||||
sampler_uv_dim += 1;
|
||||
if (is_msaa)
|
||||
sampler_uv_dim += 1;
|
||||
const bool is_proj = (uv_dim > sampler_uv_dim);
|
||||
const bool is_lod = (ir->op == ir_txl);
|
||||
|
||||
|
@ -876,8 +879,10 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (ir->op == ir_txf)
|
||||
if (ir->op == ir_txf
|
||||
|| ir->op == ir_txf_ms) {
|
||||
buffer.asprintf_append ("texelFetch");
|
||||
}
|
||||
else
|
||||
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)
|
||||
buffer.asprintf_append ("Array");
|
||||
|
||||
if (is_proj)
|
||||
if (ir->op == ir_tex && is_proj)
|
||||
buffer.asprintf_append ("Proj");
|
||||
if (ir->op == ir_txl)
|
||||
buffer.asprintf_append ("Lod");
|
||||
|
@ -921,7 +926,7 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
|
|||
ir->coordinate->accept(this);
|
||||
|
||||
// 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 (", ");
|
||||
ir->lod_info.lod->accept(this);
|
||||
|
|
Loading…
Reference in New Issue