Ejemplo n.º 1
0
 public void ValidateProgram(WebGLProgram program) => this.CallMethod <object>(VALIDATE_PROGRAM, program);
Ejemplo n.º 2
0
 public object getProgramParameter(WebGLProgram program, int pname) { return default(object); }
Ejemplo n.º 3
0
 public bool isProgram(WebGLProgram program) { return default(bool); }
 /// <summary>
 /// Returns the value of the program parameter that corresponds to a supplied pname for a given program, or null if an error occurs.
 ///
 /// Errors:
 ///     gl.INVALID_ENUM            If pname isn't in the table above.
 ///     gl.INVALID_OPERATION    If program isn't a program object.
 /// </summary>
 /// <param name="program">The program object to query for pname.</param>
 /// <param name="pName">The parameter constant.
 ///     Parameter              Returned type
 ///
 ///     gl.DELETE_STATUS        Boolean
 ///     gl.LINK_STATUS            Boolean
 ///     gl.VALIDATE_STATUS        Boolean
 ///     gl.ATTACHED_SHADERS        Number
 ///     gl.ACTIVE_ATTRIBUTES    Number
 ///     gl.ACTIVE_UNIFORMS        Number
 /// </param>
 /// <returns>The value for a parameter associated with pname, or null if an error occurs.</returns>
 public virtual Any<bool, int, object> GetProgramParameter(WebGLProgram program, int pName)
 {
     return null;
 }
Ejemplo n.º 5
0
 public WebGLActiveInfo getActiveAttrib(WebGLProgram program, int index) { return default(WebGLActiveInfo); }
 /// <summary>
 /// Flags a specific WebGLProgram object for deletion if currently active. It will be deleted when it is no longer being used. Any shader objects associated with the program will be detached. They will be deleted if they were already flagged for deletion.
 /// </summary>
 /// <param name="program">The program to be deleted.</param>
 public virtual void DeleteProgram(WebGLProgram program) { }
 /// <summary>
 /// Returns an WebGLActiveInfo object containing the size, type, and name of a uniform attribute at a specific index position in a program object.
 ///
 /// Errors:
 ///     gl.INVALID_VALUE        The value of program is not generated by WebGL.
 ///                             The value of index is greater than or equal to the number of active uniforms in program.
 ///
 ///     gl.INVALID_OPERATION    The program is not a valid program object.
 /// </summary>
 /// <param name="program">The program object containing the uniform attribute of interest.</param>
 /// <param name="index">The index of the uniform. The index is zero based. Passing 0 selects the first uniform, while ACTIVE_ATTRIBUTES - 1 specifies the last uniform.</param>
 /// <returns>A WebGLActiveInfo object.</returns>
 public virtual WebGLActiveInfo GetActiveUniform(WebGLProgram program, int index)
 {
     return null;
 }
Ejemplo n.º 8
0
 protected GLShader(WebGLContext context, WebGLProgram program, ShaderType type)
 {
     _context    = context;
     _program    = program;
     _shaderType = type;
 }
Ejemplo n.º 9
0
 public WebGLActiveInfo getActiveAttrib(WebGLProgram program, int index)
 {
     return(default(WebGLActiveInfo));
 }
Ejemplo n.º 10
0
 public T GetUniform <T>(WebGLProgram program, WebGLUniformLocation location) => this.CallMethod <T>(GET_UNIFORM, program, location);
Ejemplo n.º 11
0
 public WebGLUniformLocation GetUniformLocation(WebGLProgram program, string name) => this.CallMethod <WebGLUniformLocation>(GET_UNIFORM_LOCATION, program, name);
Ejemplo n.º 12
0
 public int GetAttribLocation(WebGLProgram program, string name) => this.CallMethod <int>(GET_ATTRIB_LOCATION, program, name);
Ejemplo n.º 13
0
 public WebGLActiveInfo GetActiveUniform(WebGLProgram program, uint index) => this.CallMethod <WebGLActiveInfo>(GET_ACTIVE_UNIFORM, program, index);
Ejemplo n.º 14
0
 public WebGLActiveInfo GetActiveAttrib(WebGLProgram program, uint index) => this.CallMethod <WebGLActiveInfo>(GET_ACTIVE_ATTRIB, program, index);
 /// <summary>
 /// Gets state of WebGL program object. Returns true if program object is valid, false otherwise.
 /// </summary>
 /// <param name="program">The program object to query.</param>
 /// <returns>Returns true if program is valid, false otherwise.</returns>
 public virtual bool IsProgram(WebGLProgram program)
 {
     return false;
 }
