Inertia's picture

Asm&GLSL Shader Tokens (part 2/2) [done!]

Part 1/2 of this topic is located at http://www.opentk.com/node/190

http://www.opengl.org/registry/specs/ARB/shader_objects.txt
http://www.opengl.org/registry/specs/ARB/fragment_shader.txt
http://www.opengl.org/registry/specs/ARB/vertex_shader.txt
http://www.opengl.org/registry/specs/ARB/fragment_program.txt
http://www.opengl.org/registry/specs/ARB/vertex_program.txt

        public enum AsmProgramTarget : int
        {
            FragmentProgram = 0x8804,
            VertexProgram = 0x8620,
            GeometryProgramNv = All.GeometryProgramNv,
        }
 
        public enum AsmProgramFormat : int
        {
            ProgramFormatAscii = (int) 0x8875, // was missing
        }
 
        public enum GetAsmProgramParameters : int
        {
            ProgramLength = 0x8627,
            ProgramFormat = 0x8876,
            ProgramBinding = 0x8677,
            ProgramInstructions = 0x88A0,
            MaxProgramInstructions = 0x88A1,
            ProgramNativeInstructions = 0x88A2,
            MaxProgramNativeInstructions = 0x88A3,
            ProgramTemporaries = 0x88A4,
            MaxProgramTemporaries = 0x88A5,
            ProgramNativeTemporaries = 0x88A6,
            MaxProgramNativeTemporaries = 0x88A7,
            ProgramParameters = 0x88A8,
            MaxProgramParameters = 0x88A9,
            ProgramNativeParameters = 0x88AA,
            MaxProgramNativeParameters = 0x88AB,
            ProgramAttribs = 0x88AC,
            MaxProgramAttribs = 0x88AD,
            ProgramNativeAttribs = 0x88AE,
            MaxProgramNativeAttribs = 0x88AF,
            ProgramAddressRegisters = 0x88B0,
            MaxProgramAddressRegisters = 0x88B1,
            ProgramNativeAddressRegisters = 0x88B2,
            MaxProgramNativeAddressRegisters = 0x88B3,
            MaxProgramLocalParameters = 0x88B4,
            MaxProgramEnvParameters = 0x88B5,
            ProgramUnderNativeLimits = 0x88B6,
 
            ProgramAluInstructions = 0x8805,
            ProgramTexInstructions = 0x8806,
            ProgramTexIndirections = 0x8807,
            ProgramNativeAluInstructions = 0x8808,
            ProgramNativeTexInstructions = 0x8809,
            ProgramNativeTexIndirections = 0x880A,
            MaxProgramAluInstructions = 0x880B,
            MaxProgramTexInstructions = 0x880C,
            MaxProgramTexIndirections = 0x880D,
            MaxProgramNativeAluInstructions = 0x880E,
            MaxProgramNativeTexInstructions = 0x880F,
            MaxProgramNativeTexIndirections = 0x8810,
        }
 
        public enum GetAsmProgramString : int
        {
            ProgramString = 0x8628,
        }
 
      public enum ShaderType : int
        {
            VertexShader = ( (int) 0x8b31 ),
            FragmentShader = ( (int) 0x8b30 ),
            GeometryShaderExt = ExtGeometryShader4.GeometryShaderExt,
        }
 
        public enum ShaderObjectHandle : int
        {
            ProgramObject = (int) ArbShaderObjects.ProgramObjectArb,
        }
 
        public enum ObjectParameterName : int // whole enum added, the Object* prefix was removed (unnecessary?)
        {
            // from ShaderObject
            Type = (int) ArbShaderObjects.ObjectTypeArb,
            SubType = (int) ArbShaderObjects.ObjectSubtypeArb,
            DeleteStatus = (int) ArbShaderObjects.ObjectDeleteStatusArb,
            CompileStatus = (int) ArbShaderObjects.ObjectCompileStatusArb,
            LinkStatus = (int) ArbShaderObjects.ObjectLinkStatusArb,
            ValidateStatus = (int) ArbShaderObjects.ObjectValidateStatusArb,
            InfoLogLength = (int) ArbShaderObjects.ObjectInfoLogLengthArb,
            AttachedObjects = (int) ArbShaderObjects.ObjectAttachedObjectsArb,
            ShaderSourceLength = (int) ArbShaderObjects.ObjectShaderSourceLengthArb,
 
            // from Fragment
            ActiveUniforms = (int) ArbShaderObjects.ObjectActiveUniformsArb,
            ActiveUniformMaxLength = (int) ArbShaderObjects.ObjectActiveUniformMaxLengthArb,
 
            // from Vertex
            ActiveAttributes = ( (int) 0x8b89 ),
            ActiveAttributeMaxLength = ( (int) 0x8b8a ),
        }
 
        public enum ActiveUniformType : int
        {
            Float = All.Float, // was missing
            FloatVec2 = ( (int) 0x8b50 ),
            FloatVec3 = ( (int) 0x8b51 ),
            FloatVec4 = ( (int) 0x8b52 ),
            Int = (int) All.Int, // was missing
            IntVec2 = ( (int) 0x8b53 ),
            IntVec3 = ( (int) 0x8b54 ),
            IntVec4 = ( (int) 0x8b55 ),
            Bool = ( (int) 0x8b56 ),
            BoolVec2 = ( (int) 0x8b57 ),
            BoolVec3 = ( (int) 0x8b58 ),
            BoolVec4 = ( (int) 0x8b59 ),
            FloatMat2 = ( (int) 0x8b5a ),
            FloatMat3 = ( (int) 0x8b5b ),
            FloatMat4 = ( (int) 0x8b5c ),
            Sampler1d = ( (int) 0x8b5d ),
            Sampler2d = ( (int) 0x8b5e ),
            Sampler3d = ( (int) 0x8b5f ),
            SamplerCube = ( (int) 0x8b60 ),
            Sampler1dShadow = ( (int) 0x8b61 ),
            Sampler2dShadow = ( (int) 0x8b62 ),
            Sampler2dRect = All.Sampler2dRectArb, // was missing
            Sampler2dRectShadow = All.Sampler2dRectShadowArb, // was missing
            // GL2.1 additions
            FloatMat2x4 = ( (int) 0x8b66 ),
            FloatMat2x3 = ( (int) 0x8b65 ),
            FloatMat3x2 = ( (int) 0x8b67 ),
            FloatMat3x4 = ( (int) 0x8b68 ),
            FloatMat4x2 = ( (int) 0x8b69 ),
            FloatMat4x3 = ( (int) 0x8b6a ),
        }
 
        public enum GetAttribParameter : int
        {
            VertexAttribArrayEnabled = ( (int) 0x8622 ),
            VertexAttribArraySize = ( (int) 0x8623 ),
            VertexAttribArrayStride = ( (int) 0x8624 ),
            VertexAttribArrayType = ( (int) 0x8625 ),
            VertexAttribArrayNormalized = ( (int) 0x886a ),
            CurrentVertexAttrib = ( (int) 0x8626 ),
        }
 
        public enum GetAttribPointerParameter
        {
            VertexAttribArrayPointer = ( (int) 0x8645 ),
        }
 
        public enum ActiveAttribType
        {
            Float = All.Float, // was missing
            FloatVec2 = ( (int) 0x8b50 ),
            FloatVec3 = ( (int) 0x8b51 ),
            FloatVec4 = ( (int) 0x8b52 ),
            FloatMat2 = ( (int) 0x8b5a ),
            FloatMat3 = ( (int) 0x8b5b ),
            FloatMat4 = ( (int) 0x8b5c ),
        }
 
        // add to BOTH Enum: EnableCap AND GetPName
            VertexProgramTwoSide = ( (int) 0x8643 ),
            VertexProgramPointSize = ( (int) 0x8642 ),
            FragmentProgram = 0x8804,
            VertexProgram = 0x8620,
            ColorSum = 0x8458,
 
        // add to Enum: GetPName
            MaxVertexUniformComponents = ( (int) 0x8b4a ),
            MaxVaryingFloats = ( (int) 0x8b4b ),
            MaxVertexAttribs = ( (int) 0x8869 ),
            MaxVertexTextureImageUnits = ( (int) 0x8b4c ),
            MaxCombinedTextureImageUnits = ( (int) 0x8b4d ),
            MaxFragmentUniformComponents = ( (int) 0x8b49 ),
            MaxTextureCoords = ( (int) 0x8871 ),
            MaxTextureImageUnits = ( (int) 0x8872 ),
            FragmentShaderDerivativeHint = ( (int) 0x8b8b ),
 
            ProgramErrorPosition = 0x864B,
            CurrentMatrix = 0x8641,
            TransposeCurrentMatrix = 0x88B7,
            CurrentMatrixStackDepth = 0x8640,
            MaxProgramMatrices = 0x862F,
            MaxProgramMatrixStackDepth = 0x862E,
 
        // add to Enum: HintTarget 
            FragmentShaderDerivativeHint = ( (int) 0x8b8b ),
 
        // add to Enum: StringName
            ProgramErrorString = 0x8874,
 
        // add to Enum: MatrixMode
        Matrix0 = 0x88C0,
        Matrix1 = 0x88C1,
        Matrix2 = 0x88C2,
        Matrix3 = 0x88C3,
        Matrix4 = 0x88C4,
        Matrix5 = 0x88C5,
        Matrix6 = 0x88C6,
        Matrix7 = 0x88C7,
        Matrix8 = 0x88C8,
        Matrix9 = 0x88C9,
        Matrix10 = 0x88CA,
        Matrix11 = 0x88CB,
        Matrix12 = 0x88CC,
        Matrix13 = 0x88CD,
        Matrix14 = 0x88CE,
        Matrix15 = 0x88CF,
        Matrix16 = 0x88D0,
        Matrix17 = 0x88D1,
        Matrix18 = 0x88D2,
        Matrix19 = 0x88D3,
        Matrix20 = 0x88D4,
        Matrix21 = 0x88D5,
        Matrix22 = 0x88D6,
        Matrix23 = 0x88D7,
        Matrix24 = 0x88D8,
        Matrix25 = 0x88D9,
        Matrix26 = 0x88DA,
        Matrix27 = 0x88DB,
        Matrix28 = 0x88DC,
        Matrix29 = 0x88DD,
        Matrix30 = 0x88DE,
        Matrix31 = 0x88DF,
 
 

