From: Brian Paul Date: Wed, 4 Oct 2017 17:21:18 +0000 (-0600) Subject: svga: implement support for GL_ARB_texture_query_lod X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4a1976bfcf4b4843369aa9146af48ac8bf9e70d8;p=mesa.git svga: implement support for GL_ARB_texture_query_lod Just translate the TGSI LODQ intruction to VGPU10 LOD instruction. All (4) Piglit GL_ARB_texture_query_lod tests pass. Reviewed-by: Charmaine Lee Reviewed-by: Neha Bhende --- diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index a38e062f776..c0f898d9d8f 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -347,6 +347,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_INDEP_BLEND_FUNC: case PIPE_CAP_SAMPLE_SHADING: case PIPE_CAP_FORCE_PERSAMPLE_INTERP: + case PIPE_CAP_TEXTURE_QUERY_LOD: return sws->have_sm4_1; case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS: @@ -367,7 +368,6 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT: case PIPE_CAP_TEXTURE_GATHER_SM5: case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: - case PIPE_CAP_TEXTURE_QUERY_LOD: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION: case PIPE_CAP_DRAW_INDIRECT: diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c index b87ac906584..2dc870ffef0 100644 --- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c +++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c @@ -4253,6 +4253,30 @@ emit_lit(struct svga_shader_emitter_v10 *emit, } +/** + * Emit Level Of Detail Query (LODQ) instruction. + */ +static boolean +emit_lodq(struct svga_shader_emitter_v10 *emit, + const struct tgsi_full_instruction *inst) +{ + const uint unit = inst->Src[1].Register.Index; + + assert(emit->version >= 41); + + /* LOD dst, coord, resource, sampler */ + begin_emit_instruction(emit); + emit_opcode(emit, VGPU10_OPCODE_LOD, FALSE); + emit_dst_register(emit, &inst->Dst[0]); + emit_src_register(emit, &inst->Src[0]); /* coord */ + emit_resource_register(emit, unit); + emit_sampler_register(emit, unit); + end_emit_instruction(emit); + + return TRUE; +} + + /** * Emit code for TGSI_OPCODE_LOG instruction. */ @@ -5862,6 +5886,8 @@ emit_vgpu10_instruction(struct svga_shader_emitter_v10 *emit, return emit_lg2(emit, inst); case TGSI_OPCODE_LIT: return emit_lit(emit, inst); + case TGSI_OPCODE_LODQ: + return emit_lodq(emit, inst); case TGSI_OPCODE_LOG: return emit_log(emit, inst); case TGSI_OPCODE_LRP: