public override void CreateDeviceObjects(GraphicsDevice gd, CommandList cl, SceneRenderPipeline sp) { var factory = gd.ResourceFactory; WorldBuffer = Renderer.UniformBufferAllocator.Allocate(128, 128); WorldBuffer.FillBuffer(cl, ref _World); VertexLayoutDescription[] mainVertexLayouts = new VertexLayoutDescription[] { new VertexLayoutDescription( new VertexElementDescription("position", VertexElementSemantic.TextureCoordinate, Veldrid.VertexElementFormat.Float3), new VertexElementDescription("normal", VertexElementSemantic.TextureCoordinate, Veldrid.VertexElementFormat.SByte4), new VertexElementDescription("color", VertexElementSemantic.TextureCoordinate, Veldrid.VertexElementFormat.Byte4)) }; var res = StaticResourceCache.GetShaders(gd, gd.ResourceFactory, "Collision").ToTuple(); Shaders = new Shader[] { res.Item1, res.Item2 }; ResourceLayout projViewLayout = StaticResourceCache.GetResourceLayout( gd.ResourceFactory, StaticResourceCache.SceneParamLayoutDescription); ResourceLayout mainPerObjectLayout = StaticResourceCache.GetResourceLayout(gd.ResourceFactory, new ResourceLayoutDescription( new ResourceLayoutElementDescription("WorldBuffer", ResourceKind.StructuredBufferReadWrite, ShaderStages.Vertex | ShaderStages.Fragment, ResourceLayoutElementOptions.None))); PerObjRS = StaticResourceCache.GetResourceSet(factory, new ResourceSetDescription(mainPerObjectLayout, Renderer.UniformBufferAllocator._backingBuffer)); bool isTriStrip = false; var fres = ColResource.Get(); if (fres != null) { var mesh = fres.GPUMeshes[ColMeshIndex]; } GraphicsPipelineDescription pipelineDescription = new GraphicsPipelineDescription(); pipelineDescription.BlendState = BlendStateDescription.SingleOverrideBlend; pipelineDescription.DepthStencilState = DepthStencilStateDescription.DepthOnlyGreaterEqual; pipelineDescription.RasterizerState = new RasterizerStateDescription( cullMode: FaceCullMode.Back, fillMode: PolygonFillMode.Solid, frontFace: WindClockwise ? FrontFace.Clockwise : FrontFace.CounterClockwise, depthClipEnabled: true, scissorTestEnabled: false); pipelineDescription.PrimitiveTopology = isTriStrip ? PrimitiveTopology.TriangleStrip : PrimitiveTopology.TriangleList; pipelineDescription.ShaderSet = new ShaderSetDescription( vertexLayouts: mainVertexLayouts, shaders: Shaders); pipelineDescription.ResourceLayouts = new ResourceLayout[] { projViewLayout, mainPerObjectLayout, Renderer.GlobalTexturePool.GetLayout(), Renderer.GlobalCubeTexturePool.GetLayout(), Renderer.MaterialBufferAllocator.GetLayout(), SamplerSet.SamplersLayout }; pipelineDescription.Outputs = gd.SwapchainFramebuffer.OutputDescription; RenderPipeline = StaticResourceCache.GetPipeline(factory, ref pipelineDescription); }