Revert of Return GrGLContext from GrTestTarget (patchset #3 id:40001 of https://codereview.chromium.org/1207393002/)
Reason for revert: speculative revert to unblock DEPS roll (layout-tests) Original issue's description: > Return GrGLContext from GrTestTarget > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/b6d93ea428ca5d13641c35faca7d0380980a3a17 TBR=bsalomon@google.com,joshualitt@google.com,joshualitt@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1211123004
This commit is contained in:
parent
ca10953d9c
commit
1852ec2b46
@ -105,7 +105,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We currently hav only implemented the texture uploads for GL.
|
// We currently hav only implemented the texture uploads for GL.
|
||||||
const GrGLInterface* gl = tt.glContext()->interface();
|
const GrGLInterface* gl = tt.glInterface();
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ protected:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GrGLInterface* gl = tt.glContext()->interface();
|
const GrGLInterface* gl = tt.glInterface();
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
class GrBatchTracker;
|
class GrBatchTracker;
|
||||||
class GrContext;
|
class GrContext;
|
||||||
class GrGLContext;
|
struct GrGLInterface;
|
||||||
class GrIndexBuffer;
|
class GrIndexBuffer;
|
||||||
class GrNonInstancedVertices;
|
class GrNonInstancedVertices;
|
||||||
class GrPath;
|
class GrPath;
|
||||||
@ -366,7 +366,7 @@ public:
|
|||||||
bool attachStencilAttachmentToRenderTarget(GrRenderTarget* target);
|
bool attachStencilAttachmentToRenderTarget(GrRenderTarget* target);
|
||||||
|
|
||||||
// This is only to be used in tests.
|
// This is only to be used in tests.
|
||||||
virtual const GrGLContext* glContextForTesting() const { return NULL; }
|
virtual const GrGLInterface* glInterfaceForTesting() const { return NULL; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Functions used to map clip-respecting stencil tests into normal
|
// Functions used to map clip-respecting stencil tests into normal
|
||||||
|
@ -11,14 +11,15 @@
|
|||||||
#include "GrGpuResourceCacheAccess.h"
|
#include "GrGpuResourceCacheAccess.h"
|
||||||
#include "GrInOrderDrawBuffer.h"
|
#include "GrInOrderDrawBuffer.h"
|
||||||
#include "GrResourceCache.h"
|
#include "GrResourceCache.h"
|
||||||
|
#include "gl/GrGLInterface.h"
|
||||||
#include "SkString.h"
|
#include "SkString.h"
|
||||||
|
|
||||||
void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLContext* gl) {
|
void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, const GrGLInterface* gl) {
|
||||||
SkASSERT(!fContext);
|
SkASSERT(!fContext);
|
||||||
|
|
||||||
fContext.reset(SkRef(ctx));
|
fContext.reset(SkRef(ctx));
|
||||||
fDrawTarget.reset(SkRef(target));
|
fDrawTarget.reset(SkRef(target));
|
||||||
fGLContext.reset(SkRef(gl));
|
fGLInterface.reset(SkSafeRef(gl));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrContext::getTestTarget(GrTestTarget* tar) {
|
void GrContext::getTestTarget(GrTestTarget* tar) {
|
||||||
@ -27,7 +28,7 @@ void GrContext::getTestTarget(GrTestTarget* tar) {
|
|||||||
// then disconnects. This would help prevent test writers from mixing using the returned
|
// then disconnects. This would help prevent test writers from mixing using the returned
|
||||||
// GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods
|
// GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods
|
||||||
// until ~GrTestTarget().
|
// until ~GrTestTarget().
|
||||||
tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glContextForTesting());
|
tar->init(this, fDrawingMgr.fDrawTarget, fGpu->glInterfaceForTesting());
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -11,26 +11,26 @@
|
|||||||
|
|
||||||
#include "GrContext.h"
|
#include "GrContext.h"
|
||||||
#include "GrDrawTarget.h"
|
#include "GrDrawTarget.h"
|
||||||
#include "gl/GrGLContext.h"
|
#include "gl/GrGLInterface.h"
|
||||||
|
|
||||||
/** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this
|
/** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this
|
||||||
should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or
|
should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or
|
||||||
GrContext. In the future this object may provide some guards to prevent this. */
|
GrContext. In the future this object may provide some guards to prevent this. */
|
||||||
class GrTestTarget {
|
class GrTestTarget {
|
||||||
public:
|
public:
|
||||||
GrTestTarget() : fGLContext(NULL) {};
|
GrTestTarget() {};
|
||||||
|
|
||||||
void init(GrContext*, GrDrawTarget*, const GrGLContext*);
|
void init(GrContext*, GrDrawTarget*, const GrGLInterface*);
|
||||||
|
|
||||||
GrDrawTarget* target() { return fDrawTarget.get(); }
|
GrDrawTarget* target() { return fDrawTarget.get(); }
|
||||||
|
|
||||||
/** Returns a GrGLContext if the GrContext is backed by OpenGL. */
|
/** Returns a GrGLInterface if the GrContext is backed by OpenGL. */
|
||||||
const GrGLContext* glContext() { return fGLContext; }
|
const GrGLInterface* glInterface() { return fGLInterface.get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkAutoTUnref<GrDrawTarget> fDrawTarget;
|
SkAutoTUnref<GrDrawTarget> fDrawTarget;
|
||||||
SkAutoTUnref<GrContext> fContext;
|
SkAutoTUnref<GrContext> fContext;
|
||||||
SkAutoTUnref<const GrGLContext> fGLContext;
|
SkAutoTUnref<const GrGLInterface> fGLInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,7 +20,7 @@ struct GrContextOptions;
|
|||||||
* Encapsulates information about an OpenGL context including the OpenGL
|
* Encapsulates information about an OpenGL context including the OpenGL
|
||||||
* version, the GrGLStandard type of the context, and GLSL version.
|
* version, the GrGLStandard type of the context, and GLSL version.
|
||||||
*/
|
*/
|
||||||
class GrGLContextInfo : public SkRefCnt {
|
class GrGLContextInfo : public SkNoncopyable {
|
||||||
public:
|
public:
|
||||||
GrGLStandard standard() const { return fInterface->fStandard; }
|
GrGLStandard standard() const { return fInterface->fStandard; }
|
||||||
GrGLVersion version() const { return fGLVersion; }
|
GrGLVersion version() const { return fGLVersion; }
|
||||||
|
@ -109,8 +109,8 @@ public:
|
|||||||
const GrPipeline&,
|
const GrPipeline&,
|
||||||
const GrBatchTracker&) const override;
|
const GrBatchTracker&) const override;
|
||||||
|
|
||||||
const GrGLContext* glContextForTesting() const override {
|
virtual const GrGLInterface* glInterfaceForTesting() const {
|
||||||
return &this->glContext();
|
return this->glInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -300,7 +300,7 @@ private:
|
|||||||
|
|
||||||
void unbindTextureFromFBO(GrGLenum fboTarget);
|
void unbindTextureFromFBO(GrGLenum fboTarget);
|
||||||
|
|
||||||
SkAutoTUnref<GrGLContext> fGLContext;
|
SkAutoTDelete<GrGLContext> fGLContext;
|
||||||
|
|
||||||
void createCopyProgram();
|
void createCopyProgram();
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont
|
|||||||
GrTestTarget tt;
|
GrTestTarget tt;
|
||||||
context->getTestTarget(&tt);
|
context->getTestTarget(&tt);
|
||||||
|
|
||||||
const GrGLInterface* gl = tt.glContext()->interface();
|
const GrGLInterface* gl = tt.glInterface();
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We currently have only implemented the texture uploads for GL.
|
// We currently have only implemented the texture uploads for GL.
|
||||||
const GrGLInterface* gl = tt.glContext()->interface();
|
const GrGLInterface* gl = tt.glInterface();
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user