| 123456789101112131415161718192021222324252627282930313233343536 |
- // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
- // All rights reserved.
- // Code licensed under the BSD License.
- // http://www.anki3d.org/LICENSE
- #pragma anki technique comp
- #include <AnKi/Shaders/Common.hlsl>
- // Needs to match the C++. See C++ for comments
- struct PatchHeader
- {
- U32 m_dwordSizeMinusOne : 6;
- U32 m_srcDwordOffset : 26;
- U32 m_dstDwordOffset;
- };
- StructuredBuffer<PatchHeader> g_patchHeaders : register(t0);
- StructuredBuffer<U32> g_srcBuffer : register(t1);
- RWStructuredBuffer<U32> g_dstBuffer : register(u0);
- [numthreads(64, 1, 1)] void main(UVec3 svGroupId : SV_GROUPID, U32 svGroupIndex : SV_GROUPINDEX)
- {
- const PatchHeader header = SBUFF(g_patchHeaders, svGroupId.x);
- const U32 dwordCount = header.m_dwordSizeMinusOne + 1u;
- if(svGroupIndex >= dwordCount)
- {
- return;
- }
- const U32 srcDwordOffset = header.m_srcDwordOffset;
- const U32 dstDwordOffset = header.m_dstDwordOffset;
- SBUFF(g_dstBuffer, dstDwordOffset + svGroupIndex) = SBUFF(g_srcBuffer, srcDwordOffset + svGroupIndex);
- }
|