Git Product home page Git Product logo

go-vk-samples's Introduction

go-vk-samples

This repository contains runnable sample apps to demonstrate use of go-vk, a Go-language binding for the Vulkan graphics and compute API. Samples currently only run under Windows.

Before running, change to the shared/ folder and run make to build the OS delegation libary, which the shared package links to as part of go build or go run.

Run the 00_minimal example first, which will confirm that Vulkan is installed and minimally working on your system, and that go-vk is linking to it.

The "0n_" series of samples follow the project found at Vulkan-Tutorial.com.

  • 01_single_triangle - General Vulkan setup and rendering a single static triangle
  • 02_vertex_buffers - Shader input bindings, indexed rendering, staging copying data from the CPU to the GPU
  • 03_uniform_buffers - Descriptor sets, uniform buffers, MVP projections
  • 04_texture_mapping - Loading a texture from a file and sampling it in the fragment shader.
  • 05_depth_buffering - Depth buffering on a pair of textured squares.
  • 06_loading_models - Loading Wavefront OBJ models from a file
  • 07_generating_mipmaps - Generating, binding and using mipmap textures - TODO - Not yet implemented
  • 08_multisampling - TODO - Not yet implemented

The "shared" directory contains a very basic OS-independent app structure, with implementations for Win32 and MacOS/Cocoa. Operating system events are passed into a channel that the sample applications should empty before drawing each frame. Reading that channel should happen in a separate goroutine, as the windowing code is locked to the main thread, and blocks in App.Run() loop as long as the window is open.

Other samples and pending projects:

go-vk-samples's People

Contributors

bbredesen avatar johanhenriksson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

johanhenriksson

go-vk-samples's Issues

run 01_single_triangle error

Build example 01, run, output message:

go-vk - Drawing a Triangle
This program demonstrates opening a window, setting up the basics for Vulkan rendering, and draws a single triangle.

Vulkan Library API version 1.3.224
Found Physical Device:
  Device Name:          Intel(R) UHD Graphics
  Vendor/Device ID:     0x8086 / 0x9b41
  Device Type:          PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
  Device API Version:   1.3.215
  Driver Version:       0.404.2114
