diff options
author | Charmaine Lee <[email protected]> | 2017-05-05 17:00:55 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2018-09-10 13:07:30 -0600 |
commit | 22e809971167f8f9e8b0fe6ba0c98ab03fc8dea0 (patch) | |
tree | d43cc6cd0a8028293f91530a7195b0493c4cd40e /src | |
parent | f929247d247874a7dcd9031c07279c8160766b5d (diff) |
svga: add support for shadow cubemap array
Reviewed-by: Neha Bhende <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c index 2c857440f63..5f5adf13506 100644 --- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c +++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c @@ -2992,6 +2992,7 @@ tgsi_texture_to_resource_dimension(enum tgsi_texture_type target, case TGSI_TEXTURE_3D: return VGPU10_RESOURCE_DIMENSION_TEXTURE3D; case TGSI_TEXTURE_CUBE: + case TGSI_TEXTURE_SHADOWCUBE: return VGPU10_RESOURCE_DIMENSION_TEXTURECUBE; case TGSI_TEXTURE_SHADOW1D: return VGPU10_RESOURCE_DIMENSION_TEXTURE1D; @@ -3006,14 +3007,13 @@ tgsi_texture_to_resource_dimension(enum tgsi_texture_type target, case TGSI_TEXTURE_SHADOW2D_ARRAY: return is_array ? VGPU10_RESOURCE_DIMENSION_TEXTURE2DARRAY : VGPU10_RESOURCE_DIMENSION_TEXTURE2D; - case TGSI_TEXTURE_SHADOWCUBE: - return VGPU10_RESOURCE_DIMENSION_TEXTURECUBE; case TGSI_TEXTURE_2D_MSAA: return VGPU10_RESOURCE_DIMENSION_TEXTURE2DMS; case TGSI_TEXTURE_2D_ARRAY_MSAA: return is_array ? VGPU10_RESOURCE_DIMENSION_TEXTURE2DMSARRAY : VGPU10_RESOURCE_DIMENSION_TEXTURE2DMS; case TGSI_TEXTURE_CUBE_ARRAY: + case TGSI_TEXTURE_SHADOWCUBE_ARRAY: return VGPU10_RESOURCE_DIMENSION_TEXTURECUBEARRAY; default: assert(!"Unexpected resource type"); @@ -5113,6 +5113,49 @@ emit_tex(struct svga_shader_emitter_v10 *emit, /** + * Emit code for TGSI_OPCODE_TEX2 (texture lookup for shadow cube map arrays) + */ +static boolean +emit_tex2(struct svga_shader_emitter_v10 *emit, + const struct tgsi_full_instruction *inst) +{ + const uint unit = inst->Src[2].Register.Index; + unsigned target = inst->Texture.Texture; + struct tgsi_full_src_register coord, ref; + int offsets[3]; + struct tex_swizzle_info swz_info; + + /* check that the sampler returns a float */ + if (!is_valid_tex_instruction(emit, inst)) + return TRUE; + + begin_tex_swizzle(emit, unit, inst, FALSE, &swz_info); + + get_texel_offsets(emit, inst, offsets); + + coord = setup_texcoord(emit, unit, &inst->Src[0]); + ref = scalar_src(&inst->Src[1], TGSI_SWIZZLE_X); + + /* SAMPLE_C dst, coord, resource, sampler, ref */ + begin_emit_instruction(emit); + emit_sample_opcode(emit, VGPU10_OPCODE_SAMPLE_C, + inst->Instruction.Saturate, offsets); + emit_dst_register(emit, get_tex_swizzle_dst(&swz_info)); + emit_src_register(emit, &coord); + emit_resource_register(emit, unit); + emit_sampler_register(emit, unit); + emit_tex_compare_refcoord(emit, target, &ref); + end_emit_instruction(emit); + + end_tex_swizzle(emit, &swz_info); + + free_temp_indexes(emit); + + return TRUE; +} + + +/** * Emit code for TGSI_OPCODE_TXP (projective texture) */ static boolean @@ -5622,6 +5665,8 @@ emit_vgpu10_instruction(struct svga_shader_emitter_v10 *emit, return emit_issg(emit, inst); case TGSI_OPCODE_TEX: return emit_tex(emit, inst); + case TGSI_OPCODE_TEX2: + return emit_tex2(emit, inst); case TGSI_OPCODE_TXP: return emit_txp(emit, inst); case TGSI_OPCODE_TXB: |