[client] OpenGL:fix RGB24 support for non 64-bit aligned pitches

This commit is contained in:
Geoffrey McRae 2023-11-06 14:39:34 +11:00
parent d02e3730b2
commit 139e98ac3b

View file

@ -782,14 +782,12 @@ static enum ConfigStatus configure(struct Inst * this)
this->vboFormat = GL_BGR; this->vboFormat = GL_BGR;
this->dataFormat = GL_UNSIGNED_BYTE; this->dataFormat = GL_UNSIGNED_BYTE;
/* The data that the host returns for 24-bit BGR is tightly packed into an /* The data that the host returns is comes from a 32-bit RBGA texture,
* array that the host GPU will support, we need to adjust the parameters * as OpenGL supports BGR directly we need to correct dimensions in order
* here to the correct dimensions as OpenGL can use it directly * to make this happen.
*/ */
this->format.dataWidth = this->format.frameWidth; this->format.dataWidth = this->format.frameWidth;
this->format.dataHeight = this->format.frameHeight; this->format.dataHeight = this->format.frameHeight;
this->format.stride = this->format.frameWidth;
this->format.pitch = this->format.frameWidth * 3;
this->format.bpp = 24; this->format.bpp = 24;
break; break;
@ -1181,7 +1179,7 @@ static bool drawFrame(struct Inst * this)
int bpp = this->format.bpp / 8; int bpp = this->format.bpp / 8;
glPixelStorei(GL_UNPACK_ALIGNMENT , bpp < 4 ? 1 : 0); glPixelStorei(GL_UNPACK_ALIGNMENT , bpp < 4 ? 1 : 0);
glPixelStorei(GL_UNPACK_ROW_LENGTH, this->format.stride); glPixelStorei(GL_UNPACK_ROW_LENGTH, this->format.frameWidth);
this->texPos = 0; this->texPos = 0;
framebuffer_read_fn( framebuffer_read_fn(