diff --git a/src/modules/graphics/graphics.c b/src/modules/graphics/graphics.c index b10e2978..973d850b 100644 --- a/src/modules/graphics/graphics.c +++ b/src/modules/graphics/graphics.c @@ -2066,6 +2066,7 @@ Material* lovrMaterialCreate(const MaterialInfo* info) { lovrRetain(textures[i]); Texture* texture = textures[i] ? textures[i] : state.defaultTexture; lovrCheck(i == 0 || texture->info.type == TEXTURE_2D, "Material textures must be 2D"); + lovrCheck(texture->info.usage & TEXTURE_SAMPLE, "Textures must be created with the 'sample' usage to use them in Materials"); bindings[i + 1] = (gpu_binding) { i + 1, GPU_SLOT_SAMPLED_TEXTURE, .texture = texture->gpu }; material->hasWritableTexture |= texture->info.usage != TEXTURE_SAMPLE; }