aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk/GrVkCaps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/vk/GrVkCaps.cpp')
-rw-r--r--src/gpu/vk/GrVkCaps.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 0ae7c00995..e9f239c294 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -346,7 +346,7 @@ void GrVkCaps::ConfigInfo::initSampleCounts(const GrVkInterface* interface,
&properties));
VkSampleCountFlags flags = properties.sampleCounts;
if (flags & VK_SAMPLE_COUNT_1_BIT) {
- fColorSampleCounts.push(0);
+ fColorSampleCounts.push(1);
}
if (kImagination_VkVendor == physProps.vendorID) {
// MSAA does not work on imagination
@@ -386,18 +386,39 @@ void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface,
}
}
+bool GrVkCaps::isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
+ if (!SkToBool(ConfigInfo::kRenderable_Flag & fConfigTable[config].fOptimalFlags)) {
+ return false;
+ }
+ if (withMSAA && fConfigTable[config].fColorSampleCounts.count() < 2) {
+ // We expect any renderable config to support non-MSAA rendering.
+ SkASSERT(1 == fConfigTable[config].fColorSampleCounts.count());
+ SkASSERT(1 == fConfigTable[config].fColorSampleCounts[0]);
+ return false;
+ }
+ return true;
+}
+
int GrVkCaps::getSampleCount(int requestedCount, GrPixelConfig config) const {
+ requestedCount = SkTMax(1, requestedCount);
int count = fConfigTable[config].fColorSampleCounts.count();
- if (!count || !this->isConfigRenderable(config, true)) {
+
+ if (!count || !this->isConfigRenderable(config, requestedCount > 1)) {
return 0;
}
+ if (1 == requestedCount) {
+ SkASSERT(fConfigTable[config].fColorSampleCounts.count() &&
+ fConfigTable[config].fColorSampleCounts[0] == 1);
+ return 1;
+ }
+
for (int i = 0; i < count; ++i) {
if (fConfigTable[config].fColorSampleCounts[i] >= requestedCount) {
return fConfigTable[config].fColorSampleCounts[i];
}
}
- return fConfigTable[config].fColorSampleCounts[count-1];
+ return 0;
}
bool validate_image_info(const GrVkImageInfo* imageInfo, SkColorType ct, GrPixelConfig* config) {