mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Respect the requested target type.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
79ae688140
commit
f5c4c06090
@@ -163,10 +163,34 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
|
||||
struct vkd3d_shader_compile_option *option;
|
||||
struct vkd3d_shader_code byte_code;
|
||||
const D3D_SHADER_MACRO *macro;
|
||||
size_t profile_len, i;
|
||||
char *messages;
|
||||
HRESULT hr;
|
||||
int ret;
|
||||
|
||||
static const char * const d3dbc_profiles[] =
|
||||
{
|
||||
"fx_2_",
|
||||
|
||||
"ps.1.",
|
||||
"ps.2.",
|
||||
"ps.3.",
|
||||
|
||||
"ps_1_",
|
||||
"ps_2_",
|
||||
"ps_3_",
|
||||
|
||||
"vs.1.",
|
||||
"vs.2.",
|
||||
"vs.3.",
|
||||
|
||||
"vs_1_",
|
||||
"vs_2_",
|
||||
"vs_3_",
|
||||
|
||||
"tx_1_",
|
||||
};
|
||||
|
||||
TRACE("data %p, data_size %lu, filename %s, macros %p, include %p, entry_point %s, "
|
||||
"profile %s, flags %#x, effect_flags %#x, secondary_flags %#x, secondary_data %p, "
|
||||
"secondary_data_size %lu, shader_blob %p, messages_blob %p.\n",
|
||||
@@ -195,6 +219,18 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
|
||||
compile_info.log_level = VKD3D_SHADER_LOG_INFO;
|
||||
compile_info.source_name = filename;
|
||||
|
||||
profile_len = strlen(profile);
|
||||
for (i = 0; i < ARRAY_SIZE(d3dbc_profiles); ++i)
|
||||
{
|
||||
size_t len = strlen(d3dbc_profiles[i]);
|
||||
|
||||
if (len <= profile_len && !memcmp(profile, d3dbc_profiles[i], len))
|
||||
{
|
||||
compile_info.target_type = VKD3D_SHADER_TARGET_D3D_BYTECODE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
preprocess_info.type = VKD3D_SHADER_STRUCTURE_TYPE_PREPROCESS_INFO;
|
||||
preprocess_info.next = &hlsl_info;
|
||||
preprocess_info.macros = (const struct vkd3d_shader_macro *)macros;
|
||||
|
||||
Reference in New Issue
Block a user