Rip out GrPlatformSurface (has been deprecated for some time, use GrPlatformTexture or GrPlatformRenderTarget instead)

Review URL: http://codereview.appspot.com/5576052/



git-svn-id: http://skia.googlecode.com/svn/trunk@3094 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2012-01-27 00:47:24 +00:00
parent 1771cbf43d
commit b1caea00d8
7 changed files with 0 additions and 250 deletions

View File

@ -295,26 +295,6 @@ public:
GrRenderTarget* createPlatformRenderTarget(
const GrPlatformRenderTargetDesc& desc);
/**
* This interface is depracted and will be removed in a future revision.
* Callers should use createPlatformTexture or createPlatformRenderTarget
* instead.
*
* Wraps an existing 3D API surface in a GrObject. desc.fFlags determines
* the type of object returned. If kIsTexture is set the returned object
* will be a GrTexture*. Otherwise, it will be a GrRenderTarget*. If both
* are set the render target object is accessible by
* GrTexture::asRenderTarget().
*
* GL: if the object is a texture Gr may change its GL texture parameters
* when it is drawn.
*
* @param desc description of the object to create.
* @return either a GrTexture* or GrRenderTarget* depending on desc. NULL
* on failure.
*/
GrResource* createPlatformSurface(const GrPlatformSurfaceDesc& desc);
///////////////////////////////////////////////////////////////////////////
// Matrix state

View File

@ -702,133 +702,6 @@ struct GrPlatformRenderTargetDesc {
GrPlatform3DObject fRenderTargetHandle;
};
///////////////////////////////////////////////////////////////////////////////
// DEPRECATED. createPlatformSurface is replaced by createPlatformTexture
// and createPlatformRenderTarget. These enums and structs will be removed.
enum GrPlatformSurfaceType {
/**
* Specifies that the object being created is a render target.
*/
kRenderTarget_GrPlatformSurfaceType,
/**
* Specifies that the object being created is a texture.
*/
kTexture_GrPlatformSurfaceType,
/**
* Specifies that the object being created is a texture and a render
* target.
*/
kTextureRenderTarget_GrPlatformSurfaceType,
};
enum GrPlatformRenderTargetFlags {
kNone_GrPlatformRenderTargetFlagBit = 0x0,
/**
* Gives permission to Gr to perform the downsample-resolve of a
* multisampled render target. If this is not set then read pixel
* operations may fail. If the object is both a texture and render target
* then this *must* be set. Otherwise, if the client wants do its own
* resolves it must create separate GrRenderTarget and GrTexture objects
* and insert appropriate flushes and resolves betweeen data hazards.
* GrRenderTarget has a flagForResolve()
*/
kGrCanResolve_GrPlatformRenderTargetFlagBit = 0x2,
};
GR_MAKE_BITFIELD_OPS(GrPlatformRenderTargetFlags)
struct GrPlatformSurfaceDesc {
GrPlatformSurfaceType fSurfaceType; // type of surface to create
/**
* Flags for kRenderTarget and kTextureRenderTarget surface types
*/
GrPlatformRenderTargetFlags fRenderTargetFlags;
int fWidth; // width in pixels
int fHeight; // height in pixels
GrPixelConfig fConfig; // color format
/**
* Number of per sample stencil buffer. Only relevant if kIsRenderTarget is
* set in fFlags.
*/
int fStencilBits;
/**
* Number of samples per-pixel. Only relevant if kIsRenderTarget is set in
* fFlags.
*/
int fSampleCnt;
/**
* Texture object in 3D API. Only relevant if fSurfaceType is kTexture or
* kTextureRenderTarget.
* GL: this is a texture object (glGenTextures)
*/
GrPlatform3DObject fPlatformTexture;
/**
* Render target object in 3D API. Only relevant if fSurfaceType is
* kRenderTarget or kTextureRenderTarget
* GL: this is a FBO object (glGenFramebuffers)
*/
GrPlatform3DObject fPlatformRenderTarget;
/**
* 3D API object used as destination of resolve. Only relevant if
* fSurfaceType is kRenderTarget or kTextureRenderTarget and
* kGrCanResolve is set in fRenderTargetFlags.
* fFlags.
* GL: this is a FBO object (glGenFramebuffers)
*/
GrPlatform3DObject fPlatformResolveDestination;
void reset() { memset(this, 0, sizeof(GrPlatformSurfaceDesc)); }
};
/**
* Example of how to wrap render-to-texture-with-MSAA GL objects with a GrPlatformSurace
*
* GLint colorBufferID;
* glGenRenderbuffers(1, &colorID);
* glBindRenderbuffer(GL_RENDERBUFFER, colorBufferID);
* glRenderbufferStorageMultisample(GL_RENDERBUFFER, S, GL_RGBA, W, H);
*
* GLint stencilBufferID;
* glGenRenderBuffers(1, &stencilBufferID);
* glBindRenderbuffer(GL_RENDERBUFFER, stencilBufferID);
* glRenderbufferStorageMultisample(GL_RENDERBUFFER, S, GL_STENCIL_INDEX8, W, H);
*
* GLint drawFBOID;
* glGenFramebuffers(1, &drawFBOID);
* glBindFramebuffer(GL_FRAMEBUFFER, drawFBOID);
* glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorBufferID);
* glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, stencilBufferID);
*
* GLint textureID;
* glGenTextures(1, &textureID);
* glBindTexture(GL_TEXTURE_2D, textureID);
* glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, W, H, ...);
*
* GLint readFBOID;
* glGenFramebuffers(1, &readFBOID);
* glBindFramebuffer(GL_FRAMEBUFFER, readFBOID);
* glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureID, 0);
*
* GrPlatformSurfaceDesc renderTargetTextureDesc;
* renderTargetTextureDesc.fSurfaceType = kTextureRenderTarget_GrPlatformSurfaceType;
* renderTargetTextureDesc.fRenderTargetFlags = kGrCanResolve_GrPlatformRenderTargetFlagBit;
* renderTargetTextureDesc.fWidth = W;
* renderTargetTextureDesc.fHeight = H;
* renderTargetTextureDesc.fConfig = kSkia8888_PM_GrPixelConfig
* renderTargetTextureDesc.fStencilBits = 8;
* renderTargetTextureDesc.fSampleCnt = S;
* renderTargetTextureDesc.fPlatformTexture = textureID;
* renderTargetTextureDesc.fPlatformRenderTarget = drawFBOID;
* renderTargetTextureDesc.fPlatformResolveDestination = readFBOID;
*
* GrTexture* texture = static_cast<GrTexture*>(grContext->createPlatrformSurface(renderTargetTextureDesc));
*/
///////////////////////////////////////////////////////////////////////////////

