diff --git a/tests/shader_runner.h b/tests/shader_runner.h index 62358d78..ec6c340c 100644 --- a/tests/shader_runner.h +++ b/tests/shader_runner.h @@ -23,6 +23,7 @@ #include "vkd3d_d3d12.h" #include "vkd3d_dxgiformat.h" #include "vkd3d_common.h" +#include "vkd3d_shader.h" #include "utils.h" #define RENDER_TARGET_WIDTH 640 @@ -128,6 +129,18 @@ struct shader_runner_caps bool rov; }; +static inline unsigned int shader_runner_caps_get_feature_flags(const struct shader_runner_caps *caps) +{ + unsigned int flags = 0; + + if (caps->int64) + flags |= VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64; + if (caps->float64) + flags |= VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64; + + return flags; +} + struct shader_runner { const struct shader_runner_ops *ops; diff --git a/tests/shader_runner_gl.c b/tests/shader_runner_gl.c index 6cec33a4..010b11d7 100644 --- a/tests/shader_runner_gl.c +++ b/tests/shader_runner_gl.c @@ -27,7 +27,6 @@ #include #include #include "shader_runner.h" -#include "vkd3d_shader.h" #include "vkd3d_d3dcompiler.h" static PFNGLSPECIALIZESHADERPROC p_glSpecializeShader; @@ -442,11 +441,12 @@ static bool compile_shader(struct gl_runner *runner, ID3DBlob *blob, struct vkd3 char *messages; int ret; - static const struct vkd3d_shader_compile_option options[] = + const struct vkd3d_shader_compile_option options[] = { {VKD3D_SHADER_COMPILE_OPTION_API_VERSION, VKD3D_SHADER_API_VERSION_1_10}, {VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN, VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_LOWER_LEFT}, + {VKD3D_SHADER_COMPILE_OPTION_FEATURE, shader_runner_caps_get_feature_flags(&runner->caps)}, }; info.next = &combined_sampler_info; diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index c919e256..4e68fd14 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -24,7 +24,6 @@ #define VKD3D_TEST_NO_DEFS #include "config.h" #include "vulkan/vulkan.h" -#include "vkd3d_shader.h" #include "vkd3d.h" #include "vkd3d_d3dcompiler.h" #include "shader_runner.h" @@ -420,7 +419,7 @@ static bool compile_shader(struct vulkan_shader_runner *runner, const char *sour struct vkd3d_shader_resource_binding bindings[MAX_RESOURCES + MAX_SAMPLERS]; struct vkd3d_shader_push_constant_buffer push_constants; struct vkd3d_shader_resource_binding *binding; - struct vkd3d_shader_compile_option options[2]; + struct vkd3d_shader_compile_option options[3]; struct vkd3d_shader_compile_option *option; unsigned int i, compile_options; char profile[7]; @@ -499,6 +498,10 @@ static bool compile_shader(struct vulkan_shader_runner *runner, const char *sour info.source_type = VKD3D_SHADER_SOURCE_DXBC_TPF; info.target_type = VKD3D_SHADER_TARGET_SPIRV_BINARY; + option = &options[info.option_count++]; + option->name = VKD3D_SHADER_COMPILE_OPTION_FEATURE; + option->value = shader_runner_caps_get_feature_flags(&runner->caps); + spirv_info.next = &interface_info; spirv_info.environment = VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_0;