diff options
author | android-autoroll <android-autoroll@skia-public.iam.gserviceaccount.com> | 2024-01-30 17:35:46 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2024-01-30 17:35:46 +0000 |
commit | 8c9ab44127b65141c427eceeaf75f747d71fb97c (patch) | |
tree | c4180a045d5dce383186528b80bb08aecca6f5fd | |
parent | f54a40198050208eb63e624321c798385336fdf7 (diff) | |
parent | 6f4c9b7b738bf55f7572896ea19788fb46f4e0b2 (diff) | |
download | swiftshader-8c9ab44127b65141c427eceeaf75f747d71fb97c.tar.gz |
Roll SwiftShader from 328e794f0c8b to 2cc2b392c9ef (5 revisions) am: 6f4c9b7b73
Original change: https://android-review.googlesource.com/c/platform/external/swiftshader/+/2936819
Change-Id: Iac5262daa0fad00e2d591adfab777830b76226a9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | src/Device/Renderer.cpp | 6 | ||||
-rw-r--r-- | src/Pipeline/SamplerCore.cpp | 2 | ||||
-rw-r--r-- | src/Pipeline/SpirvShaderSampling.cpp | 6 | ||||
-rw-r--r-- | src/Reactor/BUILD.gn | 2 | ||||
-rw-r--r-- | src/Vulkan/VkImageView.cpp | 10 | ||||
-rw-r--r-- | src/Vulkan/VkImageView.hpp | 5 | ||||
-rw-r--r-- | third_party/llvm-10.0/llvm/include/llvm/Demangle/ItaniumDemangle.h | 7 | ||||
-rw-r--r-- | third_party/llvm-16.0/llvm/include/llvm/Demangle/ItaniumDemangle.h | 6 |
8 files changed, 30 insertions, 14 deletions
diff --git a/src/Device/Renderer.cpp b/src/Device/Renderer.cpp index b80ee4639..93d2993da 100644 --- a/src/Device/Renderer.cpp +++ b/src/Device/Renderer.cpp @@ -285,11 +285,7 @@ void Renderer::draw(const vk::GraphicsPipeline *pipeline, const vk::DynamicState data->layer = layer; data->instanceID = instanceID; data->baseVertex = baseVertex; - - if(indexBuffer) - { - draw->indexType = pipeline->getIndexBuffer().getIndexType(); - } + draw->indexType = indexBuffer ? pipeline->getIndexBuffer().getIndexType() : VK_INDEX_TYPE_UINT16; draw->vertexRoutine = vertexRoutine; diff --git a/src/Pipeline/SamplerCore.cpp b/src/Pipeline/SamplerCore.cpp index 403ed3bdd..ab55c036a 100644 --- a/src/Pipeline/SamplerCore.cpp +++ b/src/Pipeline/SamplerCore.cpp @@ -133,6 +133,8 @@ Vector4f SamplerCore::sampleTexture128(Pointer<Byte> &texture, Float4 uvwa[4], c { // TODO: Eliminate int-float-int conversion. lod = Float(As<Int>(lodOrBias)); + lod = Max(lod, state.minLod); + lod = Min(lod, state.maxLod); } else if(function == Base || function == Gather) { diff --git a/src/Pipeline/SpirvShaderSampling.cpp b/src/Pipeline/SpirvShaderSampling.cpp index 47ce57b64..4c674050e 100644 --- a/src/Pipeline/SpirvShaderSampling.cpp +++ b/src/Pipeline/SpirvShaderSampling.cpp @@ -108,6 +108,12 @@ SpirvEmitter::ImageSampler *SpirvEmitter::getImageSampler(const vk::Device *devi samplerState.minLod = 0.0f; samplerState.maxLod = 0.0f; } + // Otherwise make sure LOD is clamped for robustness + else + { + samplerState.minLod = imageViewState.minLod; + samplerState.maxLod = imageViewState.maxLod; + } } else if(samplerMethod == Write) { diff --git a/src/Reactor/BUILD.gn b/src/Reactor/BUILD.gn index 67dfeb0ec..dcb13614a 100644 --- a/src/Reactor/BUILD.gn +++ b/src/Reactor/BUILD.gn @@ -307,7 +307,7 @@ if (supports_subzero) { if (supports_llvm) { swiftshader_source_set("swiftshader_llvm_reactor") { - llvm_dir = "../../third_party/llvm-10.0" + llvm_dir = "../../third_party/llvm-16.0" deps = [ ":swiftshader_reactor_base", diff --git a/src/Vulkan/VkImageView.cpp b/src/Vulkan/VkImageView.cpp index 511c02cbb..1b25544a5 100644 --- a/src/Vulkan/VkImageView.cpp +++ b/src/Vulkan/VkImageView.cpp @@ -89,13 +89,15 @@ Identifier::Identifier(const VkImageViewCreateInfo *pCreateInfo) const Image *sampledImage = image->getSampledImage(viewFormat); vk::Format samplingFormat = (image == sampledImage) ? viewFormat : sampledImage->getFormat().getAspectFormat(subresource.aspectMask); - pack({ pCreateInfo->viewType, samplingFormat, ResolveComponentMapping(pCreateInfo->components, viewFormat), subresource.levelCount <= 1u }); + pack({ pCreateInfo->viewType, samplingFormat, ResolveComponentMapping(pCreateInfo->components, viewFormat), + static_cast<uint8_t>(subresource.baseMipLevel), + static_cast<uint8_t>(subresource.baseMipLevel + subresource.levelCount), subresource.levelCount <= 1u }); } Identifier::Identifier(VkFormat bufferFormat) { constexpr VkComponentMapping identityMapping = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A }; - pack({ VK_IMAGE_VIEW_TYPE_1D, bufferFormat, ResolveComponentMapping(identityMapping, bufferFormat), true }); + pack({ VK_IMAGE_VIEW_TYPE_1D, bufferFormat, ResolveComponentMapping(identityMapping, bufferFormat), 0, 1, true }); } void Identifier::pack(const State &state) @@ -106,6 +108,8 @@ void Identifier::pack(const State &state) g = static_cast<uint32_t>(state.mapping.g); b = static_cast<uint32_t>(state.mapping.b); a = static_cast<uint32_t>(state.mapping.a); + minLod = state.minLod; + maxLod = state.maxLod; singleMipLevel = state.singleMipLevel; } @@ -117,6 +121,8 @@ Identifier::State Identifier::getState() const static_cast<VkComponentSwizzle>(g), static_cast<VkComponentSwizzle>(b), static_cast<VkComponentSwizzle>(a) }, + static_cast<uint8_t>(minLod), + static_cast<uint8_t>(maxLod), static_cast<bool>(singleMipLevel) }; } diff --git a/src/Vulkan/VkImageView.hpp b/src/Vulkan/VkImageView.hpp index bf4d666a4..25feebc9e 100644 --- a/src/Vulkan/VkImageView.hpp +++ b/src/Vulkan/VkImageView.hpp @@ -53,6 +53,8 @@ union Identifier VkImageViewType imageViewType; VkFormat format; VkComponentMapping mapping; + uint8_t minLod; + uint8_t maxLod; bool singleMipLevel; }; State getState() const; @@ -61,6 +63,7 @@ private: void pack(const State &data); // Identifier is a union of this struct and the integer below. + static_assert(sw::MIPMAP_LEVELS <= 15); struct { uint32_t imageViewType : 3; @@ -69,6 +72,8 @@ private: uint32_t g : 3; uint32_t b : 3; uint32_t a : 3; + uint32_t minLod : 4; + uint32_t maxLod : 4; uint32_t singleMipLevel : 1; }; diff --git a/third_party/llvm-10.0/llvm/include/llvm/Demangle/ItaniumDemangle.h b/third_party/llvm-10.0/llvm/include/llvm/Demangle/ItaniumDemangle.h index 14f8102b4..d1d9617e7 100644 --- a/third_party/llvm-10.0/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/third_party/llvm-10.0/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -28,6 +28,7 @@ #include <cstring> #include <exception> #include <numeric> +#include <type_traits> #include <utility> #define FOR_EACH_NODE_KIND(X) \ @@ -2171,13 +2172,13 @@ FOR_EACH_NODE_KIND(SPECIALIZATION) template <class T, size_t N> class PODSmallVector { - static_assert(std::is_pod<T>::value, - "T is required to be a plain old data type"); + static_assert(std::is_trivial<T>::value, + "T is required to be a trivial type"); T* First = nullptr; T* Last = nullptr; T* Cap = nullptr; - T Inline[N] = {0}; + T Inline[N] = {}; bool isInline() const { return First == Inline; } diff --git a/third_party/llvm-16.0/llvm/include/llvm/Demangle/ItaniumDemangle.h b/third_party/llvm-16.0/llvm/include/llvm/Demangle/ItaniumDemangle.h index 121eae193..e20b04d54 100644 --- a/third_party/llvm-16.0/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/third_party/llvm-16.0/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -33,13 +33,13 @@ DEMANGLE_NAMESPACE_BEGIN template <class T, size_t N> class PODSmallVector { - static_assert(std::is_pod<T>::value, - "T is required to be a plain old data type"); + static_assert(std::is_trivial<T>::value, + "T is required to be a trivial type"); T *First = nullptr; T *Last = nullptr; T *Cap = nullptr; - T Inline[N] = {0}; + T Inline[N] = {}; bool isInline() const { return First == Inline; } |