Inertia's picture

[ES 2.0] Cleanup #2

Project:The Open Toolkit library
Version:1.0-beta-1
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Description

Remove from enum TextureUnit:
Activetexture = ((int)0X84e0),

SVN: void ActiveTexture( OpenTK.Graphics.GLES20.All texture)
New: void ActiveTexture( TextureUnit texture)

-------------------------------

enum BindTextureTarget
{
Texture2D = ((int)0X0de1),
Texturecubemap = ((int)0X8513),
}

SVN: void BindTexture( OpenTK.Graphics.GLES20.All target, Int32 texture)
New: void BindTexture( BindTextureTarget target, Int32 texture)

SVN: void GenerateMipmap( OpenTK.Graphics.GLES20.All target)
New: void GenerateMipmap( BindTextureTarget target)

-------------------------------

Add to enum TextureMinFilter:
Nearest = ((int)0X2600),
Linear = ((int)0X2601),

SVN: void GetTexParameter( OpenTK.Graphics.GLES20.All target, OpenTK.Graphics.GLES20.All pname, Single* @params)
New: void GetTexParameter( BindTextureTarget target, TextureParameterName pname, Single* @params)

SVN: void TexParameter( OpenTK.Graphics.GLES20.All target, OpenTK.Graphics.GLES20.All pname, Single param)
New: void TexParameter( BindTextureTarget target, TextureParameterName pname, Single param)

-------------------------------

Nuke existing enum TextureTarget (it contains too many wrong tokens, rather start from scratch)
enum TextureTarget
{
Texture2D = ((int)0X0de1),
Texturecubemappositivex = ((int)0X8515),
Texturecubemapnegativex = ((int)0X8516),
Texturecubemappositivey = ((int)0X8517),
Texturecubemapnegativey = ((int)0X8518),
Texturecubemappositivez = ((int)0X8519),
Texturecubemapnegativez = ((int)0X851a),
}

Add to enum PixelType:
Unsignedbyte = ((int)0X1401),

Remove from enum PixelFormat:
Depthcomponent = ((int)0X1902), // according to spec p.60 it's not valid

Duplicate resulting PixelFormat enum and name the copy PixelInternalFormat.

SVN: void TexImage2D( OpenTK.Graphics.GLES20.All target, Int32 level, OpenTK.Graphics.GLES20.All internalformat, Int32 width, Int32 height, Int32 border, OpenTK.Graphics.GLES20.All format, OpenTK.Graphics.GLES20.All type, IntPtr pixels)
New: void TexImage2D( TextureTarget target, Int32 level, PixelInternalFormat internalformat, Int32 width, Int32 height, Int32 border, PixelFormat format, PixelType type, IntPtr pixels)

SVN: void TexSubImage2D( OpenTK.Graphics.GLES20.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.GLES20.All format, OpenTK.Graphics.GLES20.All type, IntPtr pixels)
New: void TexSubImage2D( TextureTarget target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, PixelFormat format, PixelType type, IntPtr pixels)

SVN: void CopyTexImage2D( OpenTK.Graphics.GLES20.All target, Int32 level, OpenTK.Graphics.GLES20.All internalformat, Int32 x, Int32 y, Int32 width, Int32 height, Int32 border)
New: void CopyTexImage2D( TextureTarget target, Int32 level, PixelInternalFormat internalformat, Int32 x, Int32 y, Int32 width, Int32 height, Int32 border)

SVN: void CopyTexSubImage2D( OpenTK.Graphics.GLES20.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 x, Int32 y, Int32 width, Int32 height)
New: void CopyTexSubImage2D( TextureTarget target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 x, Int32 y, Int32 width, Int32 height)

SVN: void CompressedTexImage2D( OpenTK.Graphics.GLES20.All target, Int32 level, OpenTK.Graphics.GLES20.All internalformat, Int32 width, Int32 height, Int32 border, Int32 imageSize, IntPtr data)
New: void CompressedTexImage2D( TextureTarget target, Int32 level, PixelInternalFormat internalformat, Int32 width, Int32 height, Int32 border, Int32 imageSize, IntPtr data)

