Add support for vertex and geometry shader textures
Adds a visibility bitfield to GrTextureAccess that controls in which
shaders the texture should be accessible. Also adds caps and
validation to ensure we don't exceed texture limits.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1782583002
Review URL: https://codereview.chromium.org/1782583002
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index ca9cf35..9dbc40c 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -39,11 +39,6 @@
fShaderCaps.reset(new GrGLSLCaps(contextOptions));
- /**************************************************************************
- * GrVkCaps fields
- **************************************************************************/
- fMaxSampledTextures = 16; // Spec requires a minimum of 16 sampled textures per stage
-
this->init(contextOptions, vkInterface, physDev);
}
@@ -60,7 +55,7 @@
GR_VK_CALL(vkInterface, GetPhysicalDeviceMemoryProperties(physDev, &memoryProperties));
this->initGrCaps(properties, features, memoryProperties);
- this->initGLSLCaps(features);
+ this->initGLSLCaps(features, properties);
this->initConfigTexturableTable(vkInterface, physDev);
this->initConfigRenderableTable(vkInterface, physDev);
this->initStencilFormats(vkInterface, physDev);
@@ -114,9 +109,6 @@
this->initSampleCount(properties);
- fMaxSampledTextures = SkTMin(properties.limits.maxPerStageDescriptorSampledImages,
- properties.limits.maxPerStageDescriptorSamplers);
-
// Assuming since we will always map in the end to upload the data we might as well just map
// from the get go. There is no hard data to suggest this is faster or slower.
fGeometryBufferMapThreshold = 0;
@@ -127,7 +119,8 @@
fOversizedStencilSupport = true;
}
-void GrVkCaps::initGLSLCaps(const VkPhysicalDeviceFeatures& features) {
+void GrVkCaps::initGLSLCaps(const VkPhysicalDeviceFeatures& features,
+ const VkPhysicalDeviceProperties& properties) {
GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get());
glslCaps->fVersionDeclString = "#version 310 es\n";
@@ -155,6 +148,13 @@
glslCaps->fDualSourceBlendingSupport = features.dualSrcBlend;
#endif
glslCaps->fIntegerSupport = true;
+
+ glslCaps->fMaxVertexSamplers =
+ glslCaps->fMaxGeometrySamplers =
+ glslCaps->fMaxFragmentSamplers = SkTMin(properties.limits.maxPerStageDescriptorSampledImages,
+ properties.limits.maxPerStageDescriptorSamplers);
+ glslCaps->fMaxCombinedSamplers = SkTMin(properties.limits.maxDescriptorSetSampledImages,
+ properties.limits.maxDescriptorSetSamplers);
}
static void format_supported_for_feature(const GrVkInterface* interface,