Skip to content

Commit

Permalink
[Mono.Android] Fix omitted Gl* constants. (#9009)
Browse files Browse the repository at this point in the history
Fixes: #8612

Some OpenGL constants get removed because they conflict with method
names after they go through our capitalization correction.
For example, [`GLES20.GL_CULL_FACE`][0] *would* be bound as
`GLES20.GlCullFace`, which then conflicts with the method named
[`GLES20.GlCullFace(int)`][1], so it is skipped::

	warning BG8401: Skipping 'Android.Opengl.GLES20.GlCullFace' due to a duplicate method name. (Java type: 'android.opengl.GLES20')

Fix these cases by using metadata to assign explicit `managedName`
values that are the expected constant name + `Const` to avoid the
name collision.

[0]: ]https://developer.android.com/reference/android/opengl/GLES20#GL_CULL_FACE
[1]: ]https://developer.android.com/reference/android/opengl/GLES20#glCullFace(int)
  • Loading branch information
jpobst authored Jun 7, 2024
1 parent 3ab74db commit d2869b8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Mono.Android/PublicAPI/API-35/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2201,6 +2201,26 @@ const Android.Nfc.NfcAdapter.FlagListenNfcPassiveB = 2 -> int
const Android.Nfc.NfcAdapter.FlagListenNfcPassiveF = 4 -> int
const Android.Nfc.NfcAdapter.FlagReaderDisable = 0 -> int
const Android.Nfc.NfcAdapter.FlagReaderKeep = -2147483648 -> int
const Android.Opengl.GLES10.GlClearConst = 5376 -> int
const Android.Opengl.GLES10.GlCullFaceConst = 2884 -> int
const Android.Opengl.GLES10.GlPointSizeConst = 2833 -> int
const Android.Opengl.GLES10.GlSampleCoverageConst = 32928 -> int
const Android.Opengl.GLES20.GlActiveTextureConst = 34016 -> int
const Android.Opengl.GLES20.GlBlendColorConst = 32773 -> int
const Android.Opengl.GLES20.GlBlendEquationConst = 32777 -> int
const Android.Opengl.GLES20.GlCullFaceConst = 2884 -> int
const Android.Opengl.GLES20.GlDepthFuncConst = 2932 -> int
const Android.Opengl.GLES20.GlFrontFaceConst = 2886 -> int
const Android.Opengl.GLES20.GlLineWidthConst = 2849 -> int
const Android.Opengl.GLES20.GlSampleCoverageConst = 32928 -> int
const Android.Opengl.GLES20.GlStencilFuncConst = 2962 -> int
const Android.Opengl.GLES20.GlViewPortConst = 2978 -> int
const Android.Opengl.GLES30.GlReadBufferConst = 3074 -> int
const Android.Opengl.GLES30.GlTransformFeedbackVaryingsConst = 35971 -> int
const Android.Opengl.GLES30.GlUniformBlockBindingConst = 35391 -> int
const Android.Opengl.GLES31.GlVertexAttribBindingConst = 33492 -> int
const Android.Opengl.GLES31.GlVertexBindingDivisorConst = 33494 -> int
const Android.Opengl.GLES32.GlPrimitiveBoundingBoxConst = 37566 -> int
const Android.OS.Build.VERSION_CODES.VanillaIceCream = 10000 -> int
const Android.OS.PowerMonitor.InterfaceConsts.ContentsFileDescriptor = 1 -> int
const Android.OS.PowerMonitor.InterfaceConsts.ParcelableWriteReturnValue = Android.OS.ParcelableWriteFlags.ReturnValue -> Android.OS.ParcelableWriteFlags
Expand Down
22 changes: 22 additions & 0 deletions src/Mono.Android/metadata
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,28 @@
<!-- These new default interface methods on a Listener interface cause duplicate named EventHandlers to be generated, change to a unique name. -->
<attr api-since="35" path="/api/package[@name='android.app']/interface[@name='AppOpsManager.OnOpActiveChangedListener']/method[@name='onOpActiveChanged' and count(parameter)=8 and parameter[1][@type='java.lang.String'] and parameter[2][@type='int'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='java.lang.String'] and parameter[5][@type='int'] and parameter[6][@type='boolean'] and parameter[7][@type='int'] and parameter[8][@type='int']]" name="managedName">OnOpActiveChanged2</attr>
<attr api-since="35" path="/api/package[@name='android.app']/interface[@name='AppOpsManager.OnOpChangedListener']/method[@name='onOpChanged' and count(parameter)=4 and parameter[1][@type='java.lang.String'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='int'] and parameter[4][@type='java.lang.String']]" name="managedName">OnOpChanged2</attr>

<!-- Once our capitalization changes are applied to these constants they conflict with a method name. -->
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES10']/field[@name='GL_CLEAR']" name="managedName">GlClearConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES10']/field[@name='GL_CULL_FACE']" name="managedName">GlCullFaceConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES10']/field[@name='GL_POINT_SIZE']" name="managedName">GlPointSizeConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES10']/field[@name='GL_SAMPLE_COVERAGE']" name="managedName">GlSampleCoverageConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_ACTIVE_TEXTURE']" name="managedName">GlActiveTextureConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_BLEND_COLOR']" name="managedName">GlBlendColorConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_BLEND_EQUATION']" name="managedName">GlBlendEquationConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_CULL_FACE']" name="managedName">GlCullFaceConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_DEPTH_FUNC']" name="managedName">GlDepthFuncConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_FRONT_FACE']" name="managedName">GlFrontFaceConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_LINE_WIDTH']" name="managedName">GlLineWidthConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_SAMPLE_COVERAGE']" name="managedName">GlSampleCoverageConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_STENCIL_FUNC']" name="managedName">GlStencilFuncConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES20']/field[@name='GL_VIEWPORT']" name="managedName">GlViewPortConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES30']/field[@name='GL_READ_BUFFER']" name="managedName">GlReadBufferConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES30']/field[@name='GL_TRANSFORM_FEEDBACK_VARYINGS']" name="managedName">GlTransformFeedbackVaryingsConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES30']/field[@name='GL_UNIFORM_BLOCK_BINDING']" name="managedName">GlUniformBlockBindingConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES31']/field[@name='GL_VERTEX_ATTRIB_BINDING']" name="managedName">GlVertexAttribBindingConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES31']/field[@name='GL_VERTEX_BINDING_DIVISOR']" name="managedName">GlVertexBindingDivisorConst</attr>
<attr api-since="35" path="/api/package[@name='android.opengl']/class[@name='GLES32']/field[@name='GL_PRIMITIVE_BOUNDING_BOX']" name="managedName">GlPrimitiveBoundingBoxConst</attr>

<!--
***********************************************************************
Expand Down

0 comments on commit d2869b8

Please sign in to comment.