diff options
author | Ilia Mirkin <[email protected]> | 2015-08-27 23:03:46 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2015-09-10 17:38:29 -0400 |
commit | f9052914e979228d28502a7f7953f98ff4731f99 (patch) | |
tree | 5e7025e5de5eb58f93e6ab9f0df9dae16e4521bc | |
parent | 6efae687b7ef46eb1f738f1bc2acbde1805e364b (diff) |
glsl: add ir_texture_samples texture opcode
Will be used for textureSamples()
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/glsl/ir.cpp | 5 | ||||
-rw-r--r-- | src/glsl/ir.h | 3 | ||||
-rw-r--r-- | src/glsl/ir_clone.cpp | 1 | ||||
-rw-r--r-- | src/glsl/ir_equals.cpp | 1 | ||||
-rw-r--r-- | src/glsl/ir_hv_accept.cpp | 1 | ||||
-rw-r--r-- | src/glsl/ir_print_visitor.cpp | 6 | ||||
-rw-r--r-- | src/glsl/ir_reader.cpp | 6 | ||||
-rw-r--r-- | src/glsl/ir_rvalue_visitor.cpp | 1 | ||||
-rw-r--r-- | src/glsl/opt_tree_grafting.cpp | 1 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 |
11 files changed, 23 insertions, 6 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 724861b1e9f..fb58c3b4ef6 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1398,7 +1398,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" }; +static const char * const tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf", "txf_ms", "txs", "lod", "tg4", "query_levels", "texture_samples" }; const char *ir_texture::opcode_string() { @@ -1427,7 +1427,8 @@ ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type) this->sampler = sampler; this->type = type; - if (this->op == ir_txs || this->op == ir_query_levels) { + if (this->op == ir_txs || this->op == ir_query_levels || + this->op == ir_texture_samples) { assert(type->base_type == GLSL_TYPE_INT); } else if (this->op == ir_lod) { assert(type->vector_elements == 2); diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 7cdea017af8..bb7fa0e0af4 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1914,7 +1914,8 @@ enum ir_texture_opcode { ir_txs, /**< Texture size */ ir_lod, /**< Texture lod query */ ir_tg4, /**< Texture gather */ - ir_query_levels /**< Texture levels query */ + ir_query_levels, /**< Texture levels query */ + ir_texture_samples, /**< Texture samples query */ }; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index a8fac183a8d..a2cd672d5d6 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -222,6 +222,7 @@ ir_texture::clone(void *mem_ctx, struct hash_table *ht) const case ir_tex: case ir_lod: case ir_query_levels: + case ir_texture_samples: 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 cc1964eefee..5f0785e0ece 100644 --- a/src/glsl/ir_equals.cpp +++ b/src/glsl/ir_equals.cpp @@ -151,6 +151,7 @@ ir_texture::equals(const ir_instruction *ir, enum ir_node_type ignore) const case ir_tex: case ir_lod: case ir_query_levels: + case ir_texture_samples: 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 d3662cf5063..6495cc4581d 100644 --- a/src/glsl/ir_hv_accept.cpp +++ b/src/glsl/ir_hv_accept.cpp @@ -194,6 +194,7 @@ ir_texture::accept(ir_hierarchical_visitor *v) case ir_tex: case ir_lod: case ir_query_levels: + case ir_texture_samples: 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 b6832692419..b9196900ea6 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -274,7 +274,8 @@ void ir_print_visitor::visit(ir_texture *ir) ir->sampler->accept(this); fprintf(f, " "); - if (ir->op != ir_txs && ir->op != ir_query_levels) { + if (ir->op != ir_txs && ir->op != ir_query_levels && + ir->op != ir_texture_samples) { ir->coordinate->accept(this); fprintf(f, " "); @@ -290,7 +291,7 @@ void ir_print_visitor::visit(ir_texture *ir) if (ir->op != ir_txf && ir->op != ir_txf_ms && ir->op != ir_txs && ir->op != ir_tg4 && - ir->op != ir_query_levels) { + ir->op != ir_query_levels && ir->op != ir_texture_samples) { if (ir->projector) ir->projector->accept(this); else @@ -310,6 +311,7 @@ void ir_print_visitor::visit(ir_texture *ir) case ir_tex: case ir_lod: case ir_query_levels: + case ir_texture_samples: break; case ir_txb: ir->lod_info.bias->accept(this); diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 979653304cc..07720e28749 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -960,6 +960,8 @@ ir_reader::read_texture(s_expression *expr) { "tg4", s_type, s_sampler, s_coord, s_offset, s_component }; s_pattern query_levels_pattern[] = { "query_levels", s_type, s_sampler }; + s_pattern texture_samples_pattern[] = + { "samples", s_type, s_sampler }; s_pattern other_pattern[] = { tag, s_type, s_sampler, s_coord, s_offset, s_proj, s_shadow, s_lod }; @@ -977,6 +979,8 @@ ir_reader::read_texture(s_expression *expr) op = ir_tg4; } else if (MATCH(expr, query_levels_pattern)) { op = ir_query_levels; + } else if (MATCH(expr, texture_samples_pattern)) { + op = ir_texture_samples; } else if (MATCH(expr, other_pattern)) { op = ir_texture::get_opcode(tag->value()); if (op == (ir_texture_opcode) -1) @@ -1029,7 +1033,7 @@ ir_reader::read_texture(s_expression *expr) if (op != ir_txf && op != ir_txf_ms && op != ir_txs && op != ir_lod && op != ir_tg4 && - op != ir_query_levels) { + op != ir_query_levels && op != ir_texture_samples) { s_int *proj_as_int = SX_AS_INT(s_proj); if (proj_as_int && proj_as_int->value() == 1) { tex->projector = NULL; diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp index 2eee3da7b22..a6966f546bc 100644 --- a/src/glsl/ir_rvalue_visitor.cpp +++ b/src/glsl/ir_rvalue_visitor.cpp @@ -58,6 +58,7 @@ ir_rvalue_base_visitor::rvalue_visit(ir_texture *ir) case ir_tex: case ir_lod: case ir_query_levels: + case ir_texture_samples: 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 7f2ee6cee34..a7a219c55ca 100644 --- a/src/glsl/opt_tree_grafting.cpp +++ b/src/glsl/opt_tree_grafting.cpp @@ -274,6 +274,7 @@ ir_tree_grafting_visitor::visit_enter(ir_texture *ir) case ir_tex: case ir_lod: case ir_query_levels: + case ir_texture_samples: break; case ir_txb: if (do_graft(&ir->lod_info.bias)) diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 0defed83207..afb400f714c 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1919,6 +1919,8 @@ ir_to_mesa_visitor::visit(ir_texture *ir) case ir_query_levels: assert(!"Unexpected ir_query_levels opcode"); break; + case ir_texture_samples: + unreachable("Unexpected ir_texture_samples opcode"); } const glsl_type *sampler_type = ir->sampler->type; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 6c9f9477a17..625c4e9c8a6 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3228,6 +3228,8 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) case ir_lod: opcode = TGSI_OPCODE_LODQ; break; + case ir_texture_samples: + unreachable("unexpected texture op"); } if (ir->projector) { |