mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/dxbc: Map sm4 fragment outputs to system values based on their name.
This commit is contained in:
parent
8c11270940
commit
1615e5a76b
Notes:
Alexandre Julliard
2023-09-21 22:01:59 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/356
@ -321,6 +321,26 @@ int vkd3d_shader_parse_dxbc(const struct vkd3d_shader_code *dxbc,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Shader Model 6 shaders use these special values in the output signature,
|
||||||
|
* but Shader Model 4/5 just use VKD3D_SHADER_SV_NONE. Normalize to SM6. */
|
||||||
|
static enum vkd3d_shader_sysval_semantic map_fragment_output_sysval(const char *name)
|
||||||
|
{
|
||||||
|
if (!ascii_strcasecmp(name, "sv_target"))
|
||||||
|
return VKD3D_SHADER_SV_TARGET;
|
||||||
|
if (!ascii_strcasecmp(name, "sv_depth"))
|
||||||
|
return VKD3D_SHADER_SV_DEPTH;
|
||||||
|
if (!ascii_strcasecmp(name, "sv_coverage"))
|
||||||
|
return VKD3D_SHADER_SV_COVERAGE;
|
||||||
|
if (!ascii_strcasecmp(name, "sv_depthgreaterequal"))
|
||||||
|
return VKD3D_SHADER_SV_DEPTH_GREATER_EQUAL;
|
||||||
|
if (!ascii_strcasecmp(name, "sv_depthlessequal"))
|
||||||
|
return VKD3D_SHADER_SV_DEPTH_LESS_EQUAL;
|
||||||
|
if (!ascii_strcasecmp(name, "sv_stencilref"))
|
||||||
|
return VKD3D_SHADER_SV_STENCIL_REF;
|
||||||
|
|
||||||
|
return VKD3D_SHADER_SV_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *section,
|
static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *section,
|
||||||
struct vkd3d_shader_message_context *message_context, struct shader_signature *s)
|
struct vkd3d_shader_message_context *message_context, struct shader_signature *s)
|
||||||
{
|
{
|
||||||
@ -401,6 +421,9 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
|
|||||||
case TAG_OSGN:
|
case TAG_OSGN:
|
||||||
case TAG_OSG1:
|
case TAG_OSG1:
|
||||||
case TAG_OSG5:
|
case TAG_OSG5:
|
||||||
|
if (e[i].sysval_semantic == VKD3D_SHADER_SV_NONE)
|
||||||
|
e[i].sysval_semantic = map_fragment_output_sysval(e[i].semantic_name);
|
||||||
|
/* Fall through. */
|
||||||
case TAG_PCSG:
|
case TAG_PCSG:
|
||||||
case TAG_PSG1:
|
case TAG_PSG1:
|
||||||
e[i].used_mask = e[i].mask & ~e[i].used_mask;
|
e[i].used_mask = e[i].mask & ~e[i].used_mask;
|
||||||
|
@ -566,8 +566,8 @@ static void test_scan_signatures(void)
|
|||||||
|
|
||||||
static const struct vkd3d_shader_signature_element ps1_outputs[] =
|
static const struct vkd3d_shader_signature_element ps1_outputs[] =
|
||||||
{
|
{
|
||||||
{"sv_target", 2, 0, VKD3D_SHADER_SV_NONE, VKD3D_SHADER_COMPONENT_FLOAT, 2, 0xf, 0xf},
|
{"sv_target", 2, 0, VKD3D_SHADER_SV_TARGET, VKD3D_SHADER_COMPONENT_FLOAT, 2, 0xf, 0xf},
|
||||||
{"sv_depth", 0, 0, VKD3D_SHADER_SV_NONE, VKD3D_SHADER_COMPONENT_FLOAT, ~0u, 0x1, 0x1},
|
{"sv_depth", 0, 0, VKD3D_SHADER_SV_DEPTH, VKD3D_SHADER_COMPONENT_FLOAT, ~0u, 0x1, 0x1},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char ps2_source[] =
|
static const char ps2_source[] =
|
||||||
|
Loading…
Reference in New Issue
Block a user