SVN: void CompressedTexSubImage2D( OpenTK.Graphics.GLES20.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.GLES20.All format, Int32 imageSize, IntPtr data)
New: void CompressedTexSubImage2D( TextureTarget target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, PixelFormat format, Int32 imageSize, IntPtr data)

SVN: void ReadPixels( Int32 x, Int32 y, Int32 width, Int32 height, OpenTK.Graphics.GLES20.All format, OpenTK.Graphics.GLES20.All type, IntPtr pixels)
New: void ReadPixels( Int32 x, Int32 y, Int32 width, Int32 height, PixelFormat format, PixelType type, IntPtr pixels)

-------------------------------

enum FramebufferTarget
{
Framebuffer = ((int)0X8d40),
}

enum FramebufferError
{
Framebuffercomplete = ((int)0X8cd5),
Framebufferincompleteattachment = ((int)0X8cd6),
Framebufferincompletemissingattachment = ((int)0X8cd7),
Framebufferincompletedimensions = ((int)0X8cd9),
Framebufferunsupported = ((int)0X8cdd),
}

SVN: OpenTK.Graphics.GLES20.All CheckFramebufferStatus( OpenTK.Graphics.GLES20.All target)
New: FramebufferError CheckFramebufferStatus( FramebufferTarget target)

SVN: void BindFramebuffer( OpenTK.Graphics.GLES20.All target, Int32 framebuffer)
New: void BindFramebuffer( FramebufferTarget target, Int32 framebuffer)

enum RenderbufferTarget
{
Renderbuffer = ((int)0X8d41),
}

SVN: void BindRenderbuffer( OpenTK.Graphics.GLES20.All target, Int32 renderbuffer)
New: void BindRenderbuffer( RenderbufferTarget target, Int32 renderbuffer)

enum RenderbufferInternalFormat
{
Depthcomponent16 = ((int)0X81a5),
Rgba4 = ((int)0X8056),
Rgb5a1 = ((int)0X8057),
Rgb565 = ((int)0X8d62),
Stencilindex8 = ((int)0X8d48),
}

SVN: void RenderbufferStorage( OpenTK.Graphics.GLES20.All target, OpenTK.Graphics.GLES20.All internalformat, Int32 width, Int32 height)
New: void RenderbufferStorage( RenderbufferTarget target, RenderbufferInternalFormat internalformat, Int32 width, Int32 height)

enum GetRenderbufferPName
{
Renderbufferwidth = ((int)0X8d42),
Renderbufferheight = ((int)0X8d43),
Renderbufferinternalformat = ((int)0X8d44),
Renderbufferredsize = ((int)0X8d50),
Renderbuffergreensize = ((int)0X8d51),
Renderbufferbluesize = ((int)0X8d52),
Renderbufferalphasize = ((int)0X8d53),
Renderbufferdepthsize = ((int)0X8d54),
Renderbufferstencilsize = ((int)0X8d55),
}

SVN: void GetRenderbufferParameter( OpenTK.Graphics.GLES20.All target, OpenTK.Graphics.GLES20.All pname, Int32* @params)
New: void GetRenderbufferParameter( RenderbufferTarget target, GetRenderbufferPName pname, Int32* @params)

enum FramebufferSlot
{
Colorattachment0 = ((int)0X8ce0),
Depthattachment = ((int)0X8d00),
Stencilattachment = ((int)0X8d20),
}

SVN: void FramebufferRenderbuffer( OpenTK.Graphics.GLES20.All target, OpenTK.Graphics.GLES20.All attachment, OpenTK.Graphics.GLES20.All renderbuffertarget, Int32 renderbuffer)
New: void FramebufferRenderbuffer( FramebufferTarget target, FramebufferSlot attachment, RenderbufferTarget renderbuffertarget, Int32 renderbuffer)

