public void SetData_GetData()
        {
            VkRenderContext rc  = TestData.CreateVulkanContext();
            ConstantBuffer  cb  = rc.ResourceFactory.CreateConstantBuffer(ShaderConstantType.Matrix4x4);
            Matrix4x4       mat = Matrix4x4.Identity;

            cb.SetData(ref mat, Unsafe.SizeOf <Matrix4x4>());

            Matrix4x4 ret = new Matrix4x4();

            cb.GetData(ref ret, Unsafe.SizeOf <Matrix4x4>());
            Assert.Equal(mat, ret);
        }
예제 #2
0
        public static unsafe RenderContext CreateVulkanRenderContext(ref RenderContextCreateInfo contextCI, Sdl2Window window)
        {
            IntPtr        sdlHandle = window.SdlWindowHandle;
            SDL_SysWMinfo sysWmInfo;

            Sdl2Native.SDL_GetVersion(&sysWmInfo.version);
            Sdl2Native.SDL_GetWMWindowInfo(sdlHandle, &sysWmInfo);
            VkSurfaceSource surfaceSource = GetSurfaceSource(sysWmInfo);
            VkRenderContext rc            = new VkRenderContext(surfaceSource, window.Width, window.Height);

            if (contextCI.DebugContext)
            {
                rc.EnableDebugCallback();
            }

            return(rc);
        }