From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d-shader/dxbc.c | 1 + libs/vkd3d-shader/spirv.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 2fd0cda7b308..0b5f7bc892f6 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -1566,6 +1566,7 @@ static bool shader_sm4_is_scalar_register(const struct vkd3d_shader_register *re { switch (reg->type) { + case VKD3DSPR_COVERAGE: case VKD3DSPR_DEPTHOUT: case VKD3DSPR_DEPTHOUTGE: case VKD3DSPR_DEPTHOUTLE: diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index d2c417f0da6e..ddcaead2a185 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2302,6 +2302,9 @@ static bool vkd3d_dxbc_compiler_get_register_name(char *buffer, unsigned int buf case VKD3DSPR_IDXTEMP: snprintf(buffer, buffer_size, "x%u", idx); break; + case VKD3DSPR_COVERAGE: + snprintf(buffer, buffer_size, "vCoverage"); + break; case VKD3DSPR_SAMPLEMASK: snprintf(buffer, buffer_size, "oMask"); break; @@ -2473,7 +2476,7 @@ static void vkd3d_dxbc_compiler_emit_dereference_register(struct vkd3d_dxbc_comp { indexes[index_count++] = vkd3d_dxbc_compiler_emit_register_addressing(compiler, ®->idx[1]); } - else if (reg->type == VKD3DSPR_SAMPLEMASK) + else if (reg->type == VKD3DSPR_COVERAGE || reg->type == VKD3DSPR_SAMPLEMASK) { indexes[index_count++] = vkd3d_dxbc_compiler_get_constant_uint(compiler, register_info->member_idx); } @@ -3116,6 +3119,7 @@ vkd3d_register_builtins[] =
{VKD3DSPR_TESSCOORD, {VKD3D_TYPE_FLOAT, 3, SpvBuiltInTessCoord}},
+ {VKD3DSPR_COVERAGE, {VKD3D_TYPE_UINT, 1, SpvBuiltInSampleMask, NULL, true}}, {VKD3DSPR_SAMPLEMASK, {VKD3D_TYPE_UINT, 1, SpvBuiltInSampleMask, NULL, true}},
{VKD3DSPR_DEPTHOUT, {VKD3D_TYPE_FLOAT, 1, SpvBuiltInFragDepth}}, @@ -3437,6 +3441,7 @@ static void vkd3d_dxbc_compiler_emit_input_register(struct vkd3d_dxbc_compiler * const struct vkd3d_shader_register *reg = &dst->reg; const struct vkd3d_spirv_builtin *builtin; struct vkd3d_symbol reg_symbol; + unsigned int array_size; uint32_t input_id;
assert(!reg->idx[0].rel_addr); @@ -3449,15 +3454,17 @@ static void vkd3d_dxbc_compiler_emit_input_register(struct vkd3d_dxbc_compiler * return; }
- input_id = vkd3d_dxbc_compiler_emit_variable(compiler, + array_size = builtin->is_spirv_array ? 1 : 0; + input_id = vkd3d_dxbc_compiler_emit_array_variable(compiler, &builder->global_stream, SpvStorageClassInput, - builtin->component_type, builtin->component_count); + builtin->component_type, builtin->component_count, array_size); vkd3d_spirv_add_iface_variable(builder, input_id); vkd3d_dxbc_compiler_decorate_builtin(compiler, input_id, builtin->spirv_builtin);
vkd3d_symbol_make_register(®_symbol, reg); reg_symbol.id = input_id; reg_symbol.info.reg.storage_class = SpvStorageClassInput; + reg_symbol.info.reg.member_idx = 0; reg_symbol.info.reg.component_type = builtin->component_type; reg_symbol.info.reg.write_mask = vkd3d_write_mask_from_component_count(builtin->component_count); vkd3d_dxbc_compiler_put_symbol(compiler, ®_symbol);