Commit f87bd3dc by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Implement EXT_texture_filter_anisotropic

Bug: angleproject:2901 Change-Id: If05b4a5270ac1c0bebc3fc854b2aff710e554ce1 Reviewed-on: https://chromium-review.googlesource.com/c/1325730 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent fca8fd62
...@@ -968,14 +968,18 @@ angle::Result TextureVk::syncState(const gl::Context *context, ...@@ -968,14 +968,18 @@ angle::Result TextureVk::syncState(const gl::Context *context,
} }
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
RendererVk *renderer = contextVk->getRenderer();
if (mSampler.valid()) if (mSampler.valid())
{ {
RendererVk *renderer = contextVk->getRenderer();
renderer->releaseObject(renderer->getCurrentQueueSerial(), &mSampler); renderer->releaseObject(renderer->getCurrentQueueSerial(), &mSampler);
} }
const gl::Extensions &extensions = renderer->getNativeExtensions();
const gl::SamplerState &samplerState = mState.getSamplerState(); const gl::SamplerState &samplerState = mState.getSamplerState();
float maxAnisotropy = samplerState.getMaxAnisotropy();
bool anisotropyEnable = extensions.textureFilterAnisotropic && maxAnisotropy > 1.0f;
// Create a simple sampler. Force basic parameter settings. // Create a simple sampler. Force basic parameter settings.
VkSamplerCreateInfo samplerInfo = {}; VkSamplerCreateInfo samplerInfo = {};
samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
...@@ -987,8 +991,8 @@ angle::Result TextureVk::syncState(const gl::Context *context, ...@@ -987,8 +991,8 @@ angle::Result TextureVk::syncState(const gl::Context *context,
samplerInfo.addressModeV = gl_vk::GetSamplerAddressMode(samplerState.getWrapT()); samplerInfo.addressModeV = gl_vk::GetSamplerAddressMode(samplerState.getWrapT());
samplerInfo.addressModeW = gl_vk::GetSamplerAddressMode(samplerState.getWrapR()); samplerInfo.addressModeW = gl_vk::GetSamplerAddressMode(samplerState.getWrapR());
samplerInfo.mipLodBias = 0.0f; samplerInfo.mipLodBias = 0.0f;
samplerInfo.anisotropyEnable = VK_FALSE; samplerInfo.anisotropyEnable = anisotropyEnable;
samplerInfo.maxAnisotropy = 1.0f; samplerInfo.maxAnisotropy = maxAnisotropy;
samplerInfo.compareEnable = VK_FALSE; samplerInfo.compareEnable = VK_FALSE;
samplerInfo.compareOp = VK_COMPARE_OP_ALWAYS; samplerInfo.compareOp = VK_COMPARE_OP_ALWAYS;
samplerInfo.minLod = samplerState.getMinLod(); samplerInfo.minLod = samplerState.getMinLod();
......
...@@ -63,6 +63,13 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties, ...@@ -63,6 +63,13 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties,
outExtensions->queryCounterBitsTimeElapsed = queueFamilyProperties.timestampValidBits; outExtensions->queryCounterBitsTimeElapsed = queueFamilyProperties.timestampValidBits;
outExtensions->queryCounterBitsTimestamp = queueFamilyProperties.timestampValidBits; outExtensions->queryCounterBitsTimestamp = queueFamilyProperties.timestampValidBits;
outExtensions->textureFilterAnisotropic =
physicalDeviceFeatures.samplerAnisotropy &&
physicalDeviceProperties.limits.maxSamplerAnisotropy > 1.0f;
outExtensions->maxTextureAnisotropy = outExtensions->textureFilterAnisotropic
? physicalDeviceProperties.limits.maxSamplerAnisotropy
: 0.0f;
// TODO(lucferron): Eventually remove everything above this line in this function as the caps // TODO(lucferron): Eventually remove everything above this line in this function as the caps
// get implemented. // get implemented.
// https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch31s02.html // https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch31s02.html
......
...@@ -82,5 +82,5 @@ TEST_P(SamplersTest, InvalidOverTextureSamplerMaxAnisotropyExt) ...@@ -82,5 +82,5 @@ TEST_P(SamplersTest, InvalidOverTextureSamplerMaxAnisotropyExt)
// Use this to select which configurations (e.g. which renderer, which GLES major version) these // Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against. // tests should be run against.
// Samplers are only supported on ES3. // Samplers are only supported on ES3.
ANGLE_INSTANTIATE_TEST(SamplersTest, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES()); ANGLE_INSTANTIATE_TEST(SamplersTest, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES(), ES3_VULKAN());
} // namespace } // namespace
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