Ejemplo n.º 16
0
 public WebGLActiveInfo getActiveUniform(WebGLProgram program, int index)
 {
     return(default(WebGLActiveInfo));
 }
 /// <summary>
 /// Set the program object to use for rendering.
 /// Program objects can be used for multiple rendering contexts.
 ///
 /// Errors:
 ///     gl.INVALID_OPERATION    If program hasn't been linked.
 ///                             If program isn't a WebGLProgram object, but is a WebGL generated object.
 ///
 ///     gl.INVALID_VALUE        If program isn't a WebGL generated object.
 /// </summary>
 /// <param name="program">The program object.</param>
 public virtual void UseProgram(WebGLProgram program) { }
Ejemplo n.º 18
0
 public void getAttachedShaders(WebGLProgram program)
 {
 }
 /// <summary>
 /// Detach a shader object from a program object.
 /// If the shader is flagged for deletion by deleteShader, it's deleted after it's removed.
 /// </summary>
 /// <param name="program">The program object that contains the shader to detach. </param>
 /// <param name="shader">The shader to detach.</param>
 public virtual void DetachShader(WebGLProgram program, WebGLShader shader) { }
Ejemplo n.º 20
0
        void INativeShaderProgram.LoadProgram(INativeShaderPart vertex, INativeShaderPart fragment)
        {
            // Removed thread guards because of performance
            //DefaultOpenTKBackendPlugin.GuardSingleThreadState();

            if (this.handle == null)
            {
                this.handle = GraphicsBackend.GL.CreateProgram();
            }
            else
            {
                this.DetachShaders();
            }

            if (vertex == null)
            {
                vertex = VertexShader.Minimal.Res.Native;
            }
            if (fragment == null)
            {
                fragment = FragmentShader.Minimal.Res.Native;
            }


            // Attach both shaders
            GraphicsBackend.GL.AttachShader(this.handle, (vertex as NativeShaderPart).Handle);
            GraphicsBackend.GL.AttachShader(this.handle, (fragment as NativeShaderPart).Handle);

            // Link the shader program
            GraphicsBackend.GL.LinkProgram(this.handle);

            bool result = (bool)GraphicsBackend.GL.GetProgramParameter(this.handle, WebGLRenderingContextBase.LINK_STATUS);

            if (!result)
            {
                string errorLog = GraphicsBackend.GL.GetProgramInfoLog(this.handle);
                this.RollbackAtFault();
                throw new BackendException(string.Format("Linker error:{1}{0}", errorLog, Environment.NewLine));
            }

            // Collect variable infos from sub programs
            {
                NativeShaderPart vert = vertex as NativeShaderPart;
                NativeShaderPart frag = fragment as NativeShaderPart;

                ShaderFieldInfo[] fragVarArray = frag != null ? frag.Fields : null;
                ShaderFieldInfo[] vertVarArray = vert != null ? vert.Fields : null;

                if (fragVarArray != null && vertVarArray != null)
                {
                    this.fields = vertVarArray.Union(fragVarArray).ToArray();
                }
                else if (vertVarArray != null)
                {
                    this.fields = vertVarArray.ToArray();
                }
                else
                {
                    this.fields = fragVarArray.ToArray();
                }
            }

            // Determine each variables location
            this.fieldLocations = new FieldLocation[this.fields.Length];
            for (int i = 0; i < this.fields.Length; i++)
            {
                if (this.fields[i].Scope == ShaderFieldScope.Uniform)
                {
                    this.fieldLocations[i].Uniform = GraphicsBackend.GL.GetUniformLocation(this.handle, this.fields[i].Name);
                }
                else
                {
                    this.fieldLocations[i].Attrib = GraphicsBackend.GL.GetAttribLocation(this.handle, this.fields[i].Name);
                }
            }
        }
 /// <summary>
 /// Returns an index to the location in a program of a named attribute variable.
 /// If name is a matrix variable, index points to the first column of the matrix.
 /// </summary>
 /// <param name="program">The program object.</param>
 /// <param name="name">The name of the attribute variable.</param>
 /// <returns>The location of the attribute variable name if found. Returns a -1 if not.</returns>
 public virtual int GetAttribLocation(WebGLProgram program, string name)
 {
     return 0;
 }
Ejemplo n.º 22
0
 public object getUniform(WebGLProgram program, WebGLUniformLocation location)
 {
     return(null);
 }
Ejemplo n.º 23
0
 public void deleteProgram(WebGLProgram program) { }
Ejemplo n.º 24
0
 public object getProgramParameter(WebGLProgram program, int pname)
 {
     return(null);
 }
