Skip to content

Commit

Permalink
Fixed|libgui: Invalid values in GLPixelFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent 2594d3c commit 1626ab4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions doomsday/libs/gui/include/de/graphics/glpixelformat.h
Expand Up @@ -32,14 +32,14 @@ struct LIBGUI_PUBLIC GLPixelFormat {
duint internalFormat;
duint format;
duint type;
duint rowAlignment;
duint rowStartAlignment; // 1, 2, 4, 8

GLPixelFormat(duint glInternalFormat, duint glFormat, duint glDataType = 0,
duint glRowAlignment = 0)
duint glRowStartAlignment = 0)
: internalFormat(glInternalFormat)
, format(glFormat)
, type(glDataType)
, rowAlignment(glRowAlignment)
, rowStartAlignment(glRowStartAlignment)
{}
};

Expand Down
6 changes: 3 additions & 3 deletions doomsday/libs/gui/src/graphics/gltexture.cpp
Expand Up @@ -184,7 +184,7 @@ DENG2_PIMPL(GLTexture)
<< level << internalFormat << size.x << size.y << 0
<< glFormat.format << glFormat.type << data;*/

if (data) LIBGUI_GL.glPixelStorei(GL_UNPACK_ALIGNMENT, GLint(glFormat.rowAlignment));
if (data) LIBGUI_GL.glPixelStorei(GL_UNPACK_ALIGNMENT, GLint(glFormat.rowStartAlignment));
LIBGUI_GL.glTexImage2D(isCube() ? glFace(face) : texTarget,
level,
glFormat.internalFormat,
Expand All @@ -200,7 +200,7 @@ DENG2_PIMPL(GLTexture)
void glSubImage(int level, Vector2i const &pos, Size const &size,
GLPixelFormat const &glFormat, void const *data, CubeFace face = PositiveX)
{
if (data) LIBGUI_GL.glPixelStorei(GL_UNPACK_ALIGNMENT, GLint(glFormat.rowAlignment));
if (data) LIBGUI_GL.glPixelStorei(GL_UNPACK_ALIGNMENT, GLint(glFormat.rowStartAlignment));
LIBGUI_GL.glTexSubImage2D(isCube() ? glFace(face) : texTarget,
level,
pos.x,
Expand All @@ -218,7 +218,7 @@ DENG2_PIMPL(GLTexture)
{
auto const &glFormat = image.glFormat();

LIBGUI_GL.glPixelStorei(GL_UNPACK_ALIGNMENT, GLint(glFormat.rowAlignment));
LIBGUI_GL.glPixelStorei(GL_UNPACK_ALIGNMENT, GLint(glFormat.rowStartAlignment));
LIBGUI_GL.glPixelStorei(GL_UNPACK_ROW_LENGTH, GLint(image.width()));

int const bytesPerPixel = image.depth() / 8;
Expand Down
18 changes: 9 additions & 9 deletions doomsday/libs/gui/src/graphics/image.cpp
Expand Up @@ -825,37 +825,37 @@ GLPixelFormat Image::glFormat(Format imageFormat)
return GLPixelFormat(GL_R32F, GL_RED, GL_FLOAT, 4);

case RG_32f:
return GLPixelFormat(GL_RG32F, GL_RG, GL_FLOAT, 8);
return GLPixelFormat(GL_RG32F, GL_RG, GL_FLOAT, 4);

case RGB_32f:
return GLPixelFormat(GL_RGB32F, GL_RGB, GL_FLOAT, 12);
return GLPixelFormat(GL_RGB32F, GL_RGB, GL_FLOAT, 4);

case RGBA_32f:
return GLPixelFormat(GL_RGBA32F, GL_RGBA, GL_FLOAT, 16);
return GLPixelFormat(GL_RGBA32F, GL_RGBA, GL_FLOAT, 4);

case R_32i:
return GLPixelFormat(GL_R32I, GL_RED, GL_INT, 4);

case RG_32i:
return GLPixelFormat(GL_RG32I, GL_RG, GL_INT, 8);
return GLPixelFormat(GL_RG32I, GL_RG, GL_INT, 4);

case RGB_32i:
return GLPixelFormat(GL_RGB32I, GL_RGB, GL_INT, 12);
return GLPixelFormat(GL_RGB32I, GL_RGB, GL_INT, 4);

case RGBA_32i:
return GLPixelFormat(GL_RGBA32I, GL_RGBA, GL_INT, 16);
return GLPixelFormat(GL_RGBA32I, GL_RGBA, GL_INT, 4);

case R_32ui:
return GLPixelFormat(GL_R32UI, GL_RED, GL_UNSIGNED_INT, 4);

case RG_32ui:
return GLPixelFormat(GL_RG32UI, GL_RG, GL_UNSIGNED_INT, 8);
return GLPixelFormat(GL_RG32UI, GL_RG, GL_UNSIGNED_INT, 4);

case RGB_32ui:
return GLPixelFormat(GL_RGB32UI, GL_RGB, GL_UNSIGNED_INT, 12);
return GLPixelFormat(GL_RGB32UI, GL_RGB, GL_UNSIGNED_INT, 4);

case RGBA_32ui:
return GLPixelFormat(GL_RGBA32UI, GL_RGBA, GL_UNSIGNED_INT, 16);
return GLPixelFormat(GL_RGBA32UI, GL_RGBA, GL_UNSIGNED_INT, 4);
}
}

Expand Down

0 comments on commit 1626ab4

Please sign in to comment.