Skip to content

Commit

Permalink
[dxbc] Improve code gen for zeroing workgroup memory
Browse files Browse the repository at this point in the history
  • Loading branch information
doitsujin committed Jan 11, 2025
1 parent 228d3d6 commit e42ecbc
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/dxbc/dxbc_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6193,13 +6193,11 @@ namespace dxvk {

uint32_t threadId = m_module.opLoad(
intTypeId, m_cs.builtinLocalInvocationIndex);

uint32_t strideId = m_module.constu32(numThreads);
uint32_t zeroId = m_module.constu32(0);
uint32_t zeroId = m_module.constu32(0);

for (uint32_t e = 0; e < numElementsPerThread; e++) {
uint32_t ofsId = m_module.opIAdd(intTypeId, threadId,
m_module.opIMul(intTypeId, strideId, m_module.constu32(e)));
m_module.constu32(numThreads * e));

uint32_t ptrId = m_module.opAccessChain(
ptrTypeId, m_gRegs[i].varId, 1, &ofsId);
Expand All @@ -6221,9 +6219,8 @@ namespace dxvk {

m_module.opLabel(cond.labelIf);

uint32_t ofsId = m_module.opIAdd(intTypeId,
m_module.constu32(numThreads * numElementsPerThread),
threadId);
uint32_t ofsId = m_module.opIAdd(intTypeId, threadId,
m_module.constu32(numThreads * numElementsPerThread));

uint32_t ptrId = m_module.opAccessChain(
ptrTypeId, m_gRegs[i].varId, 1, &ofsId);
Expand Down

0 comments on commit e42ecbc

Please sign in to comment.