[spirv] Track currently active block ID

This commit is contained in:
Philip Rebohle 2022-07-20 22:38:03 +02:00
parent a178c57aea
commit 779f8b39cd
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 16 additions and 1 deletions

View File

@ -2986,6 +2986,8 @@ namespace dxvk {
void SpirvModule::opLabel(uint32_t labelId) {
m_code.putIns (spv::OpLabel, 2);
m_code.putWord(labelId);
m_blockId = labelId;
}
@ -3533,6 +3535,8 @@ namespace dxvk {
uint32_t label) {
m_code.putIns (spv::OpBranch, 2);
m_code.putWord(label);
m_blockId = 0;
}
@ -3544,6 +3548,8 @@ namespace dxvk {
m_code.putWord(condition);
m_code.putWord(trueLabel);
m_code.putWord(falseLabel);
m_blockId = 0;
}
@ -3560,6 +3566,8 @@ namespace dxvk {
m_code.putWord(caseLabels[i].literal);
m_code.putWord(caseLabels[i].labelId);
}
m_blockId = 0;
}
@ -3584,11 +3592,13 @@ namespace dxvk {
void SpirvModule::opReturn() {
m_code.putIns (spv::OpReturn, 1);
m_blockId = 0;
}
void SpirvModule::opKill() {
m_code.putIns (spv::OpKill, 1);
m_blockId = 0;
}

View File

@ -50,7 +50,7 @@ namespace dxvk {
~SpirvModule();
SpirvCodeBuffer compile() const;
size_t getInsertionPtr() {
return m_code.getInsertionPtr();
}
@ -63,6 +63,10 @@ namespace dxvk {
m_code.endInsertion();
}
uint32_t getBlockId() const {
return m_blockId;
}
uint32_t allocateId();
bool hasCapability(
@ -1239,6 +1243,7 @@ namespace dxvk {
uint32_t m_version;
uint32_t m_id = 1;
uint32_t m_instExtGlsl450 = 0;
uint32_t m_blockId = 0;
SpirvCodeBuffer m_capabilities;
SpirvCodeBuffer m_extensions;