|
|
@ -937,6 +937,8 @@ bool AccelerateDMA::BufferToImage(const Tegra::DMA::ImageCopy& copy_info, |
|
|
|
|
|
|
|
|
void RasterizerVulkan::UpdateDynamicStates() { |
|
|
void RasterizerVulkan::UpdateDynamicStates() { |
|
|
auto& regs = maxwell3d->regs; |
|
|
auto& regs = maxwell3d->regs; |
|
|
|
|
|
|
|
|
|
|
|
// Core Dynamic States (Vulkan 1.0) - Always active regardless of dyna_state setting
|
|
|
UpdateViewportsState(regs); |
|
|
UpdateViewportsState(regs); |
|
|
UpdateScissorsState(regs); |
|
|
UpdateScissorsState(regs); |
|
|
UpdateDepthBias(regs); |
|
|
UpdateDepthBias(regs); |
|
|
@ -944,6 +946,15 @@ void RasterizerVulkan::UpdateDynamicStates() { |
|
|
UpdateDepthBounds(regs); |
|
|
UpdateDepthBounds(regs); |
|
|
UpdateStencilFaces(regs); |
|
|
UpdateStencilFaces(regs); |
|
|
UpdateLineWidth(regs); |
|
|
UpdateLineWidth(regs); |
|
|
|
|
|
|
|
|
|
|
|
// Extended Dynamic States (EDS) - Controlled by dyna_state setting in vulkan_device.cpp
|
|
|
|
|
|
// User granularity levels (accumulative):
|
|
|
|
|
|
// Level 0: Core only
|
|
|
|
|
|
// Level 1: Core + EDS1
|
|
|
|
|
|
// Level 2: Core + EDS1 + EDS2
|
|
|
|
|
|
// Level 3: Core + EDS1 + EDS2 + EDS3
|
|
|
|
|
|
|
|
|
|
|
|
// EDS1: CullMode, DepthCompare, FrontFace, StencilOp, DepthBoundsTest, DepthTest, DepthWrite, StencilTest
|
|
|
if (device.IsExtExtendedDynamicStateSupported()) { |
|
|
if (device.IsExtExtendedDynamicStateSupported()) { |
|
|
UpdateCullMode(regs); |
|
|
UpdateCullMode(regs); |
|
|
UpdateDepthCompareOp(regs); |
|
|
UpdateDepthCompareOp(regs); |
|
|
@ -955,16 +966,26 @@ void RasterizerVulkan::UpdateDynamicStates() { |
|
|
UpdateDepthWriteEnable(regs); |
|
|
UpdateDepthWriteEnable(regs); |
|
|
UpdateStencilTestEnable(regs); |
|
|
UpdateStencilTestEnable(regs); |
|
|
} |
|
|
} |
|
|
// EDS2 states must always be set, not just when TouchStateEnable() is true
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// EDS2: PrimitiveRestart, RasterizerDiscard, DepthBias enable/disable
|
|
|
if (device.IsExtExtendedDynamicState2Supported()) { |
|
|
if (device.IsExtExtendedDynamicState2Supported()) { |
|
|
UpdatePrimitiveRestartEnable(regs); |
|
|
UpdatePrimitiveRestartEnable(regs); |
|
|
UpdateRasterizerDiscardEnable(regs); |
|
|
UpdateRasterizerDiscardEnable(regs); |
|
|
UpdateDepthBiasEnable(regs); |
|
|
UpdateDepthBiasEnable(regs); |
|
|
} |
|
|
} |
|
|
if (state_tracker.TouchStateEnable()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// EDS2 Extras: LogicOp operation selection
|
|
|
|
|
|
if (device.IsExtExtendedDynamicState2ExtrasSupported()) { |
|
|
|
|
|
UpdateLogicOp(regs); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// EDS3 Enables: LogicOpEnable, DepthClamp, LineStipple, ConservativeRaster
|
|
|
if (device.IsExtExtendedDynamicState3EnablesSupported()) { |
|
|
if (device.IsExtExtendedDynamicState3EnablesSupported()) { |
|
|
using namespace Tegra::Engines; |
|
|
using namespace Tegra::Engines; |
|
|
if (device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_OPEN_SOURCE || device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_PROPRIETARY) { |
|
|
|
|
|
|
|
|
// AMD Workaround: LogicOp incompatible with float render targets
|
|
|
|
|
|
if (device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_OPEN_SOURCE || |
|
|
|
|
|
device.GetDriverID() == VkDriverIdKHR::VK_DRIVER_ID_AMD_PROPRIETARY) { |
|
|
const auto has_float = std::any_of( |
|
|
const auto has_float = std::any_of( |
|
|
regs.vertex_attrib_format.begin(), |
|
|
regs.vertex_attrib_format.begin(), |
|
|
regs.vertex_attrib_format.end(), |
|
|
regs.vertex_attrib_format.end(), |
|
|
@ -978,19 +999,16 @@ void RasterizerVulkan::UpdateDynamicStates() { |
|
|
} |
|
|
} |
|
|
UpdateLogicOpEnable(regs); |
|
|
UpdateLogicOpEnable(regs); |
|
|
UpdateDepthClampEnable(regs); |
|
|
UpdateDepthClampEnable(regs); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (device.IsExtExtendedDynamicState2ExtrasSupported()) { |
|
|
|
|
|
UpdateLogicOp(regs); |
|
|
|
|
|
} |
|
|
|
|
|
if (device.IsExtExtendedDynamicState3BlendingSupported()) { |
|
|
|
|
|
UpdateBlending(regs); |
|
|
|
|
|
} |
|
|
|
|
|
if (device.IsExtExtendedDynamicState3EnablesSupported()) { |
|
|
|
|
|
UpdateLineStippleEnable(regs); |
|
|
UpdateLineStippleEnable(regs); |
|
|
UpdateConservativeRasterizationMode(regs); |
|
|
UpdateConservativeRasterizationMode(regs); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// EDS3 Blending: ColorBlendEnable, ColorBlendEquation, ColorWriteMask
|
|
|
|
|
|
if (device.IsExtExtendedDynamicState3BlendingSupported()) { |
|
|
|
|
|
UpdateBlending(regs); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Vertex Input Dynamic State: Independent from EDS levels
|
|
|
if (device.IsExtVertexInputDynamicStateSupported()) { |
|
|
if (device.IsExtVertexInputDynamicStateSupported()) { |
|
|
if (auto* gp = pipeline_cache.CurrentGraphicsPipeline(); gp && gp->HasDynamicVertexInput()) { |
|
|
if (auto* gp = pipeline_cache.CurrentGraphicsPipeline(); gp && gp->HasDynamicVertexInput()) { |
|
|
UpdateVertexInput(regs); |
|
|
UpdateVertexInput(regs); |
|
|
|