Exemplo n.º 1
0
 public GPUPipeline(GPUEngine engine, GPUShaderProgram shaderProgram, GPUPipelineFormat format, GPUBuffer[] buffers)
 {
     _engine  = engine;
     _program = shaderProgram;
     _format  = format;
     _buffers = buffers;
 }
Exemplo n.º 2
0
 public void BindFormat(GPUPipelineFormat format)
 {
     if (_currentVao != format)
     {
         Gl.glBindVertexArray(format);
         _currentVao = format;
     }
 }
Exemplo n.º 3
0
        public GPUPipelineFormat CreatePipelineFormat(GPUBufferFormat[] bufferFormats, GPUVertexFormat[] vertexFormats)
        {
            GPUPipelineFormat f = new GPUPipelineFormat(Gl.glCreateVertexArray(), bufferFormats, vertexFormats);

            BindFormat(f);
            for (uint i = 0; i < f.GetVertexFormats().Length; i++)
            {
                GPUVertexFormat vf = f.GetVertexFormats()[i];
                Gl.glEnableVertexArrayAttrib(f, vf.Location);
                Gl.glVertexArrayAttribFormat(f, vf.Location, (int)vf.Size, vf.Type, vf.Normalized, vf.RelativeOffset);
                Gl.glVertexArrayAttribBinding(f, vf.Location, vf.BufferIndex);
            }
            _vaos.Add(f);
            return(f);
        }
Exemplo n.º 4
0
 public void DeletePipelineFormat(GPUPipelineFormat format)
 {
     _vaos.Remove(format);
     Gl.glDeleteVertexArrays(1, new uint[] { format });
 }