mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 04:54:15 +01:00
[dxbc] Implement rasterizer ordered views
This commit is contained in:
parent
8ca5edeacd
commit
35a84053b5
@ -6950,11 +6950,31 @@ namespace dxvk {
|
|||||||
this->emitInputSetup();
|
this->emitInputSetup();
|
||||||
this->emitClipCullLoad(DxbcSystemValue::ClipDistance, m_clipDistances);
|
this->emitClipCullLoad(DxbcSystemValue::ClipDistance, m_clipDistances);
|
||||||
this->emitClipCullLoad(DxbcSystemValue::CullDistance, m_cullDistances);
|
this->emitClipCullLoad(DxbcSystemValue::CullDistance, m_cullDistances);
|
||||||
|
|
||||||
|
if (m_hasRasterizerOrderedUav) {
|
||||||
|
// For simplicity, just lock the entire fragment shader
|
||||||
|
// if there are any rasterizer ordered views.
|
||||||
|
m_module.enableExtension("SPV_EXT_fragment_shader_interlock");
|
||||||
|
|
||||||
|
if (m_module.hasCapability(spv::CapabilitySampleRateShading)
|
||||||
|
&& m_moduleInfo.options.enableSampleShadingInterlock) {
|
||||||
|
m_module.enableCapability(spv::CapabilityFragmentShaderSampleInterlockEXT);
|
||||||
|
m_module.setExecutionMode(m_entryPointId, spv::ExecutionModeSampleInterlockOrderedEXT);
|
||||||
|
} else {
|
||||||
|
m_module.enableCapability(spv::CapabilityFragmentShaderPixelInterlockEXT);
|
||||||
|
m_module.setExecutionMode(m_entryPointId, spv::ExecutionModePixelInterlockOrderedEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_module.opBeginInvocationInterlock();
|
||||||
|
}
|
||||||
|
|
||||||
m_module.opFunctionCall(
|
m_module.opFunctionCall(
|
||||||
m_module.defVoidType(),
|
m_module.defVoidType(),
|
||||||
m_ps.functionId, 0, nullptr);
|
m_ps.functionId, 0, nullptr);
|
||||||
|
|
||||||
|
if (m_hasRasterizerOrderedUav)
|
||||||
|
m_module.opEndInvocationInterlock();
|
||||||
|
|
||||||
this->emitOutputSetup();
|
this->emitOutputSetup();
|
||||||
|
|
||||||
if (m_moduleInfo.options.useDepthClipWorkaround)
|
if (m_moduleInfo.options.useDepthClipWorkaround)
|
||||||
@ -7768,6 +7788,15 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
uint32_t DxbcCompiler::getUavCoherence(uint32_t registerId, DxbcUavFlags flags) {
|
uint32_t DxbcCompiler::getUavCoherence(uint32_t registerId, DxbcUavFlags flags) {
|
||||||
|
// For any ROV with write access, we must ensure that
|
||||||
|
// availability operations happen within the locked scope.
|
||||||
|
if (flags.test(DxbcUavFlag::RasterizerOrdered)
|
||||||
|
&& (m_analysis->uavInfos[registerId].accessFlags & VK_ACCESS_SHADER_WRITE_BIT)) {
|
||||||
|
m_hasGloballyCoherentUav = true;
|
||||||
|
m_hasRasterizerOrderedUav = true;
|
||||||
|
return spv::ScopeQueueFamily;
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore any resources that can't both be read and written in
|
// Ignore any resources that can't both be read and written in
|
||||||
// the current shader, explicit availability/visibility operands
|
// the current shader, explicit availability/visibility operands
|
||||||
// are not useful in that case.
|
// are not useful in that case.
|
||||||
|
@ -454,6 +454,7 @@ namespace dxvk {
|
|||||||
std::array<DxbcUav, 64> m_uavs;
|
std::array<DxbcUav, 64> m_uavs;
|
||||||
|
|
||||||
bool m_hasGloballyCoherentUav = false;
|
bool m_hasGloballyCoherentUav = false;
|
||||||
|
bool m_hasRasterizerOrderedUav = false;
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Control flow information. Stores labels for
|
// Control flow information. Stores labels for
|
||||||
|
@ -39,6 +39,7 @@ namespace dxvk {
|
|||||||
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
||||||
forceVolatileTgsmAccess = options.forceVolatileTgsmAccess;
|
forceVolatileTgsmAccess = options.forceVolatileTgsmAccess;
|
||||||
disableMsaa = options.disableMsaa;
|
disableMsaa = options.disableMsaa;
|
||||||
|
enableSampleShadingInterlock = device->features().extFragmentShaderInterlock.fragmentShaderSampleInterlock;
|
||||||
|
|
||||||
// Figure out float control flags to match D3D11 rules
|
// Figure out float control flags to match D3D11 rules
|
||||||
if (options.floatControls) {
|
if (options.floatControls) {
|
||||||
|
@ -46,6 +46,9 @@ namespace dxvk {
|
|||||||
/// Replace ld_ms with ld
|
/// Replace ld_ms with ld
|
||||||
bool disableMsaa = false;
|
bool disableMsaa = false;
|
||||||
|
|
||||||
|
// Enable per-sample interlock if supported
|
||||||
|
bool enableSampleShadingInterlock = false;
|
||||||
|
|
||||||
/// Float control flags
|
/// Float control flags
|
||||||
DxbcFloatControlFlags floatControl;
|
DxbcFloatControlFlags floatControl;
|
||||||
|
|
||||||
|
@ -3693,6 +3693,16 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SpirvModule::opBeginInvocationInterlock() {
|
||||||
|
m_code.putIns(spv::OpBeginInvocationInterlockEXT, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SpirvModule::opEndInvocationInterlock() {
|
||||||
|
m_code.putIns(spv::OpEndInvocationInterlockEXT, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t SpirvModule::defType(
|
uint32_t SpirvModule::defType(
|
||||||
spv::Op op,
|
spv::Op op,
|
||||||
uint32_t argCount,
|
uint32_t argCount,
|
||||||
|
@ -1259,7 +1259,11 @@ namespace dxvk {
|
|||||||
|
|
||||||
void opEndPrimitive(
|
void opEndPrimitive(
|
||||||
uint32_t streamId);
|
uint32_t streamId);
|
||||||
|
|
||||||
|
void opBeginInvocationInterlock();
|
||||||
|
|
||||||
|
void opEndInvocationInterlock();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint32_t m_version;
|
uint32_t m_version;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user