diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-05-13 09:32:41 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-05-13 09:36:47 +0200 |
commit | 91dddca26eca0c2e00bb2974099908bf26d34f43 (patch) | |
tree | 534a2fd5bef3b757a78dd99429843f6eadc752e4 /src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |
parent | vk_rasterizer: Remove buffer check in attribute selection (diff) | |
download | yuzu-91dddca26eca0c2e00bb2974099908bf26d34f43.tar yuzu-91dddca26eca0c2e00bb2974099908bf26d34f43.tar.gz yuzu-91dddca26eca0c2e00bb2974099908bf26d34f43.tar.bz2 yuzu-91dddca26eca0c2e00bb2974099908bf26d34f43.tar.lz yuzu-91dddca26eca0c2e00bb2974099908bf26d34f43.tar.xz yuzu-91dddca26eca0c2e00bb2974099908bf26d34f43.tar.zst yuzu-91dddca26eca0c2e00bb2974099908bf26d34f43.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index 18678968c..6ce6bfcb5 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp @@ -731,8 +731,10 @@ private: if (!IsGenericAttribute(index)) { continue; } - const u32 location = GetGenericAttributeLocation(index); + if (!IsAttributeEnabled(location)) { + continue; + } const auto type_descriptor = GetAttributeType(location); Id type; if (IsInputAttributeArray()) { @@ -976,6 +978,10 @@ private: return stage == ShaderType::TesselationControl; } + bool IsAttributeEnabled(u32 location) const { + return stage != ShaderType::Vertex || specialization.enabled_attributes[location]; + } + u32 GetNumInputVertices() const { switch (stage) { case ShaderType::Geometry: @@ -1192,16 +1198,20 @@ private: UNIMPLEMENTED_MSG("Unmanaged FrontFacing element={}", element); return {v_float_zero, Type::Float}; default: - if (IsGenericAttribute(attribute)) { - const u32 location = GetGenericAttributeLocation(attribute); - const auto type_descriptor = GetAttributeType(location); - const Type type = type_descriptor.type; - const Id attribute_id = input_attributes.at(attribute); - const std::vector elements = {element}; - const Id pointer = ArrayPass(type_descriptor.scalar, attribute_id, elements); - return {OpLoad(GetTypeDefinition(type), pointer), type}; + if (!IsGenericAttribute(attribute)) { + break; } - break; + const u32 location = GetGenericAttributeLocation(attribute); + if (!IsAttributeEnabled(location)) { + // Disabled attributes (also known as constant attributes) always return zero. + return {v_float_zero, Type::Float}; + } + const auto type_descriptor = GetAttributeType(location); + const Type type = type_descriptor.type; + const Id attribute_id = input_attributes.at(attribute); + const std::vector elements = {element}; + const Id pointer = ArrayPass(type_descriptor.scalar, attribute_id, elements); + return {OpLoad(GetTypeDefinition(type), pointer), type}; } UNIMPLEMENTED_MSG("Unhandled input attribute: {}", static_cast<u32>(attribute)); return {v_float_zero, Type::Float}; |