glsl: add support for ARB_texture_multisample
V2: - emit `sample` parameter properly for multisample texelFetch()
- fix spurious whitespace change
- introduce a new opcode ir_txf_ms rather than overloading the
existing ir_txf further. This makes doing the right thing in
the driver somewhat simpler.
V3: - fix weird whitespace
V4: - don't forget to include the new opcode in tex_opcode_strs[]
(thanks Kenneth for spotting this)
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
[V2] Reviewed-by: Eric Anholt <eric@anholt.net>
[V2] Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
+23
-9
@@ -911,6 +911,7 @@ ir_reader::read_texture(s_expression *expr)
|
||||
s_expression *s_proj = NULL;
|
||||
s_list *s_shadow = NULL;
|
||||
s_expression *s_lod = NULL;
|
||||
s_expression *s_sample_index = NULL;
|
||||
|
||||
ir_texture_opcode op = ir_tex; /* silence warning */
|
||||
|
||||
@@ -918,6 +919,8 @@ ir_reader::read_texture(s_expression *expr)
|
||||
{ "tex", s_type, s_sampler, s_coord, s_offset, s_proj, s_shadow };
|
||||
s_pattern txf_pattern[] =
|
||||
{ "txf", s_type, s_sampler, s_coord, s_offset, s_lod };
|
||||
s_pattern txf_ms_pattern[] =
|
||||
{ "txf_ms", s_type, s_sampler, s_coord, s_sample_index };
|
||||
s_pattern txs_pattern[] =
|
||||
{ "txs", s_type, s_sampler, s_lod };
|
||||
s_pattern other_pattern[] =
|
||||
@@ -927,6 +930,8 @@ ir_reader::read_texture(s_expression *expr)
|
||||
op = ir_tex;
|
||||
} else if (MATCH(expr, txf_pattern)) {
|
||||
op = ir_txf;
|
||||
} else if (MATCH(expr, txf_ms_pattern)) {
|
||||
op = ir_txf_ms;
|
||||
} else if (MATCH(expr, txs_pattern)) {
|
||||
op = ir_txs;
|
||||
} else if (MATCH(expr, other_pattern)) {
|
||||
@@ -966,18 +971,20 @@ ir_reader::read_texture(s_expression *expr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Read texel offset - either 0 or an rvalue.
|
||||
s_int *si_offset = SX_AS_INT(s_offset);
|
||||
if (si_offset == NULL || si_offset->value() != 0) {
|
||||
tex->offset = read_rvalue(s_offset);
|
||||
if (tex->offset == NULL) {
|
||||
ir_read_error(s_offset, "expected 0 or an expression");
|
||||
return NULL;
|
||||
}
|
||||
if (op != ir_txf_ms) {
|
||||
// Read texel offset - either 0 or an rvalue.
|
||||
s_int *si_offset = SX_AS_INT(s_offset);
|
||||
if (si_offset == NULL || si_offset->value() != 0) {
|
||||
tex->offset = read_rvalue(s_offset);
|
||||
if (tex->offset == NULL) {
|
||||
ir_read_error(s_offset, "expected 0 or an expression");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (op != ir_txf && op != ir_txs) {
|
||||
if (op != ir_txf && op != ir_txf_ms && op != ir_txs) {
|
||||
s_int *proj_as_int = SX_AS_INT(s_proj);
|
||||
if (proj_as_int && proj_as_int->value() == 1) {
|
||||
tex->projector = NULL;
|
||||
@@ -1020,6 +1027,13 @@ ir_reader::read_texture(s_expression *expr)
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case ir_txf_ms:
|
||||
tex->lod_info.sample_index = read_rvalue(s_sample_index);
|
||||
if (tex->lod_info.sample_index == NULL) {
|
||||
ir_read_error(NULL, "when reading sample_index in (txf_ms ...)");
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case ir_txd: {
|
||||
s_expression *s_dx, *s_dy;
|
||||
s_pattern dxdy_pat[] = { s_dx, s_dy };
|
||||
|
||||
Reference in New Issue
Block a user