aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-05-23 16:53:47 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-23 21:38:38 +0000
commitd17b4a678b4b1df49a8eb84fb8c3c954d292a12c (patch)
tree82d59ef35abe6666d01723c62e4f22570b563801 /include
parent0610a462ad2e17057849784cdab73d634bab5fb9 (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrTypes.h11
-rw-r--r--include/gpu/gl/GrGLFunctions.h2
-rw-r--r--include/gpu/gl/GrGLInterface.h2
-rw-r--r--include/private/GrSurfaceProxy.h4
4 files changed, 15 insertions, 4 deletions
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index e9630270f6..51f24b494e 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -443,6 +443,7 @@ static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
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 @@ static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
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 @@ static inline bool GrPixelConfigIsSint(GrPixelConfig config) {
* 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 9cb7ddc261..930a0c1aad 100644
--- a/include/gpu/gl/GrGLFunctions.h
+++ b/include/gpu/gl/GrGLFunctions.h
@@ -40,6 +40,8 @@ typedef GrGLenum (GR_GL_FUNCTION_TYPE* GrGLCheckFramebufferStatusProc)(GrGLenum
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 c84eca28c6..e5479eb466 100644
--- a/include/gpu/gl/GrGLInterface.h
+++ b/include/gpu/gl/GrGLInterface.h
@@ -125,6 +125,8 @@ public:
GrGLFunction<GrGLClearProc> fClear;
GrGLFunction<GrGLClearColorProc> fClearColor;
GrGLFunction<GrGLClearStencilProc> fClearStencil;
+ GrGLFunction<GrGLClearTexImageProc> fClearTexImage;
+ GrGLFunction<GrGLClearTexSubImageProc> fClearTexSubImage;
GrGLFunction<GrGLColorMaskProc> fColorMask;
GrGLFunction<GrGLCompileShaderProc> fCompileShader;
GrGLFunction<GrGLCompressedTexImage2DProc> fCompressedTexImage2D;
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 1b7950c510..4ae041d4dd 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -323,6 +323,7 @@ protected:
, fFit(fit)
, fBudgeted(budgeted)
, fFlags(flags)
+ , fNeedsClear(SkToBool(desc.fFlags & kPerformInitialClear_GrSurfaceFlag))
, fGpuMemorySize(kInvalidGpuMemorySize)
, fLastOpList(nullptr) {
// Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources
@@ -359,7 +360,6 @@ protected:
// mutable bc of SkSurface/SkImage wishy-washiness
const uint32_t fFlags;
-
const UniqueID fUniqueID; // set from the backing resource for wrapped resources
static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0);
@@ -368,6 +368,8 @@ protected:
private:
virtual size_t onUninstantiatedGpuMemorySize() const = 0;
+ bool fNeedsClear;
+
// This entry is lazily evaluated so, when the proxy wraps a resource, the resource
// will be called but, when the proxy is deferred, it will compute the answer itself.
// If the proxy computes its own answer that answer is checked (in debug mode) in