diff options
| author | 2021-03-30 03:58:46 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:25 -0400 | |
| commit | 7a1c14269e20cffeed780f388c90a86f8bba1a92 (patch) | |
| tree | 3a9807a9ef0d606840fdf645295764213c9cebb2 /src | |
| parent | shader: Add PointCoord attribute (diff) | |
| download | yuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.tar.gz yuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.tar.xz yuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.zip | |
spirv: Add fixed pipeline point size
Diffstat (limited to 'src')
4 files changed, 11 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index 2c93bada5..5cd505d99 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -495,7 +495,7 @@ void EmitContext::DefineOutputs(const Info& info) { | |||
| 495 | if (info.stores_position || stage == Stage::VertexB) { | 495 | if (info.stores_position || stage == Stage::VertexB) { |
| 496 | output_position = DefineOutput(*this, F32[4], spv::BuiltIn::Position); | 496 | output_position = DefineOutput(*this, F32[4], spv::BuiltIn::Position); |
| 497 | } | 497 | } |
| 498 | if (info.stores_point_size) { | 498 | if (info.stores_point_size || profile.fixed_state_point_size) { |
| 499 | if (stage == Stage::Fragment) { | 499 | if (stage == Stage::Fragment) { |
| 500 | throw NotImplementedException("Storing PointSize in Fragment stage"); | 500 | throw NotImplementedException("Storing PointSize in Fragment stage"); |
| 501 | } | 501 | } |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp index 44d2fde02..5f80c189f 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp | |||
| @@ -17,6 +17,10 @@ void EmitPrologue(EmitContext& ctx) { | |||
| 17 | ctx.OpStore(generic_id, default_vector); | 17 | ctx.OpStore(generic_id, default_vector); |
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| 20 | if (ctx.profile.fixed_state_point_size) { | ||
| 21 | const float point_size{*ctx.profile.fixed_state_point_size}; | ||
| 22 | ctx.OpStore(ctx.output_point_size, ctx.Constant(ctx.F32[1], point_size)); | ||
| 23 | } | ||
| 20 | } | 24 | } |
| 21 | } | 25 | } |
| 22 | 26 | ||
diff --git a/src/shader_recompiler/profile.h b/src/shader_recompiler/profile.h index 0276fc23b..f4b94896c 100644 --- a/src/shader_recompiler/profile.h +++ b/src/shader_recompiler/profile.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <optional> | ||
| 8 | 9 | ||
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 10 | 11 | ||
| @@ -41,6 +42,8 @@ struct Profile { | |||
| 41 | 42 | ||
| 42 | std::array<AttributeType, 32> generic_input_types{}; | 43 | std::array<AttributeType, 32> generic_input_types{}; |
| 43 | bool convert_depth_mode{}; | 44 | bool convert_depth_mode{}; |
| 45 | |||
| 46 | std::optional<float> fixed_state_point_size; | ||
| 44 | }; | 47 | }; |
| 45 | 48 | ||
| 46 | } // namespace Shader | 49 | } // namespace Shader |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 6cde01491..eb4df9000 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -864,6 +864,9 @@ Shader::Profile PipelineCache::MakeProfile(const GraphicsPipelineCacheKey& key, | |||
| 864 | Shader::Profile profile{base_profile}; | 864 | Shader::Profile profile{base_profile}; |
| 865 | if (stage == Shader::Stage::VertexB) { | 865 | if (stage == Shader::Stage::VertexB) { |
| 866 | profile.convert_depth_mode = key.state.ndc_minus_one_to_one != 0; | 866 | profile.convert_depth_mode = key.state.ndc_minus_one_to_one != 0; |
| 867 | if (key.state.topology == Maxwell::PrimitiveTopology::Points) { | ||
| 868 | profile.fixed_state_point_size = Common::BitCast<float>(key.state.point_size); | ||
| 869 | } | ||
| 867 | std::ranges::transform(key.state.attributes, profile.generic_input_types.begin(), | 870 | std::ranges::transform(key.state.attributes, profile.generic_input_types.begin(), |
| 868 | &CastAttributeType); | 871 | &CastAttributeType); |
| 869 | } | 872 | } |