Skip to content

Forbid non-zero BASE_LEVEL with incompatible texture levels - #3806

Open
ShabbyX wants to merge 1 commit into
KhronosGroup:mainfrom
ShabbyX:base-level-restriction
Open

ShabbyX wants to merge 1 commit into
KhronosGroup:mainfrom
ShabbyX:base-level-restriction

Conversation

@ShabbyX

@ShabbyX ShabbyX commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #3802

non-zero, the currently bound WebGLTexture (see above) is mutable,
and the texture would not be <em>mipmap complete</em> as defined in <a href="#refsGLES30">[GLES30]</a>
p161 if TEXTURE_BASE_LEVEL were 0 and TEXTURE_MAX_LEVEL were the highest defined level of the texture,
generates an <code>INVALID_OPERATION</code> error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: If levels are 4x4, 2x2, 1x1, 1x1, 1x1, is the range [0,4] considered mip complete? How about 4x4, 2x2, 1x1, 100x100? They are both rejected by ANGLE, but perhaps the language above is not sufficiently descriptive.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, this clause forbids setting a non-zero base level if that setting would make the texture not mipmap complete.

Could you please provide an example of that?

@ShabbyX ShabbyX Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean an example in the comment here, or in the spec? If I understand your first statement correctly, then that is intentional. Here are some examples:

  • Defined levels are 0:16x16, 1:8x8, 2:4x4. Setting base level to 1 or 2 is ok. One base level is non-zero, levels 0, 1 and 2 can be redefined with the exact same size and format but not different. Level 3:2x2 and 4:1x1 can be added in that order.

  • Defined levels are 0:16x16, 1:8x8, 2:4x4. Setting base level to 3+ is forbidden because it's outside the defined range.

  • Defined levels are 0:16x16, 1:10x12. Setting base level to 1 is forbidden (incompatible format). Setting base level to 2+ is also forbidden (outside the defined range)

  • Defined levels are 0:4x4, 1:2x2, 2:1x1, 3:1x1. Setting base level to 1, 2 or 3 is forbidden, because levels [0, 3] don't make a mipchain. Setting base level to 4+ is forbidden too (outside the defined range)

  • Defined levels are 0:4x4, 1:2x2, 2:1x1, 3:4x4, 4:2x2, 5:1x1. Setting base level to 1, 2, ..., 5 is forbidden, again because levels [0, 5] don't make a mipchain

  • Defined levels are 0:16x16, 1:8x8, 3:2x2, 4:1x1. Setting base level to non-zero is forbidden because levels [0, 4] don't make a mipchain due to missing level 2

<code>INVALID_OPERATION</code> error.</p>
<p>
If <em>pname</em> is TEXTURE_BASE_LEVEL, <em>param</em> is non-zero, the currently bound WebGLTexture (see
above) is mutable, and texture level zero is not <em>base complete</em> as defined in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Here and throughout, please use "... is not an immutable-format texture"
  • I don't see a definition of base complete on that spec page. There're only complete, mipmap complete, and cube complete.

non-zero, the currently bound WebGLTexture (see above) is mutable,
and the texture would not be <em>mipmap complete</em> as defined in <a href="#refsGLES30">[GLES30]</a>
p161 if TEXTURE_BASE_LEVEL were 0 and TEXTURE_MAX_LEVEL were the highest defined level of the texture,
generates an <code>INVALID_OPERATION</code> error.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, this clause forbids setting a non-zero base level if that setting would make the texture not mipmap complete.

Could you please provide an example of that?

Comment on lines +4469 to +4476
That is, the newly defined texture level must have the same format and dimensions as an
immutable texture would at the same level if defined with the same format and dimensions as
the texture's level zero format and dimensions.
</p>

<p>
Additionally, if a mutable texture is not defined in an equivalent way to an immutable
texture with the same level zero format, dimensions, and level count,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "effective internal format" instead of "format".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Forbid non-zero BASE_LEVEL with incompatible texture levels

2 participants