Proper format support for image uniforms;
@@ -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
}
