mirror of https://github.com/bjornbytes/lovr.git
Fix crash in Material:setTexture;
This commit is contained in:
parent
f959770396
commit
e2cad4ed81
|
@ -89,7 +89,7 @@ Texture* lovrMaterialGetTexture(Material* material, MaterialTexture textureType)
|
||||||
|
|
||||||
void lovrMaterialSetTexture(Material* material, MaterialTexture textureType, Texture* texture) {
|
void lovrMaterialSetTexture(Material* material, MaterialTexture textureType, Texture* texture) {
|
||||||
if (material->textures[textureType] != texture) {
|
if (material->textures[textureType] != texture) {
|
||||||
lovrAssert(lovrTextureGetType(texture) == TEXTURE_2D, "Material textures must be 2D");
|
lovrAssert(!texture || lovrTextureGetType(texture) == TEXTURE_2D, "Material textures must be 2D");
|
||||||
lovrGraphicsFlushMaterial(material);
|
lovrGraphicsFlushMaterial(material);
|
||||||
lovrRetain(texture);
|
lovrRetain(texture);
|
||||||
lovrRelease(material->textures[textureType], lovrTextureDestroy);
|
lovrRelease(material->textures[textureType], lovrTextureDestroy);
|
||||||
|
|
Loading…
Reference in New Issue