Mercurial > games > semicongine
comparison test1.nim @ 1204:e2901100a596 compiletime-tests
add: tests, some fixes, some helpers
author | sam <sam@basx.dev> |
---|---|
date | Mon, 15 Jul 2024 23:51:17 +0700 |
parents | a8864fe6fe6e |
children |
comparison
equal
deleted
inserted
replaced
1203:6360c8d17ce0 | 1204:e2901100a596 |
---|---|
45 }""" | 45 }""" |
46 fragmentCode: string = """void main() { | 46 fragmentCode: string = """void main() { |
47 color = vec4(1, 0, 0, 1); | 47 color = vec4(1, 0, 0, 1); |
48 }""" | 48 }""" |
49 | 49 |
50 InitVulkan() | |
51 | |
50 var myMesh1 = MeshA( | 52 var myMesh1 = MeshA( |
51 position: GPUArray[Vec3f, VertexBuffer](data: @[NewVec3f(-0.5, 0.5, ), NewVec3f(0, -0.5, ), NewVec3f(0.5, 0.5, )]), | 53 position: asGPUArray([NewVec3f(-0.5, -0.5), NewVec3f(0, 0.5), NewVec3f(0.5, -0.5)], VertexBuffer), |
52 indices: GPUArray[uint16, IndexBuffer](data: @[0'u16, 1'u16, 2'u16]) | 54 indices: asGPUArray([0'u16, 1'u16, 2'u16], IndexBuffer), |
53 ) | 55 ) |
54 var uniforms1 = DescriptorSet[UniformsA, MaterialSet]( | 56 var uniforms1 = DescriptorSet[UniformsA, MaterialSet]( |
55 data: UniformsA( | 57 data: UniformsA( |
56 defaultTexture: Texture[TVec4[uint8]](width: 1, height: 1, data: @[TVec4[uint8]([0'u8, 0'u8, 0'u8, 1'u8])]), | 58 defaultTexture: Texture[TVec4[uint8]](width: 1, height: 1, data: @[TVec4[uint8]([0'u8, 0'u8, 0'u8, 1'u8])]), |
57 materials: GPUValue[array[3, MaterialA], UniformBuffer](data: [ | 59 materials: GPUValue[array[3, MaterialA], UniformBuffer](data: [ |
94 renderdata.UploadTextures(myGlobals) | 96 renderdata.UploadTextures(myGlobals) |
95 renderdata.UploadTextures(uniforms1) | 97 renderdata.UploadTextures(uniforms1) |
96 | 98 |
97 # copy everything to GPU | 99 # copy everything to GPU |
98 echo "Copying all data to GPU memory" | 100 echo "Copying all data to GPU memory" |
99 UpdateAllGPUBuffers(myMesh1) | |
100 UpdateAllGPUBuffers(instances1) | |
101 UpdateAllGPUBuffers(uniforms1) | |
102 UpdateAllGPUBuffers(myGlobals) | |
103 renderdata.FlushAllMemory() | 101 renderdata.FlushAllMemory() |
104 | 102 |
105 # descriptors | 103 # descriptors |
106 echo "Writing descriptors" | 104 echo "Writing descriptors" |
107 InitDescriptorSet(renderdata, pipeline1.GetLayoutFor(GlobalSet), myGlobals) | 105 InitDescriptorSet(renderdata, pipeline1.GetLayoutFor(GlobalSet), myGlobals) |