mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-07 16:54:14 +01:00
[dxso] Use new DxvkShader constructor
This commit is contained in:
parent
8993560cde
commit
10bab0c182
@ -246,17 +246,16 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
Rc<DxvkShader> DxsoCompiler::compileShader() {
|
Rc<DxvkShader> DxsoCompiler::compileShader() {
|
||||||
DxvkShaderOptions shaderOptions = { };
|
DxvkShaderCreateInfo info;
|
||||||
DxvkShaderConstData constData = { };
|
info.stage = m_programInfo.shaderStage();
|
||||||
|
info.resourceSlotCount = m_resourceSlots.size();
|
||||||
|
info.resourceSlots = m_resourceSlots.data();
|
||||||
|
info.inputMask = m_inputMask;
|
||||||
|
info.outputMask = m_outputMask;
|
||||||
|
info.pushConstOffset = m_pushConstOffset;
|
||||||
|
info.pushConstSize = m_pushConstOffset;
|
||||||
|
|
||||||
return new DxvkShader(
|
return new DxvkShader(info, m_module.compile());
|
||||||
m_programInfo.shaderStage(),
|
|
||||||
m_resourceSlots.size(),
|
|
||||||
m_resourceSlots.data(),
|
|
||||||
m_interfaceSlots,
|
|
||||||
m_module.compile(),
|
|
||||||
shaderOptions,
|
|
||||||
std::move(constData));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DxsoCompiler::emitInit() {
|
void DxsoCompiler::emitInit() {
|
||||||
@ -709,8 +708,8 @@ namespace dxvk {
|
|||||||
uint32_t slot = 0;
|
uint32_t slot = 0;
|
||||||
|
|
||||||
uint32_t& slots = input
|
uint32_t& slots = input
|
||||||
? m_interfaceSlots.inputSlots
|
? m_inputMask
|
||||||
: m_interfaceSlots.outputSlots;
|
: m_outputMask;
|
||||||
|
|
||||||
uint16_t& explicits = input
|
uint16_t& explicits = input
|
||||||
? m_explicitInputs
|
? m_explicitInputs
|
||||||
@ -1200,8 +1199,8 @@ namespace dxvk {
|
|||||||
uint32_t slot = RegisterLinkerSlot(semantic);
|
uint32_t slot = RegisterLinkerSlot(semantic);
|
||||||
|
|
||||||
uint32_t& slots = input
|
uint32_t& slots = input
|
||||||
? m_interfaceSlots.inputSlots
|
? m_inputMask
|
||||||
: m_interfaceSlots.outputSlots;
|
: m_outputMask;
|
||||||
|
|
||||||
slots |= 1u << slot;
|
slots |= 1u << slot;
|
||||||
|
|
||||||
@ -1243,7 +1242,7 @@ namespace dxvk {
|
|||||||
m_module.constvec4f32(0.0f, 0.0f, 0.0f, 0.0f),
|
m_module.constvec4f32(0.0f, 0.0f, 0.0f, 0.0f),
|
||||||
spv::StorageClassOutput);
|
spv::StorageClassOutput);
|
||||||
|
|
||||||
m_interfaceSlots.outputSlots |= 1u << idx;
|
m_outputMask |= 1u << idx;
|
||||||
m_module.decorateLocation(m_ps.oColor[idx].id, idx);
|
m_module.decorateLocation(m_ps.oColor[idx].id, idx);
|
||||||
m_module.decorateIndex(m_ps.oColor[idx].id, 0);
|
m_module.decorateIndex(m_ps.oColor[idx].id, 0);
|
||||||
|
|
||||||
@ -3596,7 +3595,7 @@ void DxsoCompiler::emitControlFlowGenericLoop(
|
|||||||
|
|
||||||
m_module.setDebugName(outputPtr, name.c_str());
|
m_module.setDebugName(outputPtr, name.c_str());
|
||||||
|
|
||||||
m_interfaceSlots.outputSlots |= 1u << slot;
|
m_outputMask |= 1u << slot;
|
||||||
m_entryPointInterfaces.push_back(outputPtr);
|
m_entryPointInterfaces.push_back(outputPtr);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3714,20 +3713,20 @@ void DxsoCompiler::emitControlFlowGenericLoop(
|
|||||||
// No FF fog component.
|
// No FF fog component.
|
||||||
if (m_programInfo.type() == DxsoProgramType::PixelShader) {
|
if (m_programInfo.type() == DxsoProgramType::PixelShader) {
|
||||||
if (m_programInfo.majorVersion() == 3) {
|
if (m_programInfo.majorVersion() == 3) {
|
||||||
m_interfaceSlots.pushConstOffset = offsetof(D3D9RenderStateInfo, alphaRef);
|
m_pushConstOffset = offsetof(D3D9RenderStateInfo, alphaRef);
|
||||||
m_interfaceSlots.pushConstSize = sizeof(float);
|
m_pushConstSize = sizeof(float);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_interfaceSlots.pushConstOffset = 0;
|
m_pushConstOffset = 0;
|
||||||
m_interfaceSlots.pushConstSize = offsetof(D3D9RenderStateInfo, pointSize);
|
m_pushConstSize = offsetof(D3D9RenderStateInfo, pointSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 5;
|
count = 5;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_interfaceSlots.pushConstOffset = offsetof(D3D9RenderStateInfo, pointSize);
|
m_pushConstOffset = offsetof(D3D9RenderStateInfo, pointSize);
|
||||||
// Point scale never triggers on programmable
|
// Point scale never triggers on programmable
|
||||||
m_interfaceSlots.pushConstSize = sizeof(float) * 3;
|
m_pushConstSize = sizeof(float) * 3;
|
||||||
count = 8;
|
count = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +355,10 @@ namespace dxvk {
|
|||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
// Inter-stage shader interface slots. Also
|
// Inter-stage shader interface slots. Also
|
||||||
// covers vertex input and fragment output.
|
// covers vertex input and fragment output.
|
||||||
DxvkInterfaceSlots m_interfaceSlots;
|
uint32_t m_inputMask = 0u;
|
||||||
|
uint32_t m_outputMask = 0u;
|
||||||
|
uint32_t m_pushConstOffset = 0u;
|
||||||
|
uint32_t m_pushConstSize = 0u;
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
// Shader-specific data structures
|
// Shader-specific data structures
|
||||||
@ -435,14 +438,14 @@ namespace dxvk {
|
|||||||
DxsoTextureType type);
|
DxsoTextureType type);
|
||||||
|
|
||||||
bool defineInput(uint32_t idx) {
|
bool defineInput(uint32_t idx) {
|
||||||
bool alreadyDefined = m_interfaceSlots.inputSlots & 1u << idx;
|
bool alreadyDefined = m_inputMask & 1u << idx;
|
||||||
m_interfaceSlots.inputSlots |= 1u << idx;
|
m_inputMask |= 1u << idx;
|
||||||
return alreadyDefined;
|
return alreadyDefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool defineOutput(uint32_t idx) {
|
bool defineOutput(uint32_t idx) {
|
||||||
bool alreadyDefined = m_interfaceSlots.outputSlots & 1u << idx;
|
bool alreadyDefined = m_outputMask & 1u << idx;
|
||||||
m_interfaceSlots.outputSlots |= 1u << idx;
|
m_outputMask |= 1u << idx;
|
||||||
return alreadyDefined;
|
return alreadyDefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user