예제 #1
0
        public GPUBuffer CreateBuffer(uint size)
        {
            GPUBuffer buffer = new GPUBuffer(Gl.glCreateBuffer(), size);

            Gl.glNamedBufferStorage(buffer, size, IntPtr.Zero, Gl.GL_DYNAMIC_STORAGE_BIT);
            _buffers.Add(buffer);
            return(buffer);
        }
예제 #2
0
        public GPUPipeline CreatePipeline(GPUPipelineCreateInfo info)
        {
            GPUBuffer[] buffers = new GPUBuffer[info.Format.GetBufferFormats().Length];
            int         i;

            for (i = 0; i < info.Format.GetBufferFormats().Length; i++)
            {
                buffers[i] = CreateBuffer(info.Format.GetBufferFormats()[i].Size);
            }
            for (i = 0; i < info.Format.GetBufferFormats().Length; i++)
            {
                GPUBufferFormat bf = info.Format.GetBufferFormats()[i];
                Gl.glVertexArrayVertexBuffer(info.Format, bf.BufferIndex, _buffers[i], bf.Offset, (int)bf.Stride);
            }
            GPUPipeline pipe = new GPUPipeline(this, info.ShaderProgram, info.Format, buffers);

            _pipelines.Add(pipe);
            return(pipe);
        }
예제 #3
0
 public void DeleteBuffer(GPUBuffer buffer)
 {
     Gl.glDeleteBuffers(1, new uint[] { buffer });
     _buffers.Remove(buffer);
 }