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:
Connor Abbott
2020-12-08 13:45:55 +01:00
parent 3ed9e75868
commit b2da598ff9
6 changed files with 10 additions and 21 deletions

View File

@@ -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->texture_index = tex->texture_index;
txs->sampler_index = tex->sampler_index;
txs->dest_type = nir_type_int;
txs->dest_type = nir_type_int32;
unsigned idx = 0;
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->texture_index = tex->texture_index;
tql->sampler_index = tex->sampler_index;
tql->dest_type = nir_type_float;
tql->dest_type = nir_type_float32;
unsigned idx = 0;
for (unsigned i = 0; i < tex->num_srcs; i++) {

View File

@@ -95,7 +95,7 @@ lower_bitmap(nir_shader *shader, nir_builder *b,
tex->op = nir_texop_tex;
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
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 = nir_src_for_ssa(&tex_deref->dest.ssa);
tex->src[1].src_type = nir_tex_src_sampler_deref;

View File

@@ -146,7 +146,7 @@ lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
tex->op = nir_texop_tex;
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
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 = nir_src_for_ssa(&tex_deref->dest.ssa);
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->sampler_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 = nir_src_for_ssa(&pixelmap_deref->dest.ssa);
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->coord_components = 2;
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 = nir_src_for_ssa(nir_channels(b, def, 0xc));

View File

@@ -60,7 +60,7 @@ lower_fb_read(nir_builder *b, nir_intrinsic_instr *intr)
tex->op = nir_texop_txf_ms_fb;
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
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 = nir_src_for_ssa(nir_channels(b, fragcoord, 0x3));
tex->src[1].src_type = nir_tex_src_ms_index;

View File

@@ -108,19 +108,8 @@ try_lower_input_load(nir_function_impl *impl, nir_intrinsic_instr *load,
tex->op = nir_texop_txf;
tex->sampler_dim = image_dim;
switch (glsl_get_sampler_result_type(deref->type)) {
case GLSL_TYPE_FLOAT:
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->dest_type =
nir_get_nir_type_for_glsl_base_type(glsl_get_sampler_result_type(deref->type));
tex->is_array = true;
tex->is_shadow = false;
tex->is_sparse = load->intrinsic == nir_intrinsic_image_deref_sparse_load;

View File

@@ -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->op = nir_texop_tex;
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->texture_index = tex->texture_index;