mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Introduce VKD3D_SHADER_TARGET_MSL.
This commit is contained in:
parent
ab525f31e4
commit
23ba1a5e07
Notes:
Henri Verbeet
2024-09-12 18:55:53 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1055
@ -361,6 +361,7 @@ libvkd3d_shader_la_SOURCES = \
|
||||
libs/vkd3d-shader/hlsl_codegen.c \
|
||||
libs/vkd3d-shader/hlsl_constant_ops.c \
|
||||
libs/vkd3d-shader/ir.c \
|
||||
libs/vkd3d-shader/msl.c \
|
||||
libs/vkd3d-shader/preproc.h \
|
||||
libs/vkd3d-shader/spirv.c \
|
||||
libs/vkd3d-shader/tpf.c \
|
||||
|
@ -11,7 +11,7 @@ rm -fr build
|
||||
mkdir build
|
||||
cd build
|
||||
if ../configure CFLAGS="-I/opt/homebrew/opt/vulkan-headers/include -I/opt/homebrew/opt/spirv-headers/include -g -O2 -Wno-implicit-fallthrough -Wno-ignored-attributes -Wno-unknown-attributes -Wno-unused-but-set-variable -Werror" \
|
||||
CPPFLAGS="-DVKD3D_ABORT_ON_ERR" \
|
||||
CPPFLAGS="-DVKD3D_ABORT_ON_ERR -DVKD3D_SHADER_UNSUPPORTED_MSL" \
|
||||
VULKAN_LIBS=-L/opt/homebrew/opt/vulkan-loader/lib --with-spirv-tools && \
|
||||
make -j$(sysctl -n hw.ncpu) ; then
|
||||
make -j$(sysctl -n hw.ncpu) AM_COLOR_TESTS=always check || \
|
||||
|
@ -1087,6 +1087,10 @@ enum vkd3d_shader_target_type
|
||||
* Output is a raw FX section without container. \since 1.11
|
||||
*/
|
||||
VKD3D_SHADER_TARGET_FX,
|
||||
/**
|
||||
* A 'Metal Shading Language' shader. \since 1.14
|
||||
*/
|
||||
VKD3D_SHADER_TARGET_MSL,
|
||||
|
||||
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_TARGET_TYPE),
|
||||
};
|
||||
|
29
libs/vkd3d-shader/msl.c
Normal file
29
libs/vkd3d-shader/msl.c
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2024 Feifan He for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "vkd3d_shader_private.h"
|
||||
|
||||
int msl_compile(struct vkd3d_shader_message_context *message_context)
|
||||
{
|
||||
MESSAGE("Generating a MSL shader. This is unsupported; you get to keep all the pieces if it breaks.\n");
|
||||
|
||||
vkd3d_shader_error(message_context, NULL, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
"Internal compiler error: Unhandled instruction.");
|
||||
|
||||
return VKD3D_ERROR_INVALID_SHADER;
|
||||
}
|
@ -535,6 +535,8 @@ static const char *shader_get_target_type_suffix(enum vkd3d_shader_target_type t
|
||||
return "glsl";
|
||||
case VKD3D_SHADER_TARGET_FX:
|
||||
return "fx";
|
||||
case VKD3D_SHADER_TARGET_MSL:
|
||||
return "msl";
|
||||
default:
|
||||
FIXME("Unhandled target type %#x.\n", type);
|
||||
return "bin";
|
||||
@ -1646,6 +1648,10 @@ int vsir_program_compile(struct vsir_program *program, uint64_t config_flags,
|
||||
vkd3d_shader_free_scan_descriptor_info1(&scan_descriptor_info);
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_TARGET_MSL:
|
||||
ret = msl_compile(message_context);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Validation should prevent us from reaching this. */
|
||||
vkd3d_unreachable();
|
||||
@ -1945,6 +1951,9 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types(
|
||||
VKD3D_SHADER_TARGET_D3D_ASM,
|
||||
#ifdef VKD3D_SHADER_UNSUPPORTED_GLSL
|
||||
VKD3D_SHADER_TARGET_GLSL,
|
||||
#endif
|
||||
#ifdef VKD3D_SHADER_UNSUPPORTED_MSL
|
||||
VKD3D_SHADER_TARGET_MSL,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -238,6 +238,8 @@ enum vkd3d_shader_error
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_GS = 9019,
|
||||
|
||||
VKD3D_SHADER_WARNING_VSIR_DYNAMIC_DESCRIPTOR_ARRAY = 9300,
|
||||
|
||||
VKD3D_SHADER_ERROR_MSL_INTERNAL = 10000,
|
||||
};
|
||||
|
||||
enum vkd3d_shader_opcode
|
||||
@ -1593,6 +1595,8 @@ int spirv_compile(struct vsir_program *program, uint64_t config_flags,
|
||||
const struct vkd3d_shader_compile_info *compile_info,
|
||||
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
||||
|
||||
int msl_compile(struct vkd3d_shader_message_context *message_context);
|
||||
|
||||
enum vkd3d_md5_variant
|
||||
{
|
||||
VKD3D_MD5_STANDARD,
|
||||
|
@ -113,7 +113,10 @@ target_type_info[] =
|
||||
true},
|
||||
{VKD3D_SHADER_TARGET_GLSL,
|
||||
"glsl", "An 'OpenGL Shading Language' shader.\n",
|
||||
false}
|
||||
false},
|
||||
{VKD3D_SHADER_TARGET_MSL,
|
||||
"msl", "A 'Metal Shading Language' shader.\n",
|
||||
false},
|
||||
};
|
||||
|
||||
static bool read_shader(struct vkd3d_shader_code *shader, FILE *f)
|
||||
|
Loading…
Reference in New Issue
Block a user