View File

@ -541,24 +541,6 @@ GrRenderTarget* GrContext::createPlatformRenderTarget(const GrPlatformRenderTarg
return fGpu->createPlatformRenderTarget(desc);
}
GrResource* GrContext::createPlatformSurface(const GrPlatformSurfaceDesc& desc) {
// validate flags here so that GrGpu subclasses don't have to check
if (kTexture_GrPlatformSurfaceType == desc.fSurfaceType &&
0 != desc.fRenderTargetFlags) {
return NULL;
}
if (desc.fSampleCnt &&
(kGrCanResolve_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags)) {
return NULL;
}
if (kTextureRenderTarget_GrPlatformSurfaceType == desc.fSurfaceType &&
desc.fSampleCnt &&
!(kGrCanResolve_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags)) {
return NULL;
}
return fGpu->createPlatformSurface(desc);
}
///////////////////////////////////////////////////////////////////////////////
bool GrContext::supportsIndex8PixelConfig(const GrSamplerState* sampler,

View File

@ -215,11 +215,6 @@ GrRenderTarget* GrGpu::createPlatformRenderTarget(const GrPlatformRenderTargetDe
return this->onCreatePlatformRenderTarget(desc);
}
GrResource* GrGpu::createPlatformSurface(const GrPlatformSurfaceDesc& desc) {
this->handleDirtyContext();
return this->onCreatePlatformSurface(desc);
}
GrVertexBuffer* GrGpu::createVertexBuffer(uint32_t size, bool dynamic) {
this->handleDirtyContext();
return this->onCreateVertexBuffer(size, dynamic);

View File

@ -131,11 +131,6 @@ public:
*/
GrRenderTarget* createPlatformRenderTarget(const GrPlatformRenderTargetDesc& desc);
/**
* DEPRECATED. This will be removed.
*/
GrResource* createPlatformSurface(const GrPlatformSurfaceDesc& desc);
/**
* Creates a vertex buffer.
*
@ -401,7 +396,6 @@ protected:
size_t rowBytes) = 0;
virtual GrTexture* onCreatePlatformTexture(const GrPlatformTextureDesc& desc) = 0;
virtual GrRenderTarget* onCreatePlatformRenderTarget(const GrPlatformRenderTargetDesc& desc) = 0;
virtual GrResource* onCreatePlatformSurface(const GrPlatformSurfaceDesc& desc) = 0;
virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size,
bool dynamic) = 0;
virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size,

View File

@ -643,79 +643,6 @@ GrRenderTarget* GrGpuGL::onCreatePlatformRenderTarget(const GrPlatformRenderTarg
return tgt;
}
GrResource* GrGpuGL::onCreatePlatformSurface(const GrPlatformSurfaceDesc& desc) {
bool isTexture = kTexture_GrPlatformSurfaceType == desc.fSurfaceType ||
kTextureRenderTarget_GrPlatformSurfaceType == desc.fSurfaceType;
bool isRenderTarget = kRenderTarget_GrPlatformSurfaceType == desc.fSurfaceType ||
kTextureRenderTarget_GrPlatformSurfaceType == desc.fSurfaceType;
GrGLRenderTarget::Desc rtDesc;
SkAutoTUnref<GrGLStencilBuffer> sb;
if (isRenderTarget) {
rtDesc.fRTFBOID = desc.fPlatformRenderTarget;
rtDesc.fConfig = desc.fConfig;
if (desc.fSampleCnt) {
if (kGrCanResolve_GrPlatformRenderTargetFlagBit & desc.fRenderTargetFlags) {
rtDesc.fTexFBOID = desc.fPlatformResolveDestination;
} else {
GrAssert(!isTexture); // this should have been filtered by GrContext
rtDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID;
}
} else {
rtDesc.fTexFBOID = desc.fPlatformRenderTarget;
}
// we don't know what the RB ids are without glGets and we don't care
// since we aren't responsible for deleting them.
rtDesc.fMSColorRenderbufferID = 0;
rtDesc.fSampleCnt = desc.fSampleCnt;
if (desc.fStencilBits) {
GrGLStencilBuffer::Format format;
format.fInternalFormat = GrGLStencilBuffer::kUnknownInternalFormat;
format.fPacked = false;
format.fStencilBits = desc.fStencilBits;
format.fTotalBits = desc.fStencilBits;
sb.reset(new GrGLStencilBuffer(this, 0, desc.fWidth, desc.fHeight,
rtDesc.fSampleCnt, format));
}
rtDesc.fOwnIDs = false;
}
if (isTexture) {
GrGLTexture::Desc texDesc;
if (!this->configToGLFormats(desc.fConfig, false, NULL, NULL, NULL)) {
return NULL;
}
texDesc.fWidth = desc.fWidth;
texDesc.fHeight = desc.fHeight;
texDesc.fConfig = desc.fConfig;
texDesc.fOrientation = GrGLTexture::kBottomUp_Orientation;
texDesc.fTextureID = desc.fPlatformTexture;
texDesc.fOwnsID = false;
if (isRenderTarget) {
GrTexture* tex = new GrGLTexture(this, texDesc, rtDesc);
tex->asRenderTarget()->setStencilBuffer(sb.get());
return tex;
} else {
return new GrGLTexture(this, texDesc);
}
} else {
GrGLIRect viewport;
viewport.fLeft = 0;
viewport.fBottom = 0;
viewport.fWidth = desc.fWidth;
viewport.fHeight = desc.fHeight;
GrGLRenderTarget* rt = new GrGLRenderTarget(this, rtDesc, viewport);
rt->setStencilBuffer(sb.get());
return rt;
}
}
////////////////////////////////////////////////////////////////////////////////
void GrGpuGL::onWriteTexturePixels(GrTexture* texture,

View File

@ -173,7 +173,6 @@ protected:
bool dynamic);
virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size,
bool dynamic);
virtual GrResource* onCreatePlatformSurface(const GrPlatformSurfaceDesc& desc);
virtual GrTexture* onCreatePlatformTexture(const GrPlatformTextureDesc& desc) SK_OVERRIDE;
virtual GrRenderTarget* onCreatePlatformRenderTarget(const GrPlatformRenderTargetDesc& desc) SK_OVERRIDE;
virtual bool createStencilBufferForRenderTarget(GrRenderTarget* rt,