mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 11:08:03 +02:00
zink/ntv: extract picking the image to load from
v2: remove ALWAYS_INLINE (zmike) Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28511>
This commit is contained in:
parent
2678f7a554
commit
13f8a462c5
1 changed files with 12 additions and 12 deletions
|
|
@ -3748,6 +3748,14 @@ move_tex_proj_to_coord(struct ntv_context *ctx, unsigned coord_components, struc
|
|||
coord_components);
|
||||
}
|
||||
|
||||
static SpvId
|
||||
get_tex_image_to_load( struct ntv_context *ctx, SpvId image_type, bool is_buffer, SpvId load)
|
||||
{
|
||||
return is_buffer || ctx->stage == MESA_SHADER_KERNEL ?
|
||||
load :
|
||||
spirv_builder_emit_image(&ctx->builder, image_type, load);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
|
||||
{
|
||||
|
|
@ -3809,9 +3817,7 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
|
|||
|
||||
switch (tex->op) {
|
||||
case nir_texop_txs: {
|
||||
SpvId image = is_buffer || ctx->stage == MESA_SHADER_KERNEL ?
|
||||
load :
|
||||
spirv_builder_emit_image(&ctx->builder, image_type, load);
|
||||
SpvId image = get_tex_image_to_load(ctx, image_type, is_buffer, load);
|
||||
/* Its Dim operand must be one of 1D, 2D, 3D, or Cube
|
||||
* - OpImageQuerySizeLod specification
|
||||
*
|
||||
|
|
@ -3830,18 +3836,14 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
|
|||
return;
|
||||
}
|
||||
case nir_texop_query_levels: {
|
||||
SpvId image = is_buffer || ctx->stage == MESA_SHADER_KERNEL ?
|
||||
load :
|
||||
spirv_builder_emit_image(&ctx->builder, image_type, load);
|
||||
SpvId image = get_tex_image_to_load(ctx, image_type, is_buffer, load);
|
||||
SpvId result = spirv_builder_emit_image_query_levels(&ctx->builder,
|
||||
dest_type, image);
|
||||
store_def(ctx, tex->def.index, result, tex->dest_type);
|
||||
return;
|
||||
}
|
||||
case nir_texop_texture_samples: {
|
||||
SpvId image = is_buffer || ctx->stage == MESA_SHADER_KERNEL ?
|
||||
load :
|
||||
spirv_builder_emit_image(&ctx->builder, image_type, load);
|
||||
SpvId image = get_tex_image_to_load(ctx, image_type, is_buffer, load);
|
||||
SpvId result = spirv_builder_emit_unop(&ctx->builder, SpvOpImageQuerySamples,
|
||||
dest_type, image);
|
||||
store_def(ctx, tex->def.index, result, tex->dest_type);
|
||||
|
|
@ -3868,9 +3870,7 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
|
|||
if (tex->op == nir_texop_txf ||
|
||||
tex->op == nir_texop_txf_ms ||
|
||||
tex->op == nir_texop_tg4) {
|
||||
SpvId image = is_buffer || ctx->stage == MESA_SHADER_KERNEL ?
|
||||
load :
|
||||
spirv_builder_emit_image(&ctx->builder, image_type, load);
|
||||
SpvId image = get_tex_image_to_load(ctx, image_type, is_buffer, load);
|
||||
|
||||
if (tex->op == nir_texop_tg4) {
|
||||
if (tex_src.const_offset)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue