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 <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
This commit is contained in:
Brian Paul 2017-10-04 11:21:18 -06:00
parent 252e97ecdf
commit 4a1976bfcf
2 changed files with 27 additions and 1 deletions

View File

@ -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:

View File

@ -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: