mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-13 16:08:50 +01:00
[dxbc] Enable SPIR-V 1.6
This commit is contained in:
parent
e5c45d4ce0
commit
c3af42356f
@ -19,7 +19,7 @@ namespace dxvk {
|
|||||||
const DxbcAnalysisInfo& analysis)
|
const DxbcAnalysisInfo& analysis)
|
||||||
: m_moduleInfo (moduleInfo),
|
: m_moduleInfo (moduleInfo),
|
||||||
m_programInfo(programInfo),
|
m_programInfo(programInfo),
|
||||||
m_module (spvVersion(1, 3)),
|
m_module (spvVersion(1, 6)),
|
||||||
m_isgn (isgn),
|
m_isgn (isgn),
|
||||||
m_osgn (osgn),
|
m_osgn (osgn),
|
||||||
m_psgn (psgn),
|
m_psgn (psgn),
|
||||||
@ -1483,7 +1483,9 @@ namespace dxvk {
|
|||||||
m_immConstBuf = m_module.newVarInit(
|
m_immConstBuf = m_module.newVarInit(
|
||||||
pointerTypeId, spv::StorageClassPrivate,
|
pointerTypeId, spv::StorageClassPrivate,
|
||||||
arrayId);
|
arrayId);
|
||||||
|
|
||||||
m_module.setDebugName(m_immConstBuf, "icb");
|
m_module.setDebugName(m_immConstBuf, "icb");
|
||||||
|
m_module.decorate(m_immConstBuf, spv::DecorationNonWritable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6262,7 +6264,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
case DxbcSystemValue::RenderTargetId: {
|
case DxbcSystemValue::RenderTargetId: {
|
||||||
if (m_programInfo.type() != DxbcProgramType::GeometryShader)
|
if (m_programInfo.type() != DxbcProgramType::GeometryShader)
|
||||||
enableShaderViewportIndexLayer();
|
m_module.enableCapability(spv::CapabilityShaderLayer);
|
||||||
|
|
||||||
if (m_gs.builtinLayer == 0) {
|
if (m_gs.builtinLayer == 0) {
|
||||||
m_module.enableCapability(spv::CapabilityGeometry);
|
m_module.enableCapability(spv::CapabilityGeometry);
|
||||||
@ -6285,7 +6287,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
case DxbcSystemValue::ViewportId: {
|
case DxbcSystemValue::ViewportId: {
|
||||||
if (m_programInfo.type() != DxbcProgramType::GeometryShader)
|
if (m_programInfo.type() != DxbcProgramType::GeometryShader)
|
||||||
enableShaderViewportIndexLayer();
|
m_module.enableCapability(spv::CapabilityShaderViewportIndex);
|
||||||
|
|
||||||
if (m_gs.builtinViewportId == 0) {
|
if (m_gs.builtinViewportId == 0) {
|
||||||
m_module.enableCapability(spv::CapabilityMultiViewport);
|
m_module.enableCapability(spv::CapabilityMultiViewport);
|
||||||
@ -6801,8 +6803,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
if (m_analysis->usesKill && m_moduleInfo.options.useDemoteToHelperInvocation) {
|
if (m_analysis->usesKill && m_moduleInfo.options.useDemoteToHelperInvocation) {
|
||||||
// This extension basically implements D3D-style discard
|
// This extension basically implements D3D-style discard
|
||||||
m_module.enableExtension("SPV_EXT_demote_to_helper_invocation");
|
m_module.enableCapability(spv::CapabilityDemoteToHelperInvocation);
|
||||||
m_module.enableCapability(spv::CapabilityDemoteToHelperInvocationEXT);
|
|
||||||
} else if (m_analysis->usesKill && m_analysis->usesDerivatives) {
|
} else if (m_analysis->usesKill && m_analysis->usesDerivatives) {
|
||||||
// We may have to defer kill operations to the end of
|
// We may have to defer kill operations to the end of
|
||||||
// the shader in order to keep derivatives correct.
|
// the shader in order to keep derivatives correct.
|
||||||
@ -7409,6 +7410,7 @@ namespace dxvk {
|
|||||||
spv::StorageClassPrivate, samplePosArray);
|
spv::StorageClassPrivate, samplePosArray);
|
||||||
|
|
||||||
m_module.setDebugName(varId, "g_sample_pos");
|
m_module.setDebugName(varId, "g_sample_pos");
|
||||||
|
m_module.decorate(varId, spv::DecorationNonWritable);
|
||||||
return varId;
|
return varId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7515,16 +7517,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxbcCompiler::enableShaderViewportIndexLayer() {
|
|
||||||
if (!m_extensions.shaderViewportIndexLayer) {
|
|
||||||
m_extensions.shaderViewportIndexLayer = true;
|
|
||||||
|
|
||||||
m_module.enableExtension("SPV_EXT_shader_viewport_index_layer");
|
|
||||||
m_module.enableCapability(spv::CapabilityShaderViewportIndexLayerEXT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxbcCfgBlock* DxbcCompiler::cfgFindBlock(
|
DxbcCfgBlock* DxbcCompiler::cfgFindBlock(
|
||||||
const std::initializer_list<DxbcCfgBlockType>& types) {
|
const std::initializer_list<DxbcCfgBlockType>& types) {
|
||||||
for (auto cur = m_controlFlowBlocks.rbegin();
|
for (auto cur = m_controlFlowBlocks.rbegin();
|
||||||
|
@ -353,18 +353,6 @@ namespace dxvk {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief SPIR-V extension set
|
|
||||||
*
|
|
||||||
* Keeps track of which optional SPIR-V extensions
|
|
||||||
* are enabled so that any required setup code is
|
|
||||||
* only run once.
|
|
||||||
*/
|
|
||||||
struct DxbcSpirvExtensions {
|
|
||||||
bool shaderViewportIndexLayer = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief DXBC to SPIR-V shader compiler
|
* \brief DXBC to SPIR-V shader compiler
|
||||||
*
|
*
|
||||||
@ -534,10 +522,6 @@ namespace dxvk {
|
|||||||
DxbcCompilerPsPart m_ps;
|
DxbcCompilerPsPart m_ps;
|
||||||
DxbcCompilerCsPart m_cs;
|
DxbcCompilerCsPart m_cs;
|
||||||
|
|
||||||
/////////////////////////////
|
|
||||||
// Enabled SPIR-V extensions
|
|
||||||
DxbcSpirvExtensions m_extensions;
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
// Global state stuff
|
// Global state stuff
|
||||||
bool m_precise = true;
|
bool m_precise = true;
|
||||||
@ -1198,10 +1182,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
uint32_t emitPushConstants();
|
uint32_t emitPushConstants();
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
// Extension enablement methods
|
|
||||||
void enableShaderViewportIndexLayer();
|
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// Misc methods
|
// Misc methods
|
||||||
DxbcCfgBlock* cfgFindBlock(
|
DxbcCfgBlock* cfgFindBlock(
|
||||||
|
@ -3593,7 +3593,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void SpirvModule::opDemoteToHelperInvocation() {
|
void SpirvModule::opDemoteToHelperInvocation() {
|
||||||
m_code.putIns (spv::OpDemoteToHelperInvocationEXT, 1);
|
m_code.putIns (spv::OpDemoteToHelperInvocation, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user