glsl: Add support for specifying the component in textureGather

ARB_gpu_shader5 introduces new variants of textureGather* which have an
explicit component selector, rather than relying purely on the sampler's
swizzle state.

This patch adds the GLSL plumbing for the extra parameter.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Chris Forbes
2013-10-05 18:26:56 +13:00
parent f93a63bfcc
commit 88ee9bc9d1
8 changed files with 42 additions and 7 deletions
+9 -1
View File
@@ -934,6 +934,7 @@ ir_reader::read_texture(s_expression *expr)
s_list *s_shadow = NULL;
s_expression *s_lod = NULL;
s_expression *s_sample_index = NULL;
s_expression *s_component = NULL;
ir_texture_opcode op = ir_tex; /* silence warning */
@@ -948,7 +949,7 @@ ir_reader::read_texture(s_expression *expr)
s_pattern txs_pattern[] =
{ "txs", s_type, s_sampler, s_lod };
s_pattern tg4_pattern[] =
{ "tg4", s_type, s_sampler, s_coord, s_offset };
{ "tg4", s_type, s_sampler, s_coord, s_offset, s_component };
s_pattern query_levels_pattern[] =
{ "query_levels", s_type, s_sampler };
s_pattern other_pattern[] =
@@ -1089,6 +1090,13 @@ ir_reader::read_texture(s_expression *expr)
}
break;
}
case ir_tg4:
tex->lod_info.component = read_rvalue(s_component);
if (tex->lod_info.component == NULL) {
ir_read_error(NULL, "when reading component in (tg4 ...)");
return NULL;
}
break;
default:
// tex and lod don't have any extra parameters.
break;