zink: implement ARB_texture_query_lod

just needed hooking up the spirv function to the tex op

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7484>
This commit is contained in:
Mike Blumenkrantz 2020-07-15 13:51:18 -04:00
parent bf29daa1b5
commit 0bc222706d
5 changed files with 37 additions and 3 deletions

View File

@ -135,7 +135,7 @@ GL 4.0, GLSL 4.00 --- all DONE: i965/gen7+, nvc0, r600, radeonsi, llvmpipe, virg
GL_ARB_texture_buffer_object_rgb32 DONE (freedreno, i965/gen6+, softpipe, swr)
GL_ARB_texture_cube_map_array DONE (i965/gen6+, nv50, softpipe, swr, zink)
GL_ARB_texture_gather DONE (freedreno, i965/gen6+, nv50, softpipe, swr, v3d, panfrost)
GL_ARB_texture_query_lod DONE (freedreno, i965, nv50, softpipe, swr, v3d, panfrost)
GL_ARB_texture_query_lod DONE (freedreno, i965, nv50, softpipe, swr, v3d, panfrost, zink)
GL_ARB_transform_feedback2 DONE (i965/gen6+, nv50, softpipe, swr, v3d, panfrost)
GL_ARB_transform_feedback3 DONE (i965/gen7+, softpipe, swr)

View File

@ -1862,7 +1862,8 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
tex->op == nir_texop_txd ||
tex->op == nir_texop_txf ||
tex->op == nir_texop_txf_ms ||
tex->op == nir_texop_txs);
tex->op == nir_texop_txs ||
tex->op == nir_texop_lod);
assert(tex->texture_index == tex->sampler_index);
SpvId coord = 0, proj = 0, bias = 0, lod = 0, dref = 0, dx = 0, dy = 0,
@ -1983,7 +1984,13 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
constituents,
coord_components);
}
if (tex->op == nir_texop_lod) {
SpvId result = spirv_builder_emit_image_query_lod(&ctx->builder,
dest_type, load,
coord);
store_dest(ctx, &tex->dest, result, tex->dest_type);
return;
}
SpvId actual_dest_type = dest_type;
if (dref)
actual_dest_type = spirv_builder_type_float(&ctx->builder, 32);

View File

@ -758,6 +758,26 @@ spirv_builder_emit_image_query_size(struct spirv_builder *b,
return result;
}
SpvId
spirv_builder_emit_image_query_lod(struct spirv_builder *b,
SpvId result_type,
SpvId image,
SpvId coords)
{
int opcode = SpvOpImageQueryLod;
int words = 5;
SpvId result = spirv_builder_new_id(b);
spirv_buffer_prepare(&b->instructions, b->mem_ctx, words);
spirv_buffer_emit_word(&b->instructions, opcode | (words << 16));
spirv_buffer_emit_word(&b->instructions, result_type);
spirv_buffer_emit_word(&b->instructions, result);
spirv_buffer_emit_word(&b->instructions, image);
spirv_buffer_emit_word(&b->instructions, coords);
return result;
}
SpvId
spirv_builder_emit_ext_inst(struct spirv_builder *b, SpvId result_type,
SpvId set, uint32_t instruction,

View File

@ -267,6 +267,12 @@ spirv_builder_emit_image_query_size(struct spirv_builder *b,
SpvId image,
SpvId lod);
SpvId
spirv_builder_emit_image_query_lod(struct spirv_builder *b,
SpvId result_type,
SpvId image,
SpvId coords);
SpvId
spirv_builder_emit_ext_inst(struct spirv_builder *b, SpvId result_type,
SpvId set, uint32_t instruction,

View File

@ -99,6 +99,7 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_NPOT_TEXTURES:
case PIPE_CAP_TGSI_TEXCOORD:
case PIPE_CAP_DRAW_INDIRECT:
case PIPE_CAP_TEXTURE_QUERY_LOD:
return 1;
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: