nir: Use sized types for nir_tex_instr::dest_type
Revieweeviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989>
This commit is contained in:
@@ -344,7 +344,7 @@ nir_get_texture_size(nir_builder *b, nir_tex_instr *tex)
|
|||||||
txs->is_new_style_shadow = tex->is_new_style_shadow;
|
txs->is_new_style_shadow = tex->is_new_style_shadow;
|
||||||
txs->texture_index = tex->texture_index;
|
txs->texture_index = tex->texture_index;
|
||||||
txs->sampler_index = tex->sampler_index;
|
txs->sampler_index = tex->sampler_index;
|
||||||
txs->dest_type = nir_type_int;
|
txs->dest_type = nir_type_int32;
|
||||||
|
|
||||||
unsigned idx = 0;
|
unsigned idx = 0;
|
||||||
for (unsigned i = 0; i < tex->num_srcs; i++) {
|
for (unsigned i = 0; i < tex->num_srcs; i++) {
|
||||||
@@ -398,7 +398,7 @@ nir_get_texture_lod(nir_builder *b, nir_tex_instr *tex)
|
|||||||
tql->is_new_style_shadow = tex->is_new_style_shadow;
|
tql->is_new_style_shadow = tex->is_new_style_shadow;
|
||||||
tql->texture_index = tex->texture_index;
|
tql->texture_index = tex->texture_index;
|
||||||
tql->sampler_index = tex->sampler_index;
|
tql->sampler_index = tex->sampler_index;
|
||||||
tql->dest_type = nir_type_float;
|
tql->dest_type = nir_type_float32;
|
||||||
|
|
||||||
unsigned idx = 0;
|
unsigned idx = 0;
|
||||||
for (unsigned i = 0; i < tex->num_srcs; i++) {
|
for (unsigned i = 0; i < tex->num_srcs; i++) {
|
||||||
|
@@ -95,7 +95,7 @@ lower_bitmap(nir_shader *shader, nir_builder *b,
|
|||||||
tex->op = nir_texop_tex;
|
tex->op = nir_texop_tex;
|
||||||
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
||||||
tex->coord_components = 2;
|
tex->coord_components = 2;
|
||||||
tex->dest_type = nir_type_float;
|
tex->dest_type = nir_type_float32;
|
||||||
tex->src[0].src_type = nir_tex_src_texture_deref;
|
tex->src[0].src_type = nir_tex_src_texture_deref;
|
||||||
tex->src[0].src = nir_src_for_ssa(&tex_deref->dest.ssa);
|
tex->src[0].src = nir_src_for_ssa(&tex_deref->dest.ssa);
|
||||||
tex->src[1].src_type = nir_tex_src_sampler_deref;
|
tex->src[1].src_type = nir_tex_src_sampler_deref;
|
||||||
|
@@ -146,7 +146,7 @@ lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
|
|||||||
tex->op = nir_texop_tex;
|
tex->op = nir_texop_tex;
|
||||||
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
||||||
tex->coord_components = 2;
|
tex->coord_components = 2;
|
||||||
tex->dest_type = nir_type_float;
|
tex->dest_type = nir_type_float32;
|
||||||
tex->src[0].src_type = nir_tex_src_texture_deref;
|
tex->src[0].src_type = nir_tex_src_texture_deref;
|
||||||
tex->src[0].src = nir_src_for_ssa(&tex_deref->dest.ssa);
|
tex->src[0].src = nir_src_for_ssa(&tex_deref->dest.ssa);
|
||||||
tex->src[1].src_type = nir_tex_src_sampler_deref;
|
tex->src[1].src_type = nir_tex_src_sampler_deref;
|
||||||
@@ -188,7 +188,7 @@ lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
|
|||||||
tex->coord_components = 2;
|
tex->coord_components = 2;
|
||||||
tex->sampler_index = state->options->pixelmap_sampler;
|
tex->sampler_index = state->options->pixelmap_sampler;
|
||||||
tex->texture_index = state->options->pixelmap_sampler;
|
tex->texture_index = state->options->pixelmap_sampler;
|
||||||
tex->dest_type = nir_type_float;
|
tex->dest_type = nir_type_float32;
|
||||||
tex->src[0].src_type = nir_tex_src_texture_deref;
|
tex->src[0].src_type = nir_tex_src_texture_deref;
|
||||||
tex->src[0].src = nir_src_for_ssa(&pixelmap_deref->dest.ssa);
|
tex->src[0].src = nir_src_for_ssa(&pixelmap_deref->dest.ssa);
|
||||||
tex->src[1].src_type = nir_tex_src_sampler_deref;
|
tex->src[1].src_type = nir_tex_src_sampler_deref;
|
||||||
@@ -206,7 +206,7 @@ lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
|
|||||||
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
||||||
tex->coord_components = 2;
|
tex->coord_components = 2;
|
||||||
tex->sampler_index = state->options->pixelmap_sampler;
|
tex->sampler_index = state->options->pixelmap_sampler;
|
||||||
tex->dest_type = nir_type_float;
|
tex->dest_type = nir_type_float32;
|
||||||
tex->src[0].src_type = nir_tex_src_coord;
|
tex->src[0].src_type = nir_tex_src_coord;
|
||||||
tex->src[0].src = nir_src_for_ssa(nir_channels(b, def, 0xc));
|
tex->src[0].src = nir_src_for_ssa(nir_channels(b, def, 0xc));
|
||||||
|
|
||||||
|
@@ -60,7 +60,7 @@ lower_fb_read(nir_builder *b, nir_intrinsic_instr *intr)
|
|||||||
tex->op = nir_texop_txf_ms_fb;
|
tex->op = nir_texop_txf_ms_fb;
|
||||||
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
||||||
tex->coord_components = 2;
|
tex->coord_components = 2;
|
||||||
tex->dest_type = nir_type_float;
|
tex->dest_type = nir_type_float32;
|
||||||
tex->src[0].src_type = nir_tex_src_coord;
|
tex->src[0].src_type = nir_tex_src_coord;
|
||||||
tex->src[0].src = nir_src_for_ssa(nir_channels(b, fragcoord, 0x3));
|
tex->src[0].src = nir_src_for_ssa(nir_channels(b, fragcoord, 0x3));
|
||||||
tex->src[1].src_type = nir_tex_src_ms_index;
|
tex->src[1].src_type = nir_tex_src_ms_index;
|
||||||
|
@@ -108,19 +108,8 @@ try_lower_input_load(nir_function_impl *impl, nir_intrinsic_instr *load,
|
|||||||
tex->op = nir_texop_txf;
|
tex->op = nir_texop_txf;
|
||||||
tex->sampler_dim = image_dim;
|
tex->sampler_dim = image_dim;
|
||||||
|
|
||||||
switch (glsl_get_sampler_result_type(deref->type)) {
|
tex->dest_type =
|
||||||
case GLSL_TYPE_FLOAT:
|
nir_get_nir_type_for_glsl_base_type(glsl_get_sampler_result_type(deref->type));
|
||||||
tex->dest_type = nir_type_float;
|
|
||||||
break;
|
|
||||||
case GLSL_TYPE_INT:
|
|
||||||
tex->dest_type = nir_type_int;
|
|
||||||
break;
|
|
||||||
case GLSL_TYPE_UINT:
|
|
||||||
tex->dest_type = nir_type_uint;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
unreachable("Invalid image type");
|
|
||||||
}
|
|
||||||
tex->is_array = true;
|
tex->is_array = true;
|
||||||
tex->is_shadow = false;
|
tex->is_shadow = false;
|
||||||
tex->is_sparse = load->intrinsic == nir_intrinsic_image_deref_sparse_load;
|
tex->is_sparse = load->intrinsic == nir_intrinsic_image_deref_sparse_load;
|
||||||
|
@@ -264,7 +264,7 @@ sample_plane(nir_builder *b, nir_tex_instr *tex, int plane,
|
|||||||
plane_tex->src[tex->num_srcs].src_type = nir_tex_src_plane;
|
plane_tex->src[tex->num_srcs].src_type = nir_tex_src_plane;
|
||||||
plane_tex->op = nir_texop_tex;
|
plane_tex->op = nir_texop_tex;
|
||||||
plane_tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
plane_tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
|
||||||
plane_tex->dest_type = nir_type_float;
|
plane_tex->dest_type = nir_type_float | nir_dest_bit_size(tex->dest);
|
||||||
plane_tex->coord_components = 2;
|
plane_tex->coord_components = 2;
|
||||||
|
|
||||||
plane_tex->texture_index = tex->texture_index;
|
plane_tex->texture_index = tex->texture_index;
|
||||||
|
Reference in New Issue
Block a user