VUID-VkShaderModuleCreateInfo-pCode-01379(ERROR / SPEC): msgNum: 706474367 - Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-01379 ] Object 0: handle = 0x20da0963ad8, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x2a1bf17f | SPIR-V module not valid: Invalid SPIR-V magic number. The Vulkan spec states: If pCode is a pointer to GLSL code, it must be valid GLSL code written to the GL_KHR_vulkan_glsl GLSL extension specification (https://vulkan.lunarg.com/doc/view/1.3.250.0/windows/1.3-extensions/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-01379)
    Objects: 1
        [0] 0x20da0963ad8, type: 3, name: NULL
VUID-VkShaderModuleCreateInfo-codeSize-08735(ERROR / SPEC): msgNum: 1987914312 - Validation Error: [ VUID-VkShaderModuleCreateInfo-codeSize-08735 ] Object 0: handle = 0x20da0963ad8, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x767d2a48 | SPIR-V module not valid: Codesize must be a multiple of 4 but is 143 The Vulkan spec states: If pname:codeType is ename:VK_SHADER_CODE_TYPE_SPIRV_EXT, codeSize must be a multiple of 4 (https://vulkan.lunarg.com/doc/view/1.3.250.0/windows/1.3-extensions/vkspec.html#VUID-VkShaderModuleCreateInfo-codeSize-08735)
    Objects: 1
        [0] 0x20da0963ad8, type: 3, name: NULL
Exception 0xc0000005 0x0 0xffffffffffffffff 0x7ffa56ae0710
PC=0x7ffa56ae0710
signal arrived during external code execution

runtime.cgocall(0x1043ce0, 0xc00008fa68)
        C:/Program Files/Go/src/runtime/cgocall.go:157 +0x4a fp=0xc00008fa40 sp=0xc00008fa08 pc=0xf73fca
github.com/bbredesen/go-vk._Cfunc_Trampoline6(0x7ffa5088ccc0, 0x20da0963ad8, 0x0, 0x1, 0xc000112000, 0x0, 0xc000108048)
        _cgo_gotypes.go:145 +0x57 fp=0xc00008fa68 sp=0xc00008fa40 pc=0x1027497
github.com/bbredesen/go-vk.execTrampoline.func8(0x0?, {0xc00008fb58?, 0xfb7312?, 0x8?})
        C:/Users/Clark/go/pkg/mod/github.com/bbredesen/[email protected]/static_common.go:110 +0xfc fp=0xc00008faf0 sp=0xc00008fa68 pc=0x1028a7c
github.com/bbredesen/go-vk.execTrampoline(0x1058e40, {0xc00008fb58, 0x6, 0x6})
        C:/Users/Clark/go/pkg/mod/github.com/bbredesen/[email protected]/static_common.go:110 +0x15a fp=0xc00008fb30 sp=0xc00008faf0 pc=0x1027c7a
github.com/bbredesen/go-vk.CreateGraphicsPipelines(0x20da0963ad8, 0x0, {0xc00008fea8?, 0x1, 0xc00008fc90?}, 0x0)
        C:/Users/Clark/go/pkg/mod/github.com/bbredesen/[email protected]/command.go:3787 +0x12c fp=0xc00008fc48 sp=0xc00008fb30 pc=0x1020f6c
main.(*App_01).createGraphicsPipeline(0xc0000f4000)
        D:/work/gitRepos/vulkan/test2/pipeline_setup.go:127 +0x6f4 fp=0xc00008ff50 sp=0xc00008fc48 pc=0x1042414
main.(*App_01).InitVulkan(0xc0000f4000)
        D:/work/gitRepos/vulkan/test2/app.go:118 +0x85 fp=0xc00008ff70 sp=0xc00008ff50 pc=0x103f705
main.(*App_01).MainLoop(0xc0000f4000, 0x0?)
        D:/work/gitRepos/vulkan/test2/app.go:75 +0x4d fp=0xc00008ffc0 sp=0xc00008ff70 pc=0x103f4ad
main.(*App_01).Run.func1()
        D:/work/gitRepos/vulkan/test2/app.go:101 +0x2a fp=0xc00008ffe0 sp=0xc00008ffc0 pc=0x103f64a
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00008ffe8 sp=0xc00008ffe0 pc=0xfcfc61
created by main.(*App_01).Run
        D:/work/gitRepos/vulkan/test2/app.go:101 +0x8a

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x1043b30, 0xc0000c9df0)
        C:/Program Files/Go/src/runtime/cgocall.go:157 +0x4a fp=0xc0000c9dc8 sp=0xc0000c9d90 pc=0xf73fca
shared._Cfunc_runWin32Window(0xd0f7c)
        _cgo_gotypes.go:73 +0x4e fp=0xc0000c9df0 sp=0xc0000c9dc8 pc=0x103e56e
shared.(*windowsApp).Run.func1(0xc0000fc000?)
        D:/work/gitRepos/vulkan/shared/app_windows.go:71 +0x46 fp=0xc0000c9e28 sp=0xc0000c9df0 pc=0x103e906
shared.(*windowsApp).Run(0xc0000ee060)
        D:/work/gitRepos/vulkan/shared/app_windows.go:71 +0xb2 fp=0xc0000c9e60 sp=0xc0000c9e28 pc=0x103e852
main.(*App_01).Run(0xc0000f4000)
        D:/work/gitRepos/vulkan/test2/app.go:103 +0x9c fp=0xc0000c9e88 sp=0xc0000c9e60 pc=0x103f5fc
main.main()
        D:/work/gitRepos/vulkan/test2/main.go:46 +0x358 fp=0xc0000c9f80 sp=0xc0000c9e88 pc=0x1041b58
runtime.main()
        C:/Program Files/Go/src/runtime/proc.go:250 +0x1f7 fp=0xc0000c9fe0 sp=0xc0000c9f80 pc=0xfa7757
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000c9fe8 sp=0xc0000c9fe0 pc=0xfcfc61

goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        C:/Program Files/Go/src/runtime/proc.go:381 +0xd6 fp=0xc000049fb0 sp=0xc000049f90 pc=0xfa7b76
runtime.goparkunlock(...)
        C:/Program Files/Go/src/runtime/proc.go:387
runtime.forcegchelper()
        C:/Program Files/Go/src/runtime/proc.go:305 +0xb2 fp=0xc000049fe0 sp=0xc000049fb0 pc=0xfa7992
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000049fe8 sp=0xc000049fe0 pc=0xfcfc61
created by runtime.init.6
        C:/Program Files/Go/src/runtime/proc.go:293 +0x25

goroutine 3 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        C:/Program Files/Go/src/runtime/proc.go:381 +0xd6 fp=0xc00004bf80 sp=0xc00004bf60 pc=0xfa7b76
runtime.goparkunlock(...)
        C:/Program Files/Go/src/runtime/proc.go:387
runtime.bgsweep(0x0?)
        C:/Program Files/Go/src/runtime/mgcsweep.go:278 +0x8e fp=0xc00004bfc8 sp=0xc00004bf80 pc=0xf928ae
runtime.gcenable.func1()
        C:/Program Files/Go/src/runtime/mgc.go:178 +0x26 fp=0xc00004bfe0 sp=0xc00004bfc8 pc=0xf87cc6
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00004bfe8 sp=0xc00004bfe0 pc=0xfcfc61
created by runtime.gcenable
        C:/Program Files/Go/src/runtime/mgc.go:178 +0x6b

goroutine 4 [GC scavenge wait]:
runtime.gopark(0xc000020070?, 0x10cf058?, 0x1?, 0x0?, 0x0?)
        C:/Program Files/Go/src/runtime/proc.go:381 +0xd6 fp=0xc00005bf70 sp=0xc00005bf50 pc=0xfa7b76
runtime.goparkunlock(...)
        C:/Program Files/Go/src/runtime/proc.go:387
runtime.(*scavengerState).park(0x11542c0)
        C:/Program Files/Go/src/runtime/mgcscavenge.go:400 +0x53 fp=0xc00005bfa0 sp=0xc00005bf70 pc=0xf907b3
runtime.bgscavenge(0x0?)
        C:/Program Files/Go/src/runtime/mgcscavenge.go:628 +0x45 fp=0xc00005bfc8 sp=0xc00005bfa0 pc=0xf90da5
runtime.gcenable.func2()
        C:/Program Files/Go/src/runtime/mgc.go:179 +0x26 fp=0xc00005bfe0 sp=0xc00005bfc8 pc=0xf87c66
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00005bfe8 sp=0xc00005bfe0 pc=0xfcfc61
created by runtime.gcenable
        C:/Program Files/Go/src/runtime/mgc.go:179 +0xaa

goroutine 18 [finalizer wait]:
runtime.gopark(0x1a0?, 0x1154700?, 0xa0?, 0x41?, 0xc00004df70?)
        C:/Program Files/Go/src/runtime/proc.go:381 +0xd6 fp=0xc00004de28 sp=0xc00004de08 pc=0xfa7b76
runtime.runfinq()
        C:/Program Files/Go/src/runtime/mfinal.go:193 +0x107 fp=0xc00004dfe0 sp=0xc00004de28 pc=0xf86d27
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00004dfe8 sp=0xc00004dfe0 pc=0xfcfc61
created by runtime.createfing
        C:/Program Files/Go/src/runtime/mfinal.go:163 +0x45
rax     0x3ffbbffb
rbx     0x0
rcx     0x100f6d116d70e0f
rdi     0x20da09b44a0
rsi     0xec59dbfea9dca12d
rbp     0x81699faf09
rsp     0x81699fae88
r8      0xb5c0fbcf
r9      0x71374491
r10     0x428a2f98
r11     0x81699fadf0
r12     0xffffffffffffffff
r13     0x81699fe390
r14     0x20df54b0000
r15     0x81699fafa0
rip     0x7ffa56ae0710
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b

golang Env:

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Clark\AppData\Local\go-build
set GOENV=C:\Users\Clark\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Clark\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Clark\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.20.4
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\work\gitRepos\vulkan\test2\go.mod
set GOWORK=D:\work\gitRepos\vulkan\go.work
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\Clark\AppData\Local\Temp\go-build4034610837=/tmp/go-build -gno-record-gcc-switches

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.