aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrCaps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrCaps.cpp')
-rw-r--r--src/gpu/GrCaps.cpp42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 427b20425a..dd589b436f 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -196,8 +196,7 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const {
kBlendEquationSupportNames[fBlendEquationSupport]);
writer->appendString("Map Buffer Support", map_flags_to_string(fMapBufferFlags).c_str());
- SkASSERT(!this->isConfigRenderable(kUnknown_GrPixelConfig, false));
- SkASSERT(!this->isConfigRenderable(kUnknown_GrPixelConfig, true));
+ SkASSERT(!this->isConfigRenderable(kUnknown_GrPixelConfig));
SkASSERT(!this->isConfigTexturable(kUnknown_GrPixelConfig));
writer->beginArray("configs");
@@ -206,8 +205,7 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const {
GrPixelConfig config = static_cast<GrPixelConfig>(i);
writer->beginObject(nullptr, false);
writer->appendString("name", pixel_config_name(config));
- writer->appendBool("renderable", this->isConfigRenderable(config, false));
- writer->appendBool("renderableMSAA", this->isConfigRenderable(config, true));
+ writer->appendS32("max sample count", this->maxRenderTargetSampleCount(config));
writer->appendBool("texturable", this->isConfigTexturable(config));
writer->endObject();
}
@@ -222,3 +220,39 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const {
writer->endObject();
}
+bool GrCaps::validateSurfaceDesc(const GrSurfaceDesc& desc, GrMipMapped mipped) const {
+ if (!this->isConfigTexturable(desc.fConfig)) {
+ return false;
+ }
+
+ if (GrMipMapped::kYes == mipped) {
+ if (GrPixelConfigIsSint(desc.fConfig) || !this->mipMapSupport()) {
+ return false;
+ }
+ }
+
+ if (desc.fWidth < 1 || desc.fHeight < 1) {
+ return false;
+ }
+
+ if (SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag)) {
+ if (0 == this->getRenderTargetSampleCount(desc.fSampleCnt, desc.fConfig)) {
+ return false;
+ }
+ int maxRTSize = this->maxRenderTargetSize();
+ if (desc.fWidth > maxRTSize || desc.fHeight > maxRTSize) {
+ return false;
+ }
+ } else {
+ // We currently do not support multisampled textures
+ if (desc.fSampleCnt > 1) {
+ return false;
+ }
+ int maxSize = this->maxTextureSize();
+ if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
+ return false;
+ }
+ }
+
+ return true;
+}