move type name out of shader semantic macro
This commit is contained in:
parent
2eb8a07b6a
commit
af64a488c9
@ -741,16 +741,16 @@ Inline b32 MatchU128(u128 a, u128 b) { return a.lo == b.lo && a.hi == b.hi; }
|
||||
Struct(PixelShader) { ResourceKey resource; };
|
||||
Struct(ComputeShader) { ResourceKey resource; };
|
||||
#elif IsGpu
|
||||
#define Semantic(type, name) type name : name
|
||||
#define DeclComputeShader(name, x) [numthreads(x, 1, 1)] void name(Semantic(u32, SV_DispatchThreadID), Semantic(u32, SV_GroupIndex))
|
||||
#define DeclComputeShader2D(name, x, y) [numthreads(x, y, 1)] void name(Semantic(Vec2U32, SV_DispatchThreadID), Semantic(u32, SV_GroupIndex))
|
||||
#define DeclComputeShader3D(name, x, y, z) [numthreads(x, y, z)] void name(Semantic(Vec3U32, SV_DispatchThreadID), Semantic(u32, SV_GroupIndex))
|
||||
#define DeclVertexShader(name, return_type) return_type name(Semantic(u32, SV_InstanceID), Semantic(u32, SV_VertexID))
|
||||
#define DeclPixelShader(name, return_type, ...) return_type name(__VA_ARGS__)
|
||||
#define ImplComputeShader(name) void name(Semantic(u32, SV_DispatchThreadID), Semantic(u32, SV_GroupIndex))
|
||||
#define ImplComputeShader2D(name) void name(Semantic(Vec2U32, SV_DispatchThreadID), Semantic(u32, SV_GroupIndex))
|
||||
#define ImplComputeShader3D(name) void name(Semantic(Vec3U32, SV_DispatchThreadID), Semantic(u32, SV_GroupIndex))
|
||||
#define ImplVertexShader(name, return_type) return_type name(Semantic(u32, SV_InstanceID), Semantic(u32, SV_VertexID))
|
||||
#define Semantic(name) name : name
|
||||
#define DeclComputeShader(name, x) [numthreads(x, 1, 1)] ImplComputeShader(name)
|
||||
#define DeclComputeShader2D(name, x, y) [numthreads(x, y, 1)] ImplComputeShader2D(name)
|
||||
#define DeclComputeShader3D(name, x, y, z) [numthreads(x, y, z)] ImplComputeShader3D(name)
|
||||
#define DeclVertexShader(name, return_type) ImplVertexShader(name, return_type)
|
||||
#define DeclPixelShader(name, return_type, ...) ImplPixelShader(name, return_type, __VA_ARGS__)
|
||||
#define ImplComputeShader(name) void name(u32 Semantic(SV_DispatchThreadID), u32 Semantic(SV_GroupThreadID), u32 Semantic(SV_GroupIndex), u32 Semantic(SV_GroupID))
|
||||
#define ImplComputeShader2D(name) void name(Vec2U32 Semantic(SV_DispatchThreadID), Vec2U32 Semantic(SV_GroupThreadID), u32 Semantic(SV_GroupIndex), Vec2U32 Semantic(SV_GroupID))
|
||||
#define ImplComputeShader3D(name) void name(Vec3U32 Semantic(SV_DispatchThreadID), Vec3U32 Semantic(SV_GroupThreadID), u32 Semantic(SV_GroupIndex), Vec3U32 Semantic(SV_GroupID))
|
||||
#define ImplVertexShader(name, return_type) return_type name(u32 Semantic(SV_InstanceID), u32 Semantic(SV_VertexID))
|
||||
#define ImplPixelShader(name, return_type, ...) return_type name(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
|
||||
@ -3,15 +3,15 @@
|
||||
|
||||
Struct(V_QuadPSInput)
|
||||
{
|
||||
Semantic(Vec4, sv_position);
|
||||
Semantic(Vec2, world_pos);
|
||||
Semantic(Vec2, samp_uv);
|
||||
Semantic(nointerpolation V_Quad, quad);
|
||||
Vec4 Semantic(sv_position);
|
||||
Vec2 Semantic(world_pos);
|
||||
Vec2 Semantic(samp_uv);
|
||||
nointerpolation V_Quad Semantic(quad);
|
||||
};
|
||||
|
||||
Struct(V_QuadPSOutput)
|
||||
{
|
||||
Semantic(Vec4, sv_target0);
|
||||
Vec4 Semantic(sv_target0);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -19,12 +19,12 @@ Struct(V_QuadPSOutput)
|
||||
|
||||
Struct(V_CompositePSInput)
|
||||
{
|
||||
Semantic(Vec4, sv_position);
|
||||
Vec4 Semantic(sv_position);
|
||||
};
|
||||
|
||||
Struct(V_CompositePSOutput)
|
||||
{
|
||||
Semantic(Vec4, sv_target0);
|
||||
Vec4 Semantic(sv_target0);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -32,13 +32,13 @@ Struct(V_CompositePSOutput)
|
||||
|
||||
Struct(V_DVertPSInput)
|
||||
{
|
||||
Semantic(Vec4, sv_position);
|
||||
Semantic(Vec4, color_lin);
|
||||
Vec4 Semantic(sv_position);
|
||||
Vec4 Semantic(color_lin);
|
||||
};
|
||||
|
||||
Struct(V_DVertPSOutput)
|
||||
{
|
||||
Semantic(Vec4, sv_target0);
|
||||
Vec4 Semantic(sv_target0);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
4
src/proto/proto.lay
generated
4
src/proto/proto.lay
generated
@ -26,5 +26,5 @@
|
||||
|
||||
@IncludeC proto.c
|
||||
|
||||
@IncludeG proto_shaders.gh
|
||||
@IncludeG proto_shaders.g
|
||||
@IncludeG proto_gpu.gh
|
||||
@IncludeG proto_gpu.g
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
|
||||
ImplComputeShader2D(PT_TestCS)
|
||||
{
|
||||
StructuredBuffer<TestStruct> sb = G_Dereference<TestStruct>(PT_ShaderConst_TestBuff);
|
||||
StructuredBuffer<TestStruct> sb = G_SDeref<TestStruct>(PT_ShaderConst_TestBuff);
|
||||
RWTexture2D<Vec4> target_tex = G_SDerefRW<Vec4>(PT_ShaderConst_TestTarget);
|
||||
|
||||
RWTexture2D<Vec4> target_tex = G_DereferenceRW<Vec4>(PT_ShaderConst_TestTarget);
|
||||
Vec2U32 target_tex_size = countof(target_tex);
|
||||
|
||||
Vec2I32 id = SV_DispatchThreadID;
|
||||
@ -35,9 +35,9 @@ ImplVertexShader(PT_BlitVS, PT_BlitPSInput)
|
||||
|
||||
ImplPixelShader(PT_BlitPS, PT_BlitPSOutput, PT_BlitPSInput input)
|
||||
{
|
||||
SamplerState sampler = G_Dereference(PT_ShaderConst_BlitSampler);
|
||||
Texture2D<Vec4> tex = G_Dereference<Vec4>(PT_ShaderConst_BlitSrc);
|
||||
Texture3D<u32> noise = G_Dereference<u32>(PT_ShaderConst_NoiseTex);
|
||||
SamplerState sampler = G_SDeref(PT_ShaderConst_BlitSampler);
|
||||
Texture2D<Vec4> tex = G_SDeref<Vec4>(PT_ShaderConst_BlitSrc);
|
||||
Texture3D<u32> noise = G_SDeref<u32>(PT_ShaderConst_NoiseTex);
|
||||
|
||||
Vec2 uv = input.src_uv;
|
||||
Vec4 tex_col = tex.Sample(sampler, uv);
|
||||
@ -11,13 +11,13 @@ Struct(TestStruct)
|
||||
|
||||
Struct(PT_BlitPSInput)
|
||||
{
|
||||
Semantic(Vec4, sv_position);
|
||||
Semantic(Vec2, src_uv);
|
||||
Vec4 Semantic(sv_position);
|
||||
Vec2 Semantic(src_uv);
|
||||
};
|
||||
|
||||
Struct(PT_BlitPSOutput)
|
||||
{
|
||||
Semantic(Vec4, sv_target0);
|
||||
Vec4 Semantic(sv_target0);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -3,19 +3,19 @@
|
||||
|
||||
Struct(UI_DRectPSInput)
|
||||
{
|
||||
Semantic(Vec4, sv_position);
|
||||
Semantic(Vec4, base_background_premul);
|
||||
Semantic(Vec4, base_border_premul);
|
||||
Semantic(Vec4, tint_premul);
|
||||
Semantic(Vec4, debug_premul);
|
||||
Semantic(Vec2, rect_uv);
|
||||
Semantic(Vec2, tex_uv);
|
||||
nointerpolation Semantic(UI_GpuRect, rect);
|
||||
Vec4 Semantic(sv_position);
|
||||
Vec4 Semantic(base_background_premul);
|
||||
Vec4 Semantic(base_border_premul);
|
||||
Vec4 Semantic(tint_premul);
|
||||
Vec4 Semantic(debug_premul);
|
||||
Vec2 Semantic(rect_uv);
|
||||
Vec2 Semantic(tex_uv);
|
||||
nointerpolation UI_GpuRect Semantic(rect);
|
||||
};
|
||||
|
||||
Struct(UI_DRectPSOutput)
|
||||
{
|
||||
Semantic(Vec4, sv_target0);
|
||||
Vec4 Semantic(sv_target0);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -23,13 +23,13 @@ Struct(UI_DRectPSOutput)
|
||||
|
||||
Struct(UI_BlitPSInput)
|
||||
{
|
||||
Semantic(Vec4, sv_position);
|
||||
Semantic(Vec2, src_uv);
|
||||
Vec4 Semantic(sv_position);
|
||||
Vec2 Semantic(src_uv);
|
||||
};
|
||||
|
||||
Struct(UI_BlitPSOutput)
|
||||
{
|
||||
Semantic(Vec4, sv_target0);
|
||||
Vec4 Semantic(sv_target0);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
Loading…
Reference in New Issue
Block a user