static GLQueueRendererStencilState ExtractStencilValues(IGLGraphicsPipeline currentPipeline) { return(new GLQueueRendererStencilState { Flags = currentPipeline.Flags, Enums = currentPipeline.StencilState, }); }
private void SetupBlendSettings(IGLGraphicsPipeline pipeline) { if (ChangesFoundInBlend(pipeline.ColorBlendEnums)) { ApplyBlendChanges(pipeline.ColorBlendEnums); mPastColorBlendEnums = pipeline.ColorBlendEnums; } }
private GLCmdBufferPipelineItem ExtractDepthState(IGLGraphicsPipeline pipeline) { return(new GLCmdBufferPipelineItem { Flags = pipeline.Flags, DepthState = pipeline.DepthState, }); }
private void SetupRasterizationSettings(IGLGraphicsPipeline pipeline) { var currentRasterization = pipeline.Flags; if (ChangesFoundInRasterization(currentRasterization)) { ApplyRasterizationChanges(mPastRasterization.Flags, currentRasterization); } mPastRasterization.Flags = currentRasterization; }
private void SetupStencilSettings(IGLGraphicsPipeline pipeline) { var currentStencil = ExtractStencilValues(pipeline); if (ChangesFoundInStencil(mPastStencilInfo, currentStencil)) { ApplyStencilChanges(mPastStencilInfo, currentStencil); } mPastStencilInfo = currentStencil; }
private void SetupDepthSettings(IGLGraphicsPipeline pipeline) { var depthState = ExtractDepthState(pipeline); if (ChangesFoundInDepth(depthState)) { ApplyDepthChanges(depthState); mPastDepthState = depthState; } }
public GLCmdBufferPipelineItem GeneratePipelineItem(IGLGraphicsPipeline pipeline) { GLGraphicsPipelineFlagBits flags = pipeline.Flags; var pipelineItem = new GLCmdBufferPipelineItem { Flags = flags, DepthState = pipeline.DepthState, StencilState = pipeline.StencilState, }; return(pipelineItem); }
byte GenerateBlendEnums(IGLGraphicsPipeline pipeline, List <GLGraphicsPipelineBlendColorState> colorBlends) { if (pipeline == null) { throw new ArgumentNullException("pipeline"); } var nextIndex = colorBlends.Count; colorBlends.Add(pipeline.ColorBlendEnums); return((byte)nextIndex); }
void InsertNewPipeline( GLCmdRenderPassCommand pass, IGLGraphicsPipeline pipeline, List <GLCmdBufferPipelineItem> pipelines, List <GLCmdClearValuesParameter> clearValues, List <GLGraphicsPipelineBlendColorState> colorBlends ) { var pipelineItem = GeneratePipelineItem(pipeline); pipelineItem.DepthState = pipeline.DepthState; pipelineItem.StencilState = pipeline.StencilState; pipelineItem.ClearValues = GenerateClearValues(pass, clearValues); pipelineItem.ColorBlendEnums = GenerateBlendEnums(pipeline, colorBlends); pipelines.Add(pipelineItem); }
public GLCmdVertexBufferObject GenerateVBO(IGLCmdBufferRepository repository, GLCmdDrawCommand command, IGLGraphicsPipeline pipeline) { var vertexData = repository.VertexBuffers.At(command.VertexBuffer.Value); var noOfBindings = pipeline.VertexInput.Bindings.Length; var bufferIds = new int[noOfBindings]; var offsets = new long[noOfBindings]; for (uint i = 0; i < vertexData.pBuffers.Length; ++i) { uint index = i + vertexData.firstBinding; var buffer = vertexData.pBuffers [index] as GLIndirectBuffer; // SILENT error if (buffer.BufferType == GLMemoryBufferType.VERTEX) { bufferIds [i] = buffer.BufferId; offsets [i] = (vertexData.pOffsets != null) ? (long)vertexData.pOffsets [i] : 0L; } else { bufferIds [i] = 0; } } // int[] arrays = new int[1]; // GL.CreateVertexArrays(1, arrays); int vbo = mVBO.GenerateVBO(); // Debug.Assert(GL.IsVertexArray(vbo)); // GL.DeleteVertexArray (vbo); foreach (var attribute in pipeline.VertexInput.Attributes) { var bufferId = bufferIds [attribute.Binding]; var binding = pipeline.VertexInput.Bindings [attribute.Binding]; mVBO.AssociateBufferToLocation(vbo, attribute.Location, bufferId, offsets[attribute.Binding], binding.Stride); // GL.VertexArrayVertexBuffer (vertexArray, location, bufferId, new IntPtr (offset), (int)binding.Stride); if (attribute.Function == GLVertexAttribFunction.FLOAT) { // direct state access mVBO.BindFloatVertexAttribute(vbo, attribute.Location, attribute.Size, attribute.PointerType, attribute.IsNormalized, attribute.Offset); //GL.VertexArrayAttribFormat (vbo, attribute.Location, attribute.Size, attribute.PointerType, attribute.IsNormalized, attribute.Offset); } else if (attribute.Function == GLVertexAttribFunction.INT) { mVBO.BindIntVertexAttribute(vbo, attribute.Location, attribute.Size, attribute.PointerType, attribute.Offset); //GL.VertexArrayAttribIFormat (vbo, attribute.Location, attribute.Size, attribute.PointerType, attribute.Offset); } else if (attribute.Function == GLVertexAttribFunction.DOUBLE) { mVBO.BindDoubleVertexAttribute(vbo, attribute.Location, attribute.Size, attribute.PointerType, attribute.Offset); //GL.VertexArrayAttribLFormat (vbo, attribute.Location, attribute.Size, (All)attribute.PointerType, attribute.Offset); } mVBO.SetupVertexAttributeDivisor(vbo, attribute.Location, attribute.Divisor); //GL.VertexArrayBindingDivisor (vbo, attribute.Location, attribute.Divisor); } if (command.IndexBuffer.HasValue) { var indexData = repository.IndexBuffers.At(command.IndexBuffer.Value); var indexBuffer = indexData.buffer as GLIndirectBuffer; if (indexBuffer != null && indexBuffer.BufferType == GLMemoryBufferType.INDEX) { mVBO.BindIndexBuffer(vbo, indexBuffer.BufferId); //GL.VertexArrayElementBuffer (vbo, indexBuffer.BufferId); } } return(new GLCmdVertexBufferObject(vbo, command.VertexBuffer.Value, command.IndexBuffer, mVBO)); }
static GLCommandBufferFlagBits ExtractPolygonMode(IGLGraphicsPipeline pipeline) { return((pipeline.PolygonMode == MgPolygonMode.LINE) ? GLCommandBufferFlagBits.AsLinesMode : ((pipeline.PolygonMode == MgPolygonMode.POINT) ? GLCommandBufferFlagBits.AsPointsMode : 0)); }