コード例 #1
0
ファイル: Counters.cs プロジェクト: neozumm/Ryujinx
        public Counters(VulkanGraphicsDevice gd, Device device, PipelineFull pipeline)
        {
            _pipeline = pipeline;

            int count = Enum.GetNames(typeof(CounterType)).Length;

            _counterQueues = new CounterQueue[count];

            for (int index = 0; index < count; index++)
            {
                CounterType type = (CounterType)index;
                _counterQueues[index] = new CounterQueue(gd, device, pipeline, type);
            }
        }
コード例 #2
0
        internal CounterQueue(VulkanGraphicsDevice gd, Device device, PipelineFull pipeline, CounterType type)
        {
            _gd       = gd;
            _device   = device;
            _pipeline = pipeline;

            Type = type;

            _queryPool = new Queue <BufferedQuery>(QueryPoolInitialSize);
            for (int i = 0; i < QueryPoolInitialSize; i++)
            {
                _queryPool.Enqueue(new BufferedQuery(_gd, _device, _pipeline, type));
            }

            _current = new CounterQueueEvent(this, type, 0);

            _consumerThread = new Thread(EventConsumer);
            _consumerThread.Start();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: neozumm/Ryujinx
        private static (WindowBase, IRenderer) CreateRenderer(Options options)
        {
            WindowBase window;
            IRenderer  renderer;

            if (options.GraphicsBackend == GraphicsBackend.Vulkan)
            {
                VulkanWindow vulkanWindow = new VulkanWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, (bool)options.EnableMouse);
                window   = vulkanWindow;
                renderer = new VulkanGraphicsDevice((instance, vk) => new SurfaceKHR((ulong)(vulkanWindow.CreateWindowSurface(instance.Handle))),
                                                    vulkanWindow.GetRequiredInstanceExtensions);
            }
            else
            {
                window   = new OpenGLWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, (bool)options.EnableMouse);
                renderer = new Renderer();
            }

            return(window, renderer);
        }
コード例 #4
0
ファイル: BufferedQuery.cs プロジェクト: scese250/Ryujinx
        public unsafe BufferedQuery(VulkanGraphicsDevice gd, Device device, PipelineFull pipeline, CounterType type)
        {
            _api      = gd.Api;
            _device   = device;
            _pipeline = pipeline;

            var queryPoolCreateInfo = new QueryPoolCreateInfo()
            {
                SType      = StructureType.QueryPoolCreateInfo,
                QueryCount = 1,
                QueryType  = GetQueryType(type)
            };

            gd.Api.CreateQueryPool(device, queryPoolCreateInfo, null, out _queryPool).ThrowOnError();

            var buffer = gd.BufferManager.Create(gd, sizeof(long), forConditionalRendering: true);

            _bufferMap = buffer.Map(0, sizeof(long));
            Marshal.WriteInt64(_bufferMap, -1L);
            _buffer = buffer;
        }