annotate test2.nim @ 1162:46fae89cffb0 compiletime-tests

advance evenmore!
author sam <sam@basx.dev>
date Thu, 20 Jun 2024 09:37:44 +0700
parents dbca0528c714
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1160
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
1 import std/os
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
2
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
3 import semicongine/platform/window
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
4 import semicongine/core/vulkanapi
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
5 import semicongine/vulkan/instance
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
6 import semicongine/vulkan/device
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
7 import semicongine/vulkan/physicaldevice
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
8 # import ./vulkan/shader
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
9
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
10 import semicongine/core/vector
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
11 import semicongine/core/matrix
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
12
1159
e7cbb13999e4 add: changes and static tools
sam <sam@basx.dev>
parents:
diff changeset
13 type
1160
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
14 MeshA = object
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
15 positions: seq[Vec3f]
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
16 colors: seq[Vec3f]
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
17 transparency: float32
1161
dbca0528c714 add: more stuff
sam <sam@basx.dev>
parents: 1160
diff changeset
18 InstanceDataA = object
1160
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
19 transforms: seq[Vec3f]
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
20
1159
e7cbb13999e4 add: changes and static tools
sam <sam@basx.dev>
parents:
diff changeset
21 Enemy = object
1160
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
22 mesh: MeshA
1161
dbca0528c714 add: more stuff
sam <sam@basx.dev>
parents: 1160
diff changeset
23 enemies: InstanceDataA
1160
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
24
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
25 let e = Enemy()
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
26 echo e
1159
e7cbb13999e4 add: changes and static tools
sam <sam@basx.dev>
parents:
diff changeset
27
1160
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
28 let w = CreateWindow("test2")
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
29 putEnv("VK_LAYER_ENABLES", "VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_AMD,VALIDATION_CHECK_ENABLE_VENDOR_SPECIFIC_NVIDIA,VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXTVK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT,VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT")
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
30 let i = w.CreateInstance(
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
31 vulkanVersion = VK_MAKE_API_VERSION(0, 1, 3, 0),
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
32 instanceExtensions = @[],
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
33 layers = @["VK_LAYER_KHRONOS_validation"],
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
34 )
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
35
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
36 let selectedPhysicalDevice = i.GetPhysicalDevices().FilterBestGraphics()
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
37 let d = i.CreateDevice(
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
38 selectedPhysicalDevice,
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
39 enabledExtensions = @[],
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
40 selectedPhysicalDevice.FilterForGraphicsPresentationQueues()
836dc1eda5e3 did: some stuff
sam <sam@basx.dev>
parents: 1159
diff changeset
41 )