specify compute shader group size in layer files
This commit is contained in:
parent
af64a488c9
commit
35eb4e4839
@ -695,7 +695,6 @@ Inline b32 MatchU128(u128 a, u128 b) { return a.lo == b.lo && a.hi == b.hi; }
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Resource types
|
||||
|
||||
#if IsCpu
|
||||
#define ResourceEmbeddedMagic 0xfc060937194f4406
|
||||
|
||||
Struct(ResourceStore)
|
||||
@ -707,12 +706,10 @@ Inline b32 MatchU128(u128 a, u128 b) { return a.lo == b.lo && a.hi == b.hi; }
|
||||
{
|
||||
u64 v;
|
||||
};
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Cpu topology types
|
||||
|
||||
#if IsCpu
|
||||
Struct(CpuTopologyInfo)
|
||||
{
|
||||
i32 num_logical_cores; // Includes P cores, Non-P cores, SMT siblings
|
||||
@ -720,7 +717,6 @@ Inline b32 MatchU128(u128 a, u128 b) { return a.lo == b.lo && a.hi == b.hi; }
|
||||
i32 num_physical_performance_cores; // Includes P Cores
|
||||
i32 num_physical_non_performance_cores; // Includes Non-P cores
|
||||
};
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Debug types
|
||||
@ -736,22 +732,34 @@ Inline b32 MatchU128(u128 a, u128 b) { return a.lo == b.lo && a.hi == b.hi; }
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Shader linkage types
|
||||
|
||||
#if IsCpu
|
||||
Struct(VertexShader) { ResourceKey resource; };
|
||||
Struct(PixelShader) { ResourceKey resource; };
|
||||
Struct(ComputeShader) { ResourceKey resource; };
|
||||
#elif IsGpu
|
||||
Struct(VertexShaderDesc) { ResourceKey resource; u32 x, y, z; };
|
||||
Struct(PixelShaderDesc) { ResourceKey resource; u32 x, y, z; };
|
||||
Struct(ComputeShaderDesc) { ResourceKey resource; u32 x, y, z; };
|
||||
|
||||
#define GetGroupSize(name) VEC3U32(name##__GroupSize_X, name##__GroupSize_Y, name##__GroupSize_Z)
|
||||
|
||||
#if IsGpu
|
||||
#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__)
|
||||
#define VertexShader(name, return_type) return_type name(u32 Semantic(SV_InstanceID), u32 Semantic(SV_VertexID))
|
||||
#define PixelShader(name, return_type, ...) return_type name(__VA_ARGS__)
|
||||
#define ComputeShader(name) \
|
||||
[numthreads(name##__GroupSize_X, name##__GroupSize_Y, name##__GroupSize_Z)] \
|
||||
void name( \
|
||||
u32 Semantic(SV_GroupIndex), \
|
||||
Vec3U32 Semantic(SV_GroupID), \
|
||||
Vec3U32 Semantic(SV_GroupThreadID), \
|
||||
Vec3U32 Semantic(SV_DispatchThreadID) \
|
||||
)
|
||||
#endif
|
||||
|
||||
#if IsCpu
|
||||
#define DeclComputeShader(name, resource_hash, x, y, z) enum { name##__GroupSize_X = x, name##__GroupSize_Y = y, name##__GroupSize_Z = z }; static ComputeShaderDesc name = { resource_hash, x, y, z }
|
||||
#define DeclVertexShader(name, resource_hash) static VertexShaderDesc name = { resource_hash, 1, 1, 1 }
|
||||
#define DeclPixelShader(name, resource_hash) static PixelShaderDesc name = { resource_hash, 1, 1, 1 }
|
||||
#else
|
||||
#define DeclComputeShader(name, resource_hash, x, y, z) enum { name##__GroupSize_X = x, name##__GroupSize_Y = y, name##__GroupSize_Z = z };
|
||||
#define DeclVertexShader(name, resource_hash)
|
||||
#define DeclPixelShader(name, resource_hash)
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
@ -733,13 +733,13 @@ void G_MemorySyncEx(G_CommandListHandle cl, G_MemoryBarrierDesc desc);
|
||||
|
||||
//- Compute
|
||||
|
||||
void G_Compute(G_CommandListHandle cl, ComputeShader cs, Vec3I32 groups);
|
||||
void G_Compute(G_CommandListHandle cl, ComputeShaderDesc cs, Vec3I32 groups);
|
||||
|
||||
//- Rasterize
|
||||
|
||||
void G_Rasterize(
|
||||
G_CommandListHandle cl,
|
||||
VertexShader vs, PixelShader ps,
|
||||
VertexShaderDesc vs, PixelShaderDesc ps,
|
||||
u32 instances_count, G_IndexBufferDesc index_buffer,
|
||||
u32 render_targets_count, G_RenderTargetDesc *render_targets,
|
||||
Rng3 viewport, Rng2 scissor,
|
||||
|
||||
@ -3240,7 +3240,7 @@ void G_MemorySyncEx(G_CommandListHandle cl_handle, G_MemoryBarrierDesc desc)
|
||||
|
||||
//- Compute
|
||||
|
||||
void G_Compute(G_CommandListHandle cl_handle, ComputeShader cs, Vec3I32 groups)
|
||||
void G_Compute(G_CommandListHandle cl_handle, ComputeShaderDesc cs, Vec3I32 groups)
|
||||
{
|
||||
if (groups.x > 0 && groups.y > 0 && groups.z > 0)
|
||||
{
|
||||
@ -3256,7 +3256,7 @@ void G_Compute(G_CommandListHandle cl_handle, ComputeShader cs, Vec3I32 groups)
|
||||
|
||||
void G_Rasterize(
|
||||
G_CommandListHandle cl_handle,
|
||||
VertexShader vs, PixelShader ps,
|
||||
VertexShaderDesc vs, PixelShaderDesc ps,
|
||||
u32 instances_count, G_IndexBufferDesc index_buffer,
|
||||
u32 render_targets_count, G_RenderTargetDesc *render_targets,
|
||||
Rng3 viewport, Rng2 scissor,
|
||||
|
||||
@ -34,9 +34,9 @@
|
||||
// NOTE: Must be zero initialized (including padding bits) for hashing
|
||||
Struct(G_D12_PipelineDesc)
|
||||
{
|
||||
VertexShader vs;
|
||||
PixelShader ps;
|
||||
ComputeShader cs;
|
||||
VertexShaderDesc vs;
|
||||
PixelShaderDesc ps;
|
||||
ComputeShaderDesc cs;
|
||||
b32 is_wireframe;
|
||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE topology_type;
|
||||
G_Format render_target_formats[G_MaxRenderTargets];
|
||||
@ -353,14 +353,14 @@ Struct(G_D12_Cmd)
|
||||
|
||||
struct
|
||||
{
|
||||
ComputeShader cs;
|
||||
ComputeShaderDesc cs;
|
||||
Vec3I32 groups;
|
||||
} compute;
|
||||
|
||||
struct
|
||||
{
|
||||
VertexShader vs;
|
||||
PixelShader ps;
|
||||
VertexShaderDesc vs;
|
||||
PixelShaderDesc ps;
|
||||
u32 instances_count;
|
||||
G_IndexBufferDesc index_buffer_desc;
|
||||
G_RenderTargetDesc render_target_descs[G_MaxRenderTargets];
|
||||
|
||||
@ -614,9 +614,9 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
||||
}
|
||||
|
||||
//- Generate C file
|
||||
StringList shader_lines = Zi;
|
||||
{
|
||||
StringList c_store_lines = Zi;
|
||||
StringList c_shader_lines = Zi;
|
||||
StringList c_include_lines = Zi;
|
||||
StringList c_bootstrap_lines = Zi;
|
||||
{
|
||||
@ -661,14 +661,60 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
||||
{
|
||||
if (arg0_tok->valid)
|
||||
{
|
||||
String shader_type = kind == M_EntryKind_VertexShader ? Lit("VertexShader")
|
||||
: kind == M_EntryKind_PixelShader ? Lit("PixelShader")
|
||||
: kind == M_EntryKind_ComputeShader ? Lit("ComputeShader")
|
||||
: Lit("");
|
||||
String decl_type = (
|
||||
kind == M_EntryKind_VertexShader ? Lit("DeclVertexShader") :
|
||||
kind == M_EntryKind_PixelShader ? Lit("DeclPixelShader") :
|
||||
kind == M_EntryKind_ComputeShader ? Lit("DeclComputeShader") :
|
||||
Lit("")
|
||||
);
|
||||
String shader_name = arg0_tok->s;
|
||||
Vec3U32 thread_count = Zi;
|
||||
{
|
||||
StringList thread_count_args = Zi;
|
||||
for (i32 arg_idx = 1; arg_idx < countof(entry->arg_tokens); ++arg_idx)
|
||||
{
|
||||
M_Token *arg_tok = entry->arg_tokens[arg_idx];
|
||||
if (arg_tok->valid)
|
||||
{
|
||||
PushStringToList(perm, &thread_count_args, arg_tok->s);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
String thread_count_str = StringFromList(perm, thread_count_args, Lit(" "));
|
||||
Vec3 tmp = CR_Vec3FromString(thread_count_str);
|
||||
thread_count.x = MaxI32(tmp.x, 1);
|
||||
thread_count.y = MaxI32(tmp.y, 1);
|
||||
thread_count.z = MaxI32(tmp.z, 1);
|
||||
}
|
||||
u64 shader_resource_hash = HashStringEx(shader_store_hash, StringF(perm, "%F.dxil", FmtString(shader_name)));
|
||||
String line = StringF(perm, "%F %F = { 0x%F };", FmtString(shader_type), FmtString(shader_name), FmtHex(shader_resource_hash));
|
||||
PushStringToList(perm, &c_shader_lines, line);
|
||||
String lines = Zi;
|
||||
if (kind == M_EntryKind_ComputeShader)
|
||||
{
|
||||
lines = StringF(
|
||||
perm,
|
||||
"%F(%F, 0x%F, %F, %F, %F);",
|
||||
FmtString(decl_type),
|
||||
FmtString(shader_name),
|
||||
FmtHex(shader_resource_hash),
|
||||
FmtUint(thread_count.x),
|
||||
FmtUint(thread_count.y),
|
||||
FmtUint(thread_count.z)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
lines = StringF(
|
||||
perm,
|
||||
"%F(%F, 0x%F);",
|
||||
FmtString(decl_type),
|
||||
FmtString(shader_name),
|
||||
FmtHex(shader_resource_hash)
|
||||
);
|
||||
}
|
||||
PushStringToList(perm, &shader_lines, lines);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -737,11 +783,11 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
||||
}
|
||||
}
|
||||
// Define shaders
|
||||
if (c_shader_lines.count > 0)
|
||||
if (shader_lines.count > 0)
|
||||
{
|
||||
PushStringToList(perm, &c_out_lines, Lit(""));
|
||||
PushStringToList(perm, &c_out_lines, Lit("//- Shaders"));
|
||||
for (StringListNode *n = c_shader_lines.first; n; n = n->next)
|
||||
for (StringListNode *n = shader_lines.first; n; n = n->next)
|
||||
{
|
||||
PushStringToList(perm, &c_out_lines, n->s);
|
||||
}
|
||||
@ -875,6 +921,16 @@ void M_BuildEntryPoint(WaveLaneCtx *lane)
|
||||
PushStringToList(perm, &gpu_out_lines, Lit("//- Base layer includes"));
|
||||
PushStringToList(perm, &gpu_out_lines, StringF(perm, "#include \"%F\"", FmtString(base_inc_path)));
|
||||
}
|
||||
// Define shaders
|
||||
if (shader_lines.count > 0)
|
||||
{
|
||||
PushStringToList(perm, &gpu_out_lines, Lit(""));
|
||||
PushStringToList(perm, &gpu_out_lines, Lit("//- Shaders"));
|
||||
for (StringListNode *n = shader_lines.first; n; n = n->next)
|
||||
{
|
||||
PushStringToList(perm, &gpu_out_lines, n->s);
|
||||
}
|
||||
}
|
||||
// Include dependency layers
|
||||
if (gpu_out_lines.count > 0)
|
||||
{
|
||||
|
||||
@ -14,8 +14,14 @@ Readonly M_Entry M_NilEntry = {
|
||||
.name_token = &M_NilToken,
|
||||
.arg_tokens[0] = &M_NilToken,
|
||||
.arg_tokens[1] = &M_NilToken,
|
||||
.arg_tokens[2] = &M_NilToken,
|
||||
.arg_tokens[3] = &M_NilToken,
|
||||
.arg_tokens[4] = &M_NilToken,
|
||||
.arg_tokens[5] = &M_NilToken,
|
||||
.arg_tokens[6] = &M_NilToken,
|
||||
.arg_tokens[7] = &M_NilToken,
|
||||
};
|
||||
StaticAssert(countof(M_NilEntry.arg_tokens) == 2); // NilEntry must point args to nil tokens
|
||||
StaticAssert(countof(M_NilEntry.arg_tokens) == 8); // NilEntry must point args to nil tokens
|
||||
|
||||
Readonly M_Layer M_NilLayer = {
|
||||
.next = &M_NilLayer,
|
||||
|
||||
@ -105,7 +105,7 @@ Struct(M_Entry)
|
||||
M_EntryKind kind;
|
||||
M_Token *name_token;
|
||||
|
||||
M_Token *arg_tokens[2];
|
||||
M_Token *arg_tokens[8];
|
||||
u64 args_count;
|
||||
};
|
||||
|
||||
|
||||
24
src/pp/pp_vis/pp_vis.lay
generated
24
src/pp/pp_vis/pp_vis.lay
generated
@ -15,20 +15,20 @@
|
||||
//////////////////////////////
|
||||
//- Resources
|
||||
|
||||
@ComputeShader V_PrepareShadeCS
|
||||
@ComputeShader V_PrepareCellsCS
|
||||
@ComputeShader V_BackdropDownCS
|
||||
@ComputeShader V_BackdropUpCS
|
||||
@ComputeShader V_ClearParticlesCS
|
||||
@ComputeShader V_PrepareShadeCS (16, 16)
|
||||
@ComputeShader V_PrepareCellsCS (16, 16)
|
||||
@ComputeShader V_BackdropDownCS (16, 16)
|
||||
@ComputeShader V_BackdropUpCS (16, 16)
|
||||
@ComputeShader V_ClearParticlesCS (256)
|
||||
@VertexShader V_QuadVS
|
||||
@PixelShader V_QuadPS
|
||||
@ComputeShader V_EmitParticlesCS
|
||||
@ComputeShader V_SimParticlesCS
|
||||
@ComputeShader V_ShadeCS
|
||||
@ComputeShader V_CompositeCS
|
||||
@ComputeShader V_BloomDownCS
|
||||
@ComputeShader V_BloomUpCS
|
||||
@ComputeShader V_FinalizeCS
|
||||
@ComputeShader V_EmitParticlesCS (256)
|
||||
@ComputeShader V_SimParticlesCS (256)
|
||||
@ComputeShader V_ShadeCS (16, 16)
|
||||
@ComputeShader V_CompositeCS (16, 16)
|
||||
@ComputeShader V_BloomDownCS (16, 16)
|
||||
@ComputeShader V_BloomUpCS (16, 16)
|
||||
@ComputeShader V_FinalizeCS (16, 16)
|
||||
@VertexShader V_DVertVS
|
||||
@PixelShader V_DVertPS
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ Vec4 V_ColorFromParticle(V_ParticleDesc desc, u32 particle_idx, u32 density)
|
||||
//~ Prepare frame
|
||||
|
||||
//- Prepare shade
|
||||
ImplComputeShader2D(V_PrepareShadeCS)
|
||||
ComputeShader(V_PrepareShadeCS)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
RWTexture2D<Vec4> shade = G_SDerefRW<Vec4>(frame.shade);
|
||||
@ -69,7 +69,7 @@ ImplComputeShader2D(V_PrepareShadeCS)
|
||||
}
|
||||
|
||||
//- Prepare cells
|
||||
ImplComputeShader2D(V_PrepareCellsCS)
|
||||
ComputeShader(V_PrepareCellsCS)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
Texture2D<P_TileKind> tiles = G_SDeref<P_TileKind>(frame.tiles);
|
||||
@ -158,7 +158,7 @@ ImplComputeShader2D(V_PrepareCellsCS)
|
||||
}
|
||||
|
||||
//- Clear particles
|
||||
ImplComputeShader(V_ClearParticlesCS)
|
||||
ComputeShader(V_ClearParticlesCS)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
RWStructuredBuffer<V_Particle> particles = G_SDerefRW<V_Particle>(frame.particles);
|
||||
@ -175,7 +175,7 @@ ImplComputeShader(V_ClearParticlesCS)
|
||||
//////////////////////////////
|
||||
//- Downsample
|
||||
|
||||
ImplComputeShader2D(V_BackdropDownCS)
|
||||
ComputeShader(V_BackdropDownCS)
|
||||
{
|
||||
i32 mip_idx = V_GpuConst_MipIdx;
|
||||
b32 is_first_pass = mip_idx == 0;
|
||||
@ -241,7 +241,7 @@ ImplComputeShader2D(V_BackdropDownCS)
|
||||
//////////////////////////////
|
||||
//- Upsample
|
||||
|
||||
ImplComputeShader2D(V_BackdropUpCS)
|
||||
ComputeShader(V_BackdropUpCS)
|
||||
{
|
||||
i32 mip_idx = V_GpuConst_MipIdx;
|
||||
|
||||
@ -301,7 +301,7 @@ ImplComputeShader2D(V_BackdropUpCS)
|
||||
//////////////////////////////
|
||||
//- Vertex shader
|
||||
|
||||
ImplVertexShader(V_QuadVS, V_QuadPSInput)
|
||||
VertexShader(V_QuadVS, V_QuadPSInput)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
StructuredBuffer<V_Quad> quads = G_SDeref<V_Quad>(frame.quads);
|
||||
@ -325,7 +325,7 @@ ImplVertexShader(V_QuadVS, V_QuadPSInput)
|
||||
//////////////////////////////
|
||||
//- Pixel shader
|
||||
|
||||
ImplPixelShader(V_QuadPS, V_QuadPSOutput, V_QuadPSInput input)
|
||||
PixelShader(V_QuadPS, V_QuadPSOutput, V_QuadPSInput input)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
SamplerState sampler = G_SDeref(frame.basic_samplers[G_BasicSamplerKind_PointClamp]);
|
||||
@ -361,7 +361,7 @@ ImplPixelShader(V_QuadPS, V_QuadPSOutput, V_QuadPSInput input)
|
||||
//////////////////////////////
|
||||
//- Particle emitter shader
|
||||
|
||||
ImplComputeShader(V_EmitParticlesCS)
|
||||
ComputeShader(V_EmitParticlesCS)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
StructuredBuffer<V_Emitter> emitters = G_SDeref<V_Emitter>(frame.emitters);
|
||||
@ -392,7 +392,7 @@ ImplComputeShader(V_EmitParticlesCS)
|
||||
//////////////////////////////
|
||||
//- Particle sim shader
|
||||
|
||||
ImplComputeShader(V_SimParticlesCS)
|
||||
ComputeShader(V_SimParticlesCS)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
Texture2D<P_TileKind> tiles = G_SDeref<P_TileKind>(frame.tiles);
|
||||
@ -669,7 +669,7 @@ ImplComputeShader(V_SimParticlesCS)
|
||||
|
||||
// TODO: Remove this
|
||||
|
||||
ImplComputeShader2D(V_ShadeCS)
|
||||
ComputeShader(V_ShadeCS)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
SamplerState sampler = G_SDeref(frame.basic_samplers[G_BasicSamplerKind_PointClamp]);
|
||||
@ -705,7 +705,7 @@ ImplComputeShader2D(V_ShadeCS)
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Composite
|
||||
|
||||
ImplComputeShader2D(V_CompositeCS)
|
||||
ComputeShader(V_CompositeCS)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
// Texture2D<Vec4> shade_tex = G_SDeref<Vec4>(frame.shade);
|
||||
@ -720,7 +720,7 @@ ImplComputeShader2D(V_CompositeCS)
|
||||
Texture2D<Vec4> backdrop = G_SDeref<Vec4>(frame.backdrop_mips[0]);
|
||||
StructuredBuffer<V_Particle> particles = G_SDeref<V_Particle>(frame.particles);
|
||||
|
||||
Vec2 screen_pos = SV_DispatchThreadID.xy + 0.5;
|
||||
Vec2 screen_pos = SV_DispatchThreadID + 0.5;
|
||||
Vec2 world_pos = mul(frame.af.screen_to_world, Vec3(screen_pos, 1));
|
||||
Vec2 cell_pos = mul(frame.af.world_to_cell, Vec3(world_pos, 1));
|
||||
Vec2 shade_pos = mul(frame.af.screen_to_shade, Vec3(screen_pos.xy, 1));
|
||||
@ -1106,7 +1106,7 @@ ImplComputeShader2D(V_CompositeCS)
|
||||
//////////////////////////////
|
||||
//- Downsample
|
||||
|
||||
ImplComputeShader2D(V_BloomDownCS)
|
||||
ComputeShader(V_BloomDownCS)
|
||||
{
|
||||
i32 mip_idx = V_GpuConst_MipIdx;
|
||||
|
||||
@ -1181,7 +1181,7 @@ ImplComputeShader2D(V_BloomDownCS)
|
||||
//////////////////////////////
|
||||
//- Upsample
|
||||
|
||||
ImplComputeShader2D(V_BloomUpCS)
|
||||
ComputeShader(V_BloomUpCS)
|
||||
{
|
||||
i32 mip_idx = V_GpuConst_MipIdx;
|
||||
|
||||
@ -1248,7 +1248,7 @@ ImplComputeShader2D(V_BloomUpCS)
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Finalize
|
||||
|
||||
ImplComputeShader2D(V_FinalizeCS)
|
||||
ComputeShader(V_FinalizeCS)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
SamplerState bilinear_sampler = G_SDeref(frame.basic_samplers[G_BasicSamplerKind_BilinearClamp]);
|
||||
@ -1281,7 +1281,7 @@ ImplComputeShader2D(V_FinalizeCS)
|
||||
//////////////////////////////
|
||||
//- Vertex shader
|
||||
|
||||
ImplVertexShader(V_DVertVS, V_DVertPSInput)
|
||||
VertexShader(V_DVertVS, V_DVertPSInput)
|
||||
{
|
||||
V_SharedFrame frame = G_SDeref<V_SharedFrame>(V_GpuConst_Frame)[0];
|
||||
StructuredBuffer<V_DVert> verts = G_SDeref<V_DVert>(frame.dverts);
|
||||
@ -1299,7 +1299,7 @@ ImplVertexShader(V_DVertVS, V_DVertPSInput)
|
||||
//////////////////////////////
|
||||
//- Pixel shader
|
||||
|
||||
ImplPixelShader(V_DVertPS, V_DVertPSOutput, V_DVertPSInput input)
|
||||
PixelShader(V_DVertPS, V_DVertPSOutput, V_DVertPSInput input)
|
||||
{
|
||||
V_DVertPSOutput output;
|
||||
output.sv_target0 = input.color_lin;
|
||||
|
||||
@ -51,35 +51,35 @@ Vec4 V_ColorFromParticle(V_ParticleDesc desc, u32 particle_idx, u32 density);
|
||||
//~ Shaders
|
||||
|
||||
//- Prepare frame
|
||||
DeclComputeShader2D(V_PrepareShadeCS, 16, 16);
|
||||
DeclComputeShader2D(V_PrepareCellsCS, 16, 16);
|
||||
DeclComputeShader(V_ClearParticlesCS, 256);
|
||||
ComputeShader(V_PrepareShadeCS);
|
||||
ComputeShader(V_PrepareCellsCS);
|
||||
ComputeShader(V_ClearParticlesCS);
|
||||
|
||||
//- Backdrop
|
||||
DeclComputeShader2D(V_BackdropDownCS, 16, 16);
|
||||
DeclComputeShader2D(V_BackdropUpCS, 16, 16);
|
||||
ComputeShader(V_BackdropDownCS);
|
||||
ComputeShader(V_BackdropUpCS);
|
||||
|
||||
//- Quads
|
||||
DeclVertexShader(V_QuadVS, V_QuadPSInput);
|
||||
DeclPixelShader(V_QuadPS, V_QuadPSOutput, V_QuadPSInput input);
|
||||
VertexShader(V_QuadVS, V_QuadPSInput);
|
||||
PixelShader(V_QuadPS, V_QuadPSOutput, V_QuadPSInput input);
|
||||
|
||||
//- Particle simulation
|
||||
DeclComputeShader(V_EmitParticlesCS, 256);
|
||||
DeclComputeShader(V_SimParticlesCS, 256);
|
||||
ComputeShader(V_EmitParticlesCS);
|
||||
ComputeShader(V_SimParticlesCS);
|
||||
|
||||
//- Shade
|
||||
DeclComputeShader2D(V_ShadeCS, 16, 16);
|
||||
ComputeShader(V_ShadeCS);
|
||||
|
||||
//- Composite
|
||||
DeclComputeShader2D(V_CompositeCS, 16, 16);
|
||||
ComputeShader(V_CompositeCS);
|
||||
|
||||
//- Bloom
|
||||
DeclComputeShader2D(V_BloomDownCS, 16, 16);
|
||||
DeclComputeShader2D(V_BloomUpCS, 16, 16);
|
||||
ComputeShader(V_BloomDownCS);
|
||||
ComputeShader(V_BloomUpCS);
|
||||
|
||||
//- Finalize
|
||||
DeclComputeShader2D(V_FinalizeCS, 16, 16);
|
||||
ComputeShader(V_FinalizeCS);
|
||||
|
||||
//- Debug shapes
|
||||
DeclVertexShader(V_DVertVS, V_DVertPSInput);
|
||||
DeclPixelShader(V_DVertPS, V_DVertPSOutput, V_DVertPSInput input);
|
||||
VertexShader(V_DVertVS, V_DVertPSInput);
|
||||
PixelShader(V_DVertPS, V_DVertPSOutput, V_DVertPSInput input);
|
||||
|
||||
2
src/proto/proto.lay
generated
2
src/proto/proto.lay
generated
@ -9,7 +9,7 @@
|
||||
//////////////////////////////
|
||||
//- Resources
|
||||
|
||||
@ComputeShader PT_TestCS
|
||||
@ComputeShader PT_TestCS (8, 8)
|
||||
@VertexShader PT_BlitVS
|
||||
@PixelShader PT_BlitPS
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Test shader
|
||||
|
||||
ImplComputeShader2D(PT_TestCS)
|
||||
ComputeShader(PT_TestCS)
|
||||
{
|
||||
StructuredBuffer<TestStruct> sb = G_SDeref<TestStruct>(PT_ShaderConst_TestBuff);
|
||||
RWTexture2D<Vec4> target_tex = G_SDerefRW<Vec4>(PT_ShaderConst_TestTarget);
|
||||
@ -21,7 +21,7 @@ ImplComputeShader2D(PT_TestCS)
|
||||
//////////////////////////////
|
||||
//- Vertex shader
|
||||
|
||||
ImplVertexShader(PT_BlitVS, PT_BlitPSInput)
|
||||
VertexShader(PT_BlitVS, PT_BlitPSInput)
|
||||
{
|
||||
Vec2 uv = RectUvFromIdx(SV_VertexID);
|
||||
PT_BlitPSInput result;
|
||||
@ -33,7 +33,7 @@ ImplVertexShader(PT_BlitVS, PT_BlitPSInput)
|
||||
//////////////////////////////
|
||||
//- Pixel shader
|
||||
|
||||
ImplPixelShader(PT_BlitPS, PT_BlitPSOutput, PT_BlitPSInput input)
|
||||
PixelShader(PT_BlitPS, PT_BlitPSOutput, PT_BlitPSInput input)
|
||||
{
|
||||
SamplerState sampler = G_SDeref(PT_ShaderConst_BlitSampler);
|
||||
Texture2D<Vec4> tex = G_SDeref<Vec4>(PT_ShaderConst_BlitSrc);
|
||||
|
||||
@ -24,7 +24,7 @@ Struct(PT_BlitPSOutput)
|
||||
//~ Shaders
|
||||
|
||||
//- Test
|
||||
DeclComputeShader2D(PT_TestCS, 8, 8);
|
||||
ComputeShader(PT_TestCS);
|
||||
|
||||
//- Blit
|
||||
DeclVertexShader(PT_BlitVS, PT_BlitPSInput);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
//////////////////////////////
|
||||
//- Vertex shader
|
||||
|
||||
ImplVertexShader(UI_DRectVS, UI_DRectPSInput)
|
||||
VertexShader(UI_DRectVS, UI_DRectPSInput)
|
||||
{
|
||||
UI_GpuParams params = G_SDeref<UI_GpuParams>(UI_GpuConst_Params)[0];
|
||||
StructuredBuffer<UI_GpuRect> rects = G_SDeref<UI_GpuRect>(params.rects);
|
||||
@ -31,7 +31,7 @@ ImplVertexShader(UI_DRectVS, UI_DRectPSInput)
|
||||
//////////////////////////////
|
||||
//- Pixel shader
|
||||
|
||||
ImplPixelShader(UI_DRectPS, UI_DRectPSOutput, UI_DRectPSInput input)
|
||||
PixelShader(UI_DRectPS, UI_DRectPSOutput, UI_DRectPSInput input)
|
||||
{
|
||||
UI_GpuParams params = G_SDeref<UI_GpuParams>(UI_GpuConst_Params)[0];
|
||||
SamplerState sampler = G_SDeref(params.sampler);
|
||||
@ -116,7 +116,7 @@ ImplPixelShader(UI_DRectPS, UI_DRectPSOutput, UI_DRectPSInput input)
|
||||
//////////////////////////////
|
||||
//- Vertex shader
|
||||
|
||||
ImplVertexShader(UI_BlitVS, UI_BlitPSInput)
|
||||
VertexShader(UI_BlitVS, UI_BlitPSInput)
|
||||
{
|
||||
Vec2 uv = RectUvFromIdx(SV_VertexID);
|
||||
UI_BlitPSInput result;
|
||||
@ -129,7 +129,7 @@ ImplVertexShader(UI_BlitVS, UI_BlitPSInput)
|
||||
//////////////////////////////
|
||||
//- Pixel shader
|
||||
|
||||
ImplPixelShader(UI_BlitPS, UI_BlitPSOutput, UI_BlitPSInput input)
|
||||
PixelShader(UI_BlitPS, UI_BlitPSOutput, UI_BlitPSInput input)
|
||||
{
|
||||
UI_GpuParams params = G_SDeref<UI_GpuParams>(UI_GpuConst_Params)[0];
|
||||
Texture2D<Vec4> tex = G_SDeref<Vec4>(params.target_ro);
|
||||
|
||||
@ -36,9 +36,9 @@ Struct(UI_BlitPSOutput)
|
||||
//~ Shaders
|
||||
|
||||
//- Rects
|
||||
DeclVertexShader(UI_DRectVS, UI_DRectPSInput);
|
||||
DeclPixelShader(UI_DRectPS, UI_DRectPSOutput, UI_DRectPSInput input);
|
||||
VertexShader(UI_DRectVS, UI_DRectPSInput);
|
||||
PixelShader(UI_DRectPS, UI_DRectPSOutput, UI_DRectPSInput input);
|
||||
|
||||
//- Blit
|
||||
DeclVertexShader(UI_BlitVS, UI_BlitPSInput);
|
||||
DeclPixelShader(UI_BlitPS, UI_BlitPSOutput, UI_BlitPSInput input);
|
||||
VertexShader(UI_BlitVS, UI_BlitPSInput);
|
||||
PixelShader(UI_BlitPS, UI_BlitPSOutput, UI_BlitPSInput input);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user