Ejemplo n.º 25
0
 public WebGLObjectArray getAttachedShaders(WebGLProgram program) { return default(WebGLObjectArray); }
Ejemplo n.º 26
0
 public void bindAttribLocation(WebGLProgram program, int index, string name)
 {
 }
Ejemplo n.º 27
0
 public object getUniform(WebGLProgram program, WebGLUniformLocation location) { return default(object); }
Ejemplo n.º 28
0
 public void deleteProgram(WebGLProgram program)
 {
 }
Ejemplo n.º 29
0
 public void useProgram(WebGLProgram program) { }
Ejemplo n.º 30
0
 public void detachShader(WebGLProgram program, WebGLShader shader)
 {
 }
 /// <summary>
 /// Returns a WebGLUniformLocation object for the location of a uniform variable within a WebGLProgram object.
 ///
 /// Errors:
 ///     gl.INVALID_VALUE        If program is not generated by WebGL.
 ///
 ///     gl.INVALID_OPERATION    If program is not a program object.
 ///                             if program isn't successfully linked.
 /// </summary>
 /// <param name="program">The program object to query.</param>
 /// <param name="name">A string containing the name of the uniform variable. </param>
 /// <returns>The WebGLUniformLocation for the name. Returns null if a WebGL error occurs or if name starts with a reserved WebGL prefix.</returns>
 public virtual WebGLUniformLocation GetUniformLocation(WebGLProgram program, string name)
 {
     return null;
 }
Ejemplo n.º 32
0
 public int getAttribLocation(WebGLProgram program, string name)
 {
     return(default(int));
 }
 /// <summary>
 /// Links an attached vertex shader and an attached fragment shader to a program so it can be used by the graphics processing unit (GPU).
 /// If a link operation fails, any info associated with a previous link operation of program is lost.
 ///
 /// Errors:
 ///     gl.INVALID_VALUE         If program isn't a WebGL object type.
 ///     gl.INVALID_OPERATION    If program isn't a program object.
 /// </summary>
 /// <param name="program">The program object to link.</param>
 public virtual void LinkProgram(WebGLProgram program) { }
Ejemplo n.º 34
0
 public object getProgramParameter(WebGLProgram program, int pname)
 {
     return(default(object));
 }
 /// <summary>
 /// Returns whether a given program can run in the current WebGL state.
 /// A program is considered invalid if it hasn't successfully linked, or any two active samplers in the program are different types, but refer to the same texture image unit.
 /// This method is used in conjunction with getProgramParameter called with gl.VALIDATE_STATUS to test for a valid program.
 /// </summary>
 /// <param name="program">The program to validate.</param>
 public virtual void ValidateProgram(WebGLProgram program) { }
Ejemplo n.º 36
0
 public string getProgramInfoLog(WebGLProgram program)
 {
     return(default(string));
 }
 /// <summary>
 /// Binds a generic vertex index to a user-defined attribute variable.
 /// More than one name can be bound to the same vertex index, but multiple indexes cannot be bound to the same name.
 /// If name is a matrix attribute, then index points to the first column of the matrix. Additional matrix columns are automatically bound to index+1, index+2, and so forth based on matrix variable (mat2,mat3,mat4).
 ///
 /// Errors:
 ///     gl.INVALID_VALUE        If index is greater than or equal to gl.MAX_VERTEX_ATTRIBS.
 ///     gl.INVALID_VALUE        If program is not generated by WebGL.
 ///     gl.INVALID_OPERATION    If name starts with the reserved prefix gl_.
 ///     gl.INVALID_OPERATION    If program isn't a program object.
 /// </summary>
 /// <param name="program">Program object to bind. </param>
 /// <param name="index">The index of the generic vertex to bind. </param>
 /// <param name="name">me of the user variable to a bind to the generic vertex index.</param>
 public virtual void BindAttribLocation(WebGLProgram program, int index, string name) { }
Ejemplo n.º 38
0
 public object getUniform(WebGLProgram program, WebGLUniformLocation location)
 {
     return(default(object));
 }
 /// <summary>
 /// Returns an WebGLActiveInfo object containing the size, type, and name of a vertex attribute at a specific index position in a program object.
 ///
 /// Errors:
 ///     gl.INVALID_VALUE        The value of program is not generated by WebGL.
 ///                             The value of index is greater than or equal to the number of active attribute variables in program.
 ///
 ///     gl.INVALID_OPERATION    The value program is not a valid program object.
 /// </summary>
 /// <param name="program">The program object containing the vertex attribute of interest.</param>
 /// <param name="index">The index of the attribute. Index is zero based. Passing 0 selects the first attribute, while gl.ACTIVE_ATTRIBUTES - 1 specifies the last attribute.</param>
 /// <returns>A WebGLActiveInfo object.</returns>
 public virtual WebGLActiveInfo GetActiveAttrib(WebGLProgram program, int index)
 {
     return null;
 }
