Skip to content

Commit

Permalink
drivers/glrend/devpixmp: respect creation format type
Browse files Browse the repository at this point in the history
  • Loading branch information
vs49688 committed Sep 28, 2024
1 parent d882ae5 commit 33190b9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/glrend/devpixmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ static br_error recreate_renderbuffers(br_device_pixelmap *self)
UASSERT(self->use_type == BRT_OFFSCREEN || self->use_type == BRT_DEPTH);

if(self->use_type == BRT_OFFSCREEN) {
const GLenum draw_buffers[1] = {GL_COLOR_ATTACHMENT0};
const GLenum draw_buffers[1] = {GL_COLOR_ATTACHMENT0};
const br_pixelmap_gl_fmt *fmt = DeviceGLGetFormatDetails(self->pm_type);

UASSERT(self->asBack.glFbo != 0);

Expand All @@ -85,10 +86,12 @@ static br_error recreate_renderbuffers(br_device_pixelmap *self)
glBindTexture(binding_point, self->asBack.glTex);

if(self->msaa_samples) {
glTexImage2DMultisample(binding_point, self->msaa_samples, GL_RGBA8, self->pm_width, self->pm_height, GL_TRUE);
glTexImage2DMultisample(binding_point, self->msaa_samples, fmt->internal_format, self->pm_width,
self->pm_height, GL_TRUE);
} else {
glTexParameteri(binding_point, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(binding_point, 0, GL_RGBA8, self->pm_width, self->pm_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(binding_point, 0, fmt->internal_format, self->pm_width, self->pm_height, 0, fmt->format,
fmt->type, NULL);
}

DeviceGLObjectLabelF(GL_TEXTURE, self->asBack.glTex, "%s:colour", self->pm_identifier);
Expand Down

0 comments on commit 33190b9

Please sign in to comment.