nir: Separate texture from sampler in nir_tex_instr
This commit adds the capability to NIR to support separate textures and samplers. As it currently stands, glsl_to_nir only sets the texture deref and leaves the sampler deref alone as it did before and nir_lower_samplers assumes this. Backends can still assume that they are combined and only look at only at the texture index. Or, if they wish, they can assume that they are separate because nir_lower_samplers, tgsi_to_nir, and prog_to_nir all set both texture and sampler index whenever a sampler is required (the two indices are the same in this case). Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -966,6 +966,7 @@ typedef enum {
|
||||
nir_tex_src_ddx,
|
||||
nir_tex_src_ddy,
|
||||
nir_tex_src_texture_offset, /* < dynamically uniform indirect offset */
|
||||
nir_tex_src_sampler_offset, /* < dynamically uniform indirect offset */
|
||||
nir_num_tex_src_types
|
||||
} nir_tex_src_type;
|
||||
|
||||
@@ -1025,7 +1026,35 @@ typedef struct {
|
||||
/** The size of the texture array or 0 if it's not an array */
|
||||
unsigned texture_array_size;
|
||||
|
||||
nir_deref_var *texture; /* if this is NULL, use texture_index instead */
|
||||
/** The texture deref
|
||||
*
|
||||
* If this is null, use texture_index instead.
|
||||
*/
|
||||
nir_deref_var *texture;
|
||||
|
||||
/** The sampler index
|
||||
*
|
||||
* The following operations do not require a sampler and, as such, this
|
||||
* field should be ignored:
|
||||
* - nir_texop_txf
|
||||
* - nir_texop_txf_ms
|
||||
* - nir_texop_txs
|
||||
* - nir_texop_lod
|
||||
* - nir_texop_tg4
|
||||
* - nir_texop_query_levels
|
||||
* - nir_texop_texture_samples
|
||||
* - nir_texop_samples_identical
|
||||
*
|
||||
* 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 sampler deref
|
||||
*
|
||||
* If this is null, use sampler_index instead.
|
||||
*/
|
||||
nir_deref_var *sampler;
|
||||
} nir_tex_instr;
|
||||
|
||||
static inline unsigned
|
||||
|
Reference in New Issue
Block a user