Ejemplo n.º 40
0
 public WebGLUniformLocation getUniformLocation(WebGLProgram program, string name)
 {
     return(default(WebGLUniformLocation));
 }
 /// <summary>
 /// Returns a list of WebGLShaders bound to a WebGLProgram.
 /// </summary>
 /// <param name="program">The WebGLProgram object from which to get list of WebGLShaders</param>
 /// <returns>Array of the WebGLShaders that are bound to program.</returns>
 public virtual WebGLShader[] FetAttachedShaders(WebGLProgram program)
 {
     return null;
 }
Ejemplo n.º 42
0
 public bool isProgram(WebGLProgram program)
 {
     return(default(bool));
 }
 /// <summary>
 /// Returns information about the last error that occurred during the failed linking or validation of a WebGL program object.
 /// This method returns the last error that occurred during program linking or validation. WebGL reports one error at a time, and won't return another error until the reported error has been corrected.
 ///
 /// Errors:
 ///
 ///     gl.INVALID_VALUE        If program isn't a WebGL object.
 ///     gl.INVALID_OPERATION    If program isn't a program object.
 /// </summary>
 /// <param name="program">The program object to get the information for. </param>
 /// <returns>The information (error, warning, or informational messages), or an empty string if none. Returns null if an error occurs.</returns>
 public virtual string GetProgramInfoLog(WebGLProgram program)
 {
     return null;
 }
Ejemplo n.º 44
0
 public void linkProgram(WebGLProgram program)
 {
 }
Ejemplo n.º 45
0
 public void bindAttribLocation(WebGLProgram program, int index, string name) { }
Ejemplo n.º 46
0
 public void useProgram(WebGLProgram program)
 {
 }
Ejemplo n.º 47
0
 public void detachShader(WebGLProgram program, WebGLShader shader) { }
Ejemplo n.º 48
0
 public void validateProgram(WebGLProgram program)
 {
 }
Ejemplo n.º 49
0
 public WebGLActiveInfo getActiveUniform(WebGLProgram program, int index) { return default(WebGLActiveInfo); }
Ejemplo n.º 50
0
 public void BindAttribLocation(WebGLProgram program, uint index, string name) => this.CallMethod <object>(BIND_ATTRIB_LOCATION, program, index, name);
Ejemplo n.º 51
0
 public int getAttribLocation(WebGLProgram program, string name) { return default(int); }
Ejemplo n.º 52
0
 public void DeleteProgram(WebGLProgram program) => this.CallMethod <object>(DELETE_PROGRAM, program);
Ejemplo n.º 53
0
 public JsString getProgramInfoLog(WebGLProgram program) { return default(JsString); }
Ejemplo n.º 54
0
 public void DetachShader(WebGLProgram program, WebGLShader shader) => this.CallMethod <object>(DETACH_SHADER, program, shader);
Ejemplo n.º 55
0
 public WebGLUniformLocation getUniformLocation(WebGLProgram program, string name) { return default(WebGLUniformLocation); }
Ejemplo n.º 56
0
 public WebGLShader[] GetAttachedShaders(WebGLProgram program) => this.CallMethod <WebGLShader[]>(GET_ATTACHED_SHADERS, program);
Ejemplo n.º 57
0
 public void linkProgram(WebGLProgram program) { }
 /// <summary>
 /// Gets the uniform value for a specific location in a program.
 ///
 /// Errors:
 ///     gl.INVALID_VALUE    If program is not generated by WebGL.
 ///
 ///     gl.INVALID_OPERATION        If location isn't a valid uniform variable location for program
 ///                                 If program is not a program object.
 ///                                 if program isn't successfully linked.
 /// </summary>
 /// <param name="program">The program to query.</param>
 /// <param name="location">The location of the uniform variable.</param>
 /// <returns>The uniform value or null if a WebGL error is generated.</returns>
 public virtual object GetUniform(WebGLProgram program, WebGLUniformLocation location)
 {
     return null;
 }
Ejemplo n.º 59
0
 public void validateProgram(WebGLProgram program) { }
Ejemplo n.º 60
0
 public void UseProgram(WebGLProgram program) => this.CallMethod <object>(USE_PROGRAM, program);