Always set GL_[UN]PACK_ALIGNMENT to 1.
Removes an unnecessary use of GrPixelConfig.
Bug: skia:6718
Change-Id: Ib020c42eec58fc53aaf5034fb37bf9d6ec459f95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230748
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 685559e..8ede79b 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -876,50 +876,6 @@
mipLevelCount);
}
-// For GL_[UN]PACK_ALIGNMENT. TODO: This really wants to be GrColorType.
-static inline GrGLint config_alignment(GrPixelConfig config) {
- SkASSERT(!GrPixelConfigIsCompressed(config));
- switch (config) {
- case kAlpha_8_GrPixelConfig:
- case kAlpha_8_as_Alpha_GrPixelConfig:
- case kAlpha_8_as_Red_GrPixelConfig:
- case kGray_8_GrPixelConfig:
- case kGray_8_as_Lum_GrPixelConfig:
- case kGray_8_as_Red_GrPixelConfig:
- return 1;
- case kRGB_565_GrPixelConfig:
- case kRGBA_4444_GrPixelConfig:
- case kRG_88_GrPixelConfig:
- case kAlpha_half_GrPixelConfig:
- case kAlpha_half_as_Lum_GrPixelConfig:
- case kAlpha_half_as_Red_GrPixelConfig:
- case kRGBA_half_GrPixelConfig:
- case kRGBA_half_Clamped_GrPixelConfig:
- case kR_16_GrPixelConfig:
- return 2;
- case kRGBA_8888_GrPixelConfig:
- case kRGB_888_GrPixelConfig: // We're really talking about GrColorType::kRGB_888x here.
- case kRGB_888X_GrPixelConfig:
- case kBGRA_8888_GrPixelConfig:
- case kSRGBA_8888_GrPixelConfig:
- case kRGBA_1010102_GrPixelConfig:
- case kRGBA_float_GrPixelConfig:
- case kRG_1616_GrPixelConfig:
- return 4;
- case kRGB_ETC1_GrPixelConfig:
- case kUnknown_GrPixelConfig:
- return 0;
-
- // Experimental (for Y416 and mutant P016/P010)
- case kRGBA_16161616_GrPixelConfig:
- return 8;
- case kRG_half_GrPixelConfig:
- return 4;
- }
- SK_ABORT("Invalid pixel config");
- return 0;
-}
-
bool GrGLGpu::onTransferPixelsTo(GrTexture* texture, int left, int top, int width, int height,
GrColorType bufferColorType, GrGpuBuffer* transferBuffer,
size_t offset, size_t rowBytes) {
@@ -980,7 +936,7 @@
return false;
}
- GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, config_alignment(texConfig)));
+ GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1));
GL_CALL(TexSubImage2D(glTex->target(),
0,
left, top,
@@ -1232,7 +1188,7 @@
}
if (mipLevelCount) {
- GR_GL_CALL(interface, PixelStorei(GR_GL_UNPACK_ALIGNMENT, config_alignment(texConfig)));
+ GR_GL_CALL(interface, PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1));
}
bool succeeded = true;
@@ -2250,8 +2206,7 @@
SkASSERT(this->glCaps().readPixelsRowBytesSupport());
GL_CALL(PixelStorei(GR_GL_PACK_ROW_LENGTH, rowWidthInPixels));
}
- auto dstAsConfig = GrColorTypeToPixelConfig(dstColorType);
- GL_CALL(PixelStorei(GR_GL_PACK_ALIGNMENT, config_alignment(dstAsConfig)));
+ GL_CALL(PixelStorei(GR_GL_PACK_ALIGNMENT, 1));
bool reattachStencil = false;
if (this->glCaps().detachStencilFromMSAABuffersBeforeReadPixels() &&