summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-02-23 05:45:16 +0100
committerGitHub <noreply@github.com>2020-02-23 05:45:16 +0100
commit2b4cdb73b6d6a8e677db2890b5e9fadc742eb20d (patch)
tree0b37cab74541fc18b3ba3c0a52cf0710548c0033 /src
parentMerge pull request #3422 from ReinUsesLisp/buffer-flush (diff)
parentvk_shader_decompiler: Implement Layer output attribute (diff)
downloadyuzu-2b4cdb73b6d6a8e677db2890b5e9fadc742eb20d.tar
yuzu-2b4cdb73b6d6a8e677db2890b5e9fadc742eb20d.tar.gz
yuzu-2b4cdb73b6d6a8e677db2890b5e9fadc742eb20d.tar.bz2
yuzu-2b4cdb73b6d6a8e677db2890b5e9fadc742eb20d.tar.lz
yuzu-2b4cdb73b6d6a8e677db2890b5e9fadc742eb20d.tar.xz
yuzu-2b4cdb73b6d6a8e677db2890b5e9fadc742eb20d.tar.zst
yuzu-2b4cdb73b6d6a8e677db2890b5e9fadc742eb20d.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index 6d0bf6aa1..2da622d15 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -86,6 +86,7 @@ struct AttributeType {
struct VertexIndices {
std::optional<u32> position;
+ std::optional<u32> layer;
std::optional<u32> viewport;
std::optional<u32> point_size;
std::optional<u32> clip_distances;
@@ -284,9 +285,11 @@ public:
AddExtension("SPV_KHR_variable_pointers");
AddExtension("SPV_KHR_shader_draw_parameters");
- if (ir.UsesViewportIndex()) {
- AddCapability(spv::Capability::MultiViewport);
- if (device.IsExtShaderViewportIndexLayerSupported()) {
+ if (ir.UsesLayer() || ir.UsesViewportIndex()) {
+ if (ir.UsesViewportIndex()) {
+ AddCapability(spv::Capability::MultiViewport);
+ }
+ if (stage != ShaderType::Geometry && device.IsExtShaderViewportIndexLayerSupported()) {
AddExtension("SPV_EXT_shader_viewport_index_layer");
AddCapability(spv::Capability::ShaderViewportIndexLayerEXT);
}
@@ -928,13 +931,22 @@ private:
VertexIndices indices;
indices.position = AddBuiltIn(t_float4, spv::BuiltIn::Position, "position");
+ if (ir.UsesLayer()) {
+ if (stage != ShaderType::Vertex || device.IsExtShaderViewportIndexLayerSupported()) {
+ indices.layer = AddBuiltIn(t_int, spv::BuiltIn::Layer, "layer");
+ } else {
+ LOG_ERROR(
+ Render_Vulkan,
+ "Shader requires Layer but it's not supported on this stage with this device.");
+ }
+ }
+
if (ir.UsesViewportIndex()) {
if (stage != ShaderType::Vertex || device.IsExtShaderViewportIndexLayerSupported()) {
indices.viewport = AddBuiltIn(t_int, spv::BuiltIn::ViewportIndex, "viewport_index");
} else {
- LOG_ERROR(Render_Vulkan,
- "Shader requires ViewportIndex but it's not supported on this "
- "stage with this device.");
+ LOG_ERROR(Render_Vulkan, "Shader requires ViewportIndex but it's not supported on "
+ "this stage with this device.");
}
}
@@ -1296,6 +1308,13 @@ private:
}
case Attribute::Index::LayerViewportPointSize:
switch (element) {
+ case 1: {
+ if (!out_indices.layer) {
+ return {};
+ }
+ const u32 index = out_indices.layer.value();
+ return {AccessElement(t_out_int, out_vertex, index), Type::Int};
+ }
case 2: {
if (!out_indices.viewport) {
return {};
@@ -1366,6 +1385,11 @@ private:
UNIMPLEMENTED();
}
+ if (!target.id) {
+ // On failure we return a nullptr target.id, skip these stores.
+ return {};
+ }
+
OpStore(target.id, As(Visit(src), target.type));
return {};
}