浏览代码

Removed logic that generates include paths in macros (#1861)

This was confusing distributed builds.
Also added type name to the JPH_SHADER_CONSTANTS_END, JPH_SHADER_BIND_END and JPH_SHADER_STRUCT_END to make it easier to integrate in other engines
Jorrit Rouwe 3 周之前
父节点
当前提交
cb2cbeeb16

+ 1 - 1
Jolt/Compute/CPU/ComputeQueueCPU.cpp

@@ -7,7 +7,7 @@
 #include <Jolt/Compute/CPU/ComputeShaderCPU.h>
 #include <Jolt/Compute/CPU/ComputeShaderCPU.h>
 #include <Jolt/Compute/CPU/ComputeBufferCPU.h>
 #include <Jolt/Compute/CPU/ComputeBufferCPU.h>
 #include <Jolt/Compute/CPU/ShaderWrapper.h>
 #include <Jolt/Compute/CPU/ShaderWrapper.h>
-#include <Jolt/Shaders/HLSLToCPP.h>
+#include <Jolt/Compute/CPU/HLSLToCPP.h>
 
 
 JPH_NAMESPACE_BEGIN
 JPH_NAMESPACE_BEGIN
 
 

+ 0 - 0
Jolt/Shaders/HLSLToCPP.h → Jolt/Compute/CPU/HLSLToCPP.h


+ 75 - 0
Jolt/Compute/CPU/WrapShaderBegin.h

@@ -0,0 +1,75 @@
+// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
+// SPDX-FileCopyrightText: 2026 Jorrit Rouwe
+// SPDX-License-Identifier: MIT
+
+#include <Jolt/Core/HashCombine.h>
+#include <Jolt/Compute/CPU/ComputeSystemCPU.h>
+#include <Jolt/Compute/CPU/ShaderWrapper.h>
+#include <Jolt/Compute/CPU/HLSLToCPP.h>
+
+/// @cond INTERNAL
+
+JPH_NAMESPACE_BEGIN
+JPH_MSVC_SUPPRESS_WARNING(5031) // #pragma warning(pop): likely mismatch, popping warning state pushed in different file
+
+#define JPH_SHADER_OVERRIDE_MACROS
+#define JPH_SHADER_GENERATE_WRAPPER
+
+#define JPH_SHADER_CONSTANT(type, name, value)	inline static constexpr type name = value;
+
+#define JPH_SHADER_CONSTANTS_BEGIN(type, name)	struct type { alignas(16) int dummy; } name; // Ensure that the first constant is 16 byte aligned
+#define JPH_SHADER_CONSTANTS_MEMBER(type, name)	type c##name;
+#define JPH_SHADER_CONSTANTS_END(type)
+
+#define JPH_SHADER_BUFFER(type)					const type *
+#define JPH_SHADER_RW_BUFFER(type)				type *
+
+#define JPH_SHADER_BIND_BEGIN(name)
+#define JPH_SHADER_BIND_END(name)
+#define JPH_SHADER_BIND_BUFFER(type, name)		const type *name = nullptr;
+#define JPH_SHADER_BIND_RW_BUFFER(type, name)	type *name = nullptr;
+
+#define JPH_SHADER_FUNCTION_BEGIN(return_type, name, group_size_x, group_size_y, group_size_z) \
+		virtual void Main(
+#define JPH_SHADER_PARAM_THREAD_ID(name)		const HLSLToCPP::uint3 &name
+#define JPH_SHADER_FUNCTION_END					) override
+
+#define JPH_SHADER_STRUCT_BEGIN(name)			struct name {
+#define JPH_SHADER_STRUCT_MEMBER(type, name)	type m##name;
+#define JPH_SHADER_STRUCT_END(name)				};
+
+#define JPH_TO_STRING(name)						JPH_TO_STRING2(name)
+#define JPH_TO_STRING2(name)					#name
+
+#define JPH_SHADER_CLASS_NAME(name)				JPH_SHADER_CLASS_NAME2(name)
+#define JPH_SHADER_CLASS_NAME2(name)			name##ShaderWrapper
+
+#define JPH_IN(type)							const type &
+#define JPH_OUT(type)							type &
+#define JPH_IN_OUT(type)						type &
+
+// Namespace to prevent 'using' from leaking out
+namespace ShaderWrappers {
+
+using namespace HLSLToCPP;
+
+class JPH_SHADER_CLASS_NAME(JPH_SHADER_NAME) : public ShaderWrapper
+{
+public:
+	// Define types
+	using JPH_float = float;
+	using JPH_float3 = HLSLToCPP::float3;
+	using JPH_float4 = HLSLToCPP::float4;
+	using JPH_uint = uint;
+	using JPH_uint3 = HLSLToCPP::uint3;
+	using JPH_uint4 = HLSLToCPP::uint4;
+	using JPH_int = int;
+	using JPH_int3 = HLSLToCPP::int3;
+	using JPH_int4 = HLSLToCPP::int4;
+	using JPH_Quat = HLSLToCPP::Quat;
+	using JPH_Plane = HLSLToCPP::Plane;
+	using JPH_Mat44 = HLSLToCPP::Mat44;
+
+	// Now the shader code should be included followed by WrapShaderBindings.h
+
+/// @endcond

+ 40 - 0
Jolt/Compute/CPU/WrapShaderBindings.h

@@ -0,0 +1,40 @@
+// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
+// SPDX-FileCopyrightText: 2026 Jorrit Rouwe
+// SPDX-License-Identifier: MIT
+
+/// @cond INTERNAL
+
+	// First WrapShaderBegin.h should have been included, then the shader code
+
+	/// Bind a buffer to the shader
+	virtual void			Bind(const char *inName, void *inData, uint64 inSize) override
+	{
+		// Don't redefine constants
+		#undef JPH_SHADER_CONSTANT
+		#define JPH_SHADER_CONSTANT(type, name, value)
+
+		// Don't redefine structs
+		#undef JPH_SHADER_STRUCT_BEGIN
+		#undef JPH_SHADER_STRUCT_MEMBER
+		#undef JPH_SHADER_STRUCT_END
+		#define JPH_SHADER_STRUCT_BEGIN(name)
+		#define JPH_SHADER_STRUCT_MEMBER(type, name)
+		#define JPH_SHADER_STRUCT_END(name)
+
+		// When a constant buffer is bound, copy the data into the members
+		#undef JPH_SHADER_CONSTANTS_BEGIN
+		#undef JPH_SHADER_CONSTANTS_MEMBER
+		#define JPH_SHADER_CONSTANTS_BEGIN(type, name)	case HashString(#name): memcpy(&name + 1, inData, size_t(inSize));	break; // Very hacky way to get the address of the first constant and to copy the entire block of constants
+		#define JPH_SHADER_CONSTANTS_MEMBER(type, name)
+
+		// When a buffer is bound, set the pointer
+		#undef JPH_SHADER_BIND_BUFFER
+		#undef JPH_SHADER_BIND_RW_BUFFER
+		#define JPH_SHADER_BIND_BUFFER(type, name)		case HashString(#name): name = (const type *)inData;		break;
+		#define JPH_SHADER_BIND_RW_BUFFER(type, name)	case HashString(#name): name = (type *)inData;				break;
+
+		switch (HashString(inName))
+		{
+			// Now include the shader bindings followed by WrapShaderEnd.h
+
+/// @endcond

+ 61 - 0
Jolt/Compute/CPU/WrapShaderEnd.h

@@ -0,0 +1,61 @@
+// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
+// SPDX-FileCopyrightText: 2026 Jorrit Rouwe
+// SPDX-License-Identifier: MIT
+
+/// @cond INTERNAL
+
+		// WrapShaderBindings.h should have been included followed by the shader bindings
+
+		default:
+			JPH_ASSERT(false, "Buffer cannot be bound to this shader");
+			break;
+		}
+	}
+
+	/// Factory function to create a shader wrapper for this shader
+	static ShaderWrapper *	sCreate()
+	{
+		return new JPH_SHADER_CLASS_NAME(JPH_SHADER_NAME)();
+	}
+};
+
+} // ShaderWrappers
+
+/// @endcond
+
+// Stop clang from complaining that the register function is missing a prototype
+JPH_SHADER_WRAPPER_FUNCTION(, JPH_SHADER_NAME);
+
+/// Register this wrapper
+JPH_SHADER_WRAPPER_FUNCTION(inComputeSystem, JPH_SHADER_NAME)
+{
+	inComputeSystem->RegisterShader(JPH_TO_STRING(JPH_SHADER_NAME), ShaderWrappers::JPH_SHADER_CLASS_NAME(JPH_SHADER_NAME)::sCreate);
+}
+
+#undef JPH_SHADER_OVERRIDE_MACROS
+#undef JPH_SHADER_GENERATE_WRAPPER
+#undef JPH_SHADER_CONSTANT
+#undef JPH_SHADER_CONSTANTS_BEGIN
+#undef JPH_SHADER_CONSTANTS_MEMBER
+#undef JPH_SHADER_CONSTANTS_END
+#undef JPH_SHADER_BUFFER
+#undef JPH_SHADER_RW_BUFFER
+#undef JPH_SHADER_BIND_BEGIN
+#undef JPH_SHADER_BIND_END
+#undef JPH_SHADER_BIND_BUFFER
+#undef JPH_SHADER_BIND_RW_BUFFER
+#undef JPH_SHADER_FUNCTION_BEGIN
+#undef JPH_SHADER_PARAM_THREAD_ID
+#undef JPH_SHADER_FUNCTION_END
+#undef JPH_SHADER_STRUCT_BEGIN
+#undef JPH_SHADER_STRUCT_MEMBER
+#undef JPH_SHADER_STRUCT_END
+#undef JPH_TO_STRING
+#undef JPH_TO_STRING2
+#undef JPH_SHADER_CLASS_NAME
+#undef JPH_SHADER_CLASS_NAME2
+#undef JPH_OUT
+#undef JPH_IN_OUT
+#undef JPH_SHADER_NAME
+
+JPH_NAMESPACE_END

+ 4 - 2
Jolt/Jolt.cmake

@@ -25,7 +25,11 @@ set(JOLT_PHYSICS_SRC_FILES
 	${JOLT_PHYSICS_ROOT}/Compute/CPU/ComputeSystemCPU.cpp
 	${JOLT_PHYSICS_ROOT}/Compute/CPU/ComputeSystemCPU.cpp
 	${JOLT_PHYSICS_ROOT}/Compute/CPU/ComputeSystemCPU.h
 	${JOLT_PHYSICS_ROOT}/Compute/CPU/ComputeSystemCPU.h
 	${JOLT_PHYSICS_ROOT}/Compute/CPU/ComputeShaderCPU.h
 	${JOLT_PHYSICS_ROOT}/Compute/CPU/ComputeShaderCPU.h
+	${JOLT_PHYSICS_ROOT}/Compute/CPU/HLSLToCPP.h
 	${JOLT_PHYSICS_ROOT}/Compute/CPU/ShaderWrapper.h
 	${JOLT_PHYSICS_ROOT}/Compute/CPU/ShaderWrapper.h
+	${JOLT_PHYSICS_ROOT}/Compute/CPU/WrapShaderBegin.h
+	${JOLT_PHYSICS_ROOT}/Compute/CPU/WrapShaderBindings.h
+	${JOLT_PHYSICS_ROOT}/Compute/CPU/WrapShaderEnd.h
 	${JOLT_PHYSICS_ROOT}/Core/ARMNeon.h
 	${JOLT_PHYSICS_ROOT}/Core/ARMNeon.h
 	${JOLT_PHYSICS_ROOT}/Core/Array.h
 	${JOLT_PHYSICS_ROOT}/Core/Array.h
 	${JOLT_PHYSICS_ROOT}/Core/Atomics.h
 	${JOLT_PHYSICS_ROOT}/Core/Atomics.h
@@ -432,8 +436,6 @@ set(JOLT_PHYSICS_SRC_FILES
 	${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererRecorder.h
 	${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererRecorder.h
 	${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererSimple.cpp
 	${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererSimple.cpp
 	${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererSimple.h
 	${JOLT_PHYSICS_ROOT}/Renderer/DebugRendererSimple.h
-	${JOLT_PHYSICS_ROOT}/Shaders/HLSLToCPP.h
-	${JOLT_PHYSICS_ROOT}/Shaders/ShaderWrapperCreator.h
 	${JOLT_PHYSICS_ROOT}/Shaders/TestComputeWrapper.cpp
 	${JOLT_PHYSICS_ROOT}/Shaders/TestComputeWrapper.cpp
 	${JOLT_PHYSICS_ROOT}/Skeleton/SkeletalAnimation.cpp
 	${JOLT_PHYSICS_ROOT}/Skeleton/SkeletalAnimation.cpp
 	${JOLT_PHYSICS_ROOT}/Skeleton/SkeletalAnimation.h
 	${JOLT_PHYSICS_ROOT}/Skeleton/SkeletalAnimation.h

+ 5 - 5
Jolt/Shaders/ShaderCore.h

@@ -25,10 +25,10 @@
 
 
 	#define JPH_SHADER_CONSTANTS_BEGIN(type, name)	struct type {
 	#define JPH_SHADER_CONSTANTS_BEGIN(type, name)	struct type {
 	#define JPH_SHADER_CONSTANTS_MEMBER(type, name)	type c##name;
 	#define JPH_SHADER_CONSTANTS_MEMBER(type, name)	type c##name;
-	#define JPH_SHADER_CONSTANTS_END				};
+	#define JPH_SHADER_CONSTANTS_END(type)			};
 
 
 	#define JPH_SHADER_BIND_BEGIN(name)
 	#define JPH_SHADER_BIND_BEGIN(name)
-	#define JPH_SHADER_BIND_END
+	#define JPH_SHADER_BIND_END(name)
 	#define JPH_SHADER_BIND_BUFFER(type, name)
 	#define JPH_SHADER_BIND_BUFFER(type, name)
 	#define JPH_SHADER_BIND_RW_BUFFER(type, name)
 	#define JPH_SHADER_BIND_RW_BUFFER(type, name)
 
 
@@ -53,7 +53,7 @@
 
 
 	#define JPH_SHADER_CONSTANTS_BEGIN(type, name)	cbuffer name {
 	#define JPH_SHADER_CONSTANTS_BEGIN(type, name)	cbuffer name {
 	#define JPH_SHADER_CONSTANTS_MEMBER(type, name)	type c##name;
 	#define JPH_SHADER_CONSTANTS_MEMBER(type, name)	type c##name;
-	#define JPH_SHADER_CONSTANTS_END				};
+	#define JPH_SHADER_CONSTANTS_END(type)			};
 
 
 	#define JPH_SHADER_FUNCTION_BEGIN(return_type, name, group_size_x, group_size_y, group_size_z) \
 	#define JPH_SHADER_FUNCTION_BEGIN(return_type, name, group_size_x, group_size_y, group_size_z) \
 		[numthreads(group_size_x, group_size_y, group_size_z)] \
 		[numthreads(group_size_x, group_size_y, group_size_z)] \
@@ -65,7 +65,7 @@
 	#define JPH_SHADER_RW_BUFFER(type)				RWStructuredBuffer<type>
 	#define JPH_SHADER_RW_BUFFER(type)				RWStructuredBuffer<type>
 
 
 	#define JPH_SHADER_BIND_BEGIN(name)
 	#define JPH_SHADER_BIND_BEGIN(name)
-	#define JPH_SHADER_BIND_END
+	#define JPH_SHADER_BIND_END(name)
 	#define JPH_SHADER_BIND_BUFFER(type, name)		JPH_SHADER_BUFFER(type) name;
 	#define JPH_SHADER_BIND_BUFFER(type, name)		JPH_SHADER_BUFFER(type) name;
 	#define JPH_SHADER_BIND_RW_BUFFER(type, name)	JPH_SHADER_RW_BUFFER(type) name;
 	#define JPH_SHADER_BIND_RW_BUFFER(type, name)	JPH_SHADER_RW_BUFFER(type) name;
 
 
@@ -74,7 +74,7 @@
 
 
 #define JPH_SHADER_STRUCT_BEGIN(name)				struct name {
 #define JPH_SHADER_STRUCT_BEGIN(name)				struct name {
 #define JPH_SHADER_STRUCT_MEMBER(type, name)		type m##name;
 #define JPH_SHADER_STRUCT_MEMBER(type, name)		type m##name;
-#define JPH_SHADER_STRUCT_END						};
+#define JPH_SHADER_STRUCT_END(name)					};
 
 
 #define JPH_IN(type)								in type
 #define JPH_IN(type)								in type
 #define JPH_OUT(type)								out type
 #define JPH_OUT(type)								out type

+ 0 - 156
Jolt/Shaders/ShaderWrapperCreator.h

@@ -1,156 +0,0 @@
-// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
-// SPDX-FileCopyrightText: 2026 Jorrit Rouwe
-// SPDX-License-Identifier: MIT
-
-#include <Jolt/Core/HashCombine.h>
-#include <Jolt/Compute/CPU/ComputeSystemCPU.h>
-#include <Jolt/Compute/CPU/ShaderWrapper.h>
-#include <Jolt/Shaders/HLSLToCPP.h>
-
-JPH_NAMESPACE_BEGIN
-
-#define JPH_SHADER_OVERRIDE_MACROS
-
-using namespace HLSLToCPP;
-
-#define JPH_SHADER_CONSTANT(type, name, value)	inline static constexpr type name = value;
-
-#define JPH_SHADER_CONSTANTS_BEGIN(type, name)	struct type { alignas(16) int dummy; } name; // Ensure that the first constant is 16 byte aligned
-#define JPH_SHADER_CONSTANTS_MEMBER(type, name)	type c##name;
-#define JPH_SHADER_CONSTANTS_END
-
-#define JPH_SHADER_BUFFER(type)					const type *
-#define JPH_SHADER_RW_BUFFER(type)				type *
-
-#define JPH_SHADER_BIND_BEGIN(name)
-#define JPH_SHADER_BIND_END
-#define JPH_SHADER_BIND_BUFFER(type, name)		const type *name = nullptr;
-#define JPH_SHADER_BIND_RW_BUFFER(type, name)	type *name = nullptr;
-
-#define JPH_SHADER_FUNCTION_BEGIN(return_type, name, group_size_x, group_size_y, group_size_z) \
-		virtual void Main(
-#define JPH_SHADER_PARAM_THREAD_ID(name)		const HLSLToCPP::uint3 &name
-#define JPH_SHADER_FUNCTION_END					) override
-
-#define JPH_SHADER_STRUCT_BEGIN(name)			struct name {
-#define JPH_SHADER_STRUCT_MEMBER(type, name)	type m##name;
-#define JPH_SHADER_STRUCT_END					};
-
-#define JPH_TO_STRING(name)						JPH_TO_STRING2(name)
-#define JPH_TO_STRING2(name)					#name
-
-#define JPH_SHADER_CLASS_NAME(name)				JPH_SHADER_CLASS_NAME2(name)
-#define JPH_SHADER_CLASS_NAME2(name)			name##ShaderWrapper
-
-#define JPH_SHADER_HEADER_NAME(name)			JPH_TO_STRING(name.hlsl)
-
-#define JPH_BINDINGS_HEADER_NAME(name)			JPH_BINDINGS_HEADER_NAME2(name)
-#define JPH_BINDINGS_HEADER_NAME2(name)			JPH_TO_STRING(name##Bindings.h)
-
-#define JPH_IN(type)							const type &
-#define JPH_OUT(type)							type &
-#define JPH_IN_OUT(type)						type &
-
-/// @cond INTERNAL
-class JPH_SHADER_CLASS_NAME(JPH_SHADER_NAME) : public ShaderWrapper
-{
-public:
-	// Define types
-	using JPH_float = float;
-	using JPH_float3 = HLSLToCPP::float3;
-	using JPH_float4 = HLSLToCPP::float4;
-	using JPH_uint = uint;
-	using JPH_uint3 = HLSLToCPP::uint3;
-	using JPH_uint4 = HLSLToCPP::uint4;
-	using JPH_int = int;
-	using JPH_int3 = HLSLToCPP::int3;
-	using JPH_int4 = HLSLToCPP::int4;
-	using JPH_Quat = HLSLToCPP::Quat;
-	using JPH_Plane = HLSLToCPP::Plane;
-	using JPH_Mat44 = HLSLToCPP::Mat44;
-
-	// Include the actual shader
-	#include JPH_SHADER_HEADER_NAME(JPH_SHADER_NAME)
-
-	/// Bind a buffer to the shader
-	virtual void			Bind(const char *inName, void *inData, uint64 inSize) override
-	{
-		// Don't redefine constants
-		#undef JPH_SHADER_CONSTANT
-		#define JPH_SHADER_CONSTANT(type, name, value)
-
-		// Don't redefine structs
-		#undef JPH_SHADER_STRUCT_BEGIN
-		#undef JPH_SHADER_STRUCT_MEMBER
-		#undef JPH_SHADER_STRUCT_END
-		#define JPH_SHADER_STRUCT_BEGIN(name)
-		#define JPH_SHADER_STRUCT_MEMBER(type, name)
-		#define JPH_SHADER_STRUCT_END
-
-		// When a constant buffer is bound, copy the data into the members
-		#undef JPH_SHADER_CONSTANTS_BEGIN
-		#undef JPH_SHADER_CONSTANTS_MEMBER
-		#define JPH_SHADER_CONSTANTS_BEGIN(type, name)	case HashString(#name): memcpy(&name + 1, inData, size_t(inSize));	break; // Very hacky way to get the address of the first constant and to copy the entire block of constants
-		#define JPH_SHADER_CONSTANTS_MEMBER(type, name)
-
-		// When a buffer is bound, set the pointer
-		#undef JPH_SHADER_BIND_BUFFER
-		#undef JPH_SHADER_BIND_RW_BUFFER
-		#define JPH_SHADER_BIND_BUFFER(type, name)		case HashString(#name): name = (const type *)inData;		break;
-		#define JPH_SHADER_BIND_RW_BUFFER(type, name)	case HashString(#name): name = (type *)inData;				break;
-
-		switch (HashString(inName))
-		{
-		// Include the bindings header only
-		#include JPH_BINDINGS_HEADER_NAME(JPH_SHADER_NAME)
-
-		default:
-			JPH_ASSERT(false, "Buffer cannot be bound to this shader");
-			break;
-		}
-	}
-
-	/// Factory function to create a shader wrapper for this shader
-	static ShaderWrapper *	sCreate()
-	{
-		return new JPH_SHADER_CLASS_NAME(JPH_SHADER_NAME)();
-	}
-};
-/// @endcond
-
-// Stop clang from complaining that the register function is missing a prototype
-JPH_SHADER_WRAPPER_FUNCTION(, JPH_SHADER_NAME);
-
-/// Register this wrapper
-JPH_SHADER_WRAPPER_FUNCTION(inComputeSystem, JPH_SHADER_NAME)
-{
-	inComputeSystem->RegisterShader(JPH_TO_STRING(JPH_SHADER_NAME), JPH_SHADER_CLASS_NAME(JPH_SHADER_NAME)::sCreate);
-}
-
-#undef JPH_SHADER_CONSTANT
-#undef JPH_SHADER_CONSTANTS_BEGIN
-#undef JPH_SHADER_CONSTANTS_MEMBER
-#undef JPH_SHADER_CONSTANTS_END
-#undef JPH_SHADER_BUFFER
-#undef JPH_SHADER_RW_BUFFER
-#undef JPH_SHADER_BIND_BEGIN
-#undef JPH_SHADER_BIND_END
-#undef JPH_SHADER_BIND_BUFFER
-#undef JPH_SHADER_BIND_RW_BUFFER
-#undef JPH_SHADER_FUNCTION_BEGIN
-#undef JPH_SHADER_PARAM_THREAD_ID
-#undef JPH_SHADER_FUNCTION_END
-#undef JPH_SHADER_STRUCT_BEGIN
-#undef JPH_SHADER_STRUCT_MEMBER
-#undef JPH_SHADER_STRUCT_END
-#undef JPH_TO_STRING
-#undef JPH_TO_STRING2
-#undef JPH_SHADER_CLASS_NAME
-#undef JPH_SHADER_CLASS_NAME2
-#undef JPH_SHADER_HEADER_NAME
-#undef JPH_BINDINGS_HEADER_NAME
-#undef JPH_BINDINGS_HEADER_NAME2
-#undef JPH_OUT
-#undef JPH_IN_OUT
-
-JPH_NAMESPACE_END

+ 0 - 1
Jolt/Shaders/TestCompute.hlsl

@@ -2,7 +2,6 @@
 // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
 // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
 // SPDX-License-Identifier: MIT
 // SPDX-License-Identifier: MIT
 
 
-#include "ShaderCore.h"
 #include "TestComputeBindings.h"
 #include "TestComputeBindings.h"
 
 
 JPH_SHADER_FUNCTION_BEGIN(void, main, cTestComputeGroupSize, 1, 1)
 JPH_SHADER_FUNCTION_BEGIN(void, main, cTestComputeGroupSize, 1, 1)

+ 4 - 2
Jolt/Shaders/TestComputeBindings.h

@@ -2,6 +2,8 @@
 // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
 // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
 // SPDX-License-Identifier: MIT
 // SPDX-License-Identifier: MIT
 
 
+#include "ShaderCore.h"
+
 JPH_SHADER_CONSTANT(int, cTestComputeGroupSize, 64)
 JPH_SHADER_CONSTANT(int, cTestComputeGroupSize, 64)
 
 
 JPH_SHADER_CONSTANTS_BEGIN(TestComputeContext, gContext)
 JPH_SHADER_CONSTANTS_BEGIN(TestComputeContext, gContext)
@@ -10,10 +12,10 @@ JPH_SHADER_CONSTANTS_BEGIN(TestComputeContext, gContext)
 	JPH_SHADER_CONSTANTS_MEMBER(JPH_float3,		Float3Value2)
 	JPH_SHADER_CONSTANTS_MEMBER(JPH_float3,		Float3Value2)
 	JPH_SHADER_CONSTANTS_MEMBER(JPH_uint,		UIntValue2)
 	JPH_SHADER_CONSTANTS_MEMBER(JPH_uint,		UIntValue2)
 	JPH_SHADER_CONSTANTS_MEMBER(JPH_uint,		NumElements)
 	JPH_SHADER_CONSTANTS_MEMBER(JPH_uint,		NumElements)
-JPH_SHADER_CONSTANTS_END
+JPH_SHADER_CONSTANTS_END(TestComputeContext)
 
 
 JPH_SHADER_BIND_BEGIN(JPH_TestCompute)
 JPH_SHADER_BIND_BEGIN(JPH_TestCompute)
 	JPH_SHADER_BIND_BUFFER(JPH_uint, gUploadData)
 	JPH_SHADER_BIND_BUFFER(JPH_uint, gUploadData)
 	JPH_SHADER_BIND_BUFFER(JPH_uint, gOptionalData)
 	JPH_SHADER_BIND_BUFFER(JPH_uint, gOptionalData)
 	JPH_SHADER_BIND_RW_BUFFER(JPH_uint, gData)
 	JPH_SHADER_BIND_RW_BUFFER(JPH_uint, gData)
-JPH_SHADER_BIND_END
+JPH_SHADER_BIND_END(JPH_TestCompute)

+ 5 - 2
Jolt/Shaders/TestComputeWrapper.cpp

@@ -5,5 +5,8 @@
 #include <Jolt/Jolt.h>
 #include <Jolt/Jolt.h>
 
 
 #define JPH_SHADER_NAME TestCompute
 #define JPH_SHADER_NAME TestCompute
-#include "ShaderWrapperCreator.h"
-#undef JPH_SHADER_NAME
+#include <Jolt/Compute/CPU/WrapShaderBegin.h>
+#include "TestCompute.hlsl"
+#include <Jolt/Compute/CPU/WrapShaderBindings.h>
+#include "TestComputeBindings.h"
+#include <Jolt/Compute/CPU/WrapShaderEnd.h>