Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-07-17 16:58:33 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-07-18 04:43:52 +0300
commit2d9eee15c58ba1d3e2bd05a17ca09d74421c47ea (patch)
tree5178eda0d4dfef2081cad696d37052f3a797a39b /source/blender/gpu/intern/gpu_draw.c
parent0ef57d3fc079795f77ab7f13bca842ab172af08f (diff)
Cleanup: GPU: Set default GL_UNPACK_ALIGNMENT to 1
Ogl default is 4 but for almost all cases, blender use tightly packed format. This avoid confusion and state change for the common case. The only case that __might__ need alignement is DDS loader (untested) so leaving this as it is.
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r--source/blender/gpu/intern/gpu_draw.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 7e6d47636f6..9fdb98cfbf6 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1195,6 +1195,9 @@ bool GPU_upload_dxt_texture(ImBuf *ibuf, bool use_srgb)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
+ /* Reset to opengl Defaults. (Untested, might not be needed) */
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+
blocksize = (ibuf->dds_data.fourcc == FOURCC_DXT1) ? 8 : 16;
for (i = 0; i < ibuf->dds_data.nummipmaps && (width || height); i++) {
if (width == 0) {
@@ -1213,6 +1216,8 @@ bool GPU_upload_dxt_texture(ImBuf *ibuf, bool use_srgb)
width >>= 1;
height >>= 1;
}
+ /* Restore Blender default. */
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
/* set number of mipmap levels we have, needed in case they don't go down to 1x1 */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, i - 1);