summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-11-17 16:54:31 -0800
committerIan Romanick <[email protected]>2015-11-19 20:17:16 -0800
commit8343583557fbbf0e04ce8e834a71f00b219232ce (patch)
tree34281c5946ce874981a3e61f9f4b004cbf402c9d /src/glsl
parentef54434c52385bea59d47dbfcedc6845f33fb231 (diff)
glsl: Add ir_samples_identical opcode
Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir.cpp6
-rw-r--r--src/glsl/ir.h2
-rw-r--r--src/glsl/ir_clone.cpp1
-rw-r--r--src/glsl/ir_equals.cpp1
-rw-r--r--src/glsl/ir_hv_accept.cpp1
-rw-r--r--src/glsl/ir_print_visitor.cpp10
-rw-r--r--src/glsl/ir_rvalue_visitor.cpp1
-rw-r--r--src/glsl/opt_tree_grafting.cpp1
8 files changed, 22 insertions, 1 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 80cbdbf613f..f47100ee40f 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1421,7 +1421,7 @@ ir_dereference::is_lvalue() const
}
-static const char * const tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf", "txf_ms", "txs", "lod", "tg4", "query_levels", "texture_samples" };
+static const char * const tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf", "txf_ms", "txs", "lod", "tg4", "query_levels", "texture_samples", "samples_identical" };
const char *ir_texture::opcode_string()
{
@@ -1455,6 +1455,10 @@ ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type)
} else if (this->op == ir_lod) {
assert(type->vector_elements == 2);
assert(type->base_type == GLSL_TYPE_FLOAT);
+ } else if (this->op == ir_samples_identical) {
+ assert(type == glsl_type::bool_type);
+ assert(sampler->type->base_type == GLSL_TYPE_SAMPLER);
+ assert(sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_MS);
} else {
assert(sampler->type->sampler_type == (int) type->base_type);
if (sampler->type->sampler_shadow)
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index d59dee1e369..39156e0e98c 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -1965,6 +1965,7 @@ enum ir_texture_opcode {
ir_tg4, /**< Texture gather */
ir_query_levels, /**< Texture levels query */
ir_texture_samples, /**< Texture samples query */
+ ir_samples_identical, /**< Query whether all samples are definitely identical. */
};
@@ -1991,6 +1992,7 @@ enum ir_texture_opcode {
* (lod <type> <sampler> <coordinate>)
* (tg4 <type> <sampler> <coordinate> <offset> <component>)
* (query_levels <type> <sampler>)
+ * (samples_identical <sampler> <coordinate>)
*/
class ir_texture : public ir_rvalue {
public:
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index a2cd672d5d6..4484cc9d8a7 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -223,6 +223,7 @@ ir_texture::clone(void *mem_ctx, struct hash_table *ht) const
case ir_lod:
case ir_query_levels:
case ir_texture_samples:
+ case ir_samples_identical:
break;
case ir_txb:
new_tex->lod_info.bias = this->lod_info.bias->clone(mem_ctx, ht);
diff --git a/src/glsl/ir_equals.cpp b/src/glsl/ir_equals.cpp
index aafcd1f0dae..b86f4ea16bb 100644
--- a/src/glsl/ir_equals.cpp
+++ b/src/glsl/ir_equals.cpp
@@ -157,6 +157,7 @@ ir_texture::equals(const ir_instruction *ir, enum ir_node_type ignore) const
case ir_lod:
case ir_query_levels:
case ir_texture_samples:
+ case ir_samples_identical:
break;
case ir_txb:
if (!lod_info.bias->equals(other->lod_info.bias, ignore))
diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp
index 6495cc4581d..213992af28c 100644
--- a/src/glsl/ir_hv_accept.cpp
+++ b/src/glsl/ir_hv_accept.cpp
@@ -195,6 +195,7 @@ ir_texture::accept(ir_hierarchical_visitor *v)
case ir_lod:
case ir_query_levels:
case ir_texture_samples:
+ case ir_samples_identical:
break;
case ir_txb:
s = this->lod_info.bias->accept(v);
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index 42b03fdea52..fd7bc2eea98 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -268,6 +268,14 @@ void ir_print_visitor::visit(ir_texture *ir)
{
fprintf(f, "(%s ", ir->opcode_string());
+ if (ir->op == ir_samples_identical) {
+ ir->sampler->accept(this);
+ fprintf(f, " ");
+ ir->coordinate->accept(this);
+ fprintf(f, ")");
+ return;
+ }
+
print_type(f, ir->type);
fprintf(f, " ");
@@ -334,6 +342,8 @@ void ir_print_visitor::visit(ir_texture *ir)
case ir_tg4:
ir->lod_info.component->accept(this);
break;
+ case ir_samples_identical:
+ unreachable(!"ir_samples_identical was already handled");
};
fprintf(f, ")");
}
diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp
index a6966f546bc..6486838b8b8 100644
--- a/src/glsl/ir_rvalue_visitor.cpp
+++ b/src/glsl/ir_rvalue_visitor.cpp
@@ -59,6 +59,7 @@ ir_rvalue_base_visitor::rvalue_visit(ir_texture *ir)
case ir_lod:
case ir_query_levels:
case ir_texture_samples:
+ case ir_samples_identical:
break;
case ir_txb:
handle_rvalue(&ir->lod_info.bias);
diff --git a/src/glsl/opt_tree_grafting.cpp b/src/glsl/opt_tree_grafting.cpp
index e38a0e93058..cd58213c019 100644
--- a/src/glsl/opt_tree_grafting.cpp
+++ b/src/glsl/opt_tree_grafting.cpp
@@ -275,6 +275,7 @@ ir_tree_grafting_visitor::visit_enter(ir_texture *ir)
case ir_lod:
case ir_query_levels:
case ir_texture_samples:
+ case ir_samples_identical:
break;
case ir_txb:
if (do_graft(&ir->lod_info.bias))