Commit 62ac0ee8 authored by Jason Ekstrand's avatar Jason Ekstrand
Browse files

nir/tex_instr: Rename the indirect source type and add an array size



In particular, we rename nir_tex_src_sampler_index to _sampler_offset and
add a sampler_array_size field to nir_tex_instr.  This way we can pass the
size of sampler arrays through to backends even after removing the variable
information and, with it, the type.
Reviewed-by: default avatarConnor Abbott <cwabbott0@gmail.com>
parent 534d145e
......@@ -467,6 +467,10 @@ nir_tex_instr_create(void *mem_ctx, unsigned num_srcs)
instr->has_predicate = false;
src_init(&instr->predicate);
instr->sampler_index = 0;
instr->sampler_array_size = 0;
instr->sampler = NULL;
return instr;
}
......
......@@ -793,7 +793,7 @@ typedef enum {
nir_tex_src_ms_index, /* MSAA sample index */
nir_tex_src_ddx,
nir_tex_src_ddy,
nir_tex_src_sampler_index, /* < dynamically uniform indirect index */
nir_tex_src_sampler_offset, /* < dynamically uniform indirect offset */
nir_num_texinput_types
} nir_texinput_type;
......@@ -838,7 +838,16 @@ typedef struct {
/* gather component selector */
unsigned component : 2;
/** The sampler index
*
* If this texture instruction has a nir_tex_src_sampler_offset source,
* then the sampler index is given by sampler_index + sampler_offset.
*/
unsigned sampler_index;
/** The size of the sampler array or 0 if it's not an array */
unsigned sampler_array_size;
nir_deref_var *sampler; /* if this is NULL, use sampler_index instead */
} nir_tex_instr;
......
......@@ -464,8 +464,8 @@ print_tex_instr(nir_tex_instr *instr, print_var_state *state, FILE *fp)
case nir_tex_src_ddy:
fprintf(fp, "(ddy)");
break;
case nir_tex_src_sampler_index:
fprintf(fp, "(sampler_index)");
case nir_tex_src_sampler_offset:
fprintf(fp, "(sampler_offset)");
break;
default:
......
......@@ -1662,7 +1662,7 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)
break;
case nir_tex_src_projector:
unreachable("should be lowered");
case nir_tex_src_sampler_index:
case nir_tex_src_sampler_offset:
unreachable("not yet supported");
default:
unreachable("unknown texture source");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment