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

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

Issue 1153813002: Remove init from GrGLContextInfo and caps classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 7 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
« src/effects/gradients/SkSweepGradient.cpp ('K') | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index d48f2080119c583d70ecfd374151567de5416253..07aaaae26b5c1b4288bb6f0c1a985f8268f436ce 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -157,18 +157,35 @@ bool GrGLGpu::BlendCoeffReferencesConstant(GrBlendCoeff coeff) {
///////////////////////////////////////////////////////////////////////////////
+GrGpu* GrGLGpu::Create(GrBackendContext backendContext, GrContext* context) {
+ SkAutoTUnref<const GrGLInterface> glInterface(
+ reinterpret_cast<const GrGLInterface*>(backendContext));
+ if (!glInterface) {
+ glInterface.reset(GrGLDefaultInterface());
+ } else {
+ glInterface->ref();
+ }
+ if (!glInterface) {
+ return NULL;
+ }
+ GrGLContext* glContext = GrGLContext::Create(glInterface);
+ if (glContext) {
+ return SkNEW_ARGS(GrGLGpu, (glContext, context));
+ }
+ return NULL;
+}
+
static bool gPrintStartupSpew;
-GrGLGpu::GrGLGpu(const GrGLContext& ctx, GrContext* context)
+GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context)
: GrGpu(context)
, fGLContext(ctx) {
-
- SkASSERT(ctx.isInitialized());
- fCaps.reset(SkRef(ctx.caps()));
+ SkASSERT(ctx);
+ fCaps.reset(SkRef(ctx->caps()));
fHWBoundTextureUniqueIDs.reset(this->glCaps().maxFragmentTextureUnits());
- GrGLClearErr(fGLContext.interface());
+ GrGLClearErr(this->glInterface());
if (gPrintStartupSpew) {
const GrGLubyte* vendor;
const GrGLubyte* renderer;
@@ -182,7 +199,7 @@ GrGLGpu::GrGLGpu(const GrGLContext& ctx, GrContext* context)
SkDebugf("------ RENDERER %s\n", renderer);
SkDebugf("------ VERSION %s\n", version);
SkDebugf("------ EXTENSIONS\n");
- ctx.extensions().print();
+ this->glContext().extensions().print();
SkDebugf("\n");
SkDebugf("%s", this->glCaps().dump().c_str());
}
@@ -331,7 +348,7 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
}
if (kGLES_GrGLStandard == this->glStandard() &&
- fGLContext.hasExtension("GL_ARM_shader_framebuffer_fetch")) {
+ this->hasExtension("GL_ARM_shader_framebuffer_fetch")) {
// The arm extension requires specifically enabling MSAA fetching per sample.
// On some devices this may have a perf hit. Also multiple render targets are disabled
GL_CALL(Enable(GR_GL_FETCH_PER_SAMPLE_ARM));
@@ -812,7 +829,7 @@ bool GrGLGpu::uploadCompressedTexData(const GrSurfaceDesc& desc,
return true;
}
-static bool renderbuffer_storage_msaa(GrGLContext& ctx,
+static bool renderbuffer_storage_msaa(const GrGLContext& ctx,
int sampleCount,
GrGLenum format,
int width, int height) {
@@ -899,7 +916,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
if (idDesc->fRTFBOID != idDesc->fTexFBOID) {
SkASSERT(desc.fSampleCnt > 0);
GL_CALL(BindRenderbuffer(GR_GL_RENDERBUFFER, idDesc->fMSColorRenderbufferID));
- if (!renderbuffer_storage_msaa(fGLContext,
+ if (!renderbuffer_storage_msaa(*fGLContext,
desc.fSampleCnt,
msColorFormat,
desc.fWidth, desc.fHeight)) {
@@ -917,7 +934,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
goto FAILED;
}
- fGLContext.caps()->markConfigAsValidColorAttachment(desc.fConfig);
+ fGLContext->caps()->markConfigAsValidColorAttachment(desc.fConfig);
}
}
fStats.incRenderTargetBinds();
@@ -940,7 +957,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
goto FAILED;
}
- fGLContext.caps()->markConfigAsValidColorAttachment(desc.fConfig);
+ fGLContext->caps()->markConfigAsValidColorAttachment(desc.fConfig);
}
return true;
@@ -1162,7 +1179,7 @@ bool GrGLGpu::createStencilAttachmentForRenderTarget(GrRenderTarget* rt, int wid
// version on a GL that doesn't have an MSAA extension.
bool created;
if (samples > 0) {
- created = renderbuffer_storage_msaa(fGLContext,
+ created = renderbuffer_storage_msaa(*fGLContext,
samples,
sFmt.fInternalFormat,
width, height);
@@ -1303,7 +1320,7 @@ bool GrGLGpu::attachStencilAttachmentToRenderTarget(GrStencilAttachment* sb, GrR
}
return false;
} else {
- fGLContext.caps()->markColorConfigAndStencilFormatAsVerified(
+ fGLContext->caps()->markColorConfigAndStencilFormatAsVerified(
rt->config(),
glsb->format());
}
« src/effects/gradients/SkSweepGradient.cpp ('K') | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698