Major overhaul of resource barrier and state tracking in RenderGraph: - Introduce ResourceBarrierData for explicit (layout, access, sync) tracking. - Separate aliasing and transition barriers; explicit aliasing support. - Remove BufferHint; infer buffer usage from BufferUsage flags. - Update TextureAccess/BufferAccess to include usage requirements. - Improve enums (BarrierSync, BarrierAccess, BarrierLayout) for D3D12 alignment. - Update D3D12CommandBuffer to use new barrier data and error handling. - Make D3D12DescriptorHeap a class; add ReleaseSampler to IResourceDatabase. - Reset resource pools and aliasing managers each frame. - Batch and flush barriers efficiently per pass. - Update HLSL mesh shader macros to [NumThreads]. - Remove obsolete code and improve documentation. This refactor improves correctness, extensibility, and prepares for advanced features.
74 lines
2.0 KiB
Plaintext
74 lines
2.0 KiB
Plaintext
shader "Hidden/Blit"
|
|
{
|
|
properties
|
|
{
|
|
tex2d mainTex = { white };
|
|
sampler sampler_mainTex;
|
|
}
|
|
|
|
pass "Blit"
|
|
{
|
|
pipeline
|
|
{
|
|
ztest = disabled;
|
|
zwrite = off;
|
|
cull = off;
|
|
blend = opaque;
|
|
color_mask = all;
|
|
}
|
|
|
|
includes
|
|
{
|
|
"F:/csharp/GhostEngine/Ghost.Graphics/Shaders/Includes/Common.hlsl";
|
|
"F:/csharp/GhostEngine/Ghost.Graphics/Shaders/Includes/Color.hlsl";
|
|
"F:/csharp/GhostEngine/Ghost.Graphics/Shaders/Includes/Properties.hlsl";
|
|
}
|
|
|
|
hlsl
|
|
{
|
|
struct PSInput
|
|
{
|
|
float4 position : SV_POSITION;
|
|
float4 uv : TEXCOORD0;
|
|
};
|
|
|
|
[NumThreads(4, 1, 1)]
|
|
[OUTPUT_TRIANGLE_TOPOLOGY]
|
|
void MSMain(
|
|
uint gtid : SV_GroupThreadID,
|
|
out vertices PSInput verts[4],
|
|
out indices uint3 tris[2]
|
|
)
|
|
{
|
|
SetMeshOutputCounts(4, 2);
|
|
|
|
float2 uv = float2(gtid & 1, (gtid >> 1) & 1);
|
|
|
|
verts[gtid].position = float4(uv * 2.0 - 1.0, 0.0, 1.0);
|
|
verts[gtid].uv = float4(uv, 0.0, 0.0);
|
|
|
|
if (gtid == 0)
|
|
{
|
|
tris[0] = uint3(0, 1, 2); // First triangle
|
|
tris[1] = uint3(1, 3, 2); // Second triangle
|
|
}
|
|
}
|
|
|
|
float4 PSMain(PSInput input) : SV_TARGET
|
|
{
|
|
PerMaterialData perMaterialData = LoadData<PerMaterialData>(g_PushConstantData.perMaterialBuffer, 0);
|
|
|
|
float2 uv = input.uv.xy;
|
|
float4 color = SAMPLE_TEXTURE2D(perMaterialData.mainTex, perMaterialData.sampler_mainTex, uv);
|
|
#ifdef LINEAR_COLORSPACE
|
|
color = LinearToSRGB(color);
|
|
#endif
|
|
return color;
|
|
}
|
|
}
|
|
|
|
mesh "hlsl_block" : "MSMain";
|
|
pixel "hlsl_block" : "PSMain";
|
|
}
|
|
}
|