|
@@ -54,6 +54,9 @@ void maybeUnused(T a)
|
|
|
}
|
|
}
|
|
|
# define ANKI_MAYBE_UNUSED(x) maybeUnused(x)
|
|
# define ANKI_MAYBE_UNUSED(x) maybeUnused(x)
|
|
|
|
|
|
|
|
|
|
+# define _ANKI_CONCATENATE(a, b) a##b
|
|
|
|
|
+# define ANKI_CONCATENATE(a, b) _ANKI_CONCATENATE(a, b)
|
|
|
|
|
+
|
|
|
# define ANKI_BINDLESS_SET(s) \
|
|
# define ANKI_BINDLESS_SET(s) \
|
|
|
[[vk::binding(0, s)]] Texture2D<uint4> u_bindlessTextures2dU32[kMaxBindlessTextures]; \
|
|
[[vk::binding(0, s)]] Texture2D<uint4> u_bindlessTextures2dU32[kMaxBindlessTextures]; \
|
|
|
[[vk::binding(0, s)]] Texture2D<int4> u_bindlessTextures2dI32[kMaxBindlessTextures]; \
|
|
[[vk::binding(0, s)]] Texture2D<int4> u_bindlessTextures2dI32[kMaxBindlessTextures]; \
|
|
@@ -61,6 +64,43 @@ void maybeUnused(T a)
|
|
|
[[vk::binding(0, s)]] Texture2DArray<RVec4> u_bindlessTextures2dArrayF32[kMaxBindlessTextures]; \
|
|
[[vk::binding(0, s)]] Texture2DArray<RVec4> u_bindlessTextures2dArrayF32[kMaxBindlessTextures]; \
|
|
|
[[vk::binding(1, s)]] Buffer<float4> u_bindlessTextureBuffersF32[kMaxBindlessReadonlyTextureBuffers];
|
|
[[vk::binding(1, s)]] Buffer<float4> u_bindlessTextureBuffersF32[kMaxBindlessReadonlyTextureBuffers];
|
|
|
|
|
|
|
|
|
|
+# define _ANKI_SCONST_X(type, n, id) [[vk::constant_id(id)]] const type n = (type)1;
|
|
|
|
|
+
|
|
|
|
|
+# define _ANKI_SCONST_X2(type, componentType, n, id) \
|
|
|
|
|
+ [[vk::constant_id(id + 0u)]] const componentType ANKI_CONCATENATE(_anki_const_0_2_, n) = (componentType)1; \
|
|
|
|
|
+ [[vk::constant_id(id + 1u)]] const componentType ANKI_CONCATENATE(_anki_const_1_2_, n) = (componentType)1; \
|
|
|
|
|
+ static const type n = type(ANKI_CONCATENATE(_anki_const_0_2_, n), ANKI_CONCATENATE(_anki_const_1_2_, n))
|
|
|
|
|
+
|
|
|
|
|
+# define _ANKI_SCONST_X3(type, componentType, n, id) \
|
|
|
|
|
+ [[vk::constant_id(id + 0u)]] const componentType ANKI_CONCATENATE(_anki_const_0_3_, n) = (componentType)1; \
|
|
|
|
|
+ [[vk::constant_id(id + 1u)]] const componentType ANKI_CONCATENATE(_anki_const_1_3_, n) = (componentType)1; \
|
|
|
|
|
+ [[vk::constant_id(id + 2u)]] const componentType ANKI_CONCATENATE(_anki_const_2_3_, n) = (componentType)1; \
|
|
|
|
|
+ static const type n = type(ANKI_CONCATENATE(_anki_const_0_3_, n), ANKI_CONCATENATE(_anki_const_1_3_, n), \
|
|
|
|
|
+ ANKI_CONCATENATE(_anki_const_2_3_, n))
|
|
|
|
|
+
|
|
|
|
|
+# define _ANKI_SCONST_X4(type, componentType, n, id) \
|
|
|
|
|
+ [[vk::constant_id(id + 0u)]] const componentType ANKI_CONCATENATE(_anki_const_0_4_, n) = (componentType)1; \
|
|
|
|
|
+ [[vk::constant_id(id + 1u)]] const componentType ANKI_CONCATENATE(_anki_const_1_4_, n) = (componentType)1; \
|
|
|
|
|
+ [[vk::constant_id(id + 2u)]] const componentType ANKI_CONCATENATE(_anki_const_2_4_, n) = (componentType)1; \
|
|
|
|
|
+ [[vk::constant_id(id + 3u)]] const componentType ANKI_CONCATENATE(_anki_const_3_4_, n) = (componentType)1; \
|
|
|
|
|
+ static const type n = type(ANKI_CONCATENATE(_anki_const_0_4_, n), ANKI_CONCATENATE(_anki_const_1_4_, n), \
|
|
|
|
|
+ ANKI_CONCATENATE(_anki_const_2_4_, n), ANKI_CONCATENATE(_anki_const_2_4_, n))
|
|
|
|
|
+
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_I32(n, id) _ANKI_SCONST_X(I32, n, id)
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_IVEC2(n, id) _ANKI_SCONST_X2(IVec2, I32, n, id)
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_IVEC3(n, id) _ANKI_SCONST_X3(IVec3, I32, n, id)
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_IVEC4(n, id) _ANKI_SCONST_X4(IVec4, I32, n, id)
|
|
|
|
|
+
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_U32(n, id) _ANKI_SCONST_X(U32, n, id)
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_UVEC2(n, id) _ANKI_SCONST_X2(UVec2, U32, n, id)
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_UVEC3(n, id) _ANKI_SCONST_X3(UVec3, U32, n, id)
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_UVEC4(n, id) _ANKI_SCONST_X4(UVec4, U32, n, id)
|
|
|
|
|
+
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_F32(n, id) _ANKI_SCONST_X(F32, n, id)
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_VEC2(n, id) _ANKI_SCONST_X2(Vec2, F32, n, id)
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_VEC3(n, id) _ANKI_SCONST_X3(Vec3, F32, n, id)
|
|
|
|
|
+# define ANKI_SPECIALIZATION_CONSTANT_VEC4(n, id) _ANKI_SCONST_X4(Vec4, F32, n, id)
|
|
|
|
|
+
|
|
|
typedef float F32;
|
|
typedef float F32;
|
|
|
constexpr uint kSizeof_F32 = 4u;
|
|
constexpr uint kSizeof_F32 = 4u;
|
|
|
typedef float2 Vec2;
|
|
typedef float2 Vec2;
|
|
@@ -342,9 +382,7 @@ const uint kSizeof_mat4x3 = 48u;
|
|
|
# define sizeof(type) _ANKI_CONCATENATE(kSizeof_, type)
|
|
# define sizeof(type) _ANKI_CONCATENATE(kSizeof_, type)
|
|
|
# define alignof(type) _ANKI_CONCATENATE(kAlignof_, type)
|
|
# define alignof(type) _ANKI_CONCATENATE(kAlignof_, type)
|
|
|
|
|
|
|
|
-# define _ANKI_SCONST_X(type, n, id) \
|
|
|
|
|
- layout(constant_id = id) const type n = type(1); \
|
|
|
|
|
- const U32 ANKI_CONCATENATE(n, _CONST_ID) = id
|
|
|
|
|
|
|
+# define _ANKI_SCONST_X(type, n, id) layout(constant_id = id) const type n = type(1)
|
|
|
|
|
|
|
|
# define _ANKI_SCONST_X2(type, componentType, n, id, constWorkaround) \
|
|
# define _ANKI_SCONST_X2(type, componentType, n, id, constWorkaround) \
|
|
|
layout(constant_id = id + 0u) const componentType ANKI_CONCATENATE(_anki_const_0_2_, n) = componentType(1); \
|
|
layout(constant_id = id + 0u) const componentType ANKI_CONCATENATE(_anki_const_0_2_, n) = componentType(1); \
|