mirror of https://github.com/bjornbytes/lovr.git
Fix Shader:sendImage;
This commit is contained in:
parent
1b3e8c9766
commit
7e1687ce6b
|
@ -68,7 +68,7 @@ int luax_checkuniform(lua_State* L, int index, const Uniform* uniform, void* des
|
|||
case UNIFORM_IMAGE: {
|
||||
Image* image = (Image*) dest + i;
|
||||
image->texture = luax_checktype(L, j, Texture);
|
||||
image->slice = 0;
|
||||
image->slice = -1;
|
||||
image->mipmap = 0;
|
||||
image->access = ACCESS_READ_WRITE;
|
||||
TextureType type = lovrTextureGetType(image->texture);
|
||||
|
|
|
@ -539,10 +539,12 @@ static void lovrGpuBindImage(Image* image, int slot) {
|
|||
lovrAssert(image->slice < texture->depth, "Invalid texture slice '%d' for image uniform", image->slice);
|
||||
GLenum glAccess = convertAccess(image->access);
|
||||
GLenum glFormat = convertTextureFormatInternal(texture->format, false);
|
||||
bool layered = image->slice == -1;
|
||||
int slice = layered ? 0 : image->slice;
|
||||
|
||||
lovrRetain(texture);
|
||||
lovrRelease(state.images[slot].texture);
|
||||
glBindImageTexture(slot, texture->id, image->mipmap, image->slice == -1, image->slice, glAccess, glFormat);
|
||||
glBindImageTexture(slot, texture->id, image->mipmap, layered, slice, glAccess, glFormat);
|
||||
memcpy(state.images + slot, image, sizeof(Image));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue