Exemplo n.º 1
0
        public void VkGpuSurfaceIsCreatedSharpVkTypes()
        {
            using var ctx = CreateVkContext();
            using var grVkBackendContext = new GRSharpVkBackendContext
                  {
                      VkInstance               = ctx.Instance,
                      VkPhysicalDevice         = ctx.PhysicalDevice,
                      VkDevice                 = ctx.Device,
                      VkQueue                  = ctx.GraphicsQueue,
                      GraphicsQueueIndex       = ctx.GraphicsFamily,
                      GetProcedureAddress      = ctx.SharpVkGetProc,
                      VkPhysicalDeviceFeatures = ctx.PhysicalDevice.GetFeatures(),
                  };
            Assert.NotNull(grVkBackendContext);

            var baseType = grVkBackendContext as GRVkBackendContext;

            Assert.NotNull(baseType);

            Assert.Equal(ctx.Instance.RawHandle.ToUInt64(), (ulong)baseType.VkInstance);
            Assert.Equal(ctx.PhysicalDevice.RawHandle.ToUInt64(), (ulong)baseType.VkPhysicalDevice);
            Assert.Equal(ctx.Device.RawHandle.ToUInt64(), (ulong)baseType.VkDevice);
            Assert.Equal(ctx.GraphicsQueue.RawHandle.ToUInt64(), (ulong)baseType.VkQueue);
            Assert.NotEqual(0, (long)baseType.VkPhysicalDeviceFeatures);
        }
Exemplo n.º 2
0
        public void VkGpuSurfaceIsCreatedSharpVkTypes()
        {
            using var ctx = CreateVkContext();

            using var grVkBackendContext = new GRSharpVkBackendContext
                  {
                      VkInstance          = ctx.Instance,
                      VkPhysicalDevice    = ctx.PhysicalDevice,
                      VkDevice            = ctx.Device,
                      VkQueue             = ctx.GraphicsQueue,
                      GraphicsQueueIndex  = ctx.GraphicsFamily,
                      GetProcedureAddress = ctx.SharpVkGetProc
                  };

            Assert.NotNull(grVkBackendContext);

            using var grContext = GRContext.CreateVulkan(grVkBackendContext);

            using var surface = SKSurface.Create(grContext, true, new SKImageInfo(100, 100));

            Assert.NotNull(surface);

            var canvas = surface.Canvas;

            Assert.NotNull(canvas);

            canvas.Clear(SKColors.Transparent);

            canvas.Flush();
        }
Exemplo n.º 3
0
        public void PropertyIsSetAndUnset()
        {
            using var grVkBackendContext = new GRSharpVkBackendContext();
            var baseType = grVkBackendContext as GRVkBackendContext;

            Assert.Equal(0, (long)baseType.VkPhysicalDeviceFeatures);

            grVkBackendContext.VkPhysicalDeviceFeatures = new global::SharpVk.PhysicalDeviceFeatures();
            Assert.NotEqual(0, (long)baseType.VkPhysicalDeviceFeatures);

            grVkBackendContext.VkPhysicalDeviceFeatures = null;
            Assert.Equal(0, (long)baseType.VkPhysicalDeviceFeatures);
        }