Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: src/gpu/gl/GrGLCaps.cpp

Issue 1615023003: Add ability to query read pixels support without a render target. (Closed) Base URL: https://skia.googlesource.com/skia.git@fixsupp
Patch Set: squash with prev cl in series Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLCaps.cpp
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index ae6e6132b1b8e80b2c4834104131c1199561c0be..5c6d59fbb6407aa7eee109680379ef320758bde8 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -10,6 +10,7 @@
#include "GrContextOptions.h"
#include "GrGLContext.h"
+#include "GrGLRenderTarget.h"
#include "glsl/GrGLSLCaps.h"
#include "SkTSearch.h"
#include "SkTSort.h"
@@ -17,6 +18,8 @@
GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
const GrGLContextInfo& ctxInfo,
const GrGLInterface* glInterface) : INHERITED(contextOptions) {
+ fStandard = ctxInfo.standard();
+
fStencilFormats.reset();
fMSFBOType = kNone_MSFBOType;
fInvalidateFBType = kNone_InvalidateFBType;
@@ -648,47 +651,52 @@ bool GrGLCaps::hasPathRenderingSupport(const GrGLContextInfo& ctxInfo, const GrG
}
return true;
}
-bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
+
+bool GrGLCaps::readPixelsSupported(GrPixelConfig rtConfig,
GrPixelConfig readConfig,
- GrPixelConfig currFBOConfig) const {
- SkASSERT(this->isConfigRenderable(currFBOConfig, false));
+ std::function<void (GrGLenum, GrGLint*)> getIntegerv,
+ std::function<bool ()> bindRenderTarget) const {
+ SkASSERT(this->isConfigRenderable(rtConfig, false));
GrGLenum readFormat;
GrGLenum readType;
- if (!this->getReadPixelsFormat(currFBOConfig, readConfig, &readFormat, &readType)) {
+ if (!this->getReadPixelsFormat(rtConfig, readConfig, &readFormat, &readType)) {
return false;
}
- if (kGL_GrGLStandard == intf->fStandard) {
+ if (kGL_GrGLStandard == fStandard) {
// All of our renderable configs can be converted to each other by glReadPixels in OpenGL.
return true;
}
// See Section 16.1.2 in the ES 3.2 specification.
- if (kNormalizedFixedPoint_FormatType == fConfigTable[currFBOConfig].fFormatType) {
+ if (kNormalizedFixedPoint_FormatType == fConfigTable[rtConfig].fFormatType) {
if (GR_GL_RGBA == readFormat && GR_GL_UNSIGNED_BYTE == readType) {
return true;
}
} else {
- SkASSERT(kFloat_FormatType == fConfigTable[currFBOConfig].fFormatType);
+ SkASSERT(kFloat_FormatType == fConfigTable[rtConfig].fFormatType);
if (GR_GL_RGBA == readFormat && GR_GL_FLOAT == readType) {
return true;
}
}
- if (0 == fConfigTable[currFBOConfig].fSecondReadPixelsFormat.fFormat) {
+ if (0 == fConfigTable[rtConfig].fSecondReadPixelsFormat.fFormat) {
ReadPixelsFormat* rpFormat =
- const_cast<ReadPixelsFormat*>(&fConfigTable[currFBOConfig].fSecondReadPixelsFormat);
+ const_cast<ReadPixelsFormat*>(&fConfigTable[rtConfig].fSecondReadPixelsFormat);
GrGLint format = 0, type = 0;
- GR_GL_GetIntegerv(intf, GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT, &format);
- GR_GL_GetIntegerv(intf, GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, &type);
+ if (!bindRenderTarget()) {
+ return false;
+ }
+ getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT, &format);
+ getIntegerv(GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, &type);
rpFormat->fFormat = format;
rpFormat->fType = type;
}
- return fConfigTable[currFBOConfig].fSecondReadPixelsFormat.fFormat == readFormat &&
- fConfigTable[currFBOConfig].fSecondReadPixelsFormat.fType == readType;
+ return fConfigTable[rtConfig].fSecondReadPixelsFormat.fFormat == readFormat &&
+ fConfigTable[rtConfig].fSecondReadPixelsFormat.fType == readType;
}
void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698