From 1f4e6dc60330eee49567a920db682075d9bc0288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 8 Oct 2018 15:40:15 +0200 Subject: [PATCH] vkd3d-shader: Implement SV_SampleIndex. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d-shader/spirv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 98d7a931..63a1a0e0 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2958,6 +2958,14 @@ static uint32_t sv_front_face_fixup(struct vkd3d_dxbc_compiler *compiler, return vkd3d_dxbc_compiler_emit_bool_to_int(compiler, 1, front_facing_id); } +static uint32_t sv_sample_index(struct vkd3d_dxbc_compiler *compiler, uint32_t id) +{ + struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; + + vkd3d_spirv_enable_capability(builder, SpvCapabilitySampleRateShading); + return id; +} + struct vkd3d_spirv_builtin { enum vkd3d_component_type component_type; @@ -2986,6 +2994,8 @@ vkd3d_system_value_builtins[] = {VKD3D_SIV_IS_FRONT_FACE, {VKD3D_TYPE_BOOL, 1, SpvBuiltInFrontFacing, sv_front_face_fixup}}, + {VKD3D_SIV_SAMPLE_INDEX, {VKD3D_TYPE_UINT, 1, SpvBuiltInSampleId, sv_sample_index}}, + {VKD3D_SIV_CLIP_DISTANCE, {VKD3D_TYPE_FLOAT, 1, SpvBuiltInClipDistance, NULL, true}}, {VKD3D_SIV_CULL_DISTANCE, {VKD3D_TYPE_FLOAT, 1, SpvBuiltInCullDistance, NULL, true}}, };