Commit bcb7396a authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Introduce the "glsl-vkd3d" shader backend.

Note that this won't compile very many shaders until vkd3d-shader's GLSL support is much more complete.
parent a0b79ba3
...@@ -306,6 +306,28 @@ const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HA ...@@ -306,6 +306,28 @@ const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HA
return shader_opcode_names[handler_idx]; return shader_opcode_names[handler_idx];
} }
enum vkd3d_shader_visibility vkd3d_shader_visibility_from_wined3d(enum wined3d_shader_type shader_type)
{
switch (shader_type)
{
case WINED3D_SHADER_TYPE_VERTEX:
return VKD3D_SHADER_VISIBILITY_VERTEX;
case WINED3D_SHADER_TYPE_HULL:
return VKD3D_SHADER_VISIBILITY_HULL;
case WINED3D_SHADER_TYPE_DOMAIN:
return VKD3D_SHADER_VISIBILITY_DOMAIN;
case WINED3D_SHADER_TYPE_GEOMETRY:
return VKD3D_SHADER_VISIBILITY_GEOMETRY;
case WINED3D_SHADER_TYPE_PIXEL:
return VKD3D_SHADER_VISIBILITY_PIXEL;
case WINED3D_SHADER_TYPE_COMPUTE:
return VKD3D_SHADER_VISIBILITY_COMPUTE;
default:
ERR("Invalid shader type %s.\n", debug_shader_type(shader_type));
return VKD3D_SHADER_VISIBILITY_ALL;
}
}
static const char *shader_semantic_name_from_usage(enum wined3d_decl_usage usage) static const char *shader_semantic_name_from_usage(enum wined3d_decl_usage usage)
{ {
if (usage >= ARRAY_SIZE(semantic_names)) if (usage >= ARRAY_SIZE(semantic_names))
......
...@@ -116,28 +116,6 @@ struct wined3d_shader_spirv_shader_interface ...@@ -116,28 +116,6 @@ struct wined3d_shader_spirv_shader_interface
struct vkd3d_shader_transform_feedback_info xfb_info; struct vkd3d_shader_transform_feedback_info xfb_info;
}; };
static enum vkd3d_shader_visibility vkd3d_shader_visibility_from_wined3d(enum wined3d_shader_type shader_type)
{
switch (shader_type)
{
case WINED3D_SHADER_TYPE_VERTEX:
return VKD3D_SHADER_VISIBILITY_VERTEX;
case WINED3D_SHADER_TYPE_HULL:
return VKD3D_SHADER_VISIBILITY_HULL;
case WINED3D_SHADER_TYPE_DOMAIN:
return VKD3D_SHADER_VISIBILITY_DOMAIN;
case WINED3D_SHADER_TYPE_GEOMETRY:
return VKD3D_SHADER_VISIBILITY_GEOMETRY;
case WINED3D_SHADER_TYPE_PIXEL:
return VKD3D_SHADER_VISIBILITY_PIXEL;
case WINED3D_SHADER_TYPE_COMPUTE:
return VKD3D_SHADER_VISIBILITY_COMPUTE;
default:
ERR("Invalid shader type %s.\n", debug_shader_type(shader_type));
return VKD3D_SHADER_VISIBILITY_ALL;
}
}
static void shader_spirv_handle_instruction(const struct wined3d_shader_instruction *ins) static void shader_spirv_handle_instruction(const struct wined3d_shader_instruction *ins)
{ {
} }
......
...@@ -353,6 +353,11 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) ...@@ -353,6 +353,11 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
} }
if (!get_config_key(hkey, appkey, env, "shader_backend", buffer, size)) if (!get_config_key(hkey, appkey, env, "shader_backend", buffer, size))
{ {
if (!stricmp(buffer, "glsl-vkd3d"))
{
ERR_(winediag)("Using the vkd3d-shader GLSL shader backend.\n");
wined3d_settings.shader_backend = WINED3D_SHADER_BACKEND_GLSL_VKD3D;
}
if (!stricmp(buffer, "glsl")) if (!stricmp(buffer, "glsl"))
{ {
ERR_(winediag)("Using the GLSL shader backend.\n"); ERR_(winediag)("Using the GLSL shader backend.\n");
......
...@@ -466,6 +466,7 @@ enum wined3d_shader_backend ...@@ -466,6 +466,7 @@ enum wined3d_shader_backend
{ {
WINED3D_SHADER_BACKEND_AUTO, WINED3D_SHADER_BACKEND_AUTO,
WINED3D_SHADER_BACKEND_GLSL, WINED3D_SHADER_BACKEND_GLSL,
WINED3D_SHADER_BACKEND_GLSL_VKD3D,
}; };
#define WINED3D_CSMT_ENABLE 0x00000001 #define WINED3D_CSMT_ENABLE 0x00000001
...@@ -4330,6 +4331,8 @@ HRESULT shader_generate_code(const struct wined3d_shader *shader, struct wined3d ...@@ -4330,6 +4331,8 @@ HRESULT shader_generate_code(const struct wined3d_shader *shader, struct wined3d
const DWORD *start, const DWORD *end); const DWORD *start, const DWORD *end);
BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage); BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage);
enum vkd3d_shader_visibility vkd3d_shader_visibility_from_wined3d(enum wined3d_shader_type shader_type);
static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg) static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg)
{ {
switch (reg->type) switch (reg->type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment