mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests/shader_runner: Set the SPIR-V feature flags based on the runner caps.
This commit is contained in:
parent
015fde5e23
commit
5c637d68da
Notes:
Alexandre Julliard
2024-03-04 23:20:00 +01: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/688
@ -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;
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <EGL/eglext.h>
|
||||
#include <GL/gl.h>
|
||||
#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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user