Skip to content

Commit

Permalink
Merge pull request godotengine#92587 from RandomShaper/validate_tex_u…
Browse files Browse the repository at this point in the history
…sage

RenderingDevice: Reject creation of textures with no usage
  • Loading branch information
akien-mga committed May 31, 2024
2 parents 3e01ef5 + 3e58656 commit 705b7a0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions servers/rendering/rendering_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@ RID RenderingDevice::texture_create(const TextureFormat &p_format, const Texture

ERR_FAIL_INDEX_V(format.samples, TEXTURE_SAMPLES_MAX, RID());

ERR_FAIL_COND_V_MSG(format.usage_bits == 0, RID(), "No usage bits specified (at least one is needed)");

format.height = format.texture_type != TEXTURE_TYPE_1D && format.texture_type != TEXTURE_TYPE_1D_ARRAY ? format.height : 1;
format.depth = format.texture_type == TEXTURE_TYPE_3D ? format.depth : 1;

Expand Down

0 comments on commit 705b7a0

Please sign in to comment.