summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp35
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.h12
2 files changed, 21 insertions, 26 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index eb9c49d5e..02027b7d5 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -726,13 +726,13 @@ void RasterizerVulkan::SetupImageTransitions(
726} 726}
727 727
728void RasterizerVulkan::UpdateDynamicStates() { 728void RasterizerVulkan::UpdateDynamicStates() {
729 auto& gpu = system.GPU().Maxwell3D(); 729 auto& regs = system.GPU().Maxwell3D().regs;
730 UpdateViewportsState(gpu); 730 UpdateViewportsState(regs);
731 UpdateScissorsState(gpu); 731 UpdateScissorsState(regs);
732 UpdateDepthBias(gpu); 732 UpdateDepthBias(regs);
733 UpdateBlendConstants(gpu); 733 UpdateBlendConstants(regs);
734 UpdateDepthBounds(gpu); 734 UpdateDepthBounds(regs);
735 UpdateStencilFaces(gpu); 735 UpdateStencilFaces(regs);
736} 736}
737 737
738void RasterizerVulkan::SetupVertexArrays(FixedPipelineState::VertexInput& vertex_input, 738void RasterizerVulkan::SetupVertexArrays(FixedPipelineState::VertexInput& vertex_input,
@@ -978,11 +978,10 @@ void RasterizerVulkan::SetupImage(const Tegra::Texture::TICEntry& tic, const Ima
978 image_views.push_back(ImageView{std::move(view), image_layout}); 978 image_views.push_back(ImageView{std::move(view), image_layout});
979} 979}
980 980
981void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D& gpu) { 981void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& regs) {
982 if (!state_tracker.TouchViewports()) { 982 if (!state_tracker.TouchViewports()) {
983 return; 983 return;
984 } 984 }
985 const auto& regs = gpu.regs;
986 const std::array viewports{ 985 const std::array viewports{
987 GetViewportState(device, regs, 0), GetViewportState(device, regs, 1), 986 GetViewportState(device, regs, 0), GetViewportState(device, regs, 1),
988 GetViewportState(device, regs, 2), GetViewportState(device, regs, 3), 987 GetViewportState(device, regs, 2), GetViewportState(device, regs, 3),
@@ -997,11 +996,10 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D& gpu) {
997 }); 996 });
998} 997}
999 998
1000void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu) { 999void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs) {
1001 if (!state_tracker.TouchScissors()) { 1000 if (!state_tracker.TouchScissors()) {
1002 return; 1001 return;
1003 } 1002 }
1004 const auto& regs = gpu.regs;
1005 const std::array scissors = { 1003 const std::array scissors = {
1006 GetScissorState(regs, 0), GetScissorState(regs, 1), GetScissorState(regs, 2), 1004 GetScissorState(regs, 0), GetScissorState(regs, 1), GetScissorState(regs, 2),
1007 GetScissorState(regs, 3), GetScissorState(regs, 4), GetScissorState(regs, 5), 1005 GetScissorState(regs, 3), GetScissorState(regs, 4), GetScissorState(regs, 5),
@@ -1014,42 +1012,39 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu) {
1014 }); 1012 });
1015} 1013}
1016 1014
1017void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D& gpu) { 1015void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) {
1018 if (!state_tracker.TouchDepthBias()) { 1016 if (!state_tracker.TouchDepthBias()) {
1019 return; 1017 return;
1020 } 1018 }
1021 const auto& regs = gpu.regs;
1022 scheduler.Record([constant = regs.polygon_offset_units, clamp = regs.polygon_offset_clamp, 1019 scheduler.Record([constant = regs.polygon_offset_units, clamp = regs.polygon_offset_clamp,
1023 factor = regs.polygon_offset_factor](auto cmdbuf, auto& dld) { 1020 factor = regs.polygon_offset_factor](auto cmdbuf, auto& dld) {
1024 cmdbuf.setDepthBias(constant, clamp, factor / 2.0f, dld); 1021 cmdbuf.setDepthBias(constant, clamp, factor / 2.0f, dld);
1025 }); 1022 });
1026} 1023}
1027 1024
1028void RasterizerVulkan::UpdateBlendConstants(Tegra::Engines::Maxwell3D& gpu) { 1025void RasterizerVulkan::UpdateBlendConstants(Tegra::Engines::Maxwell3D::Regs& regs) {
1029 if (!state_tracker.TouchBlendConstants()) { 1026 if (!state_tracker.TouchBlendConstants()) {
1030 return; 1027 return;
1031 } 1028 }
1032 const std::array blend_color = {gpu.regs.blend_color.r, gpu.regs.blend_color.g, 1029 const std::array blend_color = {regs.blend_color.r, regs.blend_color.g, regs.blend_color.b,
1033 gpu.regs.blend_color.b, gpu.regs.blend_color.a}; 1030 regs.blend_color.a};
1034 scheduler.Record([blend_color](auto cmdbuf, auto& dld) { 1031 scheduler.Record([blend_color](auto cmdbuf, auto& dld) {
1035 cmdbuf.setBlendConstants(blend_color.data(), dld); 1032 cmdbuf.setBlendConstants(blend_color.data(), dld);
1036 }); 1033 });
1037} 1034}
1038 1035
1039void RasterizerVulkan::UpdateDepthBounds(Tegra::Engines::Maxwell3D& gpu) { 1036void RasterizerVulkan::UpdateDepthBounds(Tegra::Engines::Maxwell3D::Regs& regs) {
1040 if (!state_tracker.TouchDepthBounds()) { 1037 if (!state_tracker.TouchDepthBounds()) {
1041 return; 1038 return;
1042 } 1039 }
1043 const auto& regs = gpu.regs;
1044 scheduler.Record([min = regs.depth_bounds[0], max = regs.depth_bounds[1]]( 1040 scheduler.Record([min = regs.depth_bounds[0], max = regs.depth_bounds[1]](
1045 auto cmdbuf, auto& dld) { cmdbuf.setDepthBounds(min, max, dld); }); 1041 auto cmdbuf, auto& dld) { cmdbuf.setDepthBounds(min, max, dld); });
1046} 1042}
1047 1043
1048void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D& gpu) { 1044void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs) {
1049 if (!state_tracker.TouchStencilProperties()) { 1045 if (!state_tracker.TouchStencilProperties()) {
1050 return; 1046 return;
1051 } 1047 }
1052 const auto& regs = gpu.regs;
1053 if (regs.stencil_two_side_enable) { 1048 if (regs.stencil_two_side_enable) {
1054 // Separate values per face 1049 // Separate values per face
1055 scheduler.Record( 1050 scheduler.Record(
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h
index a79440eba..96ea05f0a 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.h
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.h
@@ -217,12 +217,12 @@ private:
217 217
218 void SetupImage(const Tegra::Texture::TICEntry& tic, const ImageEntry& entry); 218 void SetupImage(const Tegra::Texture::TICEntry& tic, const ImageEntry& entry);
219 219
220 void UpdateViewportsState(Tegra::Engines::Maxwell3D& gpu); 220 void UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& regs);
221 void UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu); 221 void UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs);
222 void UpdateDepthBias(Tegra::Engines::Maxwell3D& gpu); 222 void UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs);
223 void UpdateBlendConstants(Tegra::Engines::Maxwell3D& gpu); 223 void UpdateBlendConstants(Tegra::Engines::Maxwell3D::Regs& regs);
224 void UpdateDepthBounds(Tegra::Engines::Maxwell3D& gpu); 224 void UpdateDepthBounds(Tegra::Engines::Maxwell3D::Regs& regs);
225 void UpdateStencilFaces(Tegra::Engines::Maxwell3D& gpu); 225 void UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs);
226 226
227 std::size_t CalculateGraphicsStreamBufferSize(bool is_indexed) const; 227 std::size_t CalculateGraphicsStreamBufferSize(bool is_indexed) const;
228 228