SVN: void FramebufferTexture2D( OpenTK.Graphics.GLES20.All target, OpenTK.Graphics.GLES20.All attachment, OpenTK.Graphics.GLES20.All textarget, Int32 texture, Int32 level)
New: void FramebufferTexture2D( FramebufferTarget target, FramebufferSlot attachment, TextureTarget textarget, Int32 texture, Int32 level)

enum FramebufferAttachmentParameter
{
Framebufferattachmentobjecttype = ((int)0X8cd0),
Framebufferattachmentobjectname = ((int)0X8cd1),
Framebufferattachmenttexturelevel = ((int)0X8cd2),
Framebufferattachmenttexturecubemapface = ((int)0X8cd3),
}

SVN: void GetFramebufferAttachmentParameter( OpenTK.Graphics.GLES20.All target, OpenTK.Graphics.GLES20.All attachment, OpenTK.Graphics.GLES20.All pname, Int32* @params)
New: void GetFramebufferAttachmentParameter( FramebufferTarget target, FramebufferSlot attachment, FramebufferAttachmentParameter pname, Int32* @params)

-------------------------------

enum PixelStorePName
{
Unpackalignment = ((int)0X0cf5),
}

enum PixelStoreParameter : int // for overload
{
One = 1,
Two = 2,
Four = 4,
Eight = 8,
}

SVN: void PixelStore( OpenTK.Graphics.GLES20.All pname, Int32 param)
New: void PixelStore( PixelStorePName pname, Int32 param)
Overload: void PixelStore( PixelStorePName pname, PixelStoreParameter param)


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

#1

Second part.

TODO:
-RenderbufferInternalformat looks good, but PixelInternalFormat may be flawed.

Done:
Investigate compressed texture formats:
The same mechanic as for ShaderBinary() is used, obtain number of formats by NUM_COMPRESSED_TEXTURE_FORMATS then obtain a list with COMPRESSED_TEXTURE_FORMATS. No references to formats besides DXT1 R5G6B5 and DXT1 RGB5A1 found.

the Fiddler's picture

#2

Status:in progress» confirmed
Inertia's picture

#3

<enum name="TextureUnit">
  <token name="Texture0" value="0X84c0" />
  <token name="Texture1" value="0X84c1" />
  <token name="Texture2" value="0X84c2" />
  <token name="Texture3" value="0X84c3" />
  <token name="Texture4" value="0X84c4" />
  <token name="Texture5" value="0X84c5" />
  <token name="Texture6" value="0X84c6" />
  <token name="Texture7" value="0X84c7" />
  <token name="Texture8" value="0X84c8" />
  <token name="Texture9" value="0X84c9" />
  <token name="Texture10" value="0X84ca" />
  <token name="Texture11" value="0X84cb" />
  <token name="Texture12" value="0X84cc" />
  <token name="Texture13" value="0X84cd" />
  <token name="Texture14" value="0X84ce" />
  <token name="Texture15" value="0X84cf" />
  <token name="Texture16" value="0X84d0" />
  <token name="Texture17" value="0X84d1" />
  <token name="Texture18" value="0X84d2" />
  <token name="Texture19" value="0X84d3" />
  <token name="Texture20" value="0X84d4" />
  <token name="Texture21" value="0X84d5" />
  <token name="Texture22" value="0X84d6" />
  <token name="Texture23" value="0X84d7" />
  <token name="Texture24" value="0X84d8" />
  <token name="Texture25" value="0X84d9" />
  <token name="Texture26" value="0X84da" />
  <token name="Texture27" value="0X84db" />
  <token name="Texture28" value="0X84dc" />
  <token name="Texture29" value="0X84dd" />
  <token name="Texture30" value="0X84de" />
  <token name="Texture31" value="0X84df" />
</enum> 
 
