Use NV glsl shader compiler for Vulkan
The nvidia direct glsl shader compiler seems to perform much better than using
shaderc to compile to spir-v first.
This change also includes a change to prefer host cached memory for buffers.
Having cached buffers signifcantly improves performance whenever we need to do
buffer reads and writes.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1835813003
Review URL: https://codereview.chromium.org/1835813003
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 6d1d844..41bf1ad 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -13,7 +13,10 @@
#include "vk/GrVkBackendContext.h"
GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
- VkPhysicalDevice physDev, uint32_t featureFlags) : INHERITED(contextOptions) {
+ VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t extensionFlags)
+ : INHERITED(contextOptions) {
+ fCanUseGLSLForShaderModule = false;
+
/**************************************************************************
* GrDrawTargetCaps fields
**************************************************************************/
@@ -40,11 +43,11 @@
fShaderCaps.reset(new GrGLSLCaps(contextOptions));
- this->init(contextOptions, vkInterface, physDev, featureFlags);
+ this->init(contextOptions, vkInterface, physDev, featureFlags, extensionFlags);
}
void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
- VkPhysicalDevice physDev, uint32_t featureFlags) {
+ VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t extensionFlags) {
VkPhysicalDeviceProperties properties;
GR_VK_CALL(vkInterface, GetPhysicalDeviceProperties(physDev, &properties));
@@ -58,12 +61,13 @@
this->initConfigRenderableTable(vkInterface, physDev);
this->initStencilFormats(vkInterface, physDev);
-
+ if (SkToBool(extensionFlags & kNV_glsl_shader_GrVkExtensionFlag)) {
+ fCanUseGLSLForShaderModule = true;
+ }
this->applyOptionsOverrides(contextOptions);
- // need to friend GrVkCaps in GrGLSLCaps.h
- // GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get());
- // glslCaps->applyOptionsOverrides(contextOptions);
+ GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get());
+ glslCaps->applyOptionsOverrides(contextOptions);
}
int get_max_sample_count(VkSampleCountFlags flags) {