public GPUPipeline(GPUEngine engine, GPUShaderProgram shaderProgram, GPUPipelineFormat format, GPUBuffer[] buffers) { _engine = engine; _program = shaderProgram; _format = format; _buffers = buffers; }
public void BindFormat(GPUPipelineFormat format) { if (_currentVao != format) { Gl.glBindVertexArray(format); _currentVao = format; } }
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); }
public void DeletePipelineFormat(GPUPipelineFormat format) { _vaos.Remove(format); Gl.glDeleteVertexArrays(1, new uint[] { format }); }