mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-13 16:08:50 +01:00
[dxvk] Remove interpolation decorations for replaced shader inputs
This commit is contained in:
parent
6d3ba1b7d7
commit
5d0273f520
@ -318,16 +318,37 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove location declarations
|
// Remove location and other declarations
|
||||||
for (auto ins : code) {
|
for (auto iter = code.begin(); iter != code.end(); ) {
|
||||||
if (ins.opCode() == spv::OpDecorate
|
auto ins = *(iter++);
|
||||||
&& ins.arg(2) == spv::DecorationLocation
|
|
||||||
&& ins.arg(1) == inputVarId) {
|
if (ins.opCode() == spv::OpDecorate && ins.arg(1) == inputVarId) {
|
||||||
code.beginInsertion(ins.offset());
|
uint32_t numWords;
|
||||||
code.erase(4);
|
|
||||||
code.endInsertion();
|
switch (ins.arg(2)) {
|
||||||
break;
|
case spv::DecorationLocation:
|
||||||
|
case spv::DecorationFlat:
|
||||||
|
case spv::DecorationNoPerspective:
|
||||||
|
case spv::DecorationCentroid:
|
||||||
|
case spv::DecorationPatch:
|
||||||
|
case spv::DecorationSample:
|
||||||
|
numWords = ins.length();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
numWords = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numWords) {
|
||||||
|
code.beginInsertion(ins.offset());
|
||||||
|
code.erase(numWords);
|
||||||
|
|
||||||
|
iter = SpirvInstructionIterator(code.data(), code.endInsertion(), code.dwords());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ins.opCode() == spv::OpFunction)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix up pointer types used in access chain instructions
|
// Fix up pointer types used in access chain instructions
|
||||||
|
@ -208,9 +208,10 @@ namespace dxvk {
|
|||||||
* After this call, new instructions will be
|
* After this call, new instructions will be
|
||||||
* appended to the stream. In other words,
|
* appended to the stream. In other words,
|
||||||
* this will restore default behaviour.
|
* this will restore default behaviour.
|
||||||
|
* \returns Previous instruction pointer
|
||||||
*/
|
*/
|
||||||
void endInsertion() {
|
size_t endInsertion() {
|
||||||
m_ptr = m_code.size();
|
return std::exchange(m_ptr, m_code.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -109,7 +109,7 @@ namespace dxvk {
|
|||||||
: m_code (length != 0 ? code : nullptr),
|
: m_code (length != 0 ? code : nullptr),
|
||||||
m_offset(length != 0 ? offset : 0),
|
m_offset(length != 0 ? offset : 0),
|
||||||
m_length(length) {
|
m_length(length) {
|
||||||
if ((length >= 5) && (m_code[0] == spv::MagicNumber))
|
if ((length >= 5) && (offset == 0) && (m_code[0] == spv::MagicNumber))
|
||||||
this->advance(5);
|
this->advance(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +118,12 @@ namespace dxvk {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpirvInstructionIterator operator ++ (int) {
|
||||||
|
SpirvInstructionIterator result = *this;
|
||||||
|
this->advance(SpirvInstruction(m_code, m_offset, m_length).length());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
SpirvInstruction operator * () const {
|
SpirvInstruction operator * () const {
|
||||||
return SpirvInstruction(m_code, m_offset, m_length);
|
return SpirvInstruction(m_code, m_offset, m_length);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user