Comments

Comment viewing options

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

Changed GetAttribParameter and co from:

        public enum GetAttribParameter : int
        {
            VertexAttribArrayEnabled = ( (int) 0x8622 ),
            VertexAttribArraySize = ( (int) 0x8623 ),
            VertexAttribArrayStride = ( (int) 0x8624 ),
            VertexAttribArrayType = ( (int) 0x8625 ),
            VertexAttribArrayNormalized = ( (int) 0x886a ),
            CurrentVertexAttrib = ( (int) 0x8626 ),
        }

to:

        public enum VertexAttribParameter : int
        {
            ArrayEnabled = ( (int) 0x8622 ),
            ArraySize = ( (int) 0x8623 ),
            ArrayStride = ( (int) 0x8624 ),
            ArrayType = ( (int) 0x8625 ),
            ArrayNormalized = ( (int) 0x886a ),
            CurrentVertexAttrib = ( (int) 0x8626 ),
        }

Fits the naming scheme better.

It seems the MatrixXY tokens are not defined in 2.1 core (see http://www.opengl.org/sdk/docs/man/xhtml/glMatrixMode.xml), so I've left them out for now.

Still have to do the arb stuff.

the Fiddler's picture

Added the arb assembly program enums, but didn't spend a lot of time verifying. There's still a lot to do for the release.

Inertia's picture

Excellent :) I will verify the GLSL stuff against the orange book once you are done with them. I've been very careful making the lists though and think it's 99.5% correct.

the Fiddler's picture

Cool. I suspect I have introduced a few stupid c&p errors (late night coding does that to you ;) ), but we'll catch and correct these soon enough.

Inertia's picture

Well as long as it's nothing like GL.BufferData(EnableCap ... it should be np ^^