Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glxml fixes #480

Merged
merged 4 commits into from
Aug 20, 2021
Merged

Glxml fixes #480

merged 4 commits into from
Aug 20, 2021

Conversation

joakim-arm
Copy link
Contributor

@joakim-arm joakim-arm commented Aug 9, 2021

Some minor fixes in gl.xml:

Add GL_RENDERBUFFER to the TextureTarget group

The parameter target of the glGetInternalformati* functions belongs to the TextureTarget group. Since GL_RENDERBUFFER is a valid value for target in those functions, it needs to be added to the TextureTarget group.

Define groups for some enums

  • GL_FETCH_PER_SAMPLE_ARM (EnableCap, GetPName)
  • GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM (GetPName)

Change group of parameter format in glCompressed*TexSubImage* functions

The group of format in the glCompressed*TexSubImage* functions was set to PixelFormat. However, the correct group seems to be InternalFormat, which is containing the valid values for that parameter.

The 'target' parameter of the glGetInternalformati* functions belongs to
the TextureTarget group. GL_RENDERBUFFER is a valid value for 'target'
in the glGetInternalformati* functions. Hence, GL_RENDERBUFFER was added
to the TextureTarget group.
 * GL_FETCH_PER_SAMPLE_ARM (EnableCap, GetPName)
 * GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM (GetPName)
@joakim-arm joakim-arm marked this pull request as ready for review August 9, 2021 13:37
@@ -9180,7 +9180,7 @@ typedef unsigned int GLhandleARB;
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param group="InternalFormat"><ptype>GLenum</ptype> <name>format</name></param>
Copy link
Contributor

Choose a reason for hiding this comment

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

It's awesome to see that vendors are starting to pitch in on the groups!

This makes sense, but I think we need to establish a breaking change policy for groups going forwards. First Google and now Arm, it looks like even though Khronos themselves don't use the groups they're becoming of increasing importance among the members therein.

Other than that fine with this.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you're able to provide details on your use case for the groups this'd help, but no worries if not. I'll open a separate issue for establishing this breaking change policy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's for pretty-printing traced API calls so that GLenum/GLbitfields appear with their name instead of their integer value. gl.xml is used for generating a lookup table that makes this conversion possible.

GLenum value to name is not a one-to-one mapping (e.g. 0 can be GL_POINTS or GL_ZERO). The parameter groups make it possible to retrieve the relevant set of GLenum names for a specific parameter of a specific function.

…ions

The group of the 'format' parameter in the glCompressed*TexSubImage* functions
was set to PixelFormat. However, the correct group seems to be
InternalFormat, which is containing the valid values for that parameter.
xml/gl.xml Show resolved Hide resolved
@@ -4948,7 +4948,7 @@ typedef unsigned int GLhandleARB;
<enum value="0x8D40" name="GL_FRAMEBUFFER" group="ObjectIdentifier,FramebufferTarget,CheckFramebufferStatusTarget"/>
<enum value="0x8D40" name="GL_FRAMEBUFFER_EXT"/>
<enum value="0x8D40" name="GL_FRAMEBUFFER_OES" group="FramebufferTarget"/>
<enum value="0x8D41" name="GL_RENDERBUFFER" group="ObjectIdentifier,RenderbufferTarget,CopyImageSubDataTarget"/>
<enum value="0x8D41" name="GL_RENDERBUFFER" group="ObjectIdentifier,RenderbufferTarget,CopyImageSubDataTarget,TextureTarget"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure on this change, as currently TextureTarget kind of unofficially means "enums that you can pass to glTexImage*" and GL_RENDERBUFFER isn't really in that group.

Generally I think we might need to create more groups than just TextureTarget as it's also used for glBindTexture which doesn't allow you to pass a proxy texture as a target.
Other examples of functions that use TextureTarget but specifies a different valid enum set include glGetInternalformat (as pointed out in this PR) and glGetTexLevelParameter.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with leaving it like this for this PR (I think), but I think we need to start a discussion on whether we should create more groups for this.

Copy link
Contributor Author

@joakim-arm joakim-arm Aug 12, 2021

Choose a reason for hiding this comment

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

Agreed. Creating more groups seems to be the best long-term solution. However, glGetInternalformat, glGetTexLevelParameter, and glBindTexture seem all to use different sets of valid values for the target parameters. This means potentially three new groups. In addition, the valid target values of the different functions depend on the API version.

Instead of doing this complex refactoring, I went for the simpler route -- keep the group that glGetInternalformat is already using (TextureTarget) and add GL_RENDERBUFFER to it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the "depending on opengl version" enums is something that should be figured out from the <feature> tags.

Having the enums groups be the set of all possibly valid enums that can then be filtered out by version and other factors like extension is going to be the most useful form of these enum groups.

Copy link
Contributor

Choose a reason for hiding this comment

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

@NogginBops are you okay with this PR? I'm not sure if you're requesting a change, or just pointing out gl.xml is not perfect yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

As I think the groups discussion will result in us looking at these groups more thoroughly again (and hopefully fix them), I think there is not much harm in merging this. So yes, I think this can be merged as is.

@pdaniell-nv
Copy link
Contributor

@oddhack this is approved to merge.

@oddhack oddhack merged commit eae1d6d into KhronosGroup:master Aug 20, 2021
@joakim-arm joakim-arm deleted the glxml-fixes branch August 20, 2021 07:42
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.

5 participants