Beispiel #1
0
        public unsafe PipelineBase(VulkanGraphicsDevice gd, Device device)
        {
            Gd     = gd;
            Device = device;

            var pipelineCacheCreateInfo = new PipelineCacheCreateInfo()
            {
                SType = StructureType.PipelineCacheCreateInfo
            };

            gd.Api.CreatePipelineCache(device, pipelineCacheCreateInfo, null, out _pipelineCache).ThrowOnError();

            _descriptorSetUpdater = new DescriptorSetUpdater(gd, this);

            _transformFeedbackBuffers = new BufferState[Constants.MaxTransformFeedbackBuffers];
            _vertexBuffers            = new BufferState[Constants.MaxVertexBuffers + 1];

            const int EmptyVbSize = 16;

            using var emptyVb = gd.BufferManager.Create(gd, EmptyVbSize);
            emptyVb.SetData(0, new byte[EmptyVbSize]);
            _vertexBuffers[0]         = new BufferState(emptyVb.GetBuffer(), 0, EmptyVbSize, 0UL);
            _needsVertexBuffersRebind = true;

            RenderScaleBuffer = gd.BufferManager.Create(gd, SupportBuffer.RequiredSize);

            _newState.Initialize();
            _newState.LineWidth = 1f;
        }
Beispiel #2
0
        public unsafe PipelineBase(VulkanRenderer gd, Device device)
        {
            Gd     = gd;
            Device = device;

            var pipelineCacheCreateInfo = new PipelineCacheCreateInfo()
            {
                SType = StructureType.PipelineCacheCreateInfo
            };

            gd.Api.CreatePipelineCache(device, pipelineCacheCreateInfo, null, out PipelineCache).ThrowOnError();

            _descriptorSetUpdater = new DescriptorSetUpdater(gd, this);

            _transformFeedbackBuffers = new BufferState[Constants.MaxTransformFeedbackBuffers];
            _vertexBuffers            = new BufferState[Constants.MaxVertexBuffers + 1];

            const int EmptyVbSize = 16;

            using var emptyVb = gd.BufferManager.Create(gd, EmptyVbSize);
            emptyVb.SetData(0, new byte[EmptyVbSize]);
            _vertexBuffers[0]         = new BufferState(emptyVb.GetBuffer(), 0, EmptyVbSize, 0UL);
            _needsVertexBuffersRebind = true;

            ClearScissor = new Rectangle <int>(0, 0, 0xffff, 0xffff);

            var defaultScale = new Vector4 <float> {
                X = 1f, Y = 0f, Z = 0f, W = 0f
            };

            new Span <Vector4 <float> >(_renderScale).Fill(defaultScale);

            _newState.Initialize();
            _newState.LineWidth    = 1f;
            _newState.SamplesCount = 1;
        }