<function name="ActiveTexture" extension="Core" version="2.0">
  <param name="texture"><type>TextureUnit</type></param>
</function>
 
<enum name="BindTextureTarget">
  <token name="Texture2D" value="0X0de1" />
  <token name="TextureCubeMap" value="0X8513" />
</enum>
 
<function name="BindTexture" extension="Core" version="2.0">
  <param name="target"><type>BindTextureTarget</type></param>
</function>
 
<function name="GenerateMipmap" extension="Core" version="2.0">
  <param name="target"><type>BindTextureTarget</type></param>
</function>
 
<enum name="TextureMinFilter">
  <token name="NearestMipmapNearest" value="0X2700" />
  <token name="LinearMipmapNearest" value="0X2701" />
  <token name="NearestMipmapLinear" value="0X2702" />
  <token name="LinearMipmapLinear" value="0X2703" />
  <token name="Nearest" value="0X2600" />
  <token name="Linear" value="0X2601" />
</enum>
 
<enum name="TextureMagFilter">
  <token name="Nearest" value="0X2600" />
  <token name="Linear" value="0X2601" />
</enum>
 
<enum name="TexturePName">
  <token name="TextureMagFilter" value="0X2800" />
  <token name="TextureMinFilter" value="0X2801" />
  <token name="TextureWrapS" value="0X2802" />
  <token name="TextureWrapT" value="0X2803" />
</enum>
 
<function name="GetTexParameter" extension="Core" version="2.0">
  <param name="target"><type>BindTextureTarget</type></param>
  <param name="pname"><type>TexturePName</type></param>
</function>
 
<function name="TexParameter" extension="Core" version="2.0">
  <param name="target"><type>BindTextureTarget</type></param>
  <param name="pname"><type>TexturePName</type></param>
</function>
 
<enum name="TextureTarget">
  <token name="Texture2D" value="0X0de1" />
  <token name="TextureCubeMapPositiveX" value="0X8515" />
  <token name="TextureCubeMapNegativeX" value="0X8516" />
  <token name="TextureCubeMapPositiveY" value="0X8517" />
  <token name="TextureCubeMapNegativeY" value="0X8518" />
  <token name="TextureCubeMapPositiveZ" value="0X8519" />
  <token name="TextureCubeMapNegativeZ" value="0X851a" />
</enum>
 
<enum name="PixelType">
  <token name="UnsignedShort4444" value="0X8033" />
  <token name="UnsignedShort5551" value="0X8034" />
  <token name="UnsignedShort565" value="0X8363" />
  <token name="UnsignedByte" value="0X1401" />
</enum>
 
<enum name="PixelFormat">
  <token name="Alpha" value="0X1906" />
  <token name="Rgb" value="0X1907" />
  <token name="Rgba" value="0X1908" />
  <token name="Luminance" value="0X1909" />
  <token name="LuminanceAlpha" value="0X190a" />
</enum>
 
<enum name="PixelInternalFormat">
  <token name="Alpha" value="0X1906" />
  <token name="Rgb" value="0X1907" />
  <token name="Rgba" value="0X1908" />
  <token name="Luminance" value="0X1909" />
  <token name="LuminanceAlpha" value="0X190a" />
</enum>
 
<function name="TexImage2D" extension="Core" version="2.0">
  <param name="target"><type>TextureTarget</type></param>
  <param name="internalformat"><type>PixelInternalFormat</type></param>
  <param name="format"><type>PixelFormat</type></param>
  <param name="type"><type>PixelType</type></param>
</function>
 
<function name="TexSubImage2D" extension="Core" version="2.0">
  <param name="target"><type>TextureTarget</type></param>
  <param name="format"><type>PixelFormat</type></param>
  <param name="type"><type>PixelType</type></param>
</function>
 
<function name="CopyTexImage2D" extension="Core" version="2.0">
  <param name="target"><type>TextureTarget</type></param>
  <param name="internalformat"><type>PixelInternalFormat</type></param>
