Revert "Add sizeInBytes to GrResource, make GrRenderTarget aware of its pixel config (r1951)"
Temporarily revert this change in order to roll other changes into Chrome.
TBR=bsalomon@google.com
Review URL: http://codereview.appspot.com/4807051
git-svn-id: http://skia.googlecode.com/svn/trunk@1958 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrGLConfig.h b/gpu/include/GrGLConfig.h
index d608775..e59fe55 100644
--- a/gpu/include/GrGLConfig.h
+++ b/gpu/include/GrGLConfig.h
@@ -202,24 +202,6 @@
GR_GL(GetIntegerv(e, p)); \
} while (0)
-#define GR_GL_GetFramebufferAttachmentParameteriv(t, a, pname, p) \
- do { \
- *(p) = GR_GL_INIT_ZERO; \
- GR_GL(GetFramebufferAttachmentParameteriv(t, a, pname, p)); \
- } while (0)
-
-#define GR_GL_GetRenderbufferParameteriv(t, pname, p) \
- do { \
- *(p) = GR_GL_INIT_ZERO; \
- GR_GL(GetRenderbufferParameteriv(t, pname, p)); \
- } while (0)
-
-#define GR_GL_GetTexLevelParameteriv(t, l, pname, p) \
- do { \
- *(p) = GR_GL_INIT_ZERO; \
- GR_GL(GetTexLevelParameteriv(t, l, pname, p)); \
- } while (0)
-
////////////////////////////////////////////////////////////////////////////////
#endif
diff --git a/gpu/include/GrGLDefines.h b/gpu/include/GrGLDefines.h
index b0366fb..6c2483b 100644
--- a/gpu/include/GrGLDefines.h
+++ b/gpu/include/GrGLDefines.h
@@ -432,11 +432,11 @@
#define GR_GL_TEXTURE_ENV 0x2300
#define GR_GL_TEXTURE_ENV_MODE 0x2200
#define GR_GL_TEXTURE_1D 0x0DE0
-/* GL_TEXTURE_2D */
-/* GL_TEXTURE_WRAP_S */
-/* GL_TEXTURE_WRAP_T */
-/* GL_TEXTURE_MAG_FILTER */
-/* GL_TEXTURE_MIN_FILTER */
+#define GR_GL_TEXTURE_2D 0x0DE1
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
#define GR_GL_TEXTURE_ENV_COLOR 0x2201
#define GR_GL_TEXTURE_GEN_S 0x0C60
#define GR_GL_TEXTURE_GEN_T 0x0C61
@@ -452,11 +452,10 @@
#define GR_GL_TEXTURE_ALPHA_SIZE 0x805F
#define GR_GL_TEXTURE_LUMINANCE_SIZE 0x8060
#define GR_GL_TEXTURE_INTENSITY_SIZE 0x8061
-#define GR_GL_TEXTURE_INTERNAL_FORMAT 0x1003
-/* GL_NEAREST_MIPMAP_NEAREST */
-/* GL_NEAREST_MIPMAP_LINEAR */
-/* GL_LINEAR_MIPMAP_NEAREST */
-/* GL_LINEAR_MIPMAP_LINEAR */
+/* GL_NEAREST_MIPMAP_NEAREST */
+/* GL_NEAREST_MIPMAP_LINEAR */
+/* GL_LINEAR_MIPMAP_NEAREST */
+/* GL_LINEAR_MIPMAP_LINEAR */
#define GR_GL_OBJECT_LINEAR 0x2401
#define GR_GL_OBJECT_PLANE 0x2501
#define GR_GL_EYE_LINEAR 0x2400
@@ -606,11 +605,6 @@
#define GR_GL_RGB5_A1 0x8057
#define GR_GL_RGB565 0x8D62
#define GR_GL_RGBA8 0x8058
-#define GR_GL_RGB8 0x8051
-#define GR_GL_SRGB 0x8C40
-#define GR_GL_SRGB8 0x8C41
-#define GR_GL_SRGB_ALPHA 0x8C42
-#define GR_GL_SRGB8_ALPHA8 0x8C43
#define GR_GL_DEPTH_COMPONENT16 0x81A5
#define GR_GL_STENCIL_INDEX 0x1901
#define GR_GL_STENCIL_INDEX4 0x8D47
@@ -635,13 +629,6 @@
#define GR_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
-#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
-#define GR_GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
-#define GR_GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
-#define GR_GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
-#define GR_GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
-#define GR_GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
-#define GR_GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
#define GR_GL_COLOR_ATTACHMENT0 0x8CE0
#define GR_GL_DEPTH_ATTACHMENT 0x8D00
diff --git a/gpu/include/GrGLInterface.h b/gpu/include/GrGLInterface.h
index c959c36..42ff0c8 100644
--- a/gpu/include/GrGLInterface.h
+++ b/gpu/include/GrGLInterface.h
@@ -133,7 +133,6 @@
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderInfoLogProc)(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, char* infolog);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderivProc)(GrGLuint shader, GrGLenum pname, GrGLint* params);
typedef const GrGLubyte* (GR_GL_FUNCTION_TYPE *GrGLGetStringProc)(GrGLenum name);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetTexLevelParameteriv)(GrGLenum target, GrGLint level, GrGLenum pname, GrGLint* params);
typedef GrGLint (GR_GL_FUNCTION_TYPE *GrGLGetUniformLocationProc)(GrGLuint program, const char* name);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLineWidthProc)(GrGLfloat width);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLinkProgramProc)(GrGLuint program);
@@ -191,8 +190,6 @@
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferTexture2DProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenFramebuffersProc)(GrGLsizei n, GrGLuint *framebuffers);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenRenderbuffersProc)(GrGLsizei n, GrGLuint *renderbuffers);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetFramebufferAttachmentParameterivProc)(GrGLenum target, GrGLenum attachment, GrGLenum pname, GrGLint* params);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetRenderbufferParameterivProc)(GrGLenum target, GrGLenum pname, GrGLint* params);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageProc)(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
// Multisampling Extension Functions
@@ -286,7 +283,6 @@
GrGLGetShaderInfoLogProc fGetShaderInfoLog;
GrGLGetShaderivProc fGetShaderiv;
GrGLGetStringProc fGetString;
- GrGLGetTexLevelParameteriv fGetTexLevelParameteriv;
GrGLGetUniformLocationProc fGetUniformLocation;
GrGLLineWidthProc fLineWidth;
GrGLLinkProgramProc fLinkProgram;
@@ -344,8 +340,6 @@
GrGLFramebufferTexture2DProc fFramebufferTexture2D;
GrGLGenFramebuffersProc fGenFramebuffers;
GrGLGenRenderbuffersProc fGenRenderbuffers;
- GrGLGetFramebufferAttachmentParameterivProc fGetFramebufferAttachmentParameteriv;
- GrGLGetRenderbufferParameterivProc fGetRenderbufferParameteriv;
GrGLRenderbufferStorageProc fRenderbufferStorage;
// Multisampling Extension Functions
diff --git a/gpu/include/GrGLTexture.h b/gpu/include/GrGLTexture.h
index 53dcd22..fe2fa28 100644
--- a/gpu/include/GrGLTexture.h
+++ b/gpu/include/GrGLTexture.h
@@ -67,7 +67,6 @@
GrGLRenderTarget(GrGpuGL* gpu,
const GLRenderTargetIDs& ids,
GrGLTexID* texID,
- GrPixelConfig config,
GrGLuint stencilBits,
bool isMultisampled,
const GrGLIRect& fViewport,
@@ -178,7 +177,7 @@
int height,
const void* srcData,
size_t rowBytes);
- virtual intptr_t getTextureHandle() const;
+ virtual intptr_t getTextureHandle();
const TexParams& getTexParams() const { return fTexParams; }
void setTexParams(const TexParams& texParams) { fTexParams = texParams; }
diff --git a/gpu/include/GrGeometryBuffer.h b/gpu/include/GrGeometryBuffer.h
index d7dc177..98f58bd 100644
--- a/gpu/include/GrGeometryBuffer.h
+++ b/gpu/include/GrGeometryBuffer.h
@@ -26,6 +26,12 @@
*/
class GrGeometryBuffer : public GrResource {
public:
+ /**
+ * Retrieves the size of the buffer
+ *
+ * @return the size of the buffer in bytes
+ */
+ size_t size() const { return fSizeInBytes; }
/**
*Retrieves whether the buffer was created with the dynamic flag
@@ -88,10 +94,6 @@
virtual bool updateSubData(const void* src,
size_t srcSizeInBytes,
size_t offset) = 0;
-
- // GrResource overrides
- virtual size_t sizeInBytes() const { return fSizeInBytes; }
-
protected:
GrGeometryBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic)
: INHERITED(gpu)
diff --git a/gpu/include/GrIndexBuffer.h b/gpu/include/GrIndexBuffer.h
index 23078c3..366640e 100644
--- a/gpu/include/GrIndexBuffer.h
+++ b/gpu/include/GrIndexBuffer.h
@@ -27,9 +27,7 @@
* from the index buffer (using kTriangles_PrimitiveType).
* @return the maximum number of quads using full size of index buffer.
*/
- int maxQuads() const {
- return this->sizeInBytes() / (sizeof(uint16_t) * 6);
- }
+ int maxQuads() const { return size() / (sizeof(uint16_t) * 6); }
protected:
GrIndexBuffer(GrGpu* gpu, size_t sizeInBytes, bool dynamic)
: INHERITED(gpu, sizeInBytes, dynamic) {}
diff --git a/gpu/include/GrResource.h b/gpu/include/GrResource.h
index eee1a81..8cc4d57 100644
--- a/gpu/include/GrResource.h
+++ b/gpu/include/GrResource.h
@@ -54,14 +54,6 @@
*/
bool isValid() const { return NULL != fGpu; }
- /**
- * Retrieves the size of the object in GPU memory. This is approximate since
- * we aren't aware of additional padding or copies made by the driver.
- *
- * @return the size of the buffer in bytes
- */
- virtual size_t sizeInBytes() const = 0;
-
protected:
virtual void onRelease() = 0;
diff --git a/gpu/include/GrTexture.h b/gpu/include/GrTexture.h
index cadf0f2..50ed35d 100644
--- a/gpu/include/GrTexture.h
+++ b/gpu/include/GrTexture.h
@@ -44,13 +44,6 @@
int height() const { return fHeight; }
/**
- * @return the pixel config. Can be kUnknown_GrPixelConfig
- * if client asked us to render to a target that has a pixel
- * config that isn't equivalent with one of our configs.
- */
- int config() const { return fConfig; }
-
- /**
* @return the number of stencil bits in the rendertarget
*/
int stencilBits() const { return fStencilBits; }
@@ -112,9 +105,6 @@
*/
const GrIRect& getResolveRect() const { return fResolveRect; }
- // GrResource overrides
- virtual size_t sizeInBytes() const;
-
/**
* Reads a rectangle of pixels from the render target.
* @param left left edge of the rectangle to read (inclusive)
@@ -145,14 +135,12 @@
GrTexture* texture,
int width,
int height,
- GrPixelConfig config,
int stencilBits,
bool isMultisampled)
: INHERITED(gpu)
, fTexture(texture)
, fWidth(width)
, fHeight(height)
- , fConfig(config)
, fStencilBits(stencilBits)
, fIsMultisampled(isMultisampled)
{
@@ -172,12 +160,11 @@
private:
GrTexture* fTexture; // not ref'ed
- int fWidth;
- int fHeight;
- GrPixelConfig fConfig;
- int fStencilBits;
- bool fIsMultisampled;
- GrIRect fResolveRect;
+ int fWidth;
+ int fHeight;
+ int fStencilBits;
+ bool fIsMultisampled;
+ GrIRect fResolveRect;
// GrGpu keeps a cached clip in the render target to avoid redundantly
// rendering the clip into the same stencil buffer.
@@ -221,7 +208,7 @@
/**
* Approximate number of bytes used by the texture
*/
- virtual size_t sizeInBytes() const {
+ size_t sizeInBytes() const {
return fWidth * fHeight * GrBytesPerPixel(fConfig);
}
@@ -286,7 +273,7 @@
* Return the native ID or handle to the texture, depending on the
* platform. e.g. on opengl, return the texture ID.
*/
- virtual intptr_t getTextureHandle() const = 0;
+ virtual intptr_t getTextureHandle() = 0;
#if GR_DEBUG
void validate() const {
@@ -314,7 +301,7 @@
fShiftFixedX = 31 - Gr_clz(fWidth);
fShiftFixedY = 31 - Gr_clz(fHeight);
}
-
+
// GrResource overrides
virtual void onRelease() {
releaseRenderTarget();