Proper format support for image uniforms;

This commit is contained in:
bjorn 2018-08-10 23:54:46 -07:00
parent 7528ac2db8
commit 58dc34ec64
1 changed files with 5 additions and 1 deletions

View File

@ -424,10 +424,14 @@ static void lovrGpuBindImage(Texture* texture, int slot) {
texture = texture ? texture : lovrGpuGetDefaultTexture();
if (texture != state.images[slot]) {
lovrAssert(!texture->srgb, "Textures created with the srgb flag can not be used as image uniforms");
lovrAssert(!isTextureFormatCompressed(texture->format), "Compressed textures can not be used as image uniforms");
lovrAssert(texture->format != FORMAT_RGB && texture->format != FORMAT_RGBA4 && texture->format != FORMAT_RGB5A1, "Unsupported texture format for image uniform");
lovrRetain(texture);
lovrRelease(state.images[slot]);
state.images[slot] = texture;
glBindImageTexture(slot, texture->id, 0, true, 0, GL_READ_WRITE, GL_RGBA8);
glBindImageTexture(slot, texture->id, 0, true, 0, GL_READ_WRITE, convertTextureFormatInternal(texture->format, false));
}
#endif
}