Commit 58edd47c by Nicolas Capens Committed by Nicolas Capens

Implement sampler LOD bias

Factor the duplicate code out of 2D/3D/Cube LOD calculation and add the mipLodBias field from the sampler descriptor. Bug: b/129523279 Test: dEQP-VK.pipeline.sampler.* Change-Id: I7e25fad13fbe3307dddb2dcb853ed638344ee4aa Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30429 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com>
parent b1670ed4
......@@ -121,6 +121,7 @@ namespace sw
if(function != Base)
{
lod += *Pointer<Float>(sampler + OFFSET(vk::Sampler, mipLodBias));
lod = Max(lod, *Pointer<Float>(sampler + OFFSET(vk::Sampler, minLod)));
lod = Min(lod, *Pointer<Float>(sampler + OFFSET(vk::Sampler, maxLod)));
}
......
......@@ -68,10 +68,6 @@ SpirvShader::ImageSampler *SpirvShader::getImageSampler(uint32_t inst, const vk:
samplerState.highPrecisionFiltering = false;
samplerState.compare = COMPARE_BYPASS; ASSERT(sampler->compareEnable == VK_FALSE); // TODO(b/129523279)
// minLod // TODO(b/129523279)
// maxLod // TODO(b/129523279)
// borderColor // TODO(b/129523279)
ASSERT(sampler->mipLodBias == 0.0f); // TODO(b/129523279)
ASSERT(sampler->anisotropyEnable == VK_FALSE); // TODO(b/129523279)
ASSERT(sampler->unnormalizedCoordinates == VK_FALSE); // TODO(b/129523279)
......
......@@ -13,10 +13,11 @@
// limitations under the License.
#include "VkPhysicalDevice.hpp"
#include "VkConfig.h"
#include "VkConfig.h"
#include "Pipeline/SpirvShader.hpp" // sw::SIMD::Width
#include <limits>
#include <cstring>
namespace vk
......@@ -204,7 +205,7 @@ const VkPhysicalDeviceLimits& PhysicalDevice::getLimits() const
4, // mipmapPrecisionBits
UINT32_MAX, // maxDrawIndexedIndexValue
UINT32_MAX, // maxDrawIndirectCount
2, // maxSamplerLodBias
std::numeric_limits<float>::infinity(), // maxSamplerLodBias (no clamping takes place)
16, // maxSamplerAnisotropy
16, // maxViewports
{ 4096, 4096 }, // maxViewportDimensions[2]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment