diff options
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/fixed_pipeline_state.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 31 |
4 files changed, 20 insertions, 19 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 471d5686a..1aa43523a 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -305,10 +305,6 @@ public: | |||
| 305 | return (type == Type::SignedNorm) || (type == Type::UnsignedNorm); | 305 | return (type == Type::SignedNorm) || (type == Type::UnsignedNorm); |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | bool IsConstant() const { | ||
| 309 | return constant; | ||
| 310 | } | ||
| 311 | |||
| 312 | bool IsValid() const { | 308 | bool IsValid() const { |
| 313 | return size != Size::Invalid; | 309 | return size != Size::Invalid; |
| 314 | } | 310 | } |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 0f0d780b5..41d2b73f4 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -97,7 +97,7 @@ void RasterizerOpenGL::SyncVertexFormats() { | |||
| 97 | const auto gl_index = static_cast<GLuint>(index); | 97 | const auto gl_index = static_cast<GLuint>(index); |
| 98 | 98 | ||
| 99 | // Disable constant attributes. | 99 | // Disable constant attributes. |
| 100 | if (attrib.IsConstant()) { | 100 | if (attrib.constant) { |
| 101 | glDisableVertexAttribArray(gl_index); | 101 | glDisableVertexAttribArray(gl_index); |
| 102 | continue; | 102 | continue; |
| 103 | } | 103 | } |
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp index d089da8a4..d70153df3 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp | |||
| @@ -128,7 +128,7 @@ void FixedPipelineState::Refresh(Tegra::Engines::Maxwell3D& maxwell3d, | |||
| 128 | const auto& input = regs.vertex_attrib_format[index]; | 128 | const auto& input = regs.vertex_attrib_format[index]; |
| 129 | auto& attribute = attributes[index]; | 129 | auto& attribute = attributes[index]; |
| 130 | attribute.raw = 0; | 130 | attribute.raw = 0; |
| 131 | attribute.enabled.Assign(input.IsConstant() ? 0 : 1); | 131 | attribute.enabled.Assign(input.constant ? 0 : 1); |
| 132 | attribute.buffer.Assign(input.buffer); | 132 | attribute.buffer.Assign(input.buffer); |
| 133 | attribute.offset.Assign(input.offset); | 133 | attribute.offset.Assign(input.offset); |
| 134 | attribute.type.Assign(static_cast<u32>(input.type.Value())); | 134 | attribute.type.Assign(static_cast<u32>(input.type.Value())); |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index bb7301c53..99576b826 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -801,25 +801,30 @@ void RasterizerVulkan::UpdateVertexInput(Tegra::Engines::Maxwell3D::Regs& regs) | |||
| 801 | boost::container::static_vector<VkVertexInputBindingDescription2EXT, 32> bindings; | 801 | boost::container::static_vector<VkVertexInputBindingDescription2EXT, 32> bindings; |
| 802 | boost::container::static_vector<VkVertexInputAttributeDescription2EXT, 32> attributes; | 802 | boost::container::static_vector<VkVertexInputAttributeDescription2EXT, 32> attributes; |
| 803 | 803 | ||
| 804 | // There seems to be a bug on Nvidia's driver where updating only higher attributes ends up | ||
| 805 | // generating dirty state. Track the highest dirty attribute and update all attributes until | ||
| 806 | // that one. | ||
| 807 | size_t highest_dirty_attr{}; | ||
| 804 | for (size_t index = 0; index < Maxwell::NumVertexAttributes; ++index) { | 808 | for (size_t index = 0; index < Maxwell::NumVertexAttributes; ++index) { |
| 805 | if (!dirty[Dirty::VertexAttribute0 + index]) { | 809 | if (dirty[Dirty::VertexAttribute0 + index]) { |
| 806 | continue; | 810 | highest_dirty_attr = index; |
| 807 | } | 811 | } |
| 812 | } | ||
| 813 | for (size_t index = 0; index < highest_dirty_attr; ++index) { | ||
| 808 | const Maxwell::VertexAttribute attribute{regs.vertex_attrib_format[index]}; | 814 | const Maxwell::VertexAttribute attribute{regs.vertex_attrib_format[index]}; |
| 809 | const u32 binding{attribute.buffer}; | 815 | const u32 binding{attribute.buffer}; |
| 810 | dirty[Dirty::VertexAttribute0 + index] = false; | 816 | dirty[Dirty::VertexAttribute0 + index] = false; |
| 811 | dirty[Dirty::VertexBinding0 + static_cast<size_t>(binding)] = true; | 817 | dirty[Dirty::VertexBinding0 + static_cast<size_t>(binding)] = true; |
| 812 | 818 | if (!attribute.constant) { | |
| 813 | attributes.push_back({ | 819 | attributes.push_back({ |
| 814 | .sType = VK_STRUCTURE_TYPE_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION_2_EXT, | 820 | .sType = VK_STRUCTURE_TYPE_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION_2_EXT, |
| 815 | .pNext = nullptr, | 821 | .pNext = nullptr, |
| 816 | .location = static_cast<u32>(index), | 822 | .location = static_cast<u32>(index), |
| 817 | .binding = binding, | 823 | .binding = binding, |
| 818 | .format = attribute.IsConstant() | 824 | .format = MaxwellToVK::VertexFormat(attribute.type, attribute.size), |
| 819 | ? VK_FORMAT_A8B8G8R8_UNORM_PACK32 | 825 | .offset = attribute.offset, |
| 820 | : MaxwellToVK::VertexFormat(attribute.type, attribute.size), | 826 | }); |
| 821 | .offset = attribute.offset, | 827 | } |
| 822 | }); | ||
| 823 | } | 828 | } |
| 824 | for (size_t index = 0; index < Maxwell::NumVertexAttributes; ++index) { | 829 | for (size_t index = 0; index < Maxwell::NumVertexAttributes; ++index) { |
| 825 | if (!dirty[Dirty::VertexBinding0 + index]) { | 830 | if (!dirty[Dirty::VertexBinding0 + index]) { |