diff options
author | Rhys Perry <[email protected]> | 2018-06-06 20:55:07 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-08-01 00:10:01 -0400 |
commit | f903bce8a649296f9d8a67a740942b2a80303c50 (patch) | |
tree | cc4eeafc469a1d5a882292526dc74a2e1619cbfb /src/mesa | |
parent | ea2a3f52b4acee0378e02414b9c39e3f0c66cbf1 (diff) |
glsl, glsl_to_tgsi: fix sampler/image constants
Signed-off-by: Rhys Perry <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 73a8dc49a63..aec53309172 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3119,7 +3119,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir) GLdouble stack_vals[4] = { 0 }; gl_constant_value *values = (gl_constant_value *) stack_vals; GLenum gl_type = GL_NONE; - unsigned int i; + unsigned int i, elements; static int in_array = 0; gl_register_file file = in_array ? PROGRAM_CONSTANT : PROGRAM_IMMEDIATE; @@ -3241,6 +3241,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir) return; } + elements = ir->type->vector_elements; switch (ir->type->base_type) { case GLSL_TYPE_FLOAT: gl_type = GL_FLOAT; @@ -3290,14 +3291,21 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir) values[i].u = ir->value.b[i] ? ctx->Const.UniformBooleanTrue : 0; } break; + case GLSL_TYPE_SAMPLER: + case GLSL_TYPE_IMAGE: + gl_type = GL_UNSIGNED_INT; + elements = 2; + values[0].u = ir->value.u64[0] & 0xffffffff; + values[1].u = ir->value.u64[0] >> 32; + break; default: - assert(!"Non-float/uint/int/bool constant"); + assert(!"Non-float/uint/int/bool/sampler/image constant"); } this->result = st_src_reg(file, -1, ir->type); this->result.index = add_constant(file, values, - ir->type->vector_elements, + elements, gl_type, &this->result.swizzle); } |