mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 10:54:16 +01:00
[dxbc] Some shader signature stuff
This commit is contained in:
parent
72f353074f
commit
9cdc341946
@ -20,13 +20,6 @@ namespace dxvk {
|
||||
entry.registerId = reader.readu32();
|
||||
entry.componentMask = bit::extract(reader.readu32(), 0, 3);
|
||||
|
||||
Logger::info(str::format(
|
||||
entry.semanticName, ",",
|
||||
entry.semanticIndex, ",",
|
||||
entry.systemValue, ",",
|
||||
// entry.componentType, ",",
|
||||
entry.registerId));
|
||||
|
||||
m_entries.push_back(entry);
|
||||
}
|
||||
}
|
||||
@ -36,4 +29,14 @@ namespace dxvk {
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint32_t DxbcIsgn::entryCount() const {
|
||||
return m_entries.size();
|
||||
}
|
||||
|
||||
|
||||
const DxbcSgnEntry& DxbcIsgn::entry(uint32_t id) const {
|
||||
return m_entries.at(id);
|
||||
}
|
||||
|
||||
}
|
@ -36,6 +36,10 @@ namespace dxvk {
|
||||
DxbcIsgn(DxbcReader reader);
|
||||
~DxbcIsgn();
|
||||
|
||||
uint32_t entryCount() const;
|
||||
|
||||
const DxbcSgnEntry& entry(uint32_t id) const;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<DxbcSgnEntry> m_entries;
|
||||
|
@ -244,16 +244,6 @@ namespace dxvk {
|
||||
result = this->loadPointer(m_rRegs.at(index.immPart()));
|
||||
} break;
|
||||
|
||||
case DxbcOperandType::Input: {
|
||||
const DxbcOperandIndex index = operand.index(0);
|
||||
result = this->loadPointer(m_vRegs.at(index.immPart()));
|
||||
} break;
|
||||
|
||||
case DxbcOperandType::Output: {
|
||||
const DxbcOperandIndex index = operand.index(0);
|
||||
result = this->loadPointer(m_oRegs.at(index.immPart()));
|
||||
} break;
|
||||
|
||||
default:
|
||||
throw DxvkError(str::format(
|
||||
"DxbcCompiler::loadOperandRegister: Unhandled operand type: ",
|
||||
|
@ -52,8 +52,10 @@ namespace dxvk {
|
||||
|
||||
std::vector<uint32_t> m_interfaces;
|
||||
std::vector<DxbcPointer> m_rRegs; // Temps
|
||||
std::vector<DxbcPointer> m_vRegs; // Input registers
|
||||
std::vector<DxbcPointer> m_oRegs; // Output registers
|
||||
|
||||
DxbcPointer m_svPosition;
|
||||
std::vector<DxbcPointer> m_svClipDistance;
|
||||
std::vector<DxbcPointer> m_svCullDistance;
|
||||
|
||||
uint32_t m_entryPointId = 0;
|
||||
|
||||
@ -62,21 +64,42 @@ namespace dxvk {
|
||||
|
||||
bool m_useRestrictedMath = false;
|
||||
|
||||
|
||||
|
||||
void declareCapabilities();
|
||||
void declareMemoryModel();
|
||||
|
||||
void dclGlobalFlags(const DxbcInstruction& ins);
|
||||
void dclInput(const DxbcInstruction& ins);
|
||||
void dclOutputSiv(const DxbcInstruction& ins);
|
||||
void dclTemps(const DxbcInstruction& ins);
|
||||
void dclThreadGroup(const DxbcInstruction& ins);
|
||||
void dclGlobalFlags(
|
||||
const DxbcInstruction& ins);
|
||||
|
||||
void opMov(const DxbcInstruction& ins);
|
||||
void opRet(const DxbcInstruction& ins);
|
||||
void dclInput(
|
||||
const DxbcInstruction& ins);
|
||||
|
||||
void dclOutputSiv(
|
||||
const DxbcInstruction& ins);
|
||||
|
||||
void dclTemps(
|
||||
const DxbcInstruction& ins);
|
||||
|
||||
void dclThreadGroup(
|
||||
const DxbcInstruction& ins);
|
||||
|
||||
|
||||
void opMov(
|
||||
const DxbcInstruction& ins);
|
||||
|
||||
void opRet(
|
||||
const DxbcInstruction& ins);
|
||||
|
||||
uint32_t getScalarTypeId(
|
||||
const DxbcScalarType& type);
|
||||
|
||||
uint32_t getValueTypeId(
|
||||
const DxbcValueType& type);
|
||||
|
||||
uint32_t getPointerTypeId(
|
||||
const DxbcPointerType& type);
|
||||
|
||||
uint32_t getScalarTypeId(const DxbcScalarType& type);
|
||||
uint32_t getValueTypeId(const DxbcValueType& type);
|
||||
uint32_t getPointerTypeId(const DxbcPointerType& type);
|
||||
|
||||
DxbcValue loadPointer(
|
||||
const DxbcPointer& pointer);
|
||||
@ -85,6 +108,7 @@ namespace dxvk {
|
||||
const DxbcOperand& operand,
|
||||
const DxbcValueType& type);
|
||||
|
||||
|
||||
void storePointer(
|
||||
const DxbcPointer& pointer,
|
||||
const DxbcValue& value);
|
||||
|
@ -372,6 +372,39 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void SpirvModule::opLabel(uint32_t labelId) {
|
||||
m_code.putIns (spv::OpReturn, 2);
|
||||
m_code.putWord(labelId);
|
||||
}
|
||||
|
||||
|
||||
uint32_t SpirvModule::opLoad(
|
||||
uint32_t typeId,
|
||||
uint32_t pointerId) {
|
||||
uint32_t resultId = this->allocateId();
|
||||
|
||||
m_code.putIns (spv::OpLoad, 4);
|
||||
m_code.putWord(typeId);
|
||||
m_code.putWord(resultId);
|
||||
m_code.putWord(pointerId);
|
||||
return resultId;
|
||||
}
|
||||
|
||||
|
||||
void SpirvModule::opStore(
|
||||
uint32_t pointerId,
|
||||
uint32_t valueId) {
|
||||
m_code.putIns (spv::OpStore, 3);
|
||||
m_code.putWord(pointerId);
|
||||
m_code.putWord(valueId);
|
||||
}
|
||||
|
||||
|
||||
void SpirvModule::opReturn() {
|
||||
m_code.putIns (spv::OpReturn, 1);
|
||||
}
|
||||
|
||||
|
||||
uint32_t SpirvModule::defType(
|
||||
spv::Op op,
|
||||
uint32_t argCount,
|
||||
|
@ -136,6 +136,19 @@ namespace dxvk {
|
||||
uint32_t argCount,
|
||||
const uint32_t* argIds);
|
||||
|
||||
void opLabel(
|
||||
uint32_t labelId);
|
||||
|
||||
uint32_t opLoad(
|
||||
uint32_t typeId,
|
||||
uint32_t pointerId);
|
||||
|
||||
void opStore(
|
||||
uint32_t pointerId,
|
||||
uint32_t valueId);
|
||||
|
||||
void opReturn();
|
||||
|
||||
private:
|
||||
|
||||
uint32_t m_id = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user