Commit fde74c07 by Jamie Madill Committed by Commit Bot

Vulkan: Apply point size clamping workaround in NV.

It seems to be a regression in recent drivers. Olli contributed this workaround for the GL back-end some time ago. This CL enables it for Vulkan as well on the affected drivers. Bug: angleproject:2970 Change-Id: I37f0caf8d9db073cb880aa1500d1ff7a1eee9d34 Reviewed-on: https://chromium-review.googlesource.com/c/1341108Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 1c6b26a7
...@@ -43,6 +43,11 @@ struct FeaturesVk ...@@ -43,6 +43,11 @@ struct FeaturesVk
// of various algorithms when a fallback format is used, such as using a packed format to // of various algorithms when a fallback format is used, such as using a packed format to
// emulate a depth- or stencil-only format. // emulate a depth- or stencil-only format.
bool forceFallbackFormat = false; bool forceFallbackFormat = false;
// On some NVIDIA drivers the point size range reported from the API is inconsistent with the
// actual behavior. Clamp the point size to the value from the API to fix this.
// Tracked in http://anglebug.com/2970.
bool clampPointSize = false;
}; };
} // namespace angle } // namespace angle
......
...@@ -780,6 +780,13 @@ void RendererVk::initFeatures() ...@@ -780,6 +780,13 @@ void RendererVk::initFeatures()
angle::PlatformMethods *platform = ANGLEPlatformCurrent(); angle::PlatformMethods *platform = ANGLEPlatformCurrent();
platform->overrideFeaturesVk(platform, &mFeatures); platform->overrideFeaturesVk(platform, &mFeatures);
// Work around incorrect NVIDIA point size range clamping.
// TODO(jmadill): Narrow driver range once fixed. http://anglebug.com/2970
if (IsNvidia(mPhysicalDeviceProperties.vendorID))
{
mFeatures.clampPointSize = true;
}
} }
void RendererVk::initPipelineCacheVkKey() void RendererVk::initPipelineCacheVkKey()
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
#include "libANGLE/renderer/vulkan/ShaderVk.h" #include "libANGLE/renderer/vulkan/ShaderVk.h"
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/Context.h"
#include "libANGLE/renderer/vulkan/ContextVk.h"
#include "platform/FeaturesVk.h"
namespace rx namespace rx
{ {
...@@ -27,7 +30,17 @@ ShCompileOptions ShaderVk::prepareSourceAndReturnOptions(const gl::Context *cont ...@@ -27,7 +30,17 @@ ShCompileOptions ShaderVk::prepareSourceAndReturnOptions(const gl::Context *cont
std::string *sourcePath) std::string *sourcePath)
{ {
*sourceStream << mData.getSource(); *sourceStream << mData.getSource();
return SH_INITIALIZE_UNINITIALIZED_LOCALS;
ShCompileOptions compileOptions = SH_INITIALIZE_UNINITIALIZED_LOCALS;
ContextVk *contextVk = vk::GetImpl(context);
if (contextVk->getFeatures().clampPointSize)
{
compileOptions |= SH_CLAMP_POINT_SIZE;
}
return compileOptions;
} }
bool ShaderVk::postTranslateCompile(gl::ShCompilerInstance *compiler, std::string *infoLog) bool ShaderVk::postTranslateCompile(gl::ShCompilerInstance *compiler, std::string *infoLog)
......
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