Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 304743004: Move ETC1 and LATC enums value to GrPixelConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add isConfigTexturable() Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/gpu/gl/GrGLCaps.cpp ('K') | « src/gpu/gl/GrGLDefines.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL.cpp
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index ff53b9c14cdeb5e8e141899249399ed58bff55f7..8bc225e93112bf14a27988eafd7a5f83c8de022c 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -200,7 +200,8 @@ GrPixelConfig GrGpuGL::preferredWritePixelsConfig(GrPixelConfig writeConfig,
}
bool GrGpuGL::canWriteTexturePixels(const GrTexture* texture, GrPixelConfig srcConfig) const {
- if (kIndex_8_GrPixelConfig == srcConfig || kIndex_8_GrPixelConfig == texture->config()) {
+ if (kIndex_8_GrPixelConfig == srcConfig || kIndex_8_GrPixelConfig == texture->config() ||
+ GrPixelConfigIsCompressed(srcConfig) || GrPixelConfigIsCompressed(texture->config())) {
return false;
}
if (srcConfig != texture->config() && kGLES_GrGLStandard == this->glStandard()) {
@@ -531,6 +532,9 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
size_t rowBytes) {
SkASSERT(NULL != data || isNewTexture);
+ // If we're uploading compressed data then we should be using uploadCompressedTexData
+ SkASSERT(!GrPixelConfigIsCompressed(dataConfig));
+
size_t bpp = GrBytesPerPixel(dataConfig);
if (!adjust_pixel_ops_params(desc.fWidth, desc.fHeight, bpp, &left, &top,
&width, &height, &data, &rowBytes)) {
@@ -548,7 +552,7 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
// texture storage.
bool useTexStorage = false &&
isNewTexture &&
- desc.fConfig != kIndex_8_GrPixelConfig &&
+ kIndex_8_GrPixelConfig != desc.fConfig &&
this->glCaps().texStorageSupport();
if (useTexStorage && kGL_GrGLStandard == this->glStandard()) {
@@ -1432,6 +1436,11 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target,
GrPixelConfig config,
void* buffer,
size_t rowBytes) {
+ // We cannot read pixels into a compressed buffer
+ if (GrPixelConfigIsCompressed(config)) {
+ return false;
+ }
+
GrGLenum format;
GrGLenum type;
bool flipY = kBottomLeft_GrSurfaceOrigin == target->origin();
@@ -2483,6 +2492,22 @@ bool GrGpuGL::configToGLFormats(GrPixelConfig config,
*externalType = GR_GL_UNSIGNED_BYTE;
}
break;
+ case kETC1_GrPixelConfig:
+ *internalFormat = GR_GL_COMPRESSED_RGB8_ETC1;
+ break;
+ case kLATC_GrPixelConfig:
+ switch(this->glCaps().latcAlias()) {
+ case GrGLCaps::kLATC_LATCAlias:
+ *internalFormat = GR_GL_COMPRESSED_LUMINANCE_LATC1;
+ break;
+ case GrGLCaps::kRGTC_LATCAlias:
+ *internalFormat = GR_GL_COMPRESSED_RED_RGTC1;
+ break;
+ case GrGLCaps::k3DC_LATCAlias:
+ *internalFormat = GR_GL_COMPRESSED_3DC_X;
+ break;
+ }
+ break;
default:
return false;
}
@@ -2559,7 +2584,8 @@ inline bool can_copy_texsubimage(const GrSurface* dst,
if (gpu->glCaps().isConfigRenderable(src->config(), src->desc().fSampleCnt > 0) &&
NULL != dst->asTexture() &&
dst->origin() == src->origin() &&
- kIndex_8_GrPixelConfig != src->config()) {
+ kIndex_8_GrPixelConfig != src->config() &&
+ !GrPixelConfigIsCompressed(src->config())) {
if (NULL != wouldNeedTempFBO) {
*wouldNeedTempFBO = NULL == src->asRenderTarget();
}
« src/gpu/gl/GrGLCaps.cpp ('K') | « src/gpu/gl/GrGLDefines.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698