spirv: Add fixed pipeline point size
This commit is contained in:
		| @@ -495,7 +495,7 @@ void EmitContext::DefineOutputs(const Info& info) { | |||||||
|     if (info.stores_position || stage == Stage::VertexB) { |     if (info.stores_position || stage == Stage::VertexB) { | ||||||
|         output_position = DefineOutput(*this, F32[4], spv::BuiltIn::Position); |         output_position = DefineOutput(*this, F32[4], spv::BuiltIn::Position); | ||||||
|     } |     } | ||||||
|     if (info.stores_point_size) { |     if (info.stores_point_size || profile.fixed_state_point_size) { | ||||||
|         if (stage == Stage::Fragment) { |         if (stage == Stage::Fragment) { | ||||||
|             throw NotImplementedException("Storing PointSize in Fragment stage"); |             throw NotImplementedException("Storing PointSize in Fragment stage"); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -17,6 +17,10 @@ void EmitPrologue(EmitContext& ctx) { | |||||||
|                 ctx.OpStore(generic_id, default_vector); |                 ctx.OpStore(generic_id, default_vector); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if (ctx.profile.fixed_state_point_size) { | ||||||
|  |             const float point_size{*ctx.profile.fixed_state_point_size}; | ||||||
|  |             ctx.OpStore(ctx.output_point_size, ctx.Constant(ctx.F32[1], point_size)); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
| #include <array> | #include <array> | ||||||
|  | #include <optional> | ||||||
|  |  | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
|  |  | ||||||
| @@ -41,6 +42,8 @@ struct Profile { | |||||||
|  |  | ||||||
|     std::array<AttributeType, 32> generic_input_types{}; |     std::array<AttributeType, 32> generic_input_types{}; | ||||||
|     bool convert_depth_mode{}; |     bool convert_depth_mode{}; | ||||||
|  |  | ||||||
|  |     std::optional<float> fixed_state_point_size; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| } // namespace Shader | } // namespace Shader | ||||||
|   | |||||||
| @@ -864,6 +864,9 @@ Shader::Profile PipelineCache::MakeProfile(const GraphicsPipelineCacheKey& key, | |||||||
|     Shader::Profile profile{base_profile}; |     Shader::Profile profile{base_profile}; | ||||||
|     if (stage == Shader::Stage::VertexB) { |     if (stage == Shader::Stage::VertexB) { | ||||||
|         profile.convert_depth_mode = key.state.ndc_minus_one_to_one != 0; |         profile.convert_depth_mode = key.state.ndc_minus_one_to_one != 0; | ||||||
|  |         if (key.state.topology == Maxwell::PrimitiveTopology::Points) { | ||||||
|  |             profile.fixed_state_point_size = Common::BitCast<float>(key.state.point_size); | ||||||
|  |         } | ||||||
|         std::ranges::transform(key.state.attributes, profile.generic_input_types.begin(), |         std::ranges::transform(key.state.attributes, profile.generic_input_types.begin(), | ||||||
|                                &CastAttributeType); |                                &CastAttributeType); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user