summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-03-30 08:58:46 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:25 +0200
commit7a1c14269e20cffeed780f388c90a86f8bba1a92 (patch)
tree3a9807a9ef0d606840fdf645295764213c9cebb2 /src
parentshader: Add PointCoord attribute (diff)
downloadyuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.tar
yuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.tar.gz
yuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.tar.bz2
yuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.tar.lz
yuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.tar.xz
yuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.tar.zst
yuzu-7a1c14269e20cffeed780f388c90a86f8bba1a92.zip
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.cpp2
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_special.cpp4
-rw-r--r--src/shader_recompiler/profile.h3
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp3
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) {
if (info.stores_position || stage == Stage::VertexB) {
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) {
throw NotImplementedException("Storing PointSize in Fragment stage");
}
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) {
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));
+ }
}
}
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 @@
#pragma once
#include <array>
+#include <optional>
#include "common/common_types.h"
@@ -41,6 +42,8 @@ struct Profile {
std::array<AttributeType, 32> generic_input_types{};
bool convert_depth_mode{};
+
+ std::optional<float> fixed_state_point_size;
};
} // 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,
Shader::Profile profile{base_profile};
if (stage == Shader::Stage::VertexB) {
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(),
&CastAttributeType);
}