Revert "Revert "Add a flag to GrSurfaceFlags that requires the texture to be cleared upon creation. ""
This reverts commit a9e795eab5f59a52d96b8fdc39351452835f5eb9.
Bug: skia:
Change-Id: Ibfc51497ae99f332f8f72a799393a1b2996f7f3f
Reviewed-on: https://skia-review.googlesource.com/17767
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index e963027..51f24b4 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -443,6 +443,7 @@
switch (config) {
case kRGB_565_GrPixelConfig:
case kGray_8_GrPixelConfig:
+ case kRG_float_GrPixelConfig:
return true;
case kAlpha_8_GrPixelConfig:
case kRGBA_4444_GrPixelConfig:
@@ -454,7 +455,6 @@
case kRGBA_8888_sint_GrPixelConfig:
case kRGBA_half_GrPixelConfig:
case kRGBA_float_GrPixelConfig:
- case kRG_float_GrPixelConfig:
case kUnknown_GrPixelConfig:
return false;
}
@@ -516,12 +516,17 @@
* Optional bitfield flags that can be set on GrSurfaceDesc (below).
*/
enum GrSurfaceFlags {
- kNone_GrSurfaceFlags = 0x0,
+ kNone_GrSurfaceFlags = 0x0,
/**
* Creates a texture that can be rendered to as a GrRenderTarget. Use
* GrTexture::asRenderTarget() to access.
*/
- kRenderTarget_GrSurfaceFlag = 0x1,
+ kRenderTarget_GrSurfaceFlag = 0x1,
+ /**
+ * Clears to zero on creation. It will cause creation failure if initial data is supplied to the
+ * texture. This only affects the base level if the texture is created with MIP levels.
+ */
+ kPerformInitialClear_GrSurfaceFlag = 0x2
};
GR_MAKE_BITFIELD_OPS(GrSurfaceFlags)
diff --git a/include/gpu/gl/GrGLFunctions.h b/include/gpu/gl/GrGLFunctions.h
index 9cb7ddc..930a0c1 100644
--- a/include/gpu/gl/GrGLFunctions.h
+++ b/include/gpu/gl/GrGLFunctions.h
@@ -40,6 +40,8 @@
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearProc)(GrGLbitfield mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearStencilProc)(GrGLint s);
+typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearTexImageProc)(GrGLuint texture, GrGLint level, GrGLenum format, GrGLenum type,const GrGLvoid * data);
+typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLClearTexSubImageProc)(GrGLuint texture, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLenum format, GrGLenum type,const GrGLvoid * data);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLColorMaskProc)(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompileShaderProc)(GrGLuint shader);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompressedTexImage2DProc)(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data);
diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h
index c84eca2..e5479eb 100644
--- a/include/gpu/gl/GrGLInterface.h
+++ b/include/gpu/gl/GrGLInterface.h
@@ -125,6 +125,8 @@
GrGLFunction<GrGLClearProc> fClear;
GrGLFunction<GrGLClearColorProc> fClearColor;
GrGLFunction<GrGLClearStencilProc> fClearStencil;
+ GrGLFunction<GrGLClearTexImageProc> fClearTexImage;
+ GrGLFunction<GrGLClearTexSubImageProc> fClearTexSubImage;
GrGLFunction<GrGLColorMaskProc> fColorMask;
GrGLFunction<GrGLCompileShaderProc> fCompileShader;
GrGLFunction<GrGLCompressedTexImage2DProc> fCompressedTexImage2D;