</function>
 
<function name="CopyTexSubImage2D" extension="Core" version="2.0">
  <param name="target"><type>TextureTarget</type></param>
</function>
 
<function name="CompressedTexImage2D" extension="Core" version="2.0">
  <param name="target"><type>TextureTarget</type></param>
  <param name="internalformat"><type>PixelInternalFormat</type></param>
</function>
 
<function name="CompressedTexSubImage2D" extension="Core" version="2.0">
  <param name="target"><type>TextureTarget</type></param>
</function>
 
<function name="ReadPixels" extension="Core" version="2.0">
  <param name="format"><type>PixelFormat</type></param>
  <param name="type"><type>PixelType</type></param>
</function>
 
<enum name="FramebufferTarget">
  <token name="Framebuffer" value="0X8d40" />
</enum>
 
<enum name="FramebufferError">
  <token name="FramebufferComplete" value="0X8cd5" />
  <token name="FramebufferIncompleteAttachment" value="0X8cd6" />
  <token name="FramebufferIncompleteMissingAttachment" value="0X8cd7" />
  <token name="FramebufferIncompleteDimensions" value="0X8cd9" />
  <token name="FramebufferUnsupported" value="0X8cdd" />
</enum>
 
<function name="CheckFramebufferStatus" extension="Core" version="2.0">
  <returns type="FramebufferError" />  
  <param name="target"><type>FramebufferTarget</type></param>
</function>
 
<function name="BindFramebuffer" extension="Core" version="2.0">
  <param name="target"><type>FramebufferTarget</type></param>
</function>
 
<enum name="RenderbufferTarget">
  <token name="Renderbuffer" value="0X8d41" />
</enum>
 
<function name="BindRenderbuffer" extension="Core" version="2.0">
  <param name="target"><type>RenderbufferTarget</type></param>
</function>
 
<enum name="RenderbufferInternalFormat">
  <token name="DepthComponent16" value="0X81a5" />
  <token name="Rgba4" value="0X8056" />
  <token name="Rgb5A1" value="0X8057" />
  <token name="Rgb565" value="0X8d62" />
  <token name="StencilIndex8" value="0X8d48" />
</enum>
 
<function name="RenderbufferStorage" extension="Core" version="2.0">
  <param name="target"><type>RenderbufferTarget</type></param>
  <param name="internalformat"><type>RenderbufferInternalFormat</type></param>
</function>
 
<enum name="GetRenderbufferPName">
  <token name="RenderbufferWidth" value="0X8d42" />
  <token name="RenderbufferHeight" value="0X8d43" />
  <token name="RenderbufferInternalFormat" value="0X8d44" />
  <token name="RenderbufferRedSize" value="0X8d50" />
  <token name="RenderbufferGreenSize" value="0X8d51" />
  <token name="RenderbufferBlueSize" value="0X8d52" />
  <token name="RenderbufferAlphaSize" value="0X8d53" />
  <token name="RenderbufferDepthSize" value="0X8d54" />
  <token name="RenderbufferStencilSize" value="0X8d55" />
</enum>
 
<function name="GetRenderbufferParameter" extension="Core" version="2.0">
  <param name="target"><type>RenderbufferTarget</type></param>
  <param name="pname"><type>GetRenderbufferPName</type></param>
</function>
 
<enum name="FramebufferSlot">
  <token name="ColorAttachment0" value="0X8ce0" />
  <token name="DepthAttachment" value="0X8d00" />
  <token name="StencilAttachment" value="0X8d20" />
</enum>
 
<function name="FramebufferRenderbuffer" extension="Core" version="2.0">
  <param name="target"><type>FramebufferTarget</type></param>
  <param name="attachment"><type>FramebufferSlot</type></param>
  <param name="renderbuffertarget"><type>RenderbufferTarget</type></param>
</function>
 
<function name="FramebufferTexture2D" extension="Core" version="2.0">
  <param name="target"><type>FramebufferTarget</type></param>
  <param name="attachment"><type>FramebufferSlot</type></param>
  <param name="textarget"><type>TextureTarget</type></param>
</function>
 
<enum name="FramebufferAttachmentParameter">
  <token name="FramebufferAttachmentObjectType" value="0X8cd0" />
  <token name="FramebufferAttachmentObjectName" value="0X8cd1" />
  <token name="FramebufferAttachmentTextureLevel" value="0X8cd2" />
  <token name="FramebufferAttachmentTextureCubeMapFace" value="0X8cd3" />
</enum>
 
<function name="GetFramebufferAttachmentParameter" extension="Core" version="2.0">
  <param name="target"><type>FramebufferTarget</type></param>
  <param name="attachment"><type>FramebufferSlot</type></param>
  <param name="pname"><type>FramebufferAttachmentParameter</type></param>
</function>
 
<enum name="PixelStorePName">
  <token name="PackAlignment" value="0X0d05" />
  <token name="UnpackAlignment" value="0X0cf5" />
</enum>
 
<enum name="PixelStoreParameter">
  <token name="One" value="0X0001" />
  <token name="Two" value="0X0002" />
  <token name="Four" value="0X0004" />
  <token name="Eight" value="0X0008" />
</enum>
 
<function name="PixelStore" extension="Core" version="2.0">
  <param name="pname"><type>PixelStorePName</type></param>
  <param name="param"><type>PixelStoreParameter</type></param>
</function>
Inertia's picture

#5

Title:ES 2.0 Cleanup #2» [ES 2.0] Cleanup #2
"Inertia" wrote:

RenderbufferInternalformat looks good, but PixelInternalFormat may be flawed.

Both are correct.

Remaining Issues:

  • BindTextureTarget and TextureTarget enums are heavily related to each other. (merge? the current approach might be inconvenient, but is safe.)
    <enum name="BindTextureTarget">
      <token name="Texture2D" value="0X0de1" />
      <token name="TextureCubeMap" value="0X8513" />
    </enum>
     
    <enum name="TextureTarget">
      <token name="Texture2D" value="0X0de1" />
      <token name="TextureCubeMapPositiveX" value="0X8515" />
      <token name="TextureCubeMapNegativeX" value="0X8516" />
      <token name="TextureCubeMapPositiveY" value="0X8517" />
      <token name="TextureCubeMapNegativeY" value="0X8518" />
      <token name="TextureCubeMapPositiveZ" value="0X8519" />
      <token name="TextureCubeMapNegativeZ" value="0X851a" />
    </enum>
  • TexParameter only accepts 4 tokens. It would make sense creating helpers or overloading it so enums like TextureMin(Mag)Filter can be used instead of enforcing (int) casts.
    // example helpers:
    void TexParameterMinFilter( TextureTarget target, TextureMinFilter filter );
    void TexParameterMagFilter( TextureTarget target, TextureMagFilter filter );
    void TexParameterWrapS( TextureTarget target, TextureWrapMode wrap );
    void TexParameterWrapT( TextureTarget target, TextureWrapMode wrap );
     
    TextureMinFilter GetTexParameterMinFilter( TextureTarget target );
    TextureMagFilter GetTexParameterMagFilter( TextureTarget target );
    TextureWrapMode GetTexParameterWrapS( TextureTarget target );
    TextureWrapMode GetTexParameterWrapT( TextureTarget target );

Besides these issues (and probably some missing capital letters) this should work as-is.

the Fiddler's picture

#6

Merged into es20 branch, rev. 2374.

the Fiddler's picture

#7

Status:confirmed» in progress (commit)
the Fiddler's picture

#8

Status:in progress (commit)» fixed

Bindings regenerated (rev. 2382).

the Fiddler's picture

#9

Version:0.9.x-dev» 1.0-beta-1
Status:fixed» closed

Closing issues fixed in 1.0 beta-1.