aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2019-09-10 03:32:39 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2019-09-10 03:32:39 +0200
commit33e73319df5518cc59dacadb6f19e270b0e105fd (patch)
treec075f3f10d26a1dfd6ffa1ceb9d524dc2662bb86
parent1a4635df4a90d1aac1226cf12883b9c5a4462fcc (diff)
split vk.net and cvkl
-rw-r--r--CVKL.Addons/Directory.Build.props39
-rw-r--r--CVKL.Addons/DistanceFieldFont/BMChar.cs49
-rw-r--r--CVKL.Addons/DistanceFieldFont/BMFont.cs207
-rw-r--r--CVKL.Addons/DistanceFieldFont/DistanceFieldFont.csproj20
-rw-r--r--CVKL.Addons/EnvironmentPipeline/EnvironmentPipeline.cs318
-rw-r--r--CVKL.Addons/EnvironmentPipeline/EnvironmentPipeline.csproj20
-rw-r--r--CVKL.Addons/EnvironmentPipeline/shaders/filtercube.vert19
-rw-r--r--CVKL.Addons/EnvironmentPipeline/shaders/genbrdflut.frag90
-rw-r--r--CVKL.Addons/EnvironmentPipeline/shaders/genbrdflut.vert9
-rw-r--r--CVKL.Addons/EnvironmentPipeline/shaders/irradiancecube.frag37
-rw-r--r--CVKL.Addons/EnvironmentPipeline/shaders/prefilterenvmap.frag105
-rw-r--r--CVKL.Addons/EnvironmentPipeline/shaders/skybox.frag12
-rw-r--r--CVKL.Addons/EnvironmentPipeline/shaders/skybox.vert27
-rw-r--r--CVKL.Addons/VkvgPipeline/VkvgPipeline.cs135
-rw-r--r--CVKL.Addons/VkvgPipeline/VkvgPipeline.csproj23
-rw-r--r--CVKL.Addons/gltfLoader/PbrModel.cs124
-rw-r--r--CVKL.Addons/gltfLoader/PbrModelSeparateTextures.cs162
-rw-r--r--CVKL.Addons/gltfLoader/PbrModelTexArray.cs139
-rw-r--r--CVKL.Addons/gltfLoader/glTFLoader.cs635
-rw-r--r--CVKL.Addons/gltfLoader/gltfLoader.csproj21
-rw-r--r--CVKL/CVKL.csproj56
l---------CVKL/netfx.props1
-rw-r--r--CVKL/shaders/FullScreenQuad.vert10
-rw-r--r--CVKL/shaders/simpletexture.frag15
-rw-r--r--CVKL/src/Camera.cs130
-rw-r--r--CVKL/src/ExtensionMethods.cs144
-rw-r--r--CVKL/src/FixedUtf8String.cs85
-rw-r--r--CVKL/src/MarshaledObject.cs43
-rw-r--r--CVKL/src/MemoryPool.cs157
-rw-r--r--CVKL/src/ResourceManager.cs62
-rw-r--r--CVKL/src/ShaderInfo.cs52
-rw-r--r--CVKL/src/SpecializationConstant.cs123
-rw-r--r--CVKL/src/StbImage.cs65
-rw-r--r--CVKL/src/Utils.cs288
-rw-r--r--CVKL/src/Version.cs23
-rw-r--r--CVKL/src/VertexAttribute.cs42
-rw-r--r--CVKL/src/VkFormatSize.cs548
-rw-r--r--CVKL/src/VkWindow.cs366
-rw-r--r--CVKL/src/base/Activable.cs134
-rw-r--r--CVKL/src/base/Buffer.cs111
-rw-r--r--CVKL/src/base/CommandBuffer.cs188
-rw-r--r--CVKL/src/base/CommandPool.cs147
-rw-r--r--CVKL/src/base/ComputePipeline.cs81
-rw-r--r--CVKL/src/base/DebuDrawPipeline.cs83
-rw-r--r--CVKL/src/base/DebugReport.cs114
-rw-r--r--CVKL/src/base/DebugUtilsMessenger.cs95
-rw-r--r--CVKL/src/base/DescriptorPool.cs90
-rw-r--r--CVKL/src/base/DescriptorSet.cs28
-rw-r--r--CVKL/src/base/DescriptorSetLayout.cs60
-rw-r--r--CVKL/src/base/DescriptorSetWrites.cs227
-rw-r--r--CVKL/src/base/Device.cs328
-rw-r--r--CVKL/src/base/FrameBuffer.cs120
-rw-r--r--CVKL/src/base/GPUBuffer.cs68
-rw-r--r--CVKL/src/base/GraphicPipeline.cs135
-rw-r--r--CVKL/src/base/GraphicPipelineConfig.cs143
-rw-r--r--CVKL/src/base/HostBuffer.cs109
-rw-r--r--CVKL/src/base/Image.cs643
-rw-r--r--CVKL/src/base/Instance.cs192
-rw-r--r--CVKL/src/base/PhysicalDevice.cs203
-rw-r--r--CVKL/src/base/Pipeline.cs72
-rw-r--r--CVKL/src/base/PipelineCache.cs142
-rw-r--r--CVKL/src/base/PipelineLayout.cs113
-rw-r--r--CVKL/src/base/QueryPool.cs164
-rw-r--r--CVKL/src/base/Queue.cs136
-rw-r--r--CVKL/src/base/RenderPass.cs260
-rw-r--r--CVKL/src/base/Resource.cs108
-rw-r--r--CVKL/src/base/SubPass.cs120
-rw-r--r--CVKL/src/base/SwapChain.cs189
-rw-r--r--CVKL/src/gl.cs982
-rw-r--r--CVKL/src/glfw/CodePoint.cs39
-rw-r--r--CVKL/src/glfw/Delegates.cs127
-rw-r--r--CVKL/src/glfw/ErrorCode.cs53
-rw-r--r--CVKL/src/glfw/Glfw3.cs533
-rw-r--r--CVKL/src/glfw/InputAction.cs25
-rw-r--r--CVKL/src/glfw/Key.cs134
-rw-r--r--CVKL/src/glfw/Modifier.cs20
-rw-r--r--CVKL/src/glfw/MonitorEvent.cs21
-rw-r--r--CVKL/src/glfw/MonitorHandle.cs30
-rw-r--r--CVKL/src/glfw/MouseButton.cs61
-rw-r--r--CVKL/src/glfw/NativeString.cs42
-rw-r--r--CVKL/src/glfw/VideoMode.cs43
-rw-r--r--CVKL/src/glfw/VideoModePointer.cs34
-rw-r--r--CVKL/src/glfw/WindowAttribute.cs184
-rw-r--r--CVKL/src/ktx.cs187
-rw-r--r--CVKL/src/model/BoundingBox.cs78
-rw-r--r--CVKL/src/model/IModelLoader.cs15
-rw-r--r--CVKL/src/model/Model.cs171
-rw-r--r--README.md96
-rw-r--r--SpirVTasks/CompileGLSLTask.cs203
-rw-r--r--SpirVTasks/README.md62
-rw-r--r--SpirVTasks/SpirVTasks.csproj39
-rw-r--r--SpirVTasks/SpirVTasks.targets30
-rw-r--r--SpirVTasks/spirv.xml9
-rw-r--r--samples/Directory.Build.props39
-rw-r--r--samples/DistanceFieldFontTest/DistanceFieldFontTest.csproj9
-rw-r--r--samples/DistanceFieldFontTest/Program.cs314
-rw-r--r--samples/DistanceFieldFontTest/shaders/main.frag32
-rw-r--r--samples/DistanceFieldFontTest/shaders/main.vert28
-rw-r--r--samples/Model/Model.csproj7
-rw-r--r--samples/Model/data/DamagedHelmet.binbin558504 -> 0 bytes
-rw-r--r--samples/Model/data/DamagedHelmet.gltf204
-rw-r--r--samples/Model/data/Default_AO.jpgbin361678 -> 0 bytes
-rw-r--r--samples/Model/data/Default_albedo.jpgbin935629 -> 0 bytes
-rw-r--r--samples/Model/data/Default_emissive.jpgbin97499 -> 0 bytes
-rw-r--r--samples/Model/data/Default_metalRoughness.jpgbin1300661 -> 0 bytes
-rw-r--r--samples/Model/data/Default_normal.jpgbin517757 -> 0 bytes
-rw-r--r--samples/Model/main.cs258
-rw-r--r--samples/Model/shaders/model.frag84
-rw-r--r--samples/Model/shaders/model.vert50
-rw-r--r--samples/Textured/Textured.csproj8
-rw-r--r--samples/Textured/main.cs267
-rw-r--r--samples/Textured/shaders/main.frag15
-rw-r--r--samples/Textured/shaders/main.vert28
-rw-r--r--samples/TexturedCube/TexturedCube.csproj7
-rw-r--r--samples/TexturedCube/main.cs330
-rw-r--r--samples/TexturedCube/shaders/FullScreenQuad.vert10
-rw-r--r--samples/TexturedCube/shaders/main.frag15
-rw-r--r--samples/TexturedCube/shaders/main.vert28
-rw-r--r--samples/TexturedCube/shaders/simpletexture.frag15
-rw-r--r--samples/TexturedCube/shaders/skybox.frag15
-rw-r--r--samples/TexturedCube/shaders/skybox.vert26
-rw-r--r--samples/Triangle/Triangle.csproj6
-rw-r--r--samples/Triangle/main.cs180
-rw-r--r--samples/Triangle/shaders/main.frag9
-rw-r--r--samples/Triangle/shaders/main.vert30
-rw-r--r--samples/common/CrowWin.cs254
-rw-r--r--samples/common/shaders/preamble.inc4
-rw-r--r--samples/compute/compute.csproj10
-rw-r--r--samples/compute/delaunay.cs329
-rw-r--r--samples/compute/main.cs133
-rw-r--r--samples/compute/shaders/FullScreenQuad.vert10
-rw-r--r--samples/compute/shaders/compute.comp23
-rw-r--r--samples/compute/shaders/computeTest.comp80
-rw-r--r--samples/compute/shaders/delaunay.comp70
-rw-r--r--samples/compute/shaders/init.comp36
-rw-r--r--samples/compute/shaders/mandelbrot.comp56
-rw-r--r--samples/compute/shaders/normalize.comp73
-rw-r--r--samples/compute/shaders/simpletexture.frag15
-rw-r--r--samples/compute/shaders/test.comp21
-rw-r--r--samples/compute/shaders/triangle2.frag13
-rw-r--r--samples/compute/shaders/triangle2.vert24
-rw-r--r--samples/compute/test.cs133
-rw-r--r--samples/compute/test2.cs389
-rw-r--r--samples/datas/Directory.Build.props5
-rw-r--r--samples/datas/data/font.fnt343
-rw-r--r--samples/datas/data/font.ktx3
-rw-r--r--samples/datas/data/models/Box.gltf3
-rw-r--r--samples/datas/data/models/Bricks16_col.jpg3
-rw-r--r--samples/datas/data/models/Bricks16_nrm.jpg3
-rw-r--r--samples/datas/data/models/DamagedHelmet/glTF-Embedded/DamagedHelmet.gltf3
-rw-r--r--samples/datas/data/models/DamagedHelmet/glTF/DamagedHelmet.binbin558504 -> 0 bytes
-rw-r--r--samples/datas/data/models/DamagedHelmet/glTF/DamagedHelmet.gltf3
-rw-r--r--samples/datas/data/models/DamagedHelmet/glTF/Default_AO.jpg3
-rw-r--r--samples/datas/data/models/DamagedHelmet/glTF/Default_albedo.jpg3
-rw-r--r--samples/datas/data/models/DamagedHelmet/glTF/Default_emissive.jpg3
-rw-r--r--samples/datas/data/models/DamagedHelmet/glTF/Default_metalRoughness.jpg3
-rw-r--r--samples/datas/data/models/DamagedHelmet/glTF/Default_normal.jpg3
-rw-r--r--samples/datas/data/models/Hubble.glb3
-rw-r--r--samples/datas/data/models/ISS_stationary.glb3
-rw-r--r--samples/datas/data/models/MER_static.glb3
-rw-r--r--samples/datas/data/models/Sponza/README.md68
-rw-r--r--samples/datas/data/models/Sponza/glTF/10381718147657362067.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/10388182081421875623.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/11474523244911310074.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/11490520546946913238.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/11872827283454512094.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/11968150294050148237.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/1219024358953944284.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/12501374198249454378.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/13196865903111448057.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/13824894030729245199.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/13982482287905699490.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/14118779221266351425.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/14170708867020035030.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/14267839433702832875.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/14650633544276105767.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/15295713303328085182.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/15722799267630235092.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/16275776544635328252.pngbin1077432 -> 0 bytes
-rw-r--r--samples/datas/data/models/Sponza/glTF/16299174074766089871.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/16885566240357350108.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/17556969131407844942.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/17876391417123941155.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/2051777328469649772.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/2185409758123873465.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/2299742237651021498.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/2374361008830720677.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/2411100444841994089.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/2775690330959970771.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/2969916736137545357.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/332936164838540657.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/3371964815757888145.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/3455394979645218238.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/3628158980083700836.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/3827035219084910048.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/4477655471536070370.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/4601176305987539675.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/466164707995436622.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/4675343432951571524.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/4871783166746854860.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/4910669866631290573.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/4975155472559461469.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/5061699253647017043.pngbin2427921 -> 0 bytes
-rw-r--r--samples/datas/data/models/Sponza/glTF/5792855332885324923.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/5823059166183034438.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/6047387724914829168.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/6151467286084645207.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/6593109234861095314.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/6667038893015345571.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/6772804448157695701.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/7056944414013900257.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/715093869573992647.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/7268504077753552595.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/7441062115984513793.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/755318871556304029.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/759203620573749278.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/7645212358685992005.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/7815564343179553343.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/8006627369776289000.pngbin1225157 -> 0 bytes
-rw-r--r--samples/datas/data/models/Sponza/glTF/8051790464816141987.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/8114461559286000061.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/8481240838833932244.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/8503262930880235456.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/8747919177698443163.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/8750083169368950601.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/8773302468495022225.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/8783994986360286082.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/9288698199695299068.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/9916269861720640319.jpg3
-rw-r--r--samples/datas/data/models/Sponza/glTF/Sponza.binbin9529440 -> 0 bytes
-rw-r--r--samples/datas/data/models/Sponza/glTF/Sponza.gltf3
-rw-r--r--samples/datas/data/models/Sponza/glTF/white.pngbin951 -> 0 bytes
-rw-r--r--samples/datas/data/models/Sponza/screenshot/large.jpg3
-rw-r--r--samples/datas/data/models/Sponza/screenshot/screenshot.jpg3
-rw-r--r--samples/datas/data/models/Untitled.pngbin6630 -> 0 bytes
-rw-r--r--samples/datas/data/models/agedplanks1-albedo.pngbin8250877 -> 0 bytes
-rw-r--r--samples/datas/data/models/agedplanks1-normal4-ue.pngbin5187396 -> 0 bytes
-rw-r--r--samples/datas/data/models/chess.gltf3
-rw-r--r--samples/datas/data/models/cube.gltf3
-rw-r--r--samples/datas/data/models/green-ceramic-tiles_basecolor.pngbin3108220 -> 0 bytes
-rw-r--r--samples/datas/data/models/green-ceramic-tiles_normal-dx.pngbin5300667 -> 0 bytes
-rw-r--r--samples/datas/data/models/icosphere.gltf3
-rw-r--r--samples/datas/data/models/oxidized-copper-albedo.pngbin4896506 -> 0 bytes
-rw-r--r--samples/datas/data/models/oxidized-copper-normal-ue.pngbin5190868 -> 0 bytes
-rw-r--r--samples/datas/data/models/shadow.binbin29660 -> 0 bytes
-rw-r--r--samples/datas/data/models/shadow.glb3
-rw-r--r--samples/datas/data/models/shadow.gltf3
-rw-r--r--samples/datas/data/models/shadow2.gltf3
-rw-r--r--samples/datas/data/models/untitled.binbin26168 -> 0 bytes
-rw-r--r--samples/datas/data/models/untitled.glb3
-rw-r--r--samples/datas/data/models/untitled.gltf3
-rw-r--r--samples/datas/data/textures/cubemap_yokohama_bc3_unorm.ktx3
-rw-r--r--samples/datas/data/textures/empty.ktx3
-rw-r--r--samples/datas/data/textures/gcanyon_cube.ktx3
-rw-r--r--samples/datas/data/textures/papermill.ktx3
-rw-r--r--samples/datas/data/textures/pisa_cube.ktx3
-rwxr-xr-xsamples/datas/data/textures/rgba-reference.ktx3
-rw-r--r--samples/datas/data/textures/tex.astcbin29600 -> 0 bytes
-rw-r--r--samples/datas/data/textures/tex256.jpg3
-rw-r--r--samples/datas/data/textures/texspace256.jpg3
-rw-r--r--samples/datas/data/textures/texture.jpg3
-rw-r--r--samples/datas/data/textures/texturearray_rocks_bc3_unorm.ktx3
-rw-r--r--samples/datas/data/textures/uffizi_cube.ktx3
-rw-r--r--samples/datas/data/tiger.svg725
-rw-r--r--samples/datas/datas.csproj28
-rw-r--r--samples/deferred/DebuDrawPipeline.cs78
-rw-r--r--samples/deferred/DeferredPbrRenderer.cs528
-rw-r--r--samples/deferred/EnvironmentPipeline.cs318
-rw-r--r--samples/deferred/deferred.csproj43
-rw-r--r--samples/deferred/main-crow.cs404
-rw-r--r--samples/deferred/main.cs551
-rw-r--r--samples/deferred/mainShadow.cs415
-rw-r--r--samples/deferred/mainWithDebugDrawer.cs412
-rw-r--r--samples/deferred/modelWithVkvgStats.cs359
-rw-r--r--samples/deferred/shaders/FullScreenQuad.vert10
-rw-r--r--samples/deferred/shaders/GBuffPbr.frag212
-rw-r--r--samples/deferred/shaders/GBuffPbr.vert37
-rw-r--r--samples/deferred/shaders/GBuffPbrTexArray.frag211
-rw-r--r--samples/deferred/shaders/bloom.comp60
-rw-r--r--samples/deferred/shaders/bloom.frag63
-rw-r--r--samples/deferred/shaders/compose.frag230
-rw-r--r--samples/deferred/shaders/compose_with_shadows.frag277
-rw-r--r--samples/deferred/shaders/debug.frag12
-rw-r--r--samples/deferred/shaders/debug.vert34
-rw-r--r--samples/deferred/shaders/emissive.frag25
-rw-r--r--samples/deferred/shaders/filtercube.vert19
-rw-r--r--samples/deferred/shaders/genbrdflut.frag90
-rw-r--r--samples/deferred/shaders/genbrdflut.vert9
-rw-r--r--samples/deferred/shaders/irradiancecube.frag37
-rw-r--r--samples/deferred/shaders/prefilterenvmap.frag105
-rw-r--r--samples/deferred/shaders/shadow.geom34
-rw-r--r--samples/deferred/shaders/shadow.vert12
-rw-r--r--samples/deferred/shaders/show_gbuff.frag92
-rw-r--r--samples/deferred/shaders/simpletexture.frag15
-rw-r--r--samples/deferred/shaders/skybox.frag12
-rw-r--r--samples/deferred/shaders/skybox.vert27
-rw-r--r--samples/deferred/shaders/tone_mapping.frag70
-rw-r--r--samples/deferred/shadowMapRenderer.cs157
-rw-r--r--samples/deferred/ui/debug.crow13
-rw-r--r--samples/deferred/ui/deferred.style61
-rw-r--r--samples/deferred/ui/images/crow.svg30
-rw-r--r--samples/deferred/ui/main.crow37
-rw-r--r--samples/deferred/ui/materials.crow30
-rw-r--r--samples/deferred/ui/menu.crow9
-rw-r--r--samples/deferred/ui/sceneItem.crow18
-rw-r--r--samples/deferred/ui/scenes.crow41
-rw-r--r--samples/deferred/ui/testImage.crow3
-rw-r--r--samples/pbr/EnvironmentPipeline.cs354
-rw-r--r--samples/pbr/PbrModel.cs39
-rw-r--r--samples/pbr/PbrPipeline.cs158
-rw-r--r--samples/pbr/main.cs432
-rw-r--r--samples/pbr/pbr.csproj24
-rw-r--r--samples/pbr/screenshot.pngbin384899 -> 0 bytes
-rw-r--r--samples/pbr/shaders/FullScreenQuad.vert10
-rw-r--r--samples/pbr/shaders/filtercube.vert20
-rw-r--r--samples/pbr/shaders/genbrdflut.frag90
-rw-r--r--samples/pbr/shaders/genbrdflut.vert9
-rw-r--r--samples/pbr/shaders/irradiancecube.frag37
-rw-r--r--samples/pbr/shaders/pbr.vert44
-rw-r--r--samples/pbr/shaders/pbr_khr.frag459
-rw-r--r--samples/pbr/shaders/prefilterenvmap.frag105
-rw-r--r--samples/pbr/shaders/simpletexture.frag15
-rw-r--r--samples/pbr/shaders/skybox.frag60
-rw-r--r--samples/pbr/shaders/skybox.vert27
-rwxr-xr-xsamples/pbr/ui/fps.crow22
-rw-r--r--samples/tests/Program.cs48
-rw-r--r--samples/tests/shaders/main.vert28
-rw-r--r--samples/tests/tests.csproj6
-rw-r--r--samples/vkvg_tests/main.cs303
-rw-r--r--samples/vkvg_tests/shaders/FullScreenQuad.vert10
-rw-r--r--samples/vkvg_tests/shaders/simpletexture.frag15
-rw-r--r--samples/vkvg_tests/vkvg_tests.csproj46
-rw-r--r--vk.net.sln192
333 files changed, 5 insertions, 25129 deletions
diff --git a/CVKL.Addons/Directory.Build.props b/CVKL.Addons/Directory.Build.props
deleted file mode 100644
index b6f67c5..0000000
--- a/CVKL.Addons/Directory.Build.props
+++ /dev/null
@@ -1,39 +0,0 @@
-<Project>
- <PropertyGroup>
- <RootDirectory>$(MSBuildThisFileDirectory)../</RootDirectory>
- <Deterministic>true</Deterministic>
-
- <TargetFrameworks>net471;netstandard2.0</TargetFrameworks>
-
- <RepositoryUrl>https://github.com/jpbruyere/vk.net</RepositoryUrl>
- <License>MIT</License>
- <Authors>Jean-Philippe Bruyère</Authors>
-
- <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <IncludeDefaultNoneItems>false</IncludeDefaultNoneItems>
-
- <LangVersion>7.2</LangVersion>
-
- <SpirVAdditionalIncludeDirectories>$(MSBuildThisFileDirectory)common\shaders</SpirVAdditionalIncludeDirectories>
-
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DefineConstants>TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0;_WITH_SHADOWS;WITH_VKVG</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DefineConstants>NETSTANDARD;NETSTANDARD2_0;WITH_SHADOWS;_WITH_VKVG</DefineConstants>
- </PropertyGroup>
-
- <ItemGroup>
- <PackageReference Include="CVKL" Version="0.1.7-beta" />
- <PackageReference Include="SpirVTasks" Version="0.1.9-beta" />
- <PackageReference Include="Vulkan" Version="0.1.4" />
- </ItemGroup>
-
- <ItemGroup>
- <GLSLShader Include="shaders\**\*.frag;shaders\**\*.vert;shaders\**\*.comp;shaders\**\*.geom" />
- </ItemGroup>
-
-</Project>
diff --git a/CVKL.Addons/DistanceFieldFont/BMChar.cs b/CVKL.Addons/DistanceFieldFont/BMChar.cs
deleted file mode 100644
index 0667fc3..0000000
--- a/CVKL.Addons/DistanceFieldFont/BMChar.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-namespace CVKL.DistanceFieldFont {
- public struct BMChar {
- public enum Channel {
- Blue = 0x01,
- Green = 0x02,
- Red = 0x04,
- Alpha = 0x08,
- All = 0x0f
- }
- public uint id;
- /// <summary>
- /// The left position of the character image in the texture.
- /// </summary>
- public uint x;
- public uint y;
- /// <summary>
- /// The width of the character image in the texture.
- /// </summary>
- public uint width;
- /// <summary>
- /// The height of the character image in the texture.
- /// </summary>
- public uint height;
- /// <summary>
- /// How much the current position should be offset when copying the image from the texture to the screen.
- /// </summary>
- public int xoffset;
- /// <summary>
- /// How much the current position should be offset when copying the image from the texture to the screen.
- /// </summary>
- public int yoffset;
- /// <summary>
- /// How much the current position should be advanced after drawing the character.
- /// </summary>
- public int xadvance;
- /// <summary>
- /// The texture page where the character image is found.
- /// </summary>
- public uint page;
- /// <summary>
- /// The texture channel where the character image is found (1 = blue, 2 = green, 4 = red, 8 = alpha, 15 = all channels).
- /// </summary>
- public Channel channel;
- }
-}
diff --git a/CVKL.Addons/DistanceFieldFont/BMFont.cs b/CVKL.Addons/DistanceFieldFont/BMFont.cs
deleted file mode 100644
index e277517..0000000
--- a/CVKL.Addons/DistanceFieldFont/BMFont.cs
+++ /dev/null
@@ -1,207 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using VK;
-
-namespace CVKL.DistanceFieldFont {
- /// <summary>
- /// BMF font. (http://www.angelcode.com/products/bmfont/doc/file_format.html)
- /// </summary>
- public class BMFont {
- /// <summary>
- /// distance in pixels between each line of text.
- /// </summary>
- public readonly ushort lineHeight;
- /// <summary>
- /// The number of pixels from the absolute top of the line to the base of the characters.
- /// </summary>
- public readonly ushort @base;
- public readonly ushort width, height;
-
- public readonly Dictionary<int, BMChar> CharMap = new Dictionary<int, BMChar> ();
- public readonly Dictionary<int, string> PageImagePathes = new Dictionary<int, string> ();
-
- readonly string fntFilePath;
-
- public BMFont (string path) {
- fntFilePath = path;
- object thisFont = this;
-
-
- using (BMFontStreamReader bmf = new BMFontStreamReader (path)) {
- while (!bmf.EndOfStream) {
-
- string w = bmf.ReadWord ();
- if (string.IsNullOrEmpty (w))
- continue;
-
- if (string.Equals (w, "info", StringComparison.OrdinalIgnoreCase) ||
- string.Equals (w, "common", StringComparison.OrdinalIgnoreCase))
- bmf.ReadDatas (ref thisFont);
- else if (string.Equals (w, "page", StringComparison.OrdinalIgnoreCase)) {
- int p = bmf.ReadPageDatas (out string pageImg);
- PageImagePathes.Add (p, pageImg);
- } else if (string.Equals (w, "chars", StringComparison.OrdinalIgnoreCase))
- bmf.ReadLine ();//skip char count
- else if (string.Equals (w, "char", StringComparison.OrdinalIgnoreCase)) {
- BMChar c = bmf.NextBMChar;
- CharMap.Add ((int)c.id, c);
- } else if (string.Equals (w, "kernings", StringComparison.OrdinalIgnoreCase))
- bmf.ReadLine ();//skip
- else if (string.Equals (w, "kerning", StringComparison.OrdinalIgnoreCase))
- bmf.ReadLine ();//skip
- }
- }
- }
-
- public Image GetPageTexture (int page, Queue staggingQ, CommandPool cmdPool,
- VkMemoryPropertyFlags imgProp = VkMemoryPropertyFlags.DeviceLocal, bool genMipMaps = true, VkImageTiling tiling = VkImageTiling.Optimal) {
-
- string path = Path.Combine (Path.GetDirectoryName (fntFilePath), PageImagePathes[page]);
-
- if (path.EndsWith ("ktx", StringComparison.OrdinalIgnoreCase))
- return KTX.KTX.Load (staggingQ, cmdPool, path,
- VkImageUsageFlags.Sampled, imgProp, genMipMaps, tiling);
- return Image.Load (staggingQ.Dev, staggingQ, cmdPool, path, VkFormat.R8g8b8a8Unorm, imgProp, tiling, genMipMaps);
- }
-
- }
-
-
-
- internal class BMFontStreamReader : StreamReader {
- public BMFontStreamReader (string bmPath) : base (bmPath) { }
-
- public char PeekedChar => (char)Peek ();
- public char ReadedChar => (char)Read ();
- public bool EndOfLine => PeekedChar == '\n';
-
- public string ReadWord () {
- string word = "";
- SkipWhiteSpacesAndLineBreak ();
- while (!EndOfStream) {
- if (!Char.IsLetterOrDigit (PeekedChar))
- break;
- word += ReadedChar;
- }
- return word;
- }
- public void SkipWhiteSpaces () {
- while (!EndOfStream) {
- if (!char.IsWhiteSpace (PeekedChar) || PeekedChar == '\n')
- break;
- Read ();
- }
- }
- public void SkipWhiteSpacesAndLineBreak () {
- while (!EndOfStream) {
- if (!char.IsWhiteSpace (PeekedChar))
- break;
- Read ();
- }
- }
-
- public string NextValue {
- get {
- SkipWhiteSpaces ();
- if (ReadedChar != '=')
- throw new Exception ("expecting '='");
- SkipWhiteSpaces ();
- if (PeekedChar == '"') {
- Read ();
- return ReadUntil ('"');
- }
- return ReadUntilSpace ();
- }
- }
- public string ReadUntil (char limit) {
- string word = "";
- while (!EndOfStream) {
- char c = ReadedChar;
- if (c == limit)
- break;
- word += c;
- }
- return word;
- }
- public string ReadUntilSpace () {
- string word = "";
- while (!EndOfStream) {
- if (char.IsWhiteSpace (PeekedChar))
- break;
- word += ReadedChar;
- }
- return word;
- }
-
- public void ReadField (ref object obj, string fieldName) {
- FieldInfo fi = obj.GetType ().GetField (fieldName);
- if (fi == null) {
- System.Diagnostics.Debug.WriteLine ($"BMFont property not handled: {fieldName}");
- string tmp = NextValue;
- return;
- }
- if (fi.FieldType == typeof (ushort)) {
- fi.SetValue (obj, ushort.Parse (NextValue));
- return;
- }
- if (fi.FieldType == typeof (short)) {
- fi.SetValue (obj, short.Parse (NextValue));
- return;
- }
- if (fi.FieldType == typeof (int)) {
- fi.SetValue (obj, int.Parse (NextValue));
- return;
- }
- if (fi.FieldType == typeof (uint)) {
- fi.SetValue (obj, uint.Parse (NextValue));
- return;
- }
- if (fi.FieldType == typeof (string)) {
- fi.SetValue (obj, NextValue);
- return;
- }
- }
- public void ReadDatas (ref object obj) {
- while (!EndOfLine && !EndOfStream) {
- string field = ReadWord ();
- ReadField (ref obj, field);
- }
-
- }
- public int ReadPageDatas (out string pageImgPath) {
- int idx = 0;
- pageImgPath = "";
-
- while (!EndOfLine && !EndOfStream) {
- string field = ReadWord ();
- if (string.Equals (field, "id", StringComparison.OrdinalIgnoreCase))
- idx = int.Parse (NextValue);
- else if (string.Equals (field, "file", StringComparison.OrdinalIgnoreCase))
- pageImgPath = NextValue;
- else
- Console.WriteLine ($"BMFont page property not handled: {field} = {NextValue}");
- }
- return idx;
- }
- public BMChar NextBMChar {
- get {
- object c = default (BMChar);
-
- while (!EndOfLine && !EndOfStream) {
- string field = ReadWord ();
- ReadField (ref c, field);
- SkipWhiteSpaces ();//trailing spaces
- }
-
- return (BMChar)c;
- }
-
- }
- }
-
-}
diff --git a/CVKL.Addons/DistanceFieldFont/DistanceFieldFont.csproj b/CVKL.Addons/DistanceFieldFont/DistanceFieldFont.csproj
deleted file mode 100644
index a131f27..0000000
--- a/CVKL.Addons/DistanceFieldFont/DistanceFieldFont.csproj
+++ /dev/null
@@ -1,20 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <Import Project="$(RootDirectory)netfx.props" />
- <PropertyGroup>
- <AssemblyName>CVKL.DistanceFieldFont</AssemblyName>
- <PackageId>CVKL.DistanceFieldFont</PackageId>
- <AssemblyVersion>0.1.0</AssemblyVersion>
- <Description>CVKL signed distance field font addons, BMFont file format</Description>
- <PackageTags>C# vulkan CVKL gltf</PackageTags>
- <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
- <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
- <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
- <PackageProjectUrl>https://github.com/jpbruyere/vk.net/blob/master/README.md</PackageProjectUrl>
- <License>MIT</License>
- <PackageReleaseNotes></PackageReleaseNotes>
- <SynchReleaseVersion>false</SynchReleaseVersion>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
-
-</Project>
diff --git a/CVKL.Addons/EnvironmentPipeline/EnvironmentPipeline.cs b/CVKL.Addons/EnvironmentPipeline/EnvironmentPipeline.cs
deleted file mode 100644
index 12a0df9..0000000
--- a/CVKL.Addons/EnvironmentPipeline/EnvironmentPipeline.cs
+++ /dev/null
@@ -1,318 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL {
- public class EnvironmentCube : GraphicPipeline {
-
- GPUBuffer vboSkybox;
-
- public Image cubemap { get; private set; }
- public Image lutBrdf { get; private set; }
- public Image irradianceCube { get; private set; }
- public Image prefilterCube { get; set; }
-
- public EnvironmentCube (string cubemapPath, DescriptorSet dsSkybox, PipelineLayout plLayout, Queue staggingQ, RenderPass renderPass, PipelineCache cache = null)
- : base (renderPass, cache, "EnvCube pipeline") {
-
- using (CommandPool cmdPool = new CommandPool (staggingQ.Dev, staggingQ.index)) {
-
- vboSkybox = new GPUBuffer<float> (staggingQ, cmdPool, VkBufferUsageFlags.VertexBuffer, box_vertices);
-
- cubemap = KTX.KTX.Load (staggingQ, cmdPool, cubemapPath,
- VkImageUsageFlags.Sampled, VkMemoryPropertyFlags.DeviceLocal, true);
- cubemap.CreateView (VkImageViewType.Cube, VkImageAspectFlags.Color);
- cubemap.CreateSampler (VkSamplerAddressMode.ClampToEdge);
- cubemap.SetName ("skybox Texture");
- cubemap.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, renderPass.Samples, false);
- cfg.RenderPass = renderPass;
- cfg.Layout = plLayout;
- cfg.AddVertexBinding (0, 3 * sizeof (float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat);
- cfg.AddShader (VkShaderStageFlags.Vertex, "#CVKLEnvironment.skybox.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#CVKLEnvironment.skybox.frag.spv");
- cfg.multisampleState.rasterizationSamples = Samples;
-
- layout = cfg.Layout;
-
- init (cfg);
-
- generateBRDFLUT (staggingQ, cmdPool);
- generateCubemaps (staggingQ, cmdPool);
- }
-
- }
-
- public void RecordDraw (CommandBuffer cmd) {
- Bind (cmd);
- cmd.BindVertexBuffer (vboSkybox);
- cmd.Draw (36);
- }
-
- #region skybox
-
- static float[] box_vertices = {
- 1.0f, 1.0f,-1.0f, // +X side
- 1.0f, 1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f,
- 1.0f,-1.0f,-1.0f,
- 1.0f, 1.0f,-1.0f,
-
- -1.0f,-1.0f,-1.0f, // +X side
- -1.0f,-1.0f, 1.0f,
- -1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f,-1.0f,
- -1.0f,-1.0f,-1.0f,
-
- -1.0f, 1.0f,-1.0f, // +Y side
- -1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f,-1.0f,
- 1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f,-1.0f,
-
- -1.0f,-1.0f,-1.0f, // -Y side
- 1.0f,-1.0f,-1.0f,
- 1.0f,-1.0f, 1.0f,
- -1.0f,-1.0f,-1.0f,
- 1.0f,-1.0f, 1.0f,
- -1.0f,-1.0f, 1.0f,
-
- -1.0f, 1.0f, 1.0f, // +Z side
- -1.0f,-1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
- -1.0f,-1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
-
- -1.0f,-1.0f,-1.0f, // -Z side
- 1.0f, 1.0f,-1.0f,
- 1.0f,-1.0f,-1.0f,
- -1.0f,-1.0f,-1.0f,
- -1.0f, 1.0f,-1.0f,
- 1.0f, 1.0f,-1.0f,
-
- };
- #endregion
-
- void generateBRDFLUT (Queue staggingQ, CommandPool cmdPool) {
- const VkFormat format = VkFormat.R16g16Sfloat;
- const int dim = 512;
-
- lutBrdf = new Image (Dev, format, VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.Sampled,
- VkMemoryPropertyFlags.DeviceLocal, dim, dim);
- lutBrdf.SetName ("lutBrdf");
-
- lutBrdf.CreateView ();
- lutBrdf.CreateSampler (VkSamplerAddressMode.ClampToEdge);
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1, false);
-
- cfg.Layout = new PipelineLayout (Dev, new DescriptorSetLayout (Dev));
- cfg.RenderPass = new RenderPass (Dev);
- cfg.RenderPass.AddAttachment (format, VkImageLayout.ShaderReadOnlyOptimal);
- cfg.RenderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0, 0, 0) });
- cfg.RenderPass.AddSubpass (new SubPass (VkImageLayout.ColorAttachmentOptimal));
- cfg.AddShader (VkShaderStageFlags.Vertex, "#CVKLEnvironment.genbrdflut.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#CVKLEnvironment.genbrdflut.frag.spv");
-
- using (GraphicPipeline pl = new GraphicPipeline (cfg)) {
- using (Framebuffer fb = new Framebuffer (cfg.RenderPass, dim, dim, lutBrdf)) {
- CommandBuffer cmd = cmdPool.AllocateCommandBuffer ();
- cmd.Start (VkCommandBufferUsageFlags.OneTimeSubmit);
- pl.RenderPass.Begin (cmd, fb);
- cmd.SetViewport (dim, dim);
- cmd.SetScissor (dim, dim);
- pl.Bind (cmd);
- cmd.Draw (3, 1, 0, 0);
- pl.RenderPass.End (cmd);
- cmd.End ();
-
- staggingQ.Submit (cmd);
- staggingQ.WaitIdle ();
-
- cmd.Free ();
- }
- }
- lutBrdf.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- }
-
- public enum CBTarget { IRRADIANCE = 0, PREFILTEREDENV = 1 };
-
- public Image generateCubeMap (Queue staggingQ, CommandPool cmdPool, CBTarget target) {
- const float deltaPhi = (2.0f * (float)Math.PI) / 180.0f;
- const float deltaTheta = (0.5f * (float)Math.PI) / 64.0f;
-
- VkFormat format = VkFormat.R32g32b32a32Sfloat;
- uint dim = 64;
-
- if (target == CBTarget.PREFILTEREDENV) {
- format = VkFormat.R16g16b16a16Sfloat;
- dim = 512;
- }
-
- uint numMips = (uint)Math.Floor (Math.Log (dim, 2)) + 1;
-
- Image imgFbOffscreen = new Image (Dev, format, VkImageUsageFlags.TransferSrc | VkImageUsageFlags.ColorAttachment,
- VkMemoryPropertyFlags.DeviceLocal, dim, dim);
- imgFbOffscreen.SetName ("offscreenfb");
- imgFbOffscreen.CreateView ();
-
- Image cmap = new Image (Dev, format, VkImageUsageFlags.TransferDst | VkImageUsageFlags.Sampled,
- VkMemoryPropertyFlags.DeviceLocal, dim, dim, VkImageType.Image2D, VkSampleCountFlags.SampleCount1, VkImageTiling.Optimal,
- numMips, 6, 1, VkImageCreateFlags.CubeCompatible);
- if (target == CBTarget.PREFILTEREDENV)
- cmap.SetName ("prefilterenvmap");
- else
- cmap.SetName ("irradianceCube");
- cmap.CreateView (VkImageViewType.Cube, VkImageAspectFlags.Color, 6, 0);
- cmap.CreateSampler (VkSamplerAddressMode.ClampToEdge);
-
- DescriptorPool dsPool = new DescriptorPool (Dev, 2, new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler));
-
- DescriptorSetLayout dsLayout = new DescriptorSetLayout (Dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
-
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1, false);
- cfg.Layout = new PipelineLayout (Dev, dsLayout);
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, (uint)Marshal.SizeOf<Matrix4x4> () + 8));
-
- cfg.RenderPass = new RenderPass (Dev);
- cfg.RenderPass.AddAttachment (format, VkImageLayout.ColorAttachmentOptimal);
- cfg.RenderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0, 0, 0) });
- cfg.RenderPass.AddSubpass (new SubPass (VkImageLayout.ColorAttachmentOptimal));
-
- cfg.AddVertexBinding (0, 3 * sizeof (float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#CVKLEnvironment.filtercube.vert.spv");
- if (target == CBTarget.PREFILTEREDENV)
- cfg.AddShader (VkShaderStageFlags.Fragment, "#CVKLEnvironment.prefilterenvmap.frag.spv");
- else
- cfg.AddShader (VkShaderStageFlags.Fragment, "#CVKLEnvironment.irradiancecube.frag.spv");
-
- Matrix4x4[] matrices = {
- // POSITIVE_X
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(180)) * Matrix4x4.CreateRotationY(Utils.DegreesToRadians(90)),
- // NEGATIVE_X
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(180)) * Matrix4x4.CreateRotationY(Utils.DegreesToRadians(-90)),
- // POSITIVE_Y
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(-90)),
- // NEGATIVE_Y
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(90)),
- // POSITIVE_Z
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(180)),
- // NEGATIVE_Z
- Matrix4x4.CreateRotationZ(Utils.DegreesToRadians(180))
- };
-
- VkImageSubresourceRange subRes = new VkImageSubresourceRange (VkImageAspectFlags.Color, 0, numMips, 0, 6);
-
- using (GraphicPipeline pl = new GraphicPipeline (cfg)) {
-
- DescriptorSet dset = dsPool.Allocate (dsLayout);
- DescriptorSetWrites dsUpdate = new DescriptorSetWrites (dsLayout);
- dsUpdate.Write (Dev, dset, cubemap.Descriptor);
- Dev.WaitIdle ();
-
- using (Framebuffer fb = new Framebuffer (pl.RenderPass, dim, dim, imgFbOffscreen)) {
- CommandBuffer cmd = cmdPool.AllocateCommandBuffer ();
- cmd.Start (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- cmap.SetLayout (cmd, VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal, subRes);
-
- float roughness = 0;
-
- cmd.SetScissor (dim, dim);
- cmd.SetViewport ((float)(dim), (float)dim);
-
- for (int m = 0; m < numMips; m++) {
- roughness = (float)m / ((float)numMips - 1f);
-
- for (int f = 0; f < 6; f++) {
- pl.RenderPass.Begin (cmd, fb);
-
- pl.Bind (cmd);
-
- float viewPortSize = (float)Math.Pow (0.5, m) * dim;
- cmd.SetViewport (viewPortSize, viewPortSize);
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment,
- matrices[f] * Matrix4x4.CreatePerspectiveFieldOfView (Utils.DegreesToRadians (90), 1f, 0.1f, 512f));
- if (target == CBTarget.IRRADIANCE) {
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, deltaPhi, (uint)Marshal.SizeOf<Matrix4x4> ());
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, deltaTheta, (uint)Marshal.SizeOf<Matrix4x4> () + 4);
- } else {
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, roughness, (uint)Marshal.SizeOf<Matrix4x4> ());
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, 64u, (uint)Marshal.SizeOf<Matrix4x4> () + 4);
- }
-
- cmd.BindDescriptorSet (pl.Layout, dset);
- cmd.BindVertexBuffer (vboSkybox);
- cmd.Draw (36);
-
- pl.RenderPass.End (cmd);
-
- imgFbOffscreen.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal);
-
- VkImageCopy region = new VkImageCopy ();
- region.srcSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, 1);
- region.dstSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, 1, (uint)m, (uint)f);
- region.extent = new VkExtent3D { width = (uint)viewPortSize, height = (uint)viewPortSize, depth = 1 };
-
- Vk.vkCmdCopyImage (cmd.Handle,
- imgFbOffscreen.Handle, VkImageLayout.TransferSrcOptimal,
- cmap.Handle, VkImageLayout.TransferDstOptimal,
- 1, region.Pin ());
- region.Unpin ();
-
- imgFbOffscreen.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferSrcOptimal, VkImageLayout.ColorAttachmentOptimal);
-
- }
- }
-
- cmap.SetLayout (cmd, VkImageLayout.TransferDstOptimal, VkImageLayout.ShaderReadOnlyOptimal, subRes);
-
- cmd.End ();
-
- staggingQ.Submit (cmd);
- staggingQ.WaitIdle ();
-
- cmd.Free ();
- }
- }
- cmap.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- dsLayout.Dispose ();
- imgFbOffscreen.Dispose ();
- dsPool.Dispose ();
-
- return cmap;
- }
-
- void generateCubemaps (Queue staggingQ, CommandPool cmdPool) {
- irradianceCube = generateCubeMap (staggingQ, cmdPool, CBTarget.IRRADIANCE);
- prefilterCube = generateCubeMap (staggingQ, cmdPool, CBTarget.PREFILTEREDENV);
- }
-
- protected override void Dispose (bool disposing) {
- vboSkybox.Dispose ();
- cubemap.Dispose ();
- lutBrdf.Dispose ();
- irradianceCube.Dispose ();
- prefilterCube.Dispose ();
-
- base.Dispose (disposing);
- }
- }
-
-}
diff --git a/CVKL.Addons/EnvironmentPipeline/EnvironmentPipeline.csproj b/CVKL.Addons/EnvironmentPipeline/EnvironmentPipeline.csproj
deleted file mode 100644
index 511e55b..0000000
--- a/CVKL.Addons/EnvironmentPipeline/EnvironmentPipeline.csproj
+++ /dev/null
@@ -1,20 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <Import Project="$(RootDirectory)netfx.props" />
- <PropertyGroup>
- <AssemblyName>CVKLEnvironment</AssemblyName>
- <PackageId>CVKLEnvironmentPipeline</PackageId>
- <AssemblyVersion>0.1.0</AssemblyVersion>
- <Description>CVKL Environment cube</Description>
- <PackageTags>vulkan CVKL</PackageTags>
- <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
- <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
- <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
- <PackageProjectUrl>https://github.com/jpbruyere/vk.net/blob/master/README.md</PackageProjectUrl>
- <License>MIT</License>
- <PackageReleaseNotes></PackageReleaseNotes>
- <SynchReleaseVersion>false</SynchReleaseVersion>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
-
-</Project>
diff --git a/CVKL.Addons/EnvironmentPipeline/shaders/filtercube.vert b/CVKL.Addons/EnvironmentPipeline/shaders/filtercube.vert
deleted file mode 100644
index 1226e28..0000000
--- a/CVKL.Addons/EnvironmentPipeline/shaders/filtercube.vert
+++ /dev/null
@@ -1,19 +0,0 @@
-#version 450
-
-layout (location = 0) in vec3 inPos;
-
-layout(push_constant) uniform PushConsts {
- layout (offset = 0) mat4 mvp;
-} pushConsts;
-
-layout (location = 0) out vec3 outUVW;
-
-out gl_PerVertex {
- vec4 gl_Position;
-};
-
-void main()
-{
- outUVW = inPos;
- gl_Position = pushConsts.mvp * vec4(inPos.xyz, 1.0);
-}
diff --git a/CVKL.Addons/EnvironmentPipeline/shaders/genbrdflut.frag b/CVKL.Addons/EnvironmentPipeline/shaders/genbrdflut.frag
deleted file mode 100644
index b6290dd..0000000
--- a/CVKL.Addons/EnvironmentPipeline/shaders/genbrdflut.frag
+++ /dev/null
@@ -1,90 +0,0 @@
-#version 450
-
-layout (location = 0) in vec2 inUV;
-layout (location = 0) out vec4 outColor;
-layout (constant_id = 0) const uint NUM_SAMPLES = 1024u;
-
-const float PI = 3.1415926536;
-
-// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
-float random(vec2 co)
-{
- float a = 12.9898;
- float b = 78.233;
- float c = 43758.5453;
- float dt= dot(co.xy ,vec2(a,b));
- float sn= mod(dt,3.14);
- return fract(sin(sn) * c);
-}
-
-vec2 hammersley2d(uint i, uint N)
-{
- // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
- uint bits = (i << 16u) | (i >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- float rdi = float(bits) * 2.3283064365386963e-10;
- return vec2(float(i) /float(N), rdi);
-}
-
-// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
-vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
-{
- // Maps a 2D point to a hemisphere with spread based on roughness
- float alpha = roughness * roughness;
- float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
- float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
- float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
- vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
-
- // Tangent space
- vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangentX = normalize(cross(up, normal));
- vec3 tangentY = normalize(cross(normal, tangentX));
-
- // Convert to world Space
- return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
-}
-
-// Geometric Shadowing function
-float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness)
-{
- float k = (roughness * roughness) / 2.0;
- float GL = dotNL / (dotNL * (1.0 - k) + k);
- float GV = dotNV / (dotNV * (1.0 - k) + k);
- return GL * GV;
-}
-
-vec2 BRDF(float NoV, float roughness)
-{
- // Normal always points along z-axis for the 2D lookup
- const vec3 N = vec3(0.0, 0.0, 1.0);
- vec3 V = vec3(sqrt(1.0 - NoV*NoV), 0.0, NoV);
-
- vec2 LUT = vec2(0.0);
- for(uint i = 0u; i < NUM_SAMPLES; i++) {
- vec2 Xi = hammersley2d(i, NUM_SAMPLES);
- vec3 H = importanceSample_GGX(Xi, roughness, N);
- vec3 L = 2.0 * dot(V, H) * H - V;
-
- float dotNL = max(dot(N, L), 0.0);
- float dotNV = max(dot(N, V), 0.0);
- float dotVH = max(dot(V, H), 0.0);
- float dotNH = max(dot(H, N), 0.0);
-
- if (dotNL > 0.0) {
- float G = G_SchlicksmithGGX(dotNL, dotNV, roughness);
- float G_Vis = (G * dotVH) / (dotNH * dotNV);
- float Fc = pow(1.0 - dotVH, 5.0);
- LUT += vec2((1.0 - Fc) * G_Vis, Fc * G_Vis);
- }
- }
- return LUT / float(NUM_SAMPLES);
-}
-
-void main()
-{
- outColor = vec4(BRDF(inUV.s, 1.0-inUV.t), 0.0, 1.0);
-} \ No newline at end of file
diff --git a/CVKL.Addons/EnvironmentPipeline/shaders/genbrdflut.vert b/CVKL.Addons/EnvironmentPipeline/shaders/genbrdflut.vert
deleted file mode 100644
index f3dd233..0000000
--- a/CVKL.Addons/EnvironmentPipeline/shaders/genbrdflut.vert
+++ /dev/null
@@ -1,9 +0,0 @@
-#version 450
-
-layout (location = 0) out vec2 outUV;
-
-void main()
-{
- outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
- gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f);
-} \ No newline at end of file
diff --git a/CVKL.Addons/EnvironmentPipeline/shaders/irradiancecube.frag b/CVKL.Addons/EnvironmentPipeline/shaders/irradiancecube.frag
deleted file mode 100644
index 340d679..0000000
--- a/CVKL.Addons/EnvironmentPipeline/shaders/irradiancecube.frag
+++ /dev/null
@@ -1,37 +0,0 @@
-// Generates an irradiance cube from an environment map using convolution
-
-#version 450
-
-layout (location = 0) in vec3 inPos;
-layout (location = 0) out vec4 outColor;
-layout (binding = 0) uniform samplerCube samplerEnv;
-
-layout(push_constant) uniform PushConsts {
- layout (offset = 64) float deltaPhi;
- layout (offset = 68) float deltaTheta;
-} consts;
-
-#define PI 3.1415926535897932384626433832795
-
-void main()
-{
- vec3 N = normalize(inPos);
- vec3 up = vec3(0.0, 1.0, 0.0);
- vec3 right = normalize(cross(up, N));
- up = cross(N, right);
-
- const float TWO_PI = PI * 2.0;
- const float HALF_PI = PI * 0.5;
-
- vec3 color = vec3(0.0);
- uint sampleCount = 0u;
- for (float phi = 0.0; phi < TWO_PI; phi += consts.deltaPhi) {
- for (float theta = 0.0; theta < HALF_PI; theta += consts.deltaTheta) {
- vec3 tempVec = cos(phi) * right + sin(phi) * up;
- vec3 sampleVector = cos(theta) * N + sin(theta) * tempVec;
- color += texture(samplerEnv, sampleVector).rgb * cos(theta) * sin(theta);
- sampleCount++;
- }
- }
- outColor = vec4(PI * color / float(sampleCount), 1.0);//texture(samplerEnv, inPos).rgba;
-}
diff --git a/CVKL.Addons/EnvironmentPipeline/shaders/prefilterenvmap.frag b/CVKL.Addons/EnvironmentPipeline/shaders/prefilterenvmap.frag
deleted file mode 100644
index ae1212e..0000000
--- a/CVKL.Addons/EnvironmentPipeline/shaders/prefilterenvmap.frag
+++ /dev/null
@@ -1,105 +0,0 @@
-#version 450
-
-layout (location = 0) in vec3 inPos;
-layout (location = 0) out vec4 outColor;
-
-layout (binding = 0) uniform samplerCube samplerEnv;
-
-layout(push_constant) uniform PushConsts {
- layout (offset = 64) float roughness;
- layout (offset = 68) uint numSamples;
-} consts;
-
-const float PI = 3.1415926536;
-
-// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
-float random(vec2 co)
-{
- float a = 12.9898;
- float b = 78.233;
- float c = 43758.5453;
- float dt= dot(co.xy ,vec2(a,b));
- float sn= mod(dt,3.14);
- return fract(sin(sn) * c);
-}
-
-vec2 hammersley2d(uint i, uint N)
-{
- // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
- uint bits = (i << 16u) | (i >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- float rdi = float(bits) * 2.3283064365386963e-10;
- return vec2(float(i) /float(N), rdi);
-}
-
-// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
-vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
-{
- // Maps a 2D point to a hemisphere with spread based on roughness
- float alpha = roughness * roughness;
- float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
- float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
- float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
- vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
-
- // Tangent space
- vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangentX = normalize(cross(up, normal));
- vec3 tangentY = normalize(cross(normal, tangentX));
-
- // Convert to world Space
- return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
-}
-
-// Normal Distribution function
-float D_GGX(float dotNH, float roughness)
-{
- float alpha = roughness * roughness;
- float alpha2 = alpha * alpha;
- float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0;
- return (alpha2)/(PI * denom*denom);
-}
-
-vec3 prefilterEnvMap(vec3 R, float roughness)
-{
- vec3 N = R;
- vec3 V = R;
- vec3 color = vec3(0.0);
- float totalWeight = 0.0;
- float envMapDim = float(textureSize(samplerEnv, 0).s);
- for(uint i = 0u; i < consts.numSamples; i++) {
- vec2 Xi = hammersley2d(i, consts.numSamples);
- vec3 H = importanceSample_GGX(Xi, roughness, N);
- vec3 L = 2.0 * dot(V, H) * H - V;
- float dotNL = clamp(dot(N, L), 0.0, 1.0);
- if(dotNL > 0.0) {
- // Filtering based on https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/
-
- float dotNH = clamp(dot(N, H), 0.0, 1.0);
- float dotVH = clamp(dot(V, H), 0.0, 1.0);
-
- // Probability Distribution Function
- float pdf = D_GGX(dotNH, roughness) * dotNH / (4.0 * dotVH) + 0.0001;
- // Slid angle of current smple
- float omegaS = 1.0 / (float(consts.numSamples) * pdf);
- // Solid angle of 1 pixel across all cube faces
- float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim);
- // Biased (+1.0) mip level for better result
- float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f);
- color += textureLod(samplerEnv, L, mipLevel).rgb * dotNL;
- totalWeight += dotNL;
-
- }
- }
- return (color / totalWeight);
-}
-
-
-void main()
-{
- vec3 N = normalize(inPos);
- outColor = vec4(prefilterEnvMap(N, consts.roughness), 1.0);
-}
diff --git a/CVKL.Addons/EnvironmentPipeline/shaders/skybox.frag b/CVKL.Addons/EnvironmentPipeline/shaders/skybox.frag
deleted file mode 100644
index e505ef1..0000000
--- a/CVKL.Addons/EnvironmentPipeline/shaders/skybox.frag
+++ /dev/null
@@ -1,12 +0,0 @@
-#version 450
-
-layout (binding = 2) uniform samplerCube samplerEnv;
-
-layout (set = 0, location = 0) in vec3 inUVW;
-
-layout (set = 0, location = 0) out vec4 outColor;
-
-void main()
-{
- outColor = vec4(textureLod(samplerEnv, inUVW, 1.5).rgb, 1.0);
-} \ No newline at end of file
diff --git a/CVKL.Addons/EnvironmentPipeline/shaders/skybox.vert b/CVKL.Addons/EnvironmentPipeline/shaders/skybox.vert
deleted file mode 100644
index 22e285e..0000000
--- a/CVKL.Addons/EnvironmentPipeline/shaders/skybox.vert
+++ /dev/null
@@ -1,27 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projection;
- mat4 model;
- mat4 view;
-} ubo;
-
-layout (location = 0) out vec3 outUVW;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-void main()
-{
- outUVW = inPos;
- outUVW.y = -outUVW.y;
- gl_Position = ubo.projection * mat4(mat3(ubo.view)) * vec4(inPos, 1.0);
-}
diff --git a/CVKL.Addons/VkvgPipeline/VkvgPipeline.cs b/CVKL.Addons/VkvgPipeline/VkvgPipeline.cs
deleted file mode 100644
index 037254b..0000000
--- a/CVKL.Addons/VkvgPipeline/VkvgPipeline.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Numerics;
-using CVKL;
-using VK;
-
-namespace VkvgPipeline {
-
- public class VkvgPipeline : GraphicPipeline {
- vkvg.Device vkvgDev;
- vkvg.Surface vkvgSurf;
- Image uiImage;
-
- public vkvg.Context CreateContext () => new vkvg.Context (vkvgSurf);
-
- public VkvgPipeline (Instance instance, Device dev, Queue queue, GraphicPipeline pipeline, PipelineCache pipelineCache = null)
- : base (pipeline.RenderPass, pipelineCache, "vkvg pipeline") {
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, this.RenderPass.Samples, false);
- cfg.RenderPass = RenderPass;
- cfg.Layout = pipeline.Layout;
- cfg.AddShader (VkShaderStageFlags.Vertex, "#CVKL.FullScreenQuad.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#CVKL.simpletexture.frag.spv");
- cfg.multisampleState.rasterizationSamples = Samples;
-
- cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (true);
-
- layout = cfg.Layout;
-
- init (cfg);
-
- vkvgDev = new vkvg.Device (instance.Handle, dev.phy.Handle, dev.VkDev.Handle, queue.qFamIndex,
- vkvg.SampleCount.Sample_4, queue.index);
- }
-
- void initUISurface (int width, int height) {
- uiImage?.Dispose ();
- vkvgSurf?.Dispose ();
- vkvgSurf = new vkvg.Surface (vkvgDev, width, height);
- uiImage = new Image (Dev, new VkImage ((ulong)vkvgSurf.VkImage.ToInt64 ()), VkFormat.B8g8r8a8Unorm,
- VkImageUsageFlags.ColorAttachment, (uint)vkvgSurf.Width, (uint)vkvgSurf.Height);
- uiImage.CreateView (VkImageViewType.ImageView2D, VkImageAspectFlags.Color);
- uiImage.CreateSampler (VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder);
- uiImage.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- }
-
-
- public void Resize (int width, int height, DescriptorSetWrites dsUpdate) {
- initUISurface (width, height);
- dsUpdate.Write (Dev, uiImage.Descriptor);
- }
- public void RecordDraw (CommandBuffer cmd) {
- Bind (cmd);
-
- uiImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ColorAttachmentOptimal, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader);
-
- cmd.Draw (3, 1, 0, 0);
-
- uiImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ShaderReadOnlyOptimal, VkImageLayout.ColorAttachmentOptimal,
- VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.BottomOfPipe);
- }
- public void DrawResources (vkvg.Context ctx, int width, int height) {
- ResourceManager rm = Dev.resourceManager;
-
- int margin = 5, memPoolHeight = 15;
- int drawingWidth = width - 4 * margin;
- int drawingHeight = (memPoolHeight + margin) * (rm.memoryPools.Length) + margin;
- int y = height - drawingHeight - margin;
- int x = 2 * margin;
- ctx.LineWidth = 1;
- ctx.SetSource (0.1, 0.1, 0.1, 0.8);
- ctx.Rectangle (0.5 + margin, 0.5 + y, width - 2 * margin, drawingHeight);
- ctx.FillPreserve ();
- ctx.Flush ();
- ctx.SetSource (0.8, 0.8, 0.8);
- ctx.Stroke ();
-
- foreach (MemoryPool mp in rm.memoryPools) {
- float byteWidth = (float)drawingWidth / mp.Size;
-
- y += margin;
- ctx.Rectangle (x, y, drawingWidth, memPoolHeight);
- ctx.SetSource (0.3, 0.3, 0.3, 0.4);
- ctx.Fill ();
-
- if (mp.Last == null)
- return;
-
- Resource r = mp.Last;
- do {
- float w = Math.Max (1f, byteWidth * r.AllocatedDeviceMemorySize);
-
- Vector3 c = new Vector3 (0);
- Image img = r as Image;
- if (img != null) {
- c.Z = 1f;
- if (img.CreateInfo.usage.HasFlag (VkImageUsageFlags.InputAttachment))
- c.Y += 0.3f;
- if (img.CreateInfo.usage.HasFlag (VkImageUsageFlags.ColorAttachment))
- c.Y += 0.1f;
- if (img.CreateInfo.usage.HasFlag (VkImageUsageFlags.Sampled))
- c.X += 0.3f;
- } else {
- CVKL.Buffer buff = r as CVKL.Buffer;
- c.X = 1f;
- if (buff.Infos.usage.HasFlag (VkBufferUsageFlags.IndexBuffer))
- c.Y += 0.2f;
- if (buff.Infos.usage.HasFlag (VkBufferUsageFlags.VertexBuffer))
- c.Y += 0.4f;
- if (buff.Infos.usage.HasFlag (VkBufferUsageFlags.UniformBuffer))
- c.Z += 0.3f;
- }
- ctx.SetSource (c.X, c.Y, c.Z, 0.5);
- ctx.Rectangle (0.5f + x + byteWidth * r.poolOffset, 0.5f + y, w, memPoolHeight);
- ctx.FillPreserve ();
- ctx.SetSource (0.01f, 0.01f, 0.01f);
- ctx.Stroke ();
- r = r.next;
- } while (r != mp.Last && r != null);
- y += memPoolHeight;
- }
- }
- protected override void Dispose (bool disposing) {
- uiImage?.Dispose ();
- vkvgSurf?.Dispose ();
- vkvgDev.Dispose ();
-
- base.Dispose (disposing);
- }
- }
-
-}
diff --git a/CVKL.Addons/VkvgPipeline/VkvgPipeline.csproj b/CVKL.Addons/VkvgPipeline/VkvgPipeline.csproj
deleted file mode 100644
index 3d07598..0000000
--- a/CVKL.Addons/VkvgPipeline/VkvgPipeline.csproj
+++ /dev/null
@@ -1,23 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <Import Project="$(RootDirectory)netfx.props" />
- <PropertyGroup>
- <AssemblyName>CVKL.vkvgPipeline</AssemblyName>
- <PackageId>CVKL.vkvgPipeline</PackageId>
- <AssemblyVersion>0.1.0</AssemblyVersion>
- <Description>CVKL vkvg addons, vectorial drawing with cairo like api.</Description>
- <PackageTags>C# vulkan CVKL gltf</PackageTags>
- <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
- <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
- <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
- <PackageProjectUrl>https://github.com/jpbruyere/vk.net/blob/master/README.md</PackageProjectUrl>
- <License>MIT</License>
- <PackageReleaseNotes></PackageReleaseNotes>
- <SynchReleaseVersion>false</SynchReleaseVersion>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
-
- <ItemGroup>
- <PackageReference Include="vkvg.net" Version="0.2.2-beta" />
- </ItemGroup>
-</Project>
diff --git a/CVKL.Addons/gltfLoader/PbrModel.cs b/CVKL.Addons/gltfLoader/PbrModel.cs
deleted file mode 100644
index 396c42f..0000000
--- a/CVKL.Addons/gltfLoader/PbrModel.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System.Diagnostics;
-using System.Numerics;
-using System.Runtime.InteropServices;
-
-using VK;
-using System.Collections.Generic;
-
-namespace CVKL.glTF {
- //TODO:stride in buffer views?
- public abstract class PbrModel : Model {
- //public new struct Vertex {
- // [VertexAttribute (VertexAttributeType.Position, VkFormat.R32g32b32Sfloat)]
- // public Vector3 pos;
- // [VertexAttribute (VertexAttributeType.Normal, VkFormat.R32g32b32Sfloat)]
- // public Vector3 normal;
- // [VertexAttribute (VertexAttributeType.UVs, VkFormat.R32g32Sfloat)]
- // public Vector2 uv0;
- // [VertexAttribute (VertexAttributeType.UVs, VkFormat.R32g32Sfloat)]
- // public Vector2 uv1;
- // public override string ToString () {
- // return pos.ToString () + ";" + normal.ToString () + ";" + uv0.ToString () + ";" + uv1.ToString ();
- // }
- //};
-
- protected DescriptorPool descriptorPool;
- public GPUBuffer vbo;
- public GPUBuffer ibo;
- public Buffer materialUBO;
-
- protected PbrModel () { }
- public PbrModel (Queue transferQ, string path) {
- dev = transferQ.Dev;
- using (CommandPool cmdPool = new CommandPool (dev, transferQ.index)) {
- using (glTFLoader ctx = new glTFLoader (path, transferQ, cmdPool)) {
- loadSolids (ctx);
- }
- }
- }
-
- protected void loadSolids (glTFLoader ctx) {
- loadSolids<Vertex> (ctx);
- }
-
- protected void loadSolids<VX> (glTFLoader ctx) {
- ulong vertexCount, indexCount;
-
- ctx.GetVertexCount (out vertexCount, out indexCount, out IndexBufferType);
-
- ulong vertSize = vertexCount * (ulong)Marshal.SizeOf<VX> ();
- ulong idxSize = indexCount * (IndexBufferType == VkIndexType.Uint16 ? 2ul : 4ul);
- ulong size = vertSize + idxSize;
-
- vbo = new GPUBuffer (dev, VkBufferUsageFlags.VertexBuffer | VkBufferUsageFlags.TransferDst, vertSize);
- ibo = new GPUBuffer (dev, VkBufferUsageFlags.IndexBuffer | VkBufferUsageFlags.TransferDst, idxSize);
-
- vbo.SetName ("vbo gltf");
- ibo.SetName ("ibo gltf");
-
- Meshes = new List<Mesh> (ctx.LoadMeshes<VX> (IndexBufferType, vbo, 0, ibo, 0));
- Scenes = new List<Scene> (ctx.LoadScenes (out defaultSceneIndex));
- }
-
- /// <summary> bind vertex and index buffers </summary>
- public virtual void Bind (CommandBuffer cmd) {
- cmd.BindVertexBuffer (vbo);
- cmd.BindIndexBuffer (ibo, IndexBufferType);
- }
-
- //TODO:destset for binding must be variable
- //TODO: ADD REFAULT MAT IF NO MAT DEFINED
- public abstract void RenderNode (CommandBuffer cmd, PipelineLayout pipelineLayout, Node node, Matrix4x4 currentTransform, bool shadowPass = false);
-
- public void DrawAll (CommandBuffer cmd, PipelineLayout pipelineLayout, bool shadowPass = false) {
- foreach (Scene sc in Scenes) {
- foreach (Node node in sc.Root.Children)
- RenderNode (cmd, pipelineLayout, node, sc.Root.localMatrix, shadowPass);
- }
- }
- public void Draw(CommandBuffer cmd, PipelineLayout pipelineLayout, Scene scene, bool shadowPass = false)
- {
- if (scene.Root == null)
- return;
- RenderNode(cmd, pipelineLayout, scene.Root, Matrix4x4.Identity, shadowPass);
- }
-
- public void Draw (CommandBuffer cmd, PipelineLayout pipelineLayout, Buffer instanceBuf, bool shadowPass = false, params InstancedCmd[] instances) {
- cmd.BindVertexBuffer(instanceBuf, 1);
- uint firstInstance = 0;
- for (int i = 0; i < instances.Length; i++)
- {
- foreach (Primitive p in Meshes[instances[i].meshIdx].Primitives)
- {
- if (!shadowPass)
- cmd.PushConstant(pipelineLayout, VkShaderStageFlags.Fragment, (int)p.material, (uint)Marshal.SizeOf<Matrix4x4>());
- cmd.DrawIndexed(p.indexCount, instances[i].count, p.indexBase, p.vertexBase, firstInstance);
- }
- firstInstance += instances[i].count;
- }
- }
-
- #region IDisposable Support
- protected bool isDisposed;
-
- protected virtual void Dispose (bool disposing) {
- if (!isDisposed) {
- if (disposing) {
- ibo?.Dispose ();
- vbo?.Dispose ();
- materialUBO?.Dispose ();
- descriptorPool?.Dispose ();
- } else
- Debug.WriteLine ("model was not disposed");
- isDisposed = true;
- }
- }
- public void Dispose () {
- Dispose (true);
- }
- #endregion
- }
-}
diff --git a/CVKL.Addons/gltfLoader/PbrModelSeparateTextures.cs b/CVKL.Addons/gltfLoader/PbrModelSeparateTextures.cs
deleted file mode 100644
index c1a6ee9..0000000
--- a/CVKL.Addons/gltfLoader/PbrModelSeparateTextures.cs
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Diagnostics;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL.glTF {
- /// <summary>
- /// Indexed pbr model whith one descriptorSet per material with separate textures attachments
- /// </summary>
- public class PbrModelSeparatedTextures : PbrModel {
- /// <summary>
- /// Pbr data structure suitable for push constant or ubo, containing
- /// availablility of attached textures and the coef of pbr inputs
- /// </summary>
- public struct Material {
- public Vector4 baseColorFactor;
- public Vector4 emissiveFactor;
- public Vector4 diffuseFactor;
- public Vector4 specularFactor;
- public float workflow;
- public AttachmentType TexCoord0;
- public AttachmentType TexCoord1;
- public float metallicFactor;
- public float roughnessFactor;
- public float alphaMask;
- public float alphaMaskCutoff;
-#pragma warning disable 169
- readonly int pad0;//see std420
-#pragma warning restore 169
- }
-
- protected Image[] textures;
- public Material[] materials;
- /// <summary>
- /// one descriptor per material containing textures
- /// </summary>
- protected DescriptorSet[] descriptorSets;
-
- protected PbrModelSeparatedTextures () { }
- public PbrModelSeparatedTextures (Queue transferQ, string path, DescriptorSetLayout layout, params AttachmentType[] attachments) {
- dev = transferQ.Dev;
- using (CommandPool cmdPool = new CommandPool (dev, transferQ.index)) {
- using (glTFLoader ctx = new glTFLoader (path, transferQ, cmdPool)) {
- loadSolids (ctx);
-
- textures = ctx.LoadImages ();
- loadMaterials (ctx, layout, attachments);
-
- materialUBO = new HostBuffer<Material> (dev, VkBufferUsageFlags.UniformBuffer, materials);
-
- }
- }
- }
-
- void loadMaterials (glTFLoader ctx, DescriptorSetLayout layout, params AttachmentType[] attachments) {
- glTFLoader.Material[] mats = ctx.LoadMaterial ();
- materials = new Material[mats.Length];
- descriptorSets = new DescriptorSet[mats.Length];
-
- if (attachments.Length == 0)
- throw new InvalidOperationException ("At least one attachment is required for Model.WriteMaterialDescriptor");
-
- descriptorPool = new DescriptorPool (dev, (uint)materials.Length,
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler, (uint)(attachments.Length * materials.Length))
- );
- descriptorPool.SetName ("descPool gltfTextures");
-
- for (int i = 0; i < mats.Length; i++) {
- materials[i] = new Material {
- workflow = (float)mats[i].workflow,
- baseColorFactor = mats[i].baseColorFactor,
- emissiveFactor = mats[i].emissiveFactor,
- metallicFactor = mats[i].metallicFactor,
- roughnessFactor = mats[i].roughnessFactor,
- TexCoord0 = mats[i].availableAttachments,
- TexCoord1 = mats[i].availableAttachments1,
- alphaMask = 0f,
- alphaMaskCutoff = 0.0f,
- diffuseFactor = new Vector4 (0),
- specularFactor = new Vector4 (0)
- };
-
- descriptorSets[i] = descriptorPool.Allocate (layout);
- descriptorSets[i].Handle.SetDebugMarkerName (dev, "descSet " + mats[i].Name);
-
- VkDescriptorSetLayoutBinding dslb =
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler);
-
- using (DescriptorSetWrites2 uboUpdate = new DescriptorSetWrites2 (dev)) {
- for (uint a = 0; a < attachments.Length; a++) {
- dslb.binding = a;
- switch (attachments[a]) {
- case AttachmentType.None:
- break;
- case AttachmentType.Color:
- if (mats[i].availableAttachments.HasFlag (AttachmentType.Color))
- uboUpdate.AddWriteInfo (descriptorSets[i], dslb, textures[(int)mats[i].baseColorTexture].Descriptor);
- break;
- case AttachmentType.Normal:
- if (mats[i].availableAttachments.HasFlag (AttachmentType.Normal))
- uboUpdate.AddWriteInfo (descriptorSets[i], dslb, textures[(int)mats[i].normalTexture].Descriptor);
- break;
- case AttachmentType.AmbientOcclusion:
- if (mats[i].availableAttachments.HasFlag (AttachmentType.AmbientOcclusion))
- uboUpdate.AddWriteInfo (descriptorSets[i], dslb, textures[(int)mats[i].occlusionTexture].Descriptor);
- break;
- case AttachmentType.PhysicalProps:
- if (mats[i].availableAttachments.HasFlag (AttachmentType.PhysicalProps))
- uboUpdate.AddWriteInfo (descriptorSets[i], dslb, textures[(int)mats[i].metallicRoughnessTexture].Descriptor);
- break;
- case AttachmentType.Metal:
- break;
- case AttachmentType.Roughness:
- break;
- case AttachmentType.Emissive:
- if (mats[i].availableAttachments.HasFlag (AttachmentType.Emissive))
- uboUpdate.AddWriteInfo (descriptorSets[i], dslb, textures[(int)mats[i].emissiveTexture].Descriptor);
- break;
- }
- }
- uboUpdate.Update ();
- }
- }
- }
-
- public override void RenderNode (CommandBuffer cmd, PipelineLayout pipelineLayout, Node node, Matrix4x4 currentTransform, bool shadowPass = false) {
- Matrix4x4 localMat = node.localMatrix * currentTransform;
- VkShaderStageFlags matStage = shadowPass ? VkShaderStageFlags.Geometry : VkShaderStageFlags.Vertex;
- cmd.PushConstant (pipelineLayout, matStage, localMat);
-
- if (node.Mesh != null) {
- foreach (Primitive p in node.Mesh.Primitives) {
- if (!shadowPass) {
- cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Fragment, (int)p.material, (uint)Marshal.SizeOf<Matrix4x4> ());
- if (descriptorSets[p.material] != null)
- cmd.BindDescriptorSet (pipelineLayout, descriptorSets[p.material], 2);
- }
- cmd.DrawIndexed (p.indexCount, 1, p.indexBase, p.vertexBase, 0);
- }
- }
- if (node.Children == null)
- return;
- foreach (Node child in node.Children)
- RenderNode (cmd, pipelineLayout, child, localMat, shadowPass);
- }
-
- protected override void Dispose (bool disposing) {
- if (!isDisposed) {
- if (disposing) {
- foreach (Image txt in textures)
- txt.Dispose ();
- } else
- Debug.WriteLine ("model was not disposed");
- }
- base.Dispose (disposing);
- }
- }
-}
diff --git a/CVKL.Addons/gltfLoader/PbrModelTexArray.cs b/CVKL.Addons/gltfLoader/PbrModelTexArray.cs
deleted file mode 100644
index 5943774..0000000
--- a/CVKL.Addons/gltfLoader/PbrModelTexArray.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System.Diagnostics;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL.glTF {
- /// <summary>
- /// Indexed pbr model whith one descriptorSet per material with separate textures attachments
- /// </summary>
- public class PbrModelTexArray : PbrModel {
- public static uint TEXTURE_DIM = 512;
- public new struct Vertex {
- [VertexAttribute (VertexAttributeType.Position, VkFormat.R32g32b32Sfloat)]
- public Vector3 pos;
- [VertexAttribute (VertexAttributeType.Normal, VkFormat.R32g32b32Sfloat)]
- public Vector3 normal;
- [VertexAttribute (VertexAttributeType.UVs, VkFormat.R32g32Sfloat)]
- public Vector2 uv0;
- [VertexAttribute (VertexAttributeType.UVs, VkFormat.R32g32Sfloat)]
- public Vector2 uv1;
- public override string ToString () {
- return pos.ToString () + ";" + normal.ToString () + ";" + uv0.ToString () + ";" + uv1.ToString ();
- }
- };
-
- /// <summary>
- /// Material structure for ubo containing texture indices in tex array
- /// </summary>
- public struct Material {
- public Vector4 baseColorFactor;
- public Vector4 emissiveFactor;
- public Vector4 diffuseFactor;
- public Vector4 specularFactor;
-
- public float workflow;
- public AttachmentType TexCoord0;
- public AttachmentType TexCoord1;
- public int baseColorTextureSet;
-
- public int phyDescTex;
- public int normalTex;
- public int aoTex;
- public int emissiveTex;
-
- public float metallicFactor;
- public float roughnessFactor;
- public float alphaMask;
- public float alphaMaskCutoff;
- }
-
- public Image texArray;
- public Material[] materials;
-
- public PbrModelTexArray (Queue transferQ, string path) {
- dev = transferQ.Dev;
- using (CommandPool cmdPool = new CommandPool (dev, transferQ.index)) {
- using (glTFLoader ctx = new glTFLoader (path, transferQ, cmdPool)) {
- loadSolids<Vertex> (ctx);
-
- if (ctx.ImageCount > 0) {
- texArray = new Image (dev, Image.DefaultTextureFormat, VkImageUsageFlags.Sampled | VkImageUsageFlags.TransferDst | VkImageUsageFlags.TransferSrc,
- VkMemoryPropertyFlags.DeviceLocal, TEXTURE_DIM, TEXTURE_DIM, VkImageType.Image2D,
- VkSampleCountFlags.SampleCount1, VkImageTiling.Optimal, Image.ComputeMipLevels (TEXTURE_DIM), ctx.ImageCount);
-
- ctx.BuildTexArray (ref texArray, 0);
-
- texArray.CreateView (VkImageViewType.ImageView2DArray, VkImageAspectFlags.Color, texArray.CreateInfo.arrayLayers);
- texArray.CreateSampler ();
- texArray.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- texArray.SetName ("model texArray");
- }
-
- loadMaterials (ctx);
- materialUBO = new HostBuffer<Material> (dev, VkBufferUsageFlags.UniformBuffer, materials);
- }
- }
- }
-
- void loadMaterials (glTFLoader ctx) {
- glTFLoader.Material[] mats = ctx.LoadMaterial ();
- materials = new Material[mats.Length];
-
- for (int i = 0; i < mats.Length; i++) {
- materials[i] = new Material {
- workflow = (float)mats[i].workflow,
- baseColorFactor = mats[i].baseColorFactor,
- emissiveFactor = mats[i].emissiveFactor,
- metallicFactor = mats[i].metallicFactor,
- roughnessFactor = mats[i].roughnessFactor,
-
- baseColorTextureSet = mats[i].baseColorTexture,
- phyDescTex = mats[i].metallicRoughnessTexture,
- normalTex = mats[i].normalTexture,
- aoTex = mats[i].occlusionTexture,
- emissiveTex = mats[i].emissiveTexture,
-
- TexCoord0 = mats[i].availableAttachments,
- TexCoord1 = mats[i].availableAttachments1,
-
- alphaMask = 0f,
- alphaMaskCutoff = 0.0f,
- diffuseFactor = new Vector4 (0),
- specularFactor = new Vector4 (0)
- };
- }
- }
-
- public override void RenderNode (CommandBuffer cmd, PipelineLayout pipelineLayout, Node node, Matrix4x4 currentTransform, bool shadowPass = false) {
- Matrix4x4 localMat = node.localMatrix * currentTransform;
-
- cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Vertex, localMat);
-
- if (node.Mesh != null) {
- foreach (Primitive p in node.Mesh.Primitives) {
- if (!shadowPass)
- cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Fragment, (int)p.material, (uint)Marshal.SizeOf<Matrix4x4> ());
- cmd.DrawIndexed (p.indexCount, 1, p.indexBase, p.vertexBase, 0);
- }
- }
- if (node.Children == null)
- return;
- foreach (Node child in node.Children)
- RenderNode (cmd, pipelineLayout, child, localMat, shadowPass);
- }
-
- protected override void Dispose (bool disposing) {
- if (!isDisposed) {
- if (disposing) {
- texArray?.Dispose ();
- } else
- Debug.WriteLine ("model was not disposed");
- }
- base.Dispose (disposing);
- }
- }
-}
diff --git a/CVKL.Addons/gltfLoader/glTFLoader.cs b/CVKL.Addons/gltfLoader/glTFLoader.cs
deleted file mode 100644
index 06e8ad6..0000000
--- a/CVKL.Addons/gltfLoader/glTFLoader.cs
+++ /dev/null
@@ -1,635 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Diagnostics;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using glTFLoader;
-using GL = glTFLoader.Schema;
-
-using VK;
-using System.Collections.Generic;
-using System.IO;
-
-
-
-namespace CVKL.glTF {
- using static VK.Utils;
- using static CVKL.Model;
-
- /// <summary>
- /// Loading context with I as the vertex index type (uint16,uint32)
- /// </summary>
- public class glTFLoader : IDisposable {
- /// <summary>
- /// Material class used by the gltfLoader to fetch values.
- /// </summary>
- public class Material {
- public enum Workflow { PhysicalyBaseRendering = 1, SpecularGlossinnes };
- public string Name;
- public Workflow workflow;
- public Int32 baseColorTexture;
- public Int32 metallicRoughnessTexture;
- public Int32 normalTexture;
- public Int32 occlusionTexture;
- public Int32 emissiveTexture;
-
- public Vector4 baseColorFactor;
- public Vector4 emissiveFactor;
- public AttachmentType availableAttachments;
- public AttachmentType availableAttachments1;
-
- public AlphaMode alphaMode;
- public float alphaCutoff;
- public float metallicFactor;
- public float roughnessFactor;
-
- public bool metallicRoughness = true;
- public bool specularGlossiness = false;
-
- public Material (Int32 _baseColorTexture = -1, Int32 _metallicRoughnessTexture = -1,
- Int32 _normalTexture = -1, Int32 _occlusionTexture = -1) {
- workflow = Workflow.PhysicalyBaseRendering;
- baseColorTexture = _baseColorTexture;
- metallicRoughnessTexture = _metallicRoughnessTexture;
- normalTexture = _normalTexture;
- occlusionTexture = _occlusionTexture;
- emissiveTexture = -1;
-
- alphaMode = AlphaMode.Opaque;
- alphaCutoff = 1f;
- metallicFactor = 1f;
- roughnessFactor = 1;
- baseColorFactor = new Vector4 (1);
- emissiveFactor = new Vector4 (1);
-
- metallicRoughness = true;
- specularGlossiness = false;
-
- }
- }
-
- public Queue transferQ;
- public CommandPool cmdPool;
- Device dev => transferQ.Dev;
-
- public GL.Gltf gltf;
- public string baseDirectory;
-
- public byte[][] loadedBuffers;
- public GCHandle[] bufferHandles;
-
- List<Mesh> meshes;
- string path;
-
- public glTFLoader (string path, Queue _transferQ, CommandPool _cmdPool) {
- this.path = path;
- transferQ = _transferQ;
- cmdPool = _cmdPool;
- baseDirectory = System.IO.Path.GetDirectoryName (path);
- gltf = Interface.LoadModel (path); ;
- loadedBuffers = new byte[gltf.Buffers.Length][];
- bufferHandles = new GCHandle[gltf.Buffers.Length];
- }
-
- static byte[] loadDataUri (GL.Image img) {
- int idxComa = img.Uri.IndexOf (",", 5, StringComparison.Ordinal);
- return Convert.FromBase64String (img.Uri.Substring (idxComa + 1));
- }
- static byte[] loadDataUri (GL.Buffer buff) {
- int idxComa = buff.Uri.IndexOf (",", 5, StringComparison.Ordinal);
- return Convert.FromBase64String (buff.Uri.Substring (idxComa + 1));
- }
-
- void EnsureBufferIsLoaded (int bufferIdx) {
- if (loadedBuffers[bufferIdx] == null) {
- //load full buffer
- string uri = gltf.Buffers[bufferIdx].Uri;
- if (string.IsNullOrEmpty(uri))//glb
- loadedBuffers[bufferIdx] = gltf.LoadBinaryBuffer (bufferIdx, path);
- else if (uri.StartsWith ("data", StringComparison.Ordinal))
- loadedBuffers[bufferIdx] = loadDataUri (gltf.Buffers[bufferIdx]);//TODO:check this func=>System.Buffers.Text.Base64.EncodeToUtf8InPlace
- else
- loadedBuffers[bufferIdx] = File.ReadAllBytes (Path.Combine (baseDirectory, gltf.Buffers[bufferIdx].Uri));
- bufferHandles[bufferIdx] = GCHandle.Alloc (loadedBuffers[bufferIdx], GCHandleType.Pinned);
- }
- }
-
- public void GetVertexCount (out ulong vertexCount, out ulong indexCount, out VkIndexType largestIndexType) {
- vertexCount = 0;
- indexCount = 0;
- largestIndexType = VkIndexType.Uint16;
- //compute size of stagging buf
- foreach (GL.Mesh mesh in gltf.Meshes) {
- foreach (GL.MeshPrimitive p in mesh.Primitives) {
- int accessorIdx;
- if (p.Attributes.TryGetValue ("POSITION", out accessorIdx))
- vertexCount += (ulong)gltf.Accessors[accessorIdx].Count;
- if (p.Indices != null) {
- indexCount += (ulong)gltf.Accessors[(int)p.Indices].Count;
- if (gltf.Accessors[(int)p.Indices].ComponentType == GL.Accessor.ComponentTypeEnum.UNSIGNED_INT)
- largestIndexType = VkIndexType.Uint32;
- }
- }
- }
- }
-
- public uint ImageCount => gltf.Images == null ? 0 : (uint)gltf.Images.Length;
-
-
- //TODO: some buffer data are reused between primitives, and I duplicate the datas
- //buffers must be constructed without duplications
- public Mesh[] LoadMeshes<TVertex> (VkIndexType indexType, Buffer vbo, ulong vboOffset, Buffer ibo, ulong iboOffset) {
- ulong vCount, iCount;
- VkIndexType idxType;
- GetVertexCount (out vCount, out iCount, out idxType);
-
- int vertexByteSize = Marshal.SizeOf<TVertex> ();
- ulong vertSize = vCount * (ulong)vertexByteSize;
- ulong idxSize = iCount * (indexType == VkIndexType.Uint16 ? 2ul : 4ul);
- ulong size = vertSize + idxSize;
-
- int vertexCount = 0, indexCount = 0;
- int autoNamedMesh = 1;
-
- meshes = new List<Mesh> ();
-
- using (HostBuffer stagging = new HostBuffer (dev, VkBufferUsageFlags.TransferSrc, size)) {
- stagging.Map ();
-
- unsafe {
- byte* stagVertPtrInit = (byte*)stagging.MappedData.ToPointer ();
- byte* stagIdxPtrInit = (byte*)(stagging.MappedData.ToPointer ()) + vertSize;
- byte* stagVertPtr = stagVertPtrInit;
- byte* stagIdxPtr = stagIdxPtrInit;
-
- foreach (GL.Mesh mesh in gltf.Meshes) {
-
- string meshName = mesh.Name;
- if (string.IsNullOrEmpty (meshName)) {
- meshName = "mesh_" + autoNamedMesh.ToString ();
- autoNamedMesh++;
- }
- Mesh m = new Mesh { Name = meshName };
-
- foreach (GL.MeshPrimitive p in mesh.Primitives) {
- GL.Accessor AccPos = null, AccNorm = null, AccUv = null, AccUv1 = null;
-
- int accessorIdx;
- if (p.Attributes.TryGetValue ("POSITION", out accessorIdx)) {
- AccPos = gltf.Accessors[accessorIdx];
- EnsureBufferIsLoaded (gltf.BufferViews[(int)AccPos.BufferView].Buffer);
- }
- if (p.Attributes.TryGetValue ("NORMAL", out accessorIdx)) {
- AccNorm = gltf.Accessors[accessorIdx];
- EnsureBufferIsLoaded (gltf.BufferViews[(int)AccNorm.BufferView].Buffer);
- }
- if (p.Attributes.TryGetValue ("TEXCOORD_0", out accessorIdx)) {
- AccUv = gltf.Accessors[accessorIdx];
- EnsureBufferIsLoaded (gltf.BufferViews[(int)AccUv.BufferView].Buffer);
- }
- if (p.Attributes.TryGetValue ("TEXCOORD_1", out accessorIdx)) {
- AccUv1 = gltf.Accessors[accessorIdx];
- EnsureBufferIsLoaded (gltf.BufferViews[(int)AccUv1.BufferView].Buffer);
- }
-
- Primitive prim = new Primitive {
- indexBase = (uint)indexCount,
- vertexBase = vertexCount,
- vertexCount = (uint)AccPos.Count,
- material = (uint)(p.Material ?? 0)
- };
-
- prim.bb.min.ImportFloatArray (AccPos.Min);
- prim.bb.max.ImportFloatArray (AccPos.Max);
- prim.bb.isValid = true;
-
- //Interleaving vertices
- byte * inPosPtr = null, inNormPtr = null, inUvPtr = null, inUv1Ptr = null;
-
- GL.BufferView bv = gltf.BufferViews[(int)AccPos.BufferView];
- inPosPtr = (byte*)bufferHandles[bv.Buffer].AddrOfPinnedObject ().ToPointer ();
- inPosPtr += AccPos.ByteOffset + bv.ByteOffset;
-
- if (AccNorm != null) {
- bv = gltf.BufferViews[(int)AccNorm.BufferView];
- inNormPtr = (byte*)bufferHandles[bv.Buffer].AddrOfPinnedObject ().ToPointer ();
- inNormPtr += AccNorm.ByteOffset + bv.ByteOffset;
- }
- if (AccUv != null) {
- bv = gltf.BufferViews[(int)AccUv.BufferView];
- inUvPtr = (byte*)bufferHandles[bv.Buffer].AddrOfPinnedObject ().ToPointer ();
- inUvPtr += AccUv.ByteOffset + bv.ByteOffset;
- }
- if (AccUv1 != null) {
- bv = gltf.BufferViews[(int)AccUv1.BufferView];
- inUv1Ptr = (byte*)bufferHandles[bv.Buffer].AddrOfPinnedObject ().ToPointer ();
- inUv1Ptr += AccUv1.ByteOffset + bv.ByteOffset;
- }
-
-
- for (int j = 0; j < prim.vertexCount; j++) {
- System.Buffer.MemoryCopy (inPosPtr, stagVertPtr, 12, 12);
- inPosPtr += 12;
- if (inNormPtr != null) {
- System.Buffer.MemoryCopy (inNormPtr, stagVertPtr + 12, 12, 12);
- inNormPtr += 12;
- }
- if (inUvPtr != null) {
- System.Buffer.MemoryCopy (inUvPtr, stagVertPtr + 24, 8, 8);
- inUvPtr += 8;
- }
- if (inUv1Ptr != null) {
- System.Buffer.MemoryCopy (inUv1Ptr, stagVertPtr + 32, 8, 8);
- inUv1Ptr += 8;
- }
- stagVertPtr += vertexByteSize;
- }
-
- //indices loading
- if (p.Indices != null) {
- GL.Accessor acc = gltf.Accessors[(int)p.Indices];
- bv = gltf.BufferViews[(int)acc.BufferView];
-
- byte* inIdxPtr = (byte*)bufferHandles[bv.Buffer].AddrOfPinnedObject ().ToPointer ();
- inIdxPtr += acc.ByteOffset + bv.ByteOffset;
-
- //TODO:double check this, I dont seems to increment stag pointer
- if (acc.ComponentType == GL.Accessor.ComponentTypeEnum.UNSIGNED_SHORT) {
- if (indexType == VkIndexType.Uint16) {
- System.Buffer.MemoryCopy (inIdxPtr, stagIdxPtr, (long)acc.Count * 2, (long)acc.Count * 2);
- stagIdxPtr += (long)acc.Count * 2;
- } else {
- uint* usPtr = (uint*)stagIdxPtr;
- ushort* inPtr = (ushort*)inIdxPtr;
- for (int i = 0; i < acc.Count; i++)
- usPtr[i] = inPtr[i];
- stagIdxPtr += (long)acc.Count * 4;
- }
- } else if (acc.ComponentType == GL.Accessor.ComponentTypeEnum.UNSIGNED_INT) {
- if (indexType == VkIndexType.Uint32) {
- System.Buffer.MemoryCopy (inIdxPtr, stagIdxPtr, (long)acc.Count * 4, (long)acc.Count * 4);
- stagIdxPtr += (long)acc.Count * 4;
- } else {
- ushort* usPtr = (ushort*)stagIdxPtr;
- uint* inPtr = (uint*)inIdxPtr;
- for (int i = 0; i < acc.Count; i++)
- usPtr[i] = (ushort)inPtr[i];
- stagIdxPtr += (long)acc.Count * 2;
- }
- } else if (acc.ComponentType == GL.Accessor.ComponentTypeEnum.UNSIGNED_BYTE) {
- //convert
- if (indexType == VkIndexType.Uint16) {
- ushort* usPtr = (ushort*)stagIdxPtr;
- for (int i = 0; i < acc.Count; i++)
- usPtr[i] = (ushort)inIdxPtr[i];
- stagIdxPtr += (long)acc.Count * 2;
- } else {
- uint* usPtr = (uint*)stagIdxPtr;
- for (int i = 0; i < acc.Count; i++)
- usPtr[i] = (uint)inIdxPtr[i];
- stagIdxPtr += (long)acc.Count * 4;
- }
- } else
- throw new NotImplementedException ();
-
- prim.indexCount = (uint)acc.Count;
- indexCount += acc.Count;
- }
-
- m.AddPrimitive (prim);
-
- vertexCount += AccPos.Count;
- }
- meshes.Add (m);
- }
- }
-
- stagging.Unmap ();
-
- CommandBuffer cmd = cmdPool.AllocateCommandBuffer ();
- cmd.Start (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- stagging.CopyTo (cmd, vbo, vertSize, 0, vboOffset);
- if (iCount>0)
- stagging.CopyTo (cmd, ibo, idxSize, vertSize, iboOffset);
-
- cmd.End ();
-
- transferQ.Submit (cmd);
-
- dev.WaitIdle ();
- cmd.Free ();
-
- }
-
- return meshes.ToArray ();
- }
-
- public Scene[] LoadScenes (out int defaultScene) {
- defaultScene = -1;
- if (gltf.Scene == null)
- return new Scene[] {};
-
- List<Scene> scenes = new List<Scene> ();
- defaultScene = (int)gltf.Scene;
-
- for (int i = 0; i < gltf.Scenes.Length; i++) {
- GL.Scene scene = gltf.Scenes[i];
- Debug.WriteLine ("Loading Scene {0}", scene.Name);
-
- scenes.Add (new Scene {
- Name = scene.Name,
- });
-
- if (scene.Nodes.Length == 0)
- continue;
-
- scenes[i].Root = new Node {
- localMatrix = Matrix4x4.Identity,
- Children = new List<Node> ()
- };
-
- foreach (int nodeIdx in scene.Nodes)
- loadNode (scenes[i].Root, gltf.Nodes[nodeIdx]);
- }
- return scenes.ToArray ();
- }
-
- void loadNode (Node parentNode, GL.Node gltfNode) {
- Debug.WriteLine ("Loading node {0}", gltfNode.Name);
-
- Vector3 translation = new Vector3 ();
- Quaternion rotation = Quaternion.Identity;
- Vector3 scale = new Vector3 (1);
- Matrix4x4 localTransform = Matrix4x4.Identity;
-
- if (gltfNode.Matrix != null) {
- float[] M = gltfNode.Matrix;
- localTransform = new Matrix4x4 (
- M[0], M[1], M[2], M[3],
- M[4], M[5], M[6], M[7],
- M[8], M[9],M[10],M[11],
- M[12],M[13],M[14],M[15]);
- }
-
- if (gltfNode.Translation != null)
- FromFloatArray (ref translation, gltfNode.Translation);
- if (gltfNode.Translation != null)
- FromFloatArray (ref rotation, gltfNode.Rotation);
- if (gltfNode.Translation != null)
- FromFloatArray (ref scale, gltfNode.Scale);
-
- localTransform *=
- Matrix4x4.CreateScale (scale) *
- Matrix4x4.CreateFromQuaternion (rotation) *
- Matrix4x4.CreateTranslation (translation);
-
- //localTransform = Matrix4x4.Identity;
-
- Node node = new Node {
- localMatrix = localTransform,
- Parent = parentNode,
- Name = gltfNode.Name
- };
- parentNode.Children.Add (node);
-
- if (gltfNode.Children != null) {
- node.Children = new List<Node> ();
- for (int i = 0; i < gltfNode.Children.Length; i++)
- loadNode (node, gltf.Nodes[gltfNode.Children[i]]);
- }
-
- if (gltfNode.Mesh != null)
- node.Mesh = meshes[(int)gltfNode.Mesh];
- }
-
- ///// <summary>
- ///// build texture array
- ///// </summary>
- ///// <returns>The images.</returns>
- ///// <param name="textureSize">Uniformized Texture size for all images</param>
- public void BuildTexArray (ref Image texArray, uint firstImg = 0) {
- int texDim = (int)texArray.CreateInfo.extent.width;
-
- CommandBuffer cmd = cmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
- texArray.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
- VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.Transfer);
- cmd.End ();
- transferQ.Submit (cmd);
- transferQ.WaitIdle ();
- cmd.Free ();
-
- VkImageBlit imageBlit = new VkImageBlit {
- srcSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, 1, 0),
- dstOffsets_1 = new VkOffset3D (texDim, texDim, 1)
- };
-
- for (int l = 0; l < gltf.Images.Length; l++) {
- GL.Image img = gltf.Images[l];
- Image vkimg = null;
-
- if (img.BufferView != null) {//load image from gltf buffer view
- GL.BufferView bv = gltf.BufferViews[(int)img.BufferView];
- EnsureBufferIsLoaded (bv.Buffer);
- vkimg = Image.Load (dev, bufferHandles[bv.Buffer].AddrOfPinnedObject () + bv.ByteOffset, (ulong)bv.ByteLength, VkImageUsageFlags.TransferSrc);
- } else if (img.Uri.StartsWith ("data:", StringComparison.Ordinal)) {//load base64 encoded image
- Debug.WriteLine ("loading embedded image {0} : {1}", img.Name, img.MimeType);
- vkimg = Image.Load (dev, glTFLoader.loadDataUri (img), VkImageUsageFlags.TransferSrc);
- } else {
- Debug.WriteLine ("loading image {0} : {1} : {2}", img.Name, img.MimeType, img.Uri);//load image from file path in uri
- vkimg = Image.Load (dev, Path.Combine (baseDirectory, img.Uri), VkImageUsageFlags.TransferSrc);
- }
-
- imageBlit.srcOffsets_1 = new VkOffset3D ((int)vkimg.CreateInfo.extent.width, (int)vkimg.CreateInfo.extent.height, 1);
- imageBlit.dstSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, 1, 0, (uint)l + firstImg);
-
- cmd = cmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- vkimg.SetLayout (cmd, VkImageAspectFlags.Color,
- VkAccessFlags.HostWrite, VkAccessFlags.TransferRead,
- VkImageLayout.Undefined, VkImageLayout.TransferSrcOptimal,
- VkPipelineStageFlags.Host, VkPipelineStageFlags.Transfer);
-
- Vk.vkCmdBlitImage (cmd.Handle, vkimg.Handle, VkImageLayout.TransferSrcOptimal,
- texArray.Handle, VkImageLayout.TransferDstOptimal, 1, ref imageBlit, VkFilter.Linear);
-
- cmd.End ();
- transferQ.Submit (cmd);
- transferQ.WaitIdle ();
- cmd.Free ();
-
- vkimg.Dispose ();
- }
-
- cmd = cmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- uint imgCount = (uint)gltf.Images.Length;
- VkImageSubresourceRange mipSubRange = new VkImageSubresourceRange (VkImageAspectFlags.Color, 0, 1, firstImg, imgCount);
-
- for (int i = 1; i < texArray.CreateInfo.mipLevels; i++) {
- imageBlit = new VkImageBlit {
- srcSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, imgCount, (uint)i - 1, firstImg),
- srcOffsets_1 = new VkOffset3D ((int)texDim >> (i - 1), (int)texDim >> (i - 1), 1),
- dstSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, imgCount, (uint)i, firstImg),
- dstOffsets_1 = new VkOffset3D ((int)texDim >> i, (int)texDim >> i, 1)
- };
-
- texArray.SetLayout (cmd,
- VkAccessFlags.TransferWrite, VkAccessFlags.TransferRead,
- VkImageLayout.TransferDstOptimal, VkImageLayout.TransferSrcOptimal, mipSubRange,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.Transfer);
-
- Vk.vkCmdBlitImage (cmd.Handle, texArray.Handle, VkImageLayout.TransferSrcOptimal,
- texArray.Handle, VkImageLayout.TransferDstOptimal, 1, ref imageBlit, VkFilter.Linear);
- texArray.SetLayout (cmd, VkImageLayout.TransferSrcOptimal, VkImageLayout.ShaderReadOnlyOptimal, mipSubRange,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.FragmentShader);
-
- mipSubRange.baseMipLevel = (uint)i;
- }
- mipSubRange.baseMipLevel = texArray.CreateInfo.mipLevels - 1;
- texArray.SetLayout (cmd, VkImageLayout.TransferDstOptimal, VkImageLayout.ShaderReadOnlyOptimal, mipSubRange,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.FragmentShader);
-
- cmd.End ();
- transferQ.Submit (cmd);
- transferQ.WaitIdle ();
- cmd.Free ();
- }
- /// <summary>
- /// Load model images as separate texture in a c# array
- /// </summary>
- /// <returns>The images.</returns>
- public Image[] LoadImages () {
- if (gltf.Images == null)
- return new Image[] {};
-
- List<Image> textures = new List<Image> ();
-
- foreach (GL.Image img in gltf.Images) {
- Image vkimg = null;
-
- string imgName = img.Name;
-
- if (img.BufferView != null) {//load image from gltf buffer view
- GL.BufferView bv = gltf.BufferViews[(int)img.BufferView];
- EnsureBufferIsLoaded (bv.Buffer);
- vkimg = Image.Load (dev, transferQ, cmdPool, bufferHandles[bv.Buffer].AddrOfPinnedObject () + bv.ByteOffset, (ulong)bv.ByteLength);
- } else if (img.Uri.StartsWith ("data:", StringComparison.Ordinal)) {//load base64 encoded image
- Debug.WriteLine ("loading embedded image {0} : {1}", img.Name, img.MimeType);
- vkimg = Image.Load (dev, transferQ, cmdPool, glTFLoader.loadDataUri (img));
- } else {
- Debug.WriteLine ("loading image {0} : {1} : {2}", img.Name, img.MimeType, img.Uri);//load image from file path in uri
- vkimg = Image.Load (dev, transferQ, cmdPool, Path.Combine (baseDirectory, img.Uri));
- imgName += ";" + img.Uri;
- }
-
- vkimg.CreateView ();
- vkimg.CreateSampler ();
- vkimg.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- vkimg.SetName (imgName);
- vkimg.Descriptor.imageView.SetDebugMarkerName (dev, "imgView " + imgName);
- vkimg.Descriptor.sampler.SetDebugMarkerName (dev, "sampler " + imgName);
-
- textures.Add (vkimg);
- }
- return textures.ToArray ();
- }
-
- public Material[] LoadMaterial () {
- if (gltf.Materials == null)
- return new Material[] {};
-
- List<Material> materials = new List<Material> ();
-
- foreach (GL.Material mat in gltf.Materials) {
- Debug.WriteLine ("loading material: " + mat.Name);
- Material pbr = new Material ();
- pbr.Name = mat.Name;
-
- pbr.alphaCutoff = mat.AlphaCutoff;
- pbr.alphaMode = (AlphaMode)mat.AlphaMode;
-
- FromFloatArray (ref pbr.emissiveFactor, mat.EmissiveFactor);
-
- if (mat.EmissiveTexture != null) {
- pbr.emissiveTexture = mat.EmissiveTexture.Index;
- if (mat.EmissiveTexture.TexCoord == 1)
- pbr.availableAttachments1 |= AttachmentType.Emissive;
- else
- pbr.availableAttachments |= AttachmentType.Emissive;
- }
- if (mat.NormalTexture != null) {
- pbr.normalTexture = mat.NormalTexture.Index;
- if (mat.NormalTexture.TexCoord == 1)
- pbr.availableAttachments1 |= AttachmentType.Normal;
- else
- pbr.availableAttachments |= AttachmentType.Normal;
- }
- if (mat.OcclusionTexture != null) {
- pbr.occlusionTexture = mat.OcclusionTexture.Index;
- if (mat.OcclusionTexture.TexCoord == 1)
- pbr.availableAttachments1 |= AttachmentType.AmbientOcclusion;
- else
- pbr.availableAttachments |= AttachmentType.AmbientOcclusion;
- }
-
- if (mat.PbrMetallicRoughness != null) {
- if (mat.PbrMetallicRoughness.BaseColorTexture != null) {
- pbr.baseColorTexture = mat.PbrMetallicRoughness.BaseColorTexture.Index;
- if (mat.PbrMetallicRoughness.BaseColorTexture.TexCoord == 1)
- pbr.availableAttachments1 |= AttachmentType.Color;
- else
- pbr.availableAttachments |= AttachmentType.Color;
- }
-
- FromFloatArray (ref pbr.baseColorFactor, mat.PbrMetallicRoughness.BaseColorFactor);
-
- if (mat.PbrMetallicRoughness.MetallicRoughnessTexture != null) {
- pbr.metallicRoughnessTexture = mat.PbrMetallicRoughness.MetallicRoughnessTexture.Index;
- if (mat.PbrMetallicRoughness.MetallicRoughnessTexture.TexCoord == 1)
- pbr.availableAttachments1 |= AttachmentType.PhysicalProps;
- else
- pbr.availableAttachments |= AttachmentType.PhysicalProps;
- }
- pbr.metallicFactor = mat.PbrMetallicRoughness.MetallicFactor;
- pbr.roughnessFactor = mat.PbrMetallicRoughness.RoughnessFactor;
-
- pbr.workflow = Material.Workflow.PhysicalyBaseRendering;
- }
- materials.Add (pbr);
- }
- return materials.ToArray ();
- }
-
-
- #region IDisposable Support
- private bool isDisposed = false; // Pour détecter les appels redondants
-
- protected virtual void Dispose (bool disposing) {
- if (!isDisposed) {
- if (disposing) {
- // TODO: supprimer l'état managé (objets managés).
- }
-
- for (int i = 0; i < gltf.Buffers.Length; i++) {
- if (bufferHandles[i].IsAllocated)
- bufferHandles[i].Free ();
- }
-
- isDisposed = true;
- }
- }
-
- ~glTFLoader () {
- Dispose (false);
- }
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
- #endregion
- }
-} \ No newline at end of file
diff --git a/CVKL.Addons/gltfLoader/gltfLoader.csproj b/CVKL.Addons/gltfLoader/gltfLoader.csproj
deleted file mode 100644
index a439773..0000000
--- a/CVKL.Addons/gltfLoader/gltfLoader.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
- <PropertyGroup>
- <AssemblyName>CVKL.gltfLoader</AssemblyName>
- <PackageId>CVKL.gltfLoader</PackageId>
- <AssemblyVersion>0.1.6</AssemblyVersion>
- <Description>CVKL gltf addons</Description>
- <PackageTags>C# vulkan CVKL gltf</PackageTags>
- <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
- <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
- <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
- <PackageProjectUrl>https://github.com/jpbruyere/vk.net/blob/master/README.md</PackageProjectUrl>
- <License>MIT</License>
- <PackageReleaseNotes></PackageReleaseNotes>
- <SynchReleaseVersion>false</SynchReleaseVersion>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <ItemGroup>
- <PackageReference Include="glTF2Loader" Version="1.1.3-alpha" />
- </ItemGroup>
-</Project>
diff --git a/CVKL/CVKL.csproj b/CVKL/CVKL.csproj
deleted file mode 100644
index d9bf387..0000000
--- a/CVKL/CVKL.csproj
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project Sdk="Microsoft.NET.Sdk">
-<!-- <Import Project="$(RootDirectory)netfx.props" />-->
- <PropertyGroup>
- <ReleaseVersion>0.1.7</ReleaseVersion>
- <AssemblyVersion>$(ReleaseVersion)</AssemblyVersion>
- <Description>C# vulkan library with IDispose model and references counting</Description>
-
- <PackageTags>C# vulkan game library compute glfw</PackageTags>
- <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
- <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
- <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
- <PackageProjectUrl>https://github.com/jpbruyere/vk.net/blob/master/README.md</PackageProjectUrl>
- <License>MIT</License>
- <PackageReleaseNotes>
-
- </PackageReleaseNotes>
- <!--<PackageIconUrl>https://github.com/KhronosGroup/glTF/blob/master/specification/figures/gltf.png</PackageIconUrl>-->
- <SynchReleaseVersion>false</SynchReleaseVersion>
-
- <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
- <IntermediateOutputPath>$(SolutionDir)build\$(Configuration)\</IntermediateOutputPath>
-
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-
- <EnableDefaultNoneItems>false</EnableDefaultNoneItems>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
- <DefineConstants>MEMORY_POOLS;NETSTANDARD;NETSTANDARD2_0;DEBUG;NETFRAMEWORK;NET471</DefineConstants>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <Optimize>true</Optimize>
- <DefineConstants>MEMORY_POOLS</DefineConstants>
- </PropertyGroup>
-
- <ItemGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
- <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
- </ItemGroup>
-
- <ItemGroup>
- <PackageReference Include="SpirVTasks" Version="0.1.9-beta" />
- <PackageReference Include="Vulkan" Version="0.1.4" />
- </ItemGroup>
- <ItemGroup>
- <GLSLShader Include="shaders\**\*.frag;shaders\**\*.vert;shaders\**\*.comp;shaders\**\*.geom">
- <ResourceId>testRsID</ResourceId>
- </GLSLShader>
- <Compile Remove="Properties\AssemblyInfo.cs;src\Renderer.cs;src\QueueFamily.cs" />
- </ItemGroup>
-</Project>
diff --git a/CVKL/netfx.props b/CVKL/netfx.props
deleted file mode 120000
index 728e74b..0000000
--- a/CVKL/netfx.props
+++ /dev/null
@@ -1 +0,0 @@
-../netfx.props \ No newline at end of file
diff --git a/CVKL/shaders/FullScreenQuad.vert b/CVKL/shaders/FullScreenQuad.vert
deleted file mode 100644
index 826720b..0000000
--- a/CVKL/shaders/FullScreenQuad.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-#version 450
-
-layout (location = 0) out vec2 outUV;
-
-void main()
-{
- outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
- gl_Position = vec4(outUV * 2.0f + -1.0f, 0.0f, 1.0f);
- //gl_Position = vec4(outUV -1.0f, 0.0f, 1.0f);
-}
diff --git a/CVKL/shaders/simpletexture.frag b/CVKL/shaders/simpletexture.frag
deleted file mode 100644
index cee63cb..0000000
--- a/CVKL/shaders/simpletexture.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (set = 0, binding = 1) uniform sampler2D samplerColor;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = texture(samplerColor, inUV);
-}
diff --git a/CVKL/src/Camera.cs b/CVKL/src/Camera.cs
deleted file mode 100644
index 0410e0e..0000000
--- a/CVKL/src/Camera.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System.Numerics;
-
-namespace CVKL {
- public class Camera {
- /// <summary>Corection matrix for vulkan projection</summary>
- public static readonly Matrix4x4 VKProjectionCorrection =
- new Matrix4x4 (
- 1, 0, 0, 0,
- 0, -1, 0, 0,
- 0, 0, 1f/2, 0,
- 0, 0, 1f/2, 1
- );
-
- public enum CamType {LookAt, FirstPerson};
-
- float fov, aspectRatio, zNear = 0.1f, zFar = 128f, zoom = 1.0f;
- float moveSpeed = 0.1f, rotSpeed = 0.01f, zoomSpeed = 0.01f;
-
- Vector3 rotation = Vector3.Zero;
- Vector3 position = Vector3.Zero;
- Matrix4x4 model = Matrix4x4.Identity;
-
- public Vector3 Position => position;
- public Vector3 Rotation => rotation;
- public float NearPlane => zNear;
- public float FarPlane => zFar;
-
- public CamType Type;
-
- public float AspectRatio {
- get { return aspectRatio; }
- set {
- aspectRatio = value;
- Update ();
- }
- }
- public float FieldOfView {
- get { return fov; }
- set {
- fov = value;
- Update ();
- }
- }
- public Matrix4x4 Perspective {
- get { return Matrix4x4.CreatePerspectiveFieldOfView (fov, aspectRatio, zNear, zFar); }
- }
-
- public Camera (float fieldOfView, float aspectRatio, float nearPlane = 0.1f, float farPlane = 256f) {
- fov = fieldOfView;
- this.aspectRatio = aspectRatio;
- zNear = nearPlane;
- zFar = farPlane;
- Update ();
- }
-
- public void Rotate (float x, float y, float z = 0) {
- rotation.Y += rotSpeed * x;
- rotation.X += rotSpeed * y;
- //Update ();
- }
- public float Zoom {
- get { return zoom; }
- set {
- zoom = value;
- Update ();
- }
- }
- public void SetRotation (float x, float y, float z = 0) {
- rotation.X = x;
- rotation.Y = y;
- rotation.Z = z;
- Update ();
- }
- public void SetPosition (float x, float y, float z = 0) {
- position.X = x;
- position.Y = y;
- position.Z = z;
- Update ();
- }
- public void Move (float x, float y, float z = 0) {
- position.X += moveSpeed * x;
- position.Y += moveSpeed * y;
- position.Z += moveSpeed * z;
- Update ();
- }
- public void SetZoom (float factor) {
- zoom += zoomSpeed * factor;
- Update ();
- }
-
- public Matrix4x4 Projection { get; private set;}
- public Matrix4x4 View { get; private set;}
- public Matrix4x4 Model {
- get { return model; }
- set {
- model = value;
- Update ();
- }
- }
-
- public Matrix4x4 SkyboxView {
- get {
- return
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotation.Z) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotation.Y) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotation.X);
- }
- }
-
- public void Update () {
- Projection = Matrix4x4.CreatePerspectiveFieldOfView (fov, aspectRatio, zNear, zFar) * VKProjectionCorrection;
- Matrix4x4 translation = Matrix4x4.CreateTranslation (position * zoom * new Vector3(1,1,-1)) ;
- if (Type == CamType.LookAt) {
- View =
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotation.Z) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotation.Y) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotation.X) *
- translation ;
- } else {
- View = translation *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotation.X) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotation.Y) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotation.Z);
- }
- }
- }
-}
diff --git a/CVKL/src/ExtensionMethods.cs b/CVKL/src/ExtensionMethods.cs
deleted file mode 100644
index 287e887..0000000
--- a/CVKL/src/ExtensionMethods.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- public static class ExtensionMethods {
- /// <summary>
- /// Extensions method to check byte array equality.
- /// </summary>
- public static bool AreEquals (this byte[] b, byte[] other) {
- if (b.Length != other.Length)
- return false;
- for (int i = 0; i < b.Length; i++) {
- if (b[i] != other[i])
- return false;
- }
- return true;
- }
-
- #region pinning
- /// <summary>
- /// list of pinned GCHandles used to pass value from managed to unmanaged code.
- /// </summary>
- public static Dictionary<object, GCHandle> handles = new Dictionary<object, GCHandle>();
-
- /// <summary>
- /// Pin the specified object and return a pointer. MUST be Unpined as soon as possible.
- /// </summary>
- public static IntPtr Pin (this object obj) {
- if (handles.ContainsKey (obj)) {
- Debug.WriteLine ("Trying to pin already pinned object: {0}", obj);
- return handles[obj].AddrOfPinnedObject ();
- }
-
- GCHandle hnd = GCHandle.Alloc (obj, GCHandleType.Pinned);
- handles.Add (obj, hnd);
- return hnd.AddrOfPinnedObject ();
- }
- /// <summary>
- /// Unpin the specified object and free the GCHandle associated.
- /// </summary>
- public static void Unpin (this object obj) {
- if (!handles.ContainsKey (obj)) {
- Debug.WriteLine ("Trying to unpin unpinned object: {0}.", obj);
- return;
- }
- handles[obj].Free ();
- handles.Remove (obj);
- }
- public static IntPtr Pin<T> (this List<T> obj) {
- if (handles.ContainsKey (obj))
- Debug.WriteLine ("Pinning already pinned object: {0}", obj);
-
- GCHandle hnd = GCHandle.Alloc (obj.ToArray(), GCHandleType.Pinned);
- handles.Add (obj, hnd);
- return hnd.AddrOfPinnedObject ();
- }
- public static IntPtr Pin<T> (this T[] obj) {
- if (handles.ContainsKey (obj))
- Debug.WriteLine ("Pinning already pinned object: {0}", obj);
-
- GCHandle hnd = GCHandle.Alloc (obj, GCHandleType.Pinned);
- handles.Add (obj, hnd);
- return hnd.AddrOfPinnedObject ();
- }
- public static IntPtr Pin (this string obj) {
- if (handles.ContainsKey (obj)) {
- Debug.WriteLine ("Trying to pin already pinned object: {0}", obj);
- return handles[obj].AddrOfPinnedObject ();
- }
- byte[] n = System.Text.Encoding.UTF8.GetBytes(obj +'\0');
- GCHandle hnd = GCHandle.Alloc (n, GCHandleType.Pinned);
- handles.Add (obj, hnd);
- return hnd.AddrOfPinnedObject ();
- }
- #endregion
-
- #region DebugMarkers
- public static void SetDebugMarkerName (this VkCommandBuffer obj, Device dev, string name) {
- if (!dev.debugMarkersEnabled)
- return;
- VkDebugMarkerObjectNameInfoEXT dmo = new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.CommandBufferEXT,
- (ulong)obj.Handle.ToInt64 ()) { pObjectName = name.Pin () };
- Utils.CheckResult (vkDebugMarkerSetObjectNameEXT (dev.VkDev, ref dmo));
- name.Unpin ();
- }
- public static void SetDebugMarkerName (this VkImageView obj, Device dev, string name) {
- if (!dev.debugMarkersEnabled)
- return;
- VkDebugMarkerObjectNameInfoEXT dmo = new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.ImageViewEXT,
- obj.Handle) { pObjectName = name.Pin () };
- Utils.CheckResult (vkDebugMarkerSetObjectNameEXT (dev.VkDev, ref dmo));
- name.Unpin ();
- }
- public static void SetDebugMarkerName (this VkSampler obj, Device dev, string name) {
- if (!dev.debugMarkersEnabled)
- return;
- VkDebugMarkerObjectNameInfoEXT dmo = new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.SamplerEXT,
- obj.Handle) { pObjectName = name.Pin () };
- Utils.CheckResult (vkDebugMarkerSetObjectNameEXT (dev.VkDev, ref dmo));
- name.Unpin ();
- }
- public static void SetDebugMarkerName (this VkPipeline obj, Device dev, string name) {
- if (!dev.debugMarkersEnabled)
- return;
- VkDebugMarkerObjectNameInfoEXT dmo = new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.PipelineEXT,
- obj.Handle) { pObjectName = name.Pin () };
- Utils.CheckResult (vkDebugMarkerSetObjectNameEXT (dev.VkDev, ref dmo));
- name.Unpin ();
- }
- public static void SetDebugMarkerName (this VkDescriptorSet obj, Device dev, string name) {
- if (!dev.debugMarkersEnabled)
- return;
- VkDebugMarkerObjectNameInfoEXT dmo = new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.DescriptorSetEXT,
- obj.Handle) { pObjectName = name.Pin () };
- Utils.CheckResult (vkDebugMarkerSetObjectNameEXT (dev.VkDev, ref dmo));
- name.Unpin ();
- }
- public static void SetDebugMarkerName (this VkSemaphore obj, Device dev, string name) {
- if (!dev.debugMarkersEnabled)
- return;
- VkDebugMarkerObjectNameInfoEXT dmo = new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.SemaphoreEXT,
- obj.Handle) { pObjectName = name.Pin () };
- Utils.CheckResult (vkDebugMarkerSetObjectNameEXT (dev.VkDev, ref dmo));
- name.Unpin ();
- }
- public static void SetDebugMarkerName (this VkFence obj, Device dev, string name) {
- if (!dev.debugMarkersEnabled)
- return;
- VkDebugMarkerObjectNameInfoEXT dmo = new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.FenceEXT,
- obj.Handle) { pObjectName = name.Pin () };
- Utils.CheckResult (vkDebugMarkerSetObjectNameEXT (dev.VkDev, ref dmo));
- name.Unpin ();
- }
- #endregion
- }
-}
diff --git a/CVKL/src/FixedUtf8String.cs b/CVKL/src/FixedUtf8String.cs
deleted file mode 100644
index 7b3d7a6..0000000
--- a/CVKL/src/FixedUtf8String.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace VK
-{
- public unsafe class FixedUtf8String : IDisposable
- {
- GCHandle _handle;
- uint _numBytes;
-
- public byte* StringPtr => (byte*)_handle.AddrOfPinnedObject().ToPointer();
-
- public FixedUtf8String(string s)
- {
- if (s == null)
- {
- throw new ArgumentNullException(nameof(s));
- }
-
- byte[] text = Encoding.UTF8.GetBytes(s + "\0");
- _handle = GCHandle.Alloc(text, GCHandleType.Pinned);
- _numBytes = (uint)text.Length;
- }
-
- public void SetText(string s)
- {
- if (s == null)
- {
- throw new ArgumentNullException(nameof(s));
- }
-
- _handle.Free();
- byte[] text = Encoding.UTF8.GetBytes(s);
- _handle = GCHandle.Alloc(text, GCHandleType.Pinned);
- _numBytes = (uint)text.Length;
- }
-
- private string GetString()
- {
- return Encoding.UTF8.GetString(StringPtr, (int)_numBytes);
- }
-
- //public void Dispose()
- //{
- // _handle.Free();
- //}
-
- public static implicit operator byte* (FixedUtf8String utf8String) => utf8String.StringPtr;
- public static implicit operator IntPtr (FixedUtf8String utf8String) => utf8String._handle.AddrOfPinnedObject ();
- public static implicit operator FixedUtf8String(string s) => new FixedUtf8String(s);
- public static implicit operator string(FixedUtf8String utf8String) => utf8String.GetString();
-
- #region IDisposable Support
- private bool disposedValue = false; // Pour détecter les appels redondants
-
- protected virtual void Dispose (bool disposing) {
- if (!disposedValue) {
- if (disposing) {
- // TODO: supprimer l'état managé (objets managés).
- }
-
- // TODO: libérer les ressources non managées (objets non managés) et remplacer un finaliseur ci-dessous.
- // TODO: définir les champs de grande taille avec la valeur Null.
- _handle.Free ();
- disposedValue = true;
- }
- }
-
- // TODO: remplacer un finaliseur seulement si la fonction Dispose(bool disposing) ci-dessus a du code pour libérer les ressources non managées.
- ~FixedUtf8String() {
- // Ne modifiez pas ce code. Placez le code de nettoyage dans Dispose(bool disposing) ci-dessus.
- Dispose(false);
- }
-
- // Ce code est ajouté pour implémenter correctement le modèle supprimable.
- public void Dispose () {
- // Ne modifiez pas ce code. Placez le code de nettoyage dans Dispose(bool disposing) ci-dessus.
- Dispose (true);
- // TODO: supprimer les marques de commentaire pour la ligne suivante si le finaliseur est remplacé ci-dessus.
- GC.SuppressFinalize(this);
- }
- #endregion
- }
-} \ No newline at end of file
diff --git a/CVKL/src/MarshaledObject.cs b/CVKL/src/MarshaledObject.cs
deleted file mode 100644
index 231e69a..0000000
--- a/CVKL/src/MarshaledObject.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Runtime.InteropServices;
-
-namespace CVKL {
- public class MarshaledObject<T> : IDisposable where T : struct {
-
- GCHandle handle;
-
- public IntPtr Pointer {
- get {
- if (!handle.IsAllocated)
- throw new InvalidOperationException ("Unalocated MarshaledObject");
- return handle.AddrOfPinnedObject ();
- }
- }
-
- public MarshaledObject (T mobj) {
- handle = GCHandle.Alloc (mobj, GCHandleType.Pinned);
- }
-
- void freeHandle () {
- if (!disposed)
- handle.Free ();
- disposed = true;
- }
-
- #region IDisposable Support
- private bool disposed;
-
- ~MarshaledObject() {
- freeHandle ();
- }
-
- public void Dispose () {
- freeHandle ();
- GC.SuppressFinalize(this);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/MemoryPool.cs b/CVKL/src/MemoryPool.cs
deleted file mode 100644
index 2fbc8d8..0000000
--- a/CVKL/src/MemoryPool.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using VK;
-
-using static VK.Vk;
-
-namespace CVKL {
-#if MEMORY_POOLS
- public enum MemoryPoolType {
- Random,
- Linear
- }
- /// <summary>
- /// A memory pool is a single chunck of memory of a kind shared among multiple resources.
- /// </summary>
- public class MemoryPool : IDisposable {
- Device dev;
- internal VkDeviceMemory vkMemory;
- VkMemoryAllocateInfo memInfo = VkMemoryAllocateInfo.New ();
-
- //Resource firstResource;
- Resource lastResource;
-
- //Resource mappedFrom;
- //Resource mappedTo;
-
- //ulong freeMemPointer;
- IntPtr mappedPointer;
-
- public ulong Size => memInfo.allocationSize;
- public bool IsMapped => mappedPointer != IntPtr.Zero;
- public IntPtr MappedData => mappedPointer;
- public Resource Last => lastResource;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:CVKL.MemoryPool"/> class.
- /// </summary>
- /// <param name="dev">device</param>
- /// <param name="memoryTypeIndex">Memory type index.</param>
- /// <param name="size">Size</param>
- public MemoryPool (Device dev, uint memoryTypeIndex, UInt64 size) {
- this.dev = dev;
- memInfo.allocationSize = size;
- memInfo.memoryTypeIndex = memoryTypeIndex;
- Utils.CheckResult (vkAllocateMemory (dev.VkDev, ref memInfo, IntPtr.Zero, out vkMemory));
- }
-
- public void Add (Resource resource) {
- resource.memoryPool = this;
-
- ulong limit = Size;
- ulong offset = 0;
- Resource previous = lastResource;
-
- if (previous != null) {
- do {
- offset = previous.poolOffset + previous.AllocatedDeviceMemorySize;
- offset += resource.MemoryAlignment - (offset % resource.MemoryAlignment);
-
- if (previous.next == null) {
- if (offset + resource.AllocatedDeviceMemorySize >= limit) {
- offset = 0;
- limit = previous.poolOffset;
- }
- break;
- }
-
- if (previous.next.poolOffset < previous.poolOffset) {
- limit = Size;
- if (offset + resource.AllocatedDeviceMemorySize < Size)
- break;
- offset = 0;
- limit = previous.next.poolOffset;
- }else
- limit = previous.next.poolOffset;
-
- if (offset + resource.AllocatedDeviceMemorySize < limit)
- break;
-
- previous = previous.next;
-
- } while (previous != lastResource);
-
- }
-
- if (offset + resource.AllocatedDeviceMemorySize >= limit)
- throw new Exception ($"Out of Memory pool: {memInfo.memoryTypeIndex}");
-
- resource.poolOffset = offset;
- resource.previous = previous;
- if (previous != null) {
- if (previous.next == null) {
- resource.next = resource.previous = previous;
- previous.next = previous.previous = resource;
- } else {
- resource.next = previous.next;
- previous.next = resource.next.previous = resource;
- }
- }
- lastResource = resource;
-
- resource.bindMemory ();
- }
-
- public void Defrag () {
- throw new NotImplementedException ();
- }
-
- public void Remove (Resource resource) {
- if (resource == lastResource)
- lastResource = resource.previous;
- if (lastResource != null) {
- if (resource.previous == resource.next)//only 1 resources remaining
- lastResource.next = lastResource.previous = null;
- else {
- resource.previous.next = resource.next;
- resource.next.previous = resource.previous;
- }
- }
- resource.next = resource.previous = null;
- }
- public void Map (ulong size = Vk.WholeSize, ulong offset = 0) {
- Utils.CheckResult (vkMapMemory (dev.VkDev, vkMemory, offset, size, 0, ref mappedPointer));
- }
- public void Unmap () {
- vkUnmapMemory (dev.VkDev, vkMemory);
- mappedPointer = IntPtr.Zero;
- }
-
-#region IDisposable Support
- private bool disposedValue;
-
- protected virtual void Dispose (bool disposing) {
- if (!disposedValue) {
- if (disposing) {
- //TODO:should automatically free resources here
- } else
- System.Diagnostics.Debug.WriteLine ("MemoryPool disposed by Finalizer.");
-
- vkFreeMemory (dev.VkDev, vkMemory, IntPtr.Zero);
- disposedValue = true;
- }
- }
-
- ~MemoryPool() {
- Dispose(false);
- }
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize(this);
- }
-#endregion
- }
-#endif
-} \ No newline at end of file
diff --git a/CVKL/src/ResourceManager.cs b/CVKL/src/ResourceManager.cs
deleted file mode 100644
index c6bbd22..0000000
--- a/CVKL/src/ResourceManager.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using System;
-using VK;
-
-namespace CVKL {
-#if MEMORY_POOLS
- /// <summary>
- /// Resource manager is responsible for the memory allocations. It holds one pool for each memory type
- /// </summary>
- public class ResourceManager : IDisposable {
- VkPhysicalDeviceMemoryProperties memoryProperties;
- public MemoryPool[] memoryPools;
- ulong[] reservedHeapMemory;
-
- VkMemoryHeap getHeapFromMemoryIndex (uint i) => memoryProperties.memoryHeaps[memoryProperties.memoryTypes[i].heapIndex];
- /// <summary>
- /// Create a new resource manager that will create one memory pool for each kind of memory available on the device
- /// </summary>
- /// <param name="dev">Device</param>
- /// <param name="defaultPoolsBlockDivisor">part of the whole available memory size to reserve by pools</param>
- public ResourceManager (Device dev, ulong defaultPoolsBlockDivisor = 4) {
- memoryProperties = dev.phy.memoryProperties;
- memoryPools = new MemoryPool[memoryProperties.memoryTypeCount];
- reservedHeapMemory = new ulong[memoryProperties.memoryHeapCount];
-
- for (uint i = 0; i < memoryPools.Length; i++) {
- ulong size = getHeapFromMemoryIndex (i).size / defaultPoolsBlockDivisor;
- memoryPools[i] = new MemoryPool (dev, i, size);
- reservedHeapMemory[memoryProperties.memoryTypes[i].heapIndex] += size;
- }
- }
- /// <summary>
- /// Add one or more resources to the manager, pool will be choosen depending on the resource memory flags
- /// </summary>
- /// <param name="resources">Resource(s).</param>
- public void Add (params Resource[] resources) {
- foreach (Resource res in resources) {
- res.updateMemoryRequirements ();
- GetMemoryPool (res.TypeBits, res.MemoryFlags).Add (res);
- }
- }
-
- MemoryPool GetMemoryPool (uint typeBits, VkMemoryPropertyFlags properties) {
- // Iterate over all memory types available for the Device used in this example
- for (uint i = 0; i < memoryProperties.memoryTypeCount; i++) {
- if ((typeBits & 1) == 1) {
- if ((memoryProperties.memoryTypes[i].propertyFlags & properties) == properties)
- return memoryPools[i];
- }
- typeBits >>= 1;
- }
- throw new InvalidOperationException ("Could not find a suitable memory type!");
- }
- /// <summary>
- /// Dispose all memory pools held by this resource manager.
- /// </summary>
- public void Dispose () {
- for (uint i = 0; i < memoryPools.Length; i++)
- memoryPools[i].Dispose ();
- }
- }
-#endif
-} \ No newline at end of file
diff --git a/CVKL/src/ShaderInfo.cs b/CVKL/src/ShaderInfo.cs
deleted file mode 100644
index 1058830..0000000
--- a/CVKL/src/ShaderInfo.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using VK;
-
-namespace CVKL {
- /// <summary>
- /// This class is a helper class for VkPipelineShaderStageCreateInfo creation.
- /// </summary>
- public class ShaderInfo : IDisposable {
- public VkShaderStageFlags StageFlags;
- public string SpirvPath;
- public FixedUtf8String EntryPoint;
- public SpecializationInfo SpecializationInfo;
-
- public ShaderInfo (VkShaderStageFlags _stageFlags, string _spirvPath, SpecializationInfo specializationInfo = null, string _entryPoint = "main") {
- StageFlags = _stageFlags;
- SpirvPath = _spirvPath;
- EntryPoint = new FixedUtf8String (_entryPoint);
- SpecializationInfo = specializationInfo;
- }
- /// <summary>
- /// Create the VkPipelineShaderStageCreateInfo structure. Note that the ShaderModule is created here and has to be destroy after the pipeline creation
- /// </summary>
- public VkPipelineShaderStageCreateInfo GetStageCreateInfo (Device dev) {
- return new VkPipelineShaderStageCreateInfo {
- sType = VkStructureType.PipelineShaderStageCreateInfo,
- stage = StageFlags,
- pName = EntryPoint,
- module = dev.LoadSPIRVShader (SpirvPath),
- pSpecializationInfo = (SpecializationInfo == null) ? IntPtr.Zero : SpecializationInfo.InfosPtr
- };
- }
-
- #region IDisposable Support
- private bool disposedValue = false; // Pour détecter les appels redondants
-
- protected virtual void Dispose (bool disposing) {
- if (!disposedValue) {
- if (disposing) {
- EntryPoint.Dispose ();
- }
- disposedValue = true;
- }
- }
- public void Dispose () {
- Dispose (true);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/SpecializationConstant.cs b/CVKL/src/SpecializationConstant.cs
deleted file mode 100644
index b455cca..0000000
--- a/CVKL/src/SpecializationConstant.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// SpecializationConstant.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL {
- /// <summary>
- /// Hold shader specialization constant value and type
- /// </summary>
- public class SpecializationConstant<T> : SpecializationConstant {
- T val;
- IntPtr ptr = IntPtr.Zero;
-
- public T Value {
- get { return val; }
- set {
- val = value;
- if (ptr != IntPtr.Zero)
- WriteTo (ptr);
- }
- }
-
- #region CTOR
- public SpecializationConstant (uint id, T value) : base(id) {
- val = value;
- }
- #endregion
-
- public override uint Size => (uint)Marshal.SizeOf<T> ();
- public unsafe override void WriteTo (IntPtr ptr) {
- this.ptr = ptr;
-
- if (typeof (T) == typeof (float)) {
- float v = Convert.ToSingle (Value);
- System.Buffer.MemoryCopy (&v, ptr.ToPointer (), 4, 4);
- } else if (typeof (T) == typeof (int) || typeof (T) == typeof (uint)) {
- Marshal.WriteInt32 (ptr, Convert.ToInt32 (val));
- } else if (typeof (T) == typeof (long) || typeof (T) == typeof (ulong)) {
- Marshal.WriteInt64 (ptr, Convert.ToInt64 (val));
- } else if (typeof (T) == typeof (byte)) {
- Marshal.WriteByte (ptr, Convert.ToByte (val));
- }
- }
- }
- public abstract class SpecializationConstant {
- public uint id;
- public SpecializationConstant (uint id) {
- this.id = id;
- }
- public abstract uint Size { get; }
- public abstract void WriteTo (IntPtr ptr);
- }
-
- /// <summary>
- /// Specialization constant infos, MUST be disposed after pipeline creation
- /// </summary>
- public class SpecializationInfo : IDisposable {
- IntPtr pData;
- VkSpecializationMapEntry[] entries;
-
- VkSpecializationInfo infos;
-
- public IntPtr InfosPtr { get; private set; }
-
- #region CTOR
- public SpecializationInfo (params SpecializationConstant[] constants) {
- uint offset = 0;
- entries = new VkSpecializationMapEntry[constants.Length];
- for (int i = 0; i < constants.Length; i++) {
- entries[i] = new VkSpecializationMapEntry { constantID = constants[i].id, offset = offset, size = (UIntPtr)constants[i].Size };
- offset += constants[i].Size;
- }
- int totSize = (int)offset;
- offset = 0;
- pData = Marshal.AllocHGlobal (totSize);
- IntPtr curPtr = pData;
- foreach (SpecializationConstant sc in constants) {
- sc.WriteTo (curPtr);
- curPtr += (int)sc.Size;
- }
-
- infos = new VkSpecializationInfo {
- mapEntryCount = (uint)constants.Length,
- pMapEntries = entries.Pin (),
- pData = pData,
- dataSize = (UIntPtr)totSize
- };
- InfosPtr = infos.Pin ();
- }
- #endregion
-
- public void Dispose () {
- infos.Unpin ();
- Marshal.FreeHGlobal (pData);
- entries.Unpin ();
- }
- }
-}
diff --git a/CVKL/src/StbImage.cs b/CVKL/src/StbImage.cs
deleted file mode 100644
index 3ea1d7f..0000000
--- a/CVKL/src/StbImage.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace CVKL {
- public class StbImage : IDisposable {
- const string stblib = "stb";
-
- [DllImport (stblib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load")]
- static extern IntPtr Load ([MarshalAs (UnmanagedType.LPStr)] string filename, out int x, out int y, out int channels_in_file, int desired_channels);
-
- [DllImport (stblib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_load_from_memory")]
- static extern IntPtr Load (IntPtr bitmap, int byteCount, out int x, out int y, out int channels_in_file, int desired_channels);
-
- [DllImport (stblib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "stbi_image_free")]
- static extern void FreeImage (IntPtr img);
-
- public readonly IntPtr Handle;
- public readonly int Width;
- public readonly int Height;
- public readonly int Channels;
- public int Size => Width * Height * Channels;
-
- /// <summary>
- /// Open image with STBI library
- /// </summary>
- /// <param name="path">file path</param>
- /// <param name="requestedChannels">Force returned channels count, set 0 for original count</param>
- public StbImage (string path, int requestedChannels = 4) {
- Handle = StbImage.Load (path, out Width, out Height, out Channels, requestedChannels);
- if (Handle == IntPtr.Zero)
- throw new Exception ($"STBI image loading error.");
- if (requestedChannels > 0)
- Channels = requestedChannels;
- }
- /// <summary>
- /// Open image with STBI library
- /// </summary>
- /// <param name="bitmap">raw bitmap datas</param>
- /// <param name="bitmapByteCount">Bitmap byte count.</param>
- /// <param name="requestedChannels">Force returned channels count, set 0 for original count</param>
- public StbImage (IntPtr bitmap, ulong bitmapByteCount, int requestedChannels = 4) {
- Handle = StbImage.Load (bitmap, (int)bitmapByteCount, out Width, out Height, out Channels, requestedChannels);
- if (Handle == IntPtr.Zero)
- throw new Exception ($"STBI image loading error.");
- if (requestedChannels > 0)
- Channels = requestedChannels;
- }
- /// <summary>
- /// copy pixels to destination.
- /// </summary>
- /// <param name="destPtr">Destination pointer.</param>
- public void CoptyTo (IntPtr destPtr) {
- unsafe {
- System.Buffer.MemoryCopy (Handle.ToPointer (), destPtr.ToPointer (), Size, Size);
- }
- }
- public void Dispose () {
- StbImage.FreeImage (Handle);
- }
- }
-}
diff --git a/CVKL/src/Utils.cs b/CVKL/src/Utils.cs
deleted file mode 100644
index bd6c7a3..0000000
--- a/CVKL/src/Utils.cs
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Numerics;
-
-namespace VK {
- public static partial class Utils {
- /// <summary>Throw an erro if VkResult != Success.</summary>
- public static void CheckResult (VkResult result, string errorString = "Call failed") {
- if (result != VkResult.Success)
- throw new InvalidOperationException (errorString + ": " + result.ToString ());
- }
- /// <summary>Convert angle from degree to radian.</summary>
- public static float DegreesToRadians (float degrees) {
- return degrees * (float)Math.PI / 180f;
- }
-
- /// <summary>
- /// Populate a Vector3 with values from a float array
- /// </summary>
- public static void FromFloatArray (ref Vector3 v, float[] floats) {
- if (floats.Length > 0)
- v.X = floats[0];
- if (floats.Length > 1)
- v.Y = floats[1];
- if (floats.Length > 2)
- v.Z = floats[2];
- }
- /// <summary>
- /// Populate a Vector4 with values from a float array
- /// </summary>
- public static void FromFloatArray (ref Vector4 v, float[] floats) {
- if (floats.Length > 0)
- v.X = floats[0];
- if (floats.Length > 1)
- v.Y = floats[1];
- if (floats.Length > 2)
- v.Z = floats[2];
- if (floats.Length > 3)
- v.W = floats[3];
- }
- /// <summary>
- /// Populate a Quaternion with values from a float array
- /// </summary>
- public static void FromFloatArray (ref Quaternion v, float[] floats) {
- if (floats.Length > 0)
- v.X = floats[0];
- if (floats.Length > 1)
- v.Y = floats[1];
- if (floats.Length > 2)
- v.Z = floats[2];
- if (floats.Length > 3)
- v.W = floats[3];
- }
- /// <summary>
- /// Populate a Vector2 with values from a byte array starting at offset
- /// </summary>
- public static void FromByteArray (ref Vector2 v, byte[] byteArray, int offset) {
- v.X = BitConverter.ToSingle (byteArray, offset);
- v.Y = BitConverter.ToSingle (byteArray, offset + 4);
- }
- /// <summary>
- /// Populate a Vector3 with values from a byte array starting at offset
- /// </summary>
- public static void FromByteArray (ref Vector3 v, byte[] byteArray, int offset) {
- v.X = BitConverter.ToSingle (byteArray, offset);
- v.Y = BitConverter.ToSingle (byteArray, offset + 4);
- v.Z = BitConverter.ToSingle (byteArray, offset + 8);
- }
- /// <summary>
- /// Populate a Vector4 with values from a byte array starting at offset
- /// </summary>
- public static void FromByteArray (ref Vector4 v, byte[] byteArray, int offset) {
- v.X = BitConverter.ToSingle (byteArray, offset);
- v.Y = BitConverter.ToSingle (byteArray, offset + 4);
- v.Z = BitConverter.ToSingle (byteArray, offset + 8);
- v.W = BitConverter.ToSingle (byteArray, offset + 12);
- }
- /// <summary>
- /// Populate a Quaternion with values from a byte array starting at offset
- /// </summary>
- public static void FromByteArray (ref Quaternion v, byte[] byteArray, int offset) {
- v.X = BitConverter.ToSingle (byteArray, offset);
- v.Y = BitConverter.ToSingle (byteArray, offset + 4);
- v.Z = BitConverter.ToSingle (byteArray, offset + 8);
- v.W = BitConverter.ToSingle (byteArray, offset + 12);
- }
-
- #region Extensions methods
- public static void ImportFloatArray (this ref Vector3 v, float[] floats) {
- if (floats.Length > 0)
- v.X = floats[0];
- if (floats.Length > 1)
- v.Y = floats[1];
- if (floats.Length > 2)
- v.Z = floats[2];
- }
- public static Vector3 Transform (this Vector3 v, ref Matrix4x4 mat, bool translate = false) {
- Vector4 v4 = Vector4.Transform (new Vector4 (v, translate ? 1f : 0f), mat);
- return new Vector3 (v4.X, v4.Y, v4.Z);
- }
- public static Vector3 ToVector3 (this Vector4 v) {
- return new Vector3 (v.X, v.Y, v.Z);
- }
- #endregion
-
- // Fixed sub resource on first mip level and layer
- public static void setImageLayout (
- VkCommandBuffer cmdbuffer,
- VkImage image,
- VkImageAspectFlags aspectMask,
- VkImageLayout oldImageLayout,
- VkImageLayout newImageLayout,
- VkPipelineStageFlags srcStageMask = VkPipelineStageFlags.AllCommands,
- VkPipelineStageFlags dstStageMask = VkPipelineStageFlags.AllCommands) {
- VkImageSubresourceRange subresourceRange = new VkImageSubresourceRange {
- aspectMask = aspectMask,
- baseMipLevel = 0,
- levelCount = 1,
- layerCount = 1,
- };
- setImageLayout (cmdbuffer, image, aspectMask, oldImageLayout, newImageLayout, subresourceRange);
- }
-
- // Create an image memory barrier for changing the layout of
- // an image and put it into an active command buffer
- // See chapter 11.4 "Image Layout" for details
-
- public static void setImageLayout (
- VkCommandBuffer cmdbuffer,
- VkImage image,
- VkImageAspectFlags aspectMask,
- VkImageLayout oldImageLayout,
- VkImageLayout newImageLayout,
- VkImageSubresourceRange subresourceRange,
- VkPipelineStageFlags srcStageMask = VkPipelineStageFlags.AllCommands,
- VkPipelineStageFlags dstStageMask = VkPipelineStageFlags.AllCommands) {
- // Create an image barrier object
- VkImageMemoryBarrier imageMemoryBarrier = VkImageMemoryBarrier.New();
- imageMemoryBarrier.srcQueueFamilyIndex = Vk.QueueFamilyIgnored;
- imageMemoryBarrier.dstQueueFamilyIndex = Vk.QueueFamilyIgnored;
- imageMemoryBarrier.oldLayout = oldImageLayout;
- imageMemoryBarrier.newLayout = newImageLayout;
- imageMemoryBarrier.image = image;
- imageMemoryBarrier.subresourceRange = subresourceRange;
-
- // Source layouts (old)
- // Source access mask controls actions that have to be finished on the old layout
- // before it will be transitioned to the new layout
- switch (oldImageLayout) {
- case VkImageLayout.Undefined:
- // Image layout is undefined (or does not matter)
- // Only valid as initial layout
- // No flags required, listed only for completeness
- imageMemoryBarrier.srcAccessMask = 0;
- break;
-
- case VkImageLayout.Preinitialized:
- // Image is preinitialized
- // Only valid as initial layout for linear images, preserves memory contents
- // Make sure host writes have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.HostWrite;
- break;
-
- case VkImageLayout.ColorAttachmentOptimal:
- // Image is a color attachment
- // Make sure any writes to the color buffer have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.ColorAttachmentWrite;
- break;
-
- case VkImageLayout.DepthStencilAttachmentOptimal:
- // Image is a depth/stencil attachment
- // Make sure any writes to the depth/stencil buffer have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.DepthStencilAttachmentWrite;
- break;
-
- case VkImageLayout.TransferSrcOptimal:
- // Image is a transfer source
- // Make sure any reads from the image have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.TransferRead;
- break;
-
- case VkImageLayout.TransferDstOptimal:
- // Image is a transfer destination
- // Make sure any writes to the image have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.TransferWrite;
- break;
-
- case VkImageLayout.ShaderReadOnlyOptimal:
- // Image is read by a shader
- // Make sure any shader reads from the image have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.ShaderRead;
- break;
- }
-
- // Target layouts (new)
- // Destination access mask controls the dependency for the new image layout
- switch (newImageLayout) {
- case VkImageLayout.TransferDstOptimal:
- // Image will be used as a transfer destination
- // Make sure any writes to the image have been finished
- imageMemoryBarrier.dstAccessMask = VkAccessFlags.TransferWrite;
- break;
-
- case VkImageLayout.TransferSrcOptimal:
- // Image will be used as a transfer source
- // Make sure any reads from and writes to the image have been finished
- imageMemoryBarrier.srcAccessMask = imageMemoryBarrier.srcAccessMask | VkAccessFlags.TransferRead;
- imageMemoryBarrier.dstAccessMask = VkAccessFlags.TransferRead;
- break;
-
- case VkImageLayout.ColorAttachmentOptimal:
- // Image will be used as a color attachment
- // Make sure any writes to the color buffer have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.TransferRead;
- imageMemoryBarrier.dstAccessMask = VkAccessFlags.ColorAttachmentWrite;
- break;
-
- case VkImageLayout.DepthStencilAttachmentOptimal:
- // Image layout will be used as a depth/stencil attachment
- // Make sure any writes to depth/stencil buffer have been finished
- imageMemoryBarrier.dstAccessMask = imageMemoryBarrier.dstAccessMask | VkAccessFlags.DepthStencilAttachmentWrite;
- break;
-
- case VkImageLayout.ShaderReadOnlyOptimal:
- // Image will be read in a shader (sampler, input attachment)
- // Make sure any writes to the image have been finished
- if (imageMemoryBarrier.srcAccessMask == 0) {
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.HostWrite | VkAccessFlags.TransferWrite;
- }
- imageMemoryBarrier.dstAccessMask = VkAccessFlags.ShaderRead;
- break;
- }
-
- // Put barrier inside setup command buffer
- Vk.vkCmdPipelineBarrier (
- cmdbuffer,
- srcStageMask,
- dstStageMask,
- 0,
- 0, IntPtr.Zero,
- 0, IntPtr.Zero,
- 1, ref imageMemoryBarrier);
- }
- /// <summary>
- /// Find usage flags and aspect flag from image layout
- /// </summary>
- public static void QueryLayoutRequirements (VkImageLayout layout, ref VkImageUsageFlags usage, ref VkImageAspectFlags aspectFlags) {
- switch (layout) {
- case VkImageLayout.ColorAttachmentOptimal:
- case VkImageLayout.PresentSrcKHR:
- case VkImageLayout.SharedPresentKHR:
- aspectFlags |= VkImageAspectFlags.Color;
- if (usage.HasFlag (VkImageUsageFlags.Sampled))
- usage |= VkImageUsageFlags.InputAttachment;
- usage |= VkImageUsageFlags.ColorAttachment;
- break;
- case VkImageLayout.DepthStencilAttachmentOptimal:
- aspectFlags |= VkImageAspectFlags.Depth | VkImageAspectFlags.Stencil;
- usage |= VkImageUsageFlags.DepthStencilAttachment;
- break;
- case VkImageLayout.DepthStencilReadOnlyOptimal:
- aspectFlags |= VkImageAspectFlags.Depth | VkImageAspectFlags.Stencil;
- if (usage.HasFlag (VkImageUsageFlags.ColorAttachment))
- usage |= VkImageUsageFlags.InputAttachment;
- else
- usage |= VkImageUsageFlags.Sampled;
- break;
- case VkImageLayout.ShaderReadOnlyOptimal:
- aspectFlags |= VkImageAspectFlags.Color;
- usage |= VkImageUsageFlags.Sampled;
- break;
- case VkImageLayout.TransferSrcOptimal:
- usage |= VkImageUsageFlags.TransferSrc;
- break;
- case VkImageLayout.TransferDstOptimal:
- usage |= VkImageUsageFlags.TransferDst;
- break;
- case VkImageLayout.DepthReadOnlyStencilAttachmentOptimalKHR:
- case VkImageLayout.DepthAttachmentStencilReadOnlyOptimalKHR:
- aspectFlags |= VkImageAspectFlags.Depth | VkImageAspectFlags.Stencil;
- usage |= VkImageUsageFlags.Sampled | VkImageUsageFlags.DepthStencilAttachment;
- break;
- }
- }
- }
-}
diff --git a/CVKL/src/Version.cs b/CVKL/src/Version.cs
deleted file mode 100644
index ed71d20..0000000
--- a/CVKL/src/Version.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace Vulkan
-{
- public struct Version
- {
- private readonly uint value;
-
- public Version(uint major, uint minor, uint patch)
- {
- value = major << 22 | minor << 12 | patch;
- }
-
- public uint Major => value >> 22;
-
- public uint Minor => (value >> 12) & 0x3ff;
-
- public uint Patch => (value >> 22) & 0xfff;
-
- public static implicit operator uint(Version version)
- {
- return version.value;
- }
- }
-} \ No newline at end of file
diff --git a/CVKL/src/VertexAttribute.cs b/CVKL/src/VertexAttribute.cs
deleted file mode 100644
index 75bf5df..0000000
--- a/CVKL/src/VertexAttribute.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-
-namespace VK {
- public enum VertexAttributeType {
- Position,
- Normal,
- UVs,
- Tangent,
- }
- [Flags]
- public enum AttachmentType : UInt32 {
- None,
- Color = 0x1,
- Normal = 0x2,
- AmbientOcclusion = 0x4,
- Metal = 0x8,
- Roughness = 0x10,
- PhysicalProps = 0x20,
- Emissive = 0x40,
- };
-
- public class VertexAttributeAttribute : Attribute {
- public VkFormat Format;
- public VertexAttributeType Type;
-
- public VertexAttributeAttribute (VertexAttributeType type, VkFormat format) {
- Format = format;
- Type = type;
- }
- }
- public class AttachmentAttribute : Attribute {
- public AttachmentType AttachmentType;
- public Type DataType;
- public AttachmentAttribute (AttachmentType attachmentType, Type dataType) {
- AttachmentType = attachmentType;
- DataType = dataType;
- }
- }
-}
diff --git a/CVKL/src/VkFormatSize.cs b/CVKL/src/VkFormatSize.cs
deleted file mode 100644
index 75e815d..0000000
--- a/CVKL/src/VkFormatSize.cs
+++ /dev/null
@@ -1,548 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-
-namespace VK {
- [Flags]
- public enum VkFormatSizeFlag {
- SizePacked = 0x00000001,
- SizeCompressed = 0x00000002,
- SizePalettized = 0x00000004,
- SizeDepth = 0x00000008,
- SizeStencil = 0x00000010,
- };
-
- public struct VkFormatSize {
- public VkFormatSizeFlag flags;
- public uint paletteSizeInBits;
- public uint blockSizeInBits;
- public uint blockWidth; // in texels
- public uint blockHeight; // in texels
- public uint blockDepth; // in texels
- };
-
-
- public static partial class Utils {
- public static void vkGetFormatSize(VkFormat format, out VkFormatSize pFormatSize )
- {
- switch ( format )
- {
- case VkFormat.R4g4UnormPack8:
- pFormatSize.flags = VkFormatSizeFlag.SizePacked;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 1 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R4g4b4a4UnormPack16:
- case VkFormat.B4g4r4a4UnormPack16:
- case VkFormat.R5g6b5UnormPack16:
- case VkFormat.B5g6r5UnormPack16:
- case VkFormat.R5g5b5a1UnormPack16:
- case VkFormat.B5g5r5a1UnormPack16:
- case VkFormat.A1r5g5b5UnormPack16:
- pFormatSize.flags = VkFormatSizeFlag.SizePacked;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 2 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R8Unorm:
- case VkFormat.R8Snorm:
- case VkFormat.R8Uscaled:
- case VkFormat.R8Sscaled:
- case VkFormat.R8Uint:
- case VkFormat.R8Sint:
- case VkFormat.R8Srgb:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 1 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R8g8Unorm:
- case VkFormat.R8g8Snorm:
- case VkFormat.R8g8Uscaled:
- case VkFormat.R8g8Sscaled:
- case VkFormat.R8g8Uint:
- case VkFormat.R8g8Sint:
- case VkFormat.R8g8Srgb:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 2 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R8g8b8Unorm:
- case VkFormat.R8g8b8Snorm:
- case VkFormat.R8g8b8Uscaled:
- case VkFormat.R8g8b8Sscaled:
- case VkFormat.R8g8b8Uint:
- case VkFormat.R8g8b8Sint:
- case VkFormat.R8g8b8Srgb:
- case VkFormat.B8g8r8Unorm:
- case VkFormat.B8g8r8Snorm:
- case VkFormat.B8g8r8Uscaled:
- case VkFormat.B8g8r8Sscaled:
- case VkFormat.B8g8r8Uint:
- case VkFormat.B8g8r8Sint:
- case VkFormat.B8g8r8Srgb:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 3 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R8g8b8a8Unorm:
- case VkFormat.R8g8b8a8Snorm:
- case VkFormat.R8g8b8a8Uscaled:
- case VkFormat.R8g8b8a8Sscaled:
- case VkFormat.R8g8b8a8Uint:
- case VkFormat.R8g8b8a8Sint:
- case VkFormat.R8g8b8a8Srgb:
- case VkFormat.B8g8r8a8Unorm:
- case VkFormat.B8g8r8a8Snorm:
- case VkFormat.B8g8r8a8Uscaled:
- case VkFormat.B8g8r8a8Sscaled:
- case VkFormat.B8g8r8a8Uint:
- case VkFormat.B8g8r8a8Sint:
- case VkFormat.B8g8r8a8Srgb:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 4 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.A8b8g8r8UnormPack32:
- case VkFormat.A8b8g8r8SnormPack32:
- case VkFormat.A8b8g8r8UscaledPack32:
- case VkFormat.A8b8g8r8SscaledPack32:
- case VkFormat.A8b8g8r8UintPack32:
- case VkFormat.A8b8g8r8SintPack32:
- case VkFormat.A8b8g8r8SrgbPack32:
- pFormatSize.flags = VkFormatSizeFlag.SizePacked;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 4 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.A2r10g10b10UnormPack32:
- case VkFormat.A2r10g10b10SnormPack32:
- case VkFormat.A2r10g10b10UscaledPack32:
- case VkFormat.A2r10g10b10SscaledPack32:
- case VkFormat.A2r10g10b10UintPack32:
- case VkFormat.A2r10g10b10SintPack32:
- case VkFormat.A2b10g10r10UnormPack32:
- case VkFormat.A2b10g10r10SnormPack32:
- case VkFormat.A2b10g10r10UscaledPack32:
- case VkFormat.A2b10g10r10SscaledPack32:
- case VkFormat.A2b10g10r10UintPack32:
- case VkFormat.A2b10g10r10SintPack32:
- pFormatSize.flags = VkFormatSizeFlag.SizePacked;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 4 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R16Unorm:
- case VkFormat.R16Snorm:
- case VkFormat.R16Uscaled:
- case VkFormat.R16Sscaled:
- case VkFormat.R16Uint:
- case VkFormat.R16Sint:
- case VkFormat.R16Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 2 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R16g16Unorm:
- case VkFormat.R16g16Snorm:
- case VkFormat.R16g16Uscaled:
- case VkFormat.R16g16Sscaled:
- case VkFormat.R16g16Uint:
- case VkFormat.R16g16Sint:
- case VkFormat.R16g16Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 4 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R16g16b16Unorm:
- case VkFormat.R16g16b16Snorm:
- case VkFormat.R16g16b16Uscaled:
- case VkFormat.R16g16b16Sscaled:
- case VkFormat.R16g16b16Uint:
- case VkFormat.R16g16b16Sint:
- case VkFormat.R16g16b16Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 6 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R16g16b16a16Unorm:
- case VkFormat.R16g16b16a16Snorm:
- case VkFormat.R16g16b16a16Uscaled:
- case VkFormat.R16g16b16a16Sscaled:
- case VkFormat.R16g16b16a16Uint:
- case VkFormat.R16g16b16a16Sint:
- case VkFormat.R16g16b16a16Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 8 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R32Uint:
- case VkFormat.R32Sint:
- case VkFormat.R32Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 4 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R32g32Uint:
- case VkFormat.R32g32Sint:
- case VkFormat.R32g32Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 8 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R32g32b32Uint:
- case VkFormat.R32g32b32Sint:
- case VkFormat.R32g32b32Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 12 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R32g32b32a32Uint:
- case VkFormat.R32g32b32a32Sint:
- case VkFormat.R32g32b32a32Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R64Uint:
- case VkFormat.R64Sint:
- case VkFormat.R64Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 8 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R64g64Uint:
- case VkFormat.R64g64Sint:
- case VkFormat.R64g64Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R64g64b64Uint:
- case VkFormat.R64g64b64Sint:
- case VkFormat.R64g64b64Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 24 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.R64g64b64a64Uint:
- case VkFormat.R64g64b64a64Sint:
- case VkFormat.R64g64b64a64Sfloat:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 32 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.B10g11r11UfloatPack32:
- case VkFormat.E5b9g9r9UfloatPack32:
- pFormatSize.flags = VkFormatSizeFlag.SizePacked;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 4 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.D16Unorm:
- pFormatSize.flags = VkFormatSizeFlag.SizeDepth;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 2 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.X8D24UnormPack32:
- pFormatSize.flags = VkFormatSizeFlag.SizePacked | VkFormatSizeFlag.SizeDepth;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 4 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.D32Sfloat:
- pFormatSize.flags = VkFormatSizeFlag.SizeDepth;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 4 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.S8Uint:
- pFormatSize.flags = VkFormatSizeFlag.SizeStencil;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 1 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.D16UnormS8Uint:
- pFormatSize.flags = VkFormatSizeFlag.SizeDepth | VkFormatSizeFlag.SizeStencil;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 3 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.D24UnormS8Uint:
- pFormatSize.flags = VkFormatSizeFlag.SizeDepth | VkFormatSizeFlag.SizeStencil;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 4 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.D32SfloatS8Uint:
- pFormatSize.flags = VkFormatSizeFlag.SizeDepth | VkFormatSizeFlag.SizeStencil;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 8 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Bc1RgbUnormBlock:
- case VkFormat.Bc1RgbSrgbBlock:
- case VkFormat.Bc1RgbaUnormBlock:
- case VkFormat.Bc1RgbaSrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 8 * 8;
- pFormatSize.blockWidth = 4;
- pFormatSize.blockHeight = 4;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Bc2UnormBlock:
- case VkFormat.Bc2SrgbBlock:
- case VkFormat.Bc3UnormBlock:
- case VkFormat.Bc3SrgbBlock:
- case VkFormat.Bc4UnormBlock:
- case VkFormat.Bc4SnormBlock:
- case VkFormat.Bc5UnormBlock:
- case VkFormat.Bc5SnormBlock:
- case VkFormat.Bc6hUfloatBlock:
- case VkFormat.Bc6hSfloatBlock:
- case VkFormat.Bc7UnormBlock:
- case VkFormat.Bc7SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 4;
- pFormatSize.blockHeight = 4;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Etc2R8g8b8UnormBlock:
- case VkFormat.Etc2R8g8b8SrgbBlock:
- case VkFormat.Etc2R8g8b8a1UnormBlock:
- case VkFormat.Etc2R8g8b8a1SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 8 * 8;
- pFormatSize.blockWidth = 4;
- pFormatSize.blockHeight = 4;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Etc2R8g8b8a8UnormBlock:
- case VkFormat.Etc2R8g8b8a8SrgbBlock:
- case VkFormat.EacR11UnormBlock:
- case VkFormat.EacR11SnormBlock:
- case VkFormat.EacR11g11UnormBlock:
- case VkFormat.EacR11g11SnormBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 4;
- pFormatSize.blockHeight = 4;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc4x4UnormBlock:
- case VkFormat.Astc4x4SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 4;
- pFormatSize.blockHeight = 4;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc5x4UnormBlock:
- case VkFormat.Astc5x4SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 5;
- pFormatSize.blockHeight = 4;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc5x5UnormBlock:
- case VkFormat.Astc5x5SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 5;
- pFormatSize.blockHeight = 5;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc6x5UnormBlock:
- case VkFormat.Astc6x5SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 6;
- pFormatSize.blockHeight = 5;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc6x6UnormBlock:
- case VkFormat.Astc6x6SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 6;
- pFormatSize.blockHeight = 6;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc8x5UnormBlock:
- case VkFormat.Astc8x5SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 8;
- pFormatSize.blockHeight = 5;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc8x6UnormBlock:
- case VkFormat.Astc8x6SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 8;
- pFormatSize.blockHeight = 6;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc8x8UnormBlock:
- case VkFormat.Astc8x8SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 8;
- pFormatSize.blockHeight = 8;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc10x5UnormBlock:
- case VkFormat.Astc10x5SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 10;
- pFormatSize.blockHeight = 5;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc10x6UnormBlock:
- case VkFormat.Astc10x6SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 10;
- pFormatSize.blockHeight = 6;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc10x8UnormBlock:
- case VkFormat.Astc10x8SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 10;
- pFormatSize.blockHeight = 8;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc10x10UnormBlock:
- case VkFormat.Astc10x10SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 10;
- pFormatSize.blockHeight = 10;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc12x10UnormBlock:
- case VkFormat.Astc12x10SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 12;
- pFormatSize.blockHeight = 10;
- pFormatSize.blockDepth = 1;
- break;
- case VkFormat.Astc12x12UnormBlock:
- case VkFormat.Astc12x12SrgbBlock:
- pFormatSize.flags = VkFormatSizeFlag.SizeCompressed;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 16 * 8;
- pFormatSize.blockWidth = 12;
- pFormatSize.blockHeight = 12;
- pFormatSize.blockDepth = 1;
- break;
- default:
- pFormatSize.flags = 0;
- pFormatSize.paletteSizeInBits = 0;
- pFormatSize.blockSizeInBits = 0 * 8;
- pFormatSize.blockWidth = 1;
- pFormatSize.blockHeight = 1;
- pFormatSize.blockDepth = 1;
- break;
- }
- }
- }
-}
diff --git a/CVKL/src/VkWindow.cs b/CVKL/src/VkWindow.cs
deleted file mode 100644
index 9a1a142..0000000
--- a/CVKL/src/VkWindow.cs
+++ /dev/null
@@ -1,366 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using Glfw;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- /// <summary>
- /// Base class to build vulkan application.
- /// Provide default swapchain with its command pool and buffers per image and the main present queue
- /// </summary>
- public abstract class VkWindow : IDisposable {
- static Dictionary<IntPtr,VkWindow> windows = new Dictionary<IntPtr, VkWindow>();
-
- IntPtr hWin;
-
- protected VkSurfaceKHR hSurf;
- protected Instance instance;
- protected PhysicalDevice phy;
- protected Device dev;
- protected PresentQueue presentQueue;
- protected SwapChain swapChain;
- protected CommandPool cmdPool;
- protected CommandBuffer[] cmds;
- protected VkSemaphore[] drawComplete;
- protected VkFence[] drawFences;
-
- DebugReport dbgRepport;
-
- protected uint fps;
- protected bool updateViewRequested = true;
- protected double lastMouseX, lastMouseY;
- protected bool[] MouseButton => buttons;
-
- /// <summary>
- /// default camera
- /// </summary>
- protected Camera camera = new Camera (Utils.DegreesToRadians (45f), 1f);
-
- bool[] buttons = new bool[10];
- public Modifier KeyModifiers = 0;
-
- uint frameCount;
- Stopwatch frameChrono;
-
- /// <summary>
- /// Override this property to change the list of enabled extensions
- /// </summary>
- public virtual string[] EnabledDeviceExtensions => new string[] { Ext.D.VK_KHR_swapchain };
-
- /// <summary>
- /// Frequency in millisecond of the call to the Update method
- /// </summary>
- public long UpdateFrequency = 200;
-
- public uint Width { get; private set; }
- public uint Height { get; private set; }
- public string Title {
- set {
- Glfw3.SetWindowTitle (hWin, value);
- }
- }
-
- public VkWindow (string name = "VkWindow", uint _width = 800, uint _height = 600, bool vSync = false) {
-
- Width = _width;
- Height = _height;
-
- Glfw3.Init ();
-
- Glfw3.WindowHint (WindowAttribute.ClientApi, 0);
- Glfw3.WindowHint (WindowAttribute.Resizable, 1);
-
- hWin = Glfw3.CreateWindow ((int)Width, (int)Height, name, MonitorHandle.Zero, IntPtr.Zero);
-
- if (hWin == IntPtr.Zero)
- throw new Exception ("[GLFW3] Unable to create vulkan Window");
-
- Glfw3.SetKeyCallback (hWin, HandleKeyDelegate);
- Glfw3.SetMouseButtonPosCallback (hWin, HandleMouseButtonDelegate);
- Glfw3.SetCursorPosCallback (hWin, HandleCursorPosDelegate);
- Glfw3.SetWindowSizeCallback (hWin, HandleWindowSizeDelegate);
- Glfw3.SetScrollCallback (hWin, HandleScrollDelegate);
- Glfw3.SetCharCallback (hWin, HandleCharDelegate);
-
- windows.Add (hWin, this);
-
- initVulkan (vSync);
- }
- IntPtr currentCursor;
- public void SetCursor (CursorShape cursor) {
- if (currentCursor != IntPtr.Zero)
- Glfw3.DestroyCursor (currentCursor);
- currentCursor = Glfw3.CreateStandardCursor (cursor);
- Glfw3.SetCursor (hWin, currentCursor);
- }
-
- void initVulkan (bool vSync) {
- instance = new Instance ();
-
- if (Instance.DEBUG_UTILS) {
- //dbgmsg = new CVKL.DebugUtils.Messenger (instance);
- dbgRepport = new DebugReport (instance,
- VkDebugReportFlagsEXT.ErrorEXT
- | VkDebugReportFlagsEXT.WarningEXT
- | VkDebugReportFlagsEXT.PerformanceWarningEXT
- );
- }
-
- hSurf = instance.CreateSurface (hWin);
-
- phy = instance.GetAvailablePhysicalDevice ().Where (p => p.HasSwapChainSupport).FirstOrDefault ();
-
- VkPhysicalDeviceFeatures enabledFeatures = default (VkPhysicalDeviceFeatures);
- configureEnabledFeatures (phy.Features, ref enabledFeatures);
-
- //First create the c# device class
- dev = new Device (phy);
- //create queue class
- createQueues ();
-
- //activate the device to have effective queues created accordingly to what's available
- dev.Activate (enabledFeatures, EnabledDeviceExtensions);
-
- swapChain = new SwapChain (presentQueue as PresentQueue, Width, Height, SwapChain.PREFERED_FORMAT,
- vSync ? VkPresentModeKHR.FifoKHR : VkPresentModeKHR.MailboxKHR);
- swapChain.Create ();
-
- Width = swapChain.Width;
- Height = swapChain.Height;
-
- cmdPool = new CommandPool (dev, presentQueue.qFamIndex);
-
- cmds = new CommandBuffer[swapChain.ImageCount];
- drawComplete = new VkSemaphore[swapChain.ImageCount];
- drawFences = new VkFence[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; i++) {
- drawComplete[i] = dev.CreateSemaphore ();
- drawComplete[i].SetDebugMarkerName (dev, "Semaphore DrawComplete" + i);
- drawFences[i] = dev.CreateFence (true);
- }
-
- cmdPool.SetName ("main CmdPool");
- }
- /// <summary>
- /// override this method to modify enabled features before device creation
- /// </summary>
- /// <param name="enabled_features">Features.</param>
- protected virtual void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures enabled_features) {
- }
- /// <summary>
- /// override this method to create additional queue. Dedicated queue of the requested type will be selected first, created queues may excess
- /// available physical queues.
- /// </summary>
- protected virtual void createQueues () {
- presentQueue = new PresentQueue (dev, VkQueueFlags.Graphics, hSurf);
- }
-
- /// <summary>
- /// Main render method called each frame. get next swapchain image, process resize if needed, submit and present to the presentQueue.
- /// Wait QueueIdle after presenting.
- /// </summary>
- protected virtual void render () {
- int idx = swapChain.GetNextImage ();
- if (idx < 0) {
- OnResize ();
- return;
- }
-
- if (cmds[idx] == null)
- return;
-
- dev.WaitForFence (drawFences[idx]);
- dev.ResetFence (drawFences[idx]);
-
- presentQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx], drawFences[idx]);
- presentQueue.Present (swapChain, drawComplete[idx]);
- }
-
- protected virtual void onScroll (double xOffset, double yOffset) { }
- protected virtual void onMouseMove (double xPos, double yPos) {
- double diffX = lastMouseX - xPos;
- double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- camera.Rotate ((float)-diffX, (float)-diffY);
- } else if (MouseButton[1]) {
- camera.Move (0, 0, (float)diffY);
- }
-
- updateViewRequested = true;
- }
- protected virtual void onMouseButtonDown (Glfw.MouseButton button) { }
- protected virtual void onMouseButtonUp (Glfw.MouseButton button) { }
- protected virtual void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.F4:
- if (modifiers == Modifier.Alt)
- Glfw3.SetWindowShouldClose (hWin, 1);
- break;
- case Key.Escape:
- Glfw3.SetWindowShouldClose (hWin, 1);
- break;
- case Key.Up:
- camera.Move (0, 0, 1);
- break;
- case Key.Down:
- camera.Move (0, 0, -1);
- break;
- case Key.Left:
- camera.Move (1, 0, 0);
- break;
- case Key.Right:
- camera.Move (-1, 0, 0);
- break;
- case Key.PageUp:
- camera.Move (0, 1, 0);
- break;
- case Key.PageDown:
- camera.Move (0, -1, 0);
- break;
- case Key.F3:
- if (camera.Type == Camera.CamType.FirstPerson)
- camera.Type = Camera.CamType.LookAt;
- else
- camera.Type = Camera.CamType.FirstPerson;
- break;
- }
- updateViewRequested = true;
- }
- protected virtual void onKeyUp (Key key, int scanCode, Modifier modifiers) { }
- protected virtual void onChar (CodePoint cp) { }
-
- #region events delegates
- static void HandleWindowSizeDelegate (IntPtr window, int width, int height) { }
- static void HandleCursorPosDelegate (IntPtr window, double xPosition, double yPosition) {
- windows[window].onMouseMove (xPosition, yPosition);
- windows[window].lastMouseX = xPosition;
- windows[window].lastMouseY = yPosition;
- }
- static void HandleMouseButtonDelegate (IntPtr window, Glfw.MouseButton button, InputAction action, Modifier mods) {
- if (action == InputAction.Press) {
- windows[window].buttons[(int)button] = true;
- windows[window].onMouseButtonDown (button);
- } else {
- windows[window].buttons[(int)button] = false;
- windows[window].onMouseButtonUp (button);
- }
- }
- static void HandleScrollDelegate (IntPtr window, double xOffset, double yOffset) {
- windows[window].onScroll (xOffset, yOffset);
- }
- static void HandleKeyDelegate (IntPtr window, Key key, int scanCode, InputAction action, Modifier modifiers) {
- windows[window].KeyModifiers = modifiers;
- if (action == InputAction.Press || action == InputAction.Repeat) {
- windows[window].onKeyDown (key, scanCode, modifiers);
- } else {
- windows[window].onKeyUp (key, scanCode, modifiers);
- }
- }
- static void HandleCharDelegate (IntPtr window, CodePoint codepoint) {
- windows[window].onChar (codepoint);
- }
- #endregion
-
- /// <summary>
- /// main window loop, exits on GLFW3 exit event
- /// </summary>
- public virtual void Run () {
- OnResize ();
- UpdateView ();
-
- frameChrono = Stopwatch.StartNew ();
- long totTime = 0;
-
- while (!Glfw3.WindowShouldClose (hWin)) {
- render ();
-
- if (updateViewRequested)
- UpdateView ();
-
- frameCount++;
-
- if (frameChrono.ElapsedMilliseconds > UpdateFrequency) {
- Update ();
-
- frameChrono.Stop ();
- totTime += frameChrono.ElapsedMilliseconds;
- fps = (uint)((double)frameCount / (double)totTime * 1000.0);
- Glfw3.SetWindowTitle (hWin, "FPS: " + fps.ToString ());
- if (totTime > 2000) {
- frameCount = 0;
- totTime = 0;
- }
- frameChrono.Restart ();
- }
- Glfw3.PollEvents ();
- }
- }
- public virtual void UpdateView () { }
- /// <summary>
- /// custom update method called at UpdateFrequency
- /// </summary>
- public virtual void Update () { }
-
- /// <summary>
- /// called when swapchain has been resized, override this method to resize your framebuffers coupled to the swapchain.
- /// The base method will update Window width and height with new swapchain's dimensions.
- /// </summary>
- protected virtual void OnResize () {
- Width = swapChain.Width;
- Height = swapChain.Height;
- }
-
-
- #region IDisposable Support
- protected bool isDisposed;
-
- protected virtual void Dispose (bool disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
-
- for (int i = 0; i < swapChain.ImageCount; i++) {
- dev.DestroySemaphore (drawComplete[i]);
- dev.DestroyFence (drawFences[i]);
- cmds[i].Free ();
- }
-
- swapChain.Dispose ();
-
- vkDestroySurfaceKHR (instance.Handle, hSurf, IntPtr.Zero);
-
- if (disposing) {
- cmdPool.Dispose ();
- dev.Dispose ();
- dbgRepport?.Dispose ();
- instance.Dispose ();
- } else
- Debug.WriteLine ("a VkWindow has not been correctly disposed");
-
- if (currentCursor != IntPtr.Zero)
- Glfw3.DestroyCursor (currentCursor);
-
- Glfw3.DestroyWindow (hWin);
- Glfw3.Terminate ();
-
-
- isDisposed = true;
- }
- }
-
- ~VkWindow () {
- Dispose (false);
- }
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/Activable.cs b/CVKL/src/base/Activable.cs
deleted file mode 100644
index b77443c..0000000
--- a/CVKL/src/base/Activable.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// Activable.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- /// <summary>
- /// Tristate status of activables, reflecting vulkan openrations
- /// </summary>
- public enum ActivableState {
- /// <summary>
- /// Class has been instanced, but no vulkan handle was created.
- /// </summary>
- Init,
- /// <summary>
- /// On the first activation, vulkan handle is created and ref count is one. Further activations will increment the reference count by one.
- /// </summary>
- Activated,
- /// <summary>
- /// Reference count is zero, handles have been destroyed. Such object may be reactivated.
- /// </summary>
- Disposed
- };
- /// <summary>
- /// Base class for most of the vulkan device's objects following the IDispose pattern. Each time an activable is used, it's reference count is incremented, and
- /// each time it is disposed, the count is decremented. When the count reach zero, the handle is destroyed and the finalizizer is unregistered. Once disposed, the
- /// objecte may still be reactivated.
- /// </summary>
- /// <remarks>
- /// Some of the activation trigger the first activation on creation, those activables have to be explicitly dispose at the end of the application.
- /// The activables that trigger activation only on usage does not require an additional dispose at the end.
- /// </remarks>
- public abstract class Activable : IDisposable {
- //count number of activation, only the first one will create a handle
- protected uint references;
- //keep track of the current state of activation.
- protected ActivableState state;
- //With the debug marker extension, setting name to vulkan's object ease the debugging.
- protected string name;
- /// <summary>
- /// This property has to be implemented in every vulkan object. It should return the correct debug marker info.
- /// </summary>
- /// <value>The debug marker info.</value>
- protected abstract VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo { get; }
- /// <summary>
- /// Vulkan logical device this activable is bound to.
- /// </summary>
- public Device Dev { get; private set; }
-
- #region CTOR
- protected Activable (Device dev) {
- this.Dev = dev;
- this.name = GetType ().Name;
- }
- protected Activable (Device dev, string name) {
- this.Dev = dev;
- this.name = name;
- }
- #endregion
-
- /// <summary>
- /// if debug marker extension is activated, this will set the name for debuggers
- /// </summary>
- public void SetName (string name) {
- this.name = name;
-
- if (!Dev.debugMarkersEnabled)
- return;
-
- VkDebugMarkerObjectNameInfoEXT dmo = DebugMarkerInfo;
- dmo.pObjectName = name.Pin();
- Utils.CheckResult (vkDebugMarkerSetObjectNameEXT (Dev.VkDev, ref dmo));
- name.Unpin ();
- }
- /// <summary>
- /// Activation of the object, the reference count is incremented.
- /// </summary>
- public virtual void Activate () {
- references++;
- if (state == ActivableState.Activated)
- return;
- if (state == ActivableState.Disposed)
- GC.ReRegisterForFinalize (this);
- state = ActivableState.Activated;
- SetName (name);
- }
-
- public override string ToString () {
- return name;
- }
-
- #region IDisposable Support
- protected virtual void Dispose (bool disposing) {
- state = ActivableState.Disposed;
- }
-
- ~Activable() {
- Dispose(false);
- }
- public void Dispose () {
- if (references>0)
- references--;
- if (references>0)
- return;
- Dispose (true);
- GC.SuppressFinalize(this);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/Buffer.cs b/CVKL/src/base/Buffer.cs
deleted file mode 100644
index 254d547..0000000
--- a/CVKL/src/base/Buffer.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
-
- /// <summary>
- /// Base class for HostBuffer and GPUBuffer
- /// </summary>
- public class Buffer : Resource {
- internal VkBuffer handle;
- protected VkBufferCreateInfo createInfo = VkBufferCreateInfo.New ();
-
- public VkDescriptorBufferInfo Descriptor;
- public VkBuffer Handle => handle;
- public VkBufferCreateInfo Infos => createInfo;
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT(VkDebugReportObjectTypeEXT.BufferEXT, handle.Handle);
-
- #region CTORS
- public Buffer (Device device, VkBufferUsageFlags usage, VkMemoryPropertyFlags _memoryPropertyFlags, UInt64 size)
- : base (device, _memoryPropertyFlags) {
-
- createInfo.size = size;
- createInfo.usage = usage;
- createInfo.sharingMode = VkSharingMode.Exclusive;
-
- Activate ();//DONT OVERRIDE Activate in derived classes!!!!
- }
- #endregion
-
- public override void Activate () {
- if (state != ActivableState.Activated) {
- Utils.CheckResult (vkCreateBuffer (Dev.VkDev, ref createInfo, IntPtr.Zero, out handle));
-#if MEMORY_POOLS
- Dev.resourceManager.Add (this);
-#else
- updateMemoryRequirements ();
- allocateMemory ();
- bindMemory ();
-#endif
- SetupDescriptor ();
- }
- base.Activate ();
- }
-
- internal override void updateMemoryRequirements () {
- vkGetBufferMemoryRequirements (Dev.VkDev, handle, out memReqs);
- }
-
- internal override void bindMemory () {
-#if MEMORY_POOLS
- Utils.CheckResult (vkBindBufferMemory (Dev.VkDev, handle, memoryPool.vkMemory, poolOffset));
-#else
- Utils.CheckResult (vkBindBufferMemory (Dev.VkDev, handle, vkMemory, 0));
-#endif
- }
-
- public void SetupDescriptor (ulong size = WholeSize, ulong offset = 0) {
- Descriptor.buffer = handle;
- Descriptor.range = size;
- Descriptor.offset = offset;
- }
-
- public void CopyTo (CommandBuffer cmd, Image img, VkImageLayout finalLayout = VkImageLayout.ShaderReadOnlyOptimal) {
- img.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
- VkPipelineStageFlags.AllCommands, VkPipelineStageFlags.Transfer);
-
- VkBufferImageCopy bufferCopyRegion = new VkBufferImageCopy {
- imageExtent = img.CreateInfo.extent,
- imageSubresource = new VkImageSubresourceLayers(VkImageAspectFlags.Color)
- };
-
- vkCmdCopyBufferToImage (cmd.Handle, handle, img.handle, VkImageLayout.TransferDstOptimal, 1, ref bufferCopyRegion);
-
- img.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferDstOptimal, finalLayout,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.Transfer);
- }
- public void CopyTo (CommandBuffer cmd, Buffer buff, ulong size = 0, ulong srcOffset = 0, ulong dstOffset = 0) {
- VkBufferCopy bufferCopy = new VkBufferCopy {
- size = (size == 0) ? AllocatedDeviceMemorySize : size,
- srcOffset = srcOffset,
- dstOffset = dstOffset
- };
- vkCmdCopyBuffer (cmd.Handle, handle, buff.handle, 1, ref bufferCopy);
- }
- public void Fill (CommandBuffer cmd, uint data, ulong size = 0, ulong offset = 0) {
- vkCmdFillBuffer (cmd.Handle, handle, offset, (size == 0) ? AllocatedDeviceMemorySize : size, data);
- }
-
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{handle.Handle.ToString("x")}]");
- }
-
-#region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (state == ActivableState.Activated) {
- base.Dispose (disposing);
- vkDestroyBuffer (Dev.VkDev, handle, IntPtr.Zero);
- }
- state = ActivableState.Disposed;
- }
-#endregion
- }
-}
diff --git a/CVKL/src/base/CommandBuffer.cs b/CVKL/src/base/CommandBuffer.cs
deleted file mode 100644
index 0c381a7..0000000
--- a/CVKL/src/base/CommandBuffer.cs
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Runtime.InteropServices;
-using VK;
-
-using static VK.Vk;
-
-namespace CVKL {
- /// <summary>
- /// Command buffers are objects used to record commands which can be subsequently submitted to a device queue for execution.
- /// There are two levels of command buffers
- /// - primary command buffers, which can execute secondary command buffers, and which are submitted to queues
- /// - secondary command buffers, which can be executed by primary command buffers, and which are not directly submitted to queues.
- /// Command buffer are not derived from activable, because their state is retained by the pool which create them.
- /// </summary>
- public class CommandBuffer {
- public enum States { Init, Record, Executable, Pending, Invalid };
-
- CommandPool pool;
- VkCommandBuffer handle;
-
- public VkCommandBuffer Handle => handle;
- public Device Device => pool?.Dev;//this help
- //public States State { get; internal set; }
-
- internal CommandBuffer (VkDevice _dev, CommandPool _pool, VkCommandBuffer _buff)
- {
- pool = _pool;
- handle = _buff;
-
- //State = States.Init;
- }
-
-
- public void Submit (VkQueue queue, VkSemaphore wait = default(VkSemaphore), VkSemaphore signal = default (VkSemaphore), VkFence fence = default(VkFence)) {
- VkSubmitInfo submit_info = VkSubmitInfo.New();
-
- IntPtr dstStageMask = Marshal.AllocHGlobal (sizeof(uint));
- Marshal.WriteInt32 (dstStageMask, (int)VkPipelineStageFlags.ColorAttachmentOutput);
-
- submit_info.pWaitDstStageMask = dstStageMask;
- if (signal != VkSemaphore.Null) {
- submit_info.signalSemaphoreCount = 1;
- submit_info.pSignalSemaphores = signal.Pin();
- }
- if (wait != VkSemaphore.Null) {
- submit_info.waitSemaphoreCount = 1;
- submit_info.pWaitSemaphores = wait.Pin();
- }
-
- submit_info.commandBufferCount = 1;
- submit_info.pCommandBuffers = handle.Pin();
-
- Utils.CheckResult (vkQueueSubmit (queue, 1, ref submit_info, fence));
-
- if (signal != VkSemaphore.Null)
- signal.Unpin ();
- if (wait != VkSemaphore.Null)
- wait.Unpin ();
- handle.Unpin ();
-
- Marshal.FreeHGlobal (dstStageMask);
- }
- public void Start (VkCommandBufferUsageFlags usage = 0) {
- VkCommandBufferBeginInfo cmdBufInfo = new VkCommandBufferBeginInfo (usage);
- Utils.CheckResult (vkBeginCommandBuffer (handle, ref cmdBufInfo));
- }
- public void End () {
- Utils.CheckResult (vkEndCommandBuffer (handle));
- }
- /// <summary>
- /// Update dynamic viewport state
- /// </summary>
- public void SetViewport (float width, float height, float x = 0f, float y = 0f, float minDepth = 0.0f, float maxDepth = 1.0f) {
- VkViewport viewport = new VkViewport {
- x = x,
- y = y,
- height = height,
- width = width,
- minDepth = minDepth,
- maxDepth = maxDepth,
- };
- vkCmdSetViewport (handle, 0, 1, ref viewport);
- }
- /// <summary>
- /// Update dynamic scissor state
- /// </summary>
- public void SetScissor (uint width, uint height, int offsetX = 0, int offsetY = 0) {
- VkRect2D scissor = new VkRect2D (offsetX, offsetY, width, height);
- vkCmdSetScissor (handle, 0, 1, ref scissor);
- }
- public void BindPipeline (Pipeline pipeline, VkPipelineBindPoint bindPoint) {
- vkCmdBindPipeline (handle, bindPoint, pipeline.Handle);
- }
- public void Dispatch (uint groupCountX, uint groupCountY = 1, uint groupCountZ = 1) {
- vkCmdDispatch (handle, groupCountX, groupCountY, groupCountZ);
- }
- public void BindPipeline (Pipeline pl) {
- pl.Bind (this);
- }
- /// <summary>
- /// bind pipeline and descriptor set with default pipeline layout
- /// </summary>
- /// <param name="pl">pipeline to bind</param>
- /// <param name="ds">descriptor set</param>
- /// <param name="firstset">first set to bind</param>
- public void BindPipeline (Pipeline pl, DescriptorSet ds, uint firstset = 0) {
- pl.Bind (this);
- pl.BindDescriptorSet (this, ds, firstset);
- }
- public void BindDescriptorSet (PipelineLayout pipelineLayout, DescriptorSet descriptorSet, uint firstSet = 0) {
- vkCmdBindDescriptorSets (handle, VkPipelineBindPoint.Graphics, pipelineLayout.handle, firstSet, 1, ref descriptorSet.handle, 0, IntPtr.Zero);
- }
- public void BindDescriptorSet (VkPipelineBindPoint bindPoint, PipelineLayout pipelineLayout, DescriptorSet descriptorSet, uint firstSet = 0) {
- vkCmdBindDescriptorSets (handle, bindPoint, pipelineLayout.handle, firstSet, 1, ref descriptorSet.handle, 0, IntPtr.Zero);
- }
- public void BindVertexBuffer (Buffer vertices, uint binding = 0, ulong offset = 0) {
- vkCmdBindVertexBuffers (handle, binding, 1, ref vertices.handle, ref offset);
- }
- public void BindIndexBuffer (Buffer indices, VkIndexType indexType = VkIndexType.Uint32, ulong offset = 0) {
- vkCmdBindIndexBuffer (handle, indices.handle, offset, indexType);
- }
- public void DrawIndexed (uint indexCount, uint instanceCount = 1, uint firstIndex = 0, int vertexOffset = 0, uint firstInstance = 0) {
- vkCmdDrawIndexed (Handle, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
- }
- public void Draw (uint vertexCount, uint instanceCount = 1, uint firstVertex = 0, uint firstInstance = 0) {
- vkCmdDraw (Handle, vertexCount, instanceCount, firstVertex, firstInstance);
- }
- public void PushConstant (PipelineLayout pipelineLayout, VkShaderStageFlags stageFlags, Object data, uint offset = 0) {
- vkCmdPushConstants (handle, pipelineLayout.handle, stageFlags, offset, (uint)Marshal.SizeOf (data), data.Pin ());
- data.Unpin ();
- }
- public void PushConstant (Pipeline pipeline, object obj, int rangeIndex = 0, uint offset = 0) {
- PushConstant (pipeline.Layout, pipeline.Layout.PushConstantRanges[rangeIndex].stageFlags, obj, offset);
- }
- public void PushConstant (PipelineLayout pipelineLayout, VkShaderStageFlags stageFlags, uint size, Object data, uint offset = 0) {
- vkCmdPushConstants (handle, pipelineLayout.handle, stageFlags, offset, size, data.Pin ());
- data.Unpin ();
- }
- public void SetMemoryBarrier (VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask,
- VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkDependencyFlags dependencyFlags = VkDependencyFlags.ByRegion) {
- VkMemoryBarrier memoryBarrier = VkMemoryBarrier.New ();
- memoryBarrier.srcAccessMask = srcAccessMask;
- memoryBarrier.dstAccessMask = dstAccessMask;
- Vk.vkCmdPipelineBarrier (Handle, srcStageMask, dstStageMask,
- dependencyFlags, 1, ref memoryBarrier, 0, IntPtr.Zero, 0, IntPtr.Zero);
- }
- public void BeginRegion (string name, float r = 1f, float g = 0.1f, float b=0.1f, float a = 1f) {
- if (!Device.debugMarkersEnabled)
- return;
- VkDebugMarkerMarkerInfoEXT info = VkDebugMarkerMarkerInfoEXT.New();
- info.pMarkerName = name.Pin ();
- unsafe {
- info.color[0] = r;
- info.color[1] = g;
- info.color[2] = b;
- info.color[3] = a;
- }
- vkCmdDebugMarkerBeginEXT (Handle, ref info);
- name.Unpin ();
- }
- public void InsertDebugMarker (string name, float r = 1f, float g = 0.1f, float b=0.1f, float a = 1f) {
- if (!Device.debugMarkersEnabled)
- return;
- VkDebugMarkerMarkerInfoEXT info = VkDebugMarkerMarkerInfoEXT.New();
- info.pMarkerName = name.Pin ();
- unsafe {
- info.color[0] = r;
- info.color[1] = g;
- info.color[2] = b;
- info.color[3] = a;
- }
- vkCmdDebugMarkerInsertEXT (Handle, ref info);
- name.Unpin ();
- }
- public void EndRegion () {
- if (Device.debugMarkersEnabled)
- vkCmdDebugMarkerEndEXT (Handle);
- }
-
- public void Free () {
- pool.FreeCommandBuffers (this);
- }
- }
-}
diff --git a/CVKL/src/base/CommandPool.cs b/CVKL/src/base/CommandPool.cs
deleted file mode 100644
index 3317733..0000000
--- a/CVKL/src/base/CommandPool.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Runtime.InteropServices;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- /// <summary>
- /// Command pools are opaque objects that command buffer memory is allocated from, and which allow the implementation
- /// to amortize the cost of resource creation across multiple command buffers.
- /// </summary>
- public sealed class CommandPool : Activable {
- public readonly uint QFamIndex;
- VkCommandPool handle;
-
- #region CTORS
- /// <summary>
- /// Create and activate a new Command Pool.
- /// </summary>
- /// <param name="device">Vulkan Device.</param>
- /// <param name="qFamIdx">Queue family index.</param>
- public CommandPool (Device device, uint qFamIdx) : base(device)
- {
- QFamIndex = qFamIdx;
-
- Activate ();
- }
- /// <summary>
- /// Initializes a new instance of the [[CommandPool]]"/> class.
- /// </summary>
- /// <param name="queue">Device Queue of the queue family to create the pool for.</param>
- public CommandPool (Queue queue) : this(queue.dev, queue.qFamIndex) {}
- #endregion
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT(VkDebugReportObjectTypeEXT.CommandPoolEXT, handle.Handle);
-
- public override void Activate () {
- if (state != ActivableState.Activated) {
- VkCommandPoolCreateInfo infos = VkCommandPoolCreateInfo.New();
- infos.queueFamilyIndex = QFamIndex;
- Utils.CheckResult (vkCreateCommandPool (Dev.VkDev, ref infos, IntPtr.Zero, out handle));
- }
- base.Activate ();
- }
- /// <summary>
- /// Allocates single command buffer.
- /// When command buffers are first allocated, they are in the initial state.
- /// </summary>
- /// <returns>The command buffer in the Init state.</returns>
- /// <param name="level">Command Buffer Level.</param>
- public CommandBuffer AllocateCommandBuffer (VkCommandBufferLevel level = VkCommandBufferLevel.Primary) {
- VkCommandBuffer buff;
- VkCommandBufferAllocateInfo infos = VkCommandBufferAllocateInfo.New();
- infos.commandPool = handle;
- infos.level = level;
- infos.commandBufferCount = 1;
-
- Utils.CheckResult (vkAllocateCommandBuffers (Dev.VkDev, ref infos, out buff));
-
- return new CommandBuffer (Dev.VkDev, this, buff);
- }
- /// <summary>
- /// Allocates multiple command buffer.
- /// </summary>
- /// <returns>An array of command buffers alloocated from this pool.</returns>
- /// <param name="count">Buffer count to create.</param>
- /// <param name="level">Command Buffer Level.</param>
- public CommandBuffer[] AllocateCommandBuffer (uint count, VkCommandBufferLevel level = VkCommandBufferLevel.Primary) {
- VkCommandBufferAllocateInfo infos = VkCommandBufferAllocateInfo.New ();
- infos.commandPool = handle;
- infos.level = level;
- infos.commandBufferCount = count;
- VkCommandBuffer[] buffs = new VkCommandBuffer[count];
- Utils.CheckResult (vkAllocateCommandBuffers (Dev.VkDev, ref infos, buffs.Pin()));
- buffs.Unpin ();
- CommandBuffer[] cmds = new CommandBuffer[count];
- for (int i = 0; i < count; i++)
- cmds[i] = new CommandBuffer (Dev.VkDev, this, buffs[i]);
-
- return cmds;
- }
- /// <summary>
- /// Resetting a command pool recycles all of the resources from all of the command buffers allocated from the command
- /// pool back to the command pool. All command buffers that have been allocated from the command pool are put in the initial state.
- /// Any primary command buffer allocated from another VkCommandPool that is in the recording or executable state and has a secondary
- /// command buffer allocated from commandPool recorded into it, becomes invalid.
- /// </summary>
- /// <param name="flags">Set `ReleaseResources` flag to recycles all of the resources from the command pool back to the system.</param>
- public void Reset (VkCommandPoolResetFlags flags = 0) {
- Vk.vkResetCommandPool (Dev.VkDev, handle, flags);
- }
- /// <summary>
- /// Allocates a new command buffer and automatically start it.
- /// </summary>
- /// <returns>New command buffer in the recording state.</returns>
- /// <param name="usage">Usage.</param>
- /// <param name="level">Command buffer level, primary or secondary.</param>
- public CommandBuffer AllocateAndStart (VkCommandBufferUsageFlags usage = 0, VkCommandBufferLevel level = VkCommandBufferLevel.Primary) {
- CommandBuffer cmd = AllocateCommandBuffer (level);
- cmd.Start (usage);
- return cmd;
- }
- /// <summary>
- /// Any primary command buffer that is in the recording or executable state and has any element of the command buffer list recorded into it, becomes invalid.
- /// </summary>
- /// <param name="cmds">Command buffer list to free.</param>
- public void FreeCommandBuffers (params CommandBuffer[] cmds) {
- if (cmds.Length == 1) {
- VkCommandBuffer hnd = cmds[0].Handle;
- vkFreeCommandBuffers (Dev.VkDev, handle, 1, ref hnd);
- return;
- }
- int sizeElt = Marshal.SizeOf<IntPtr> ();
- IntPtr cmdsPtr = Marshal.AllocHGlobal (cmds.Length * sizeElt);
- int count = 0;
- for (int i = 0; i < cmds.Length; i++) {
- if (cmds[i] == null)
- continue;
- Marshal.WriteIntPtr (cmdsPtr + count * sizeElt, cmds[i].Handle.Handle);
- count++;
- }
- if (count > 0)
- vkFreeCommandBuffers (Dev.VkDev, handle, (uint)count, cmdsPtr);
-
- Marshal.FreeHGlobal (cmdsPtr);
- }
-
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{handle.Handle.ToString("x")}]");
- }
-
- #region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (!disposing)
- System.Diagnostics.Debug.WriteLine ("VKE CommandPool disposed by finalizer");
- if (state == ActivableState.Activated)
- vkDestroyCommandPool (Dev.VkDev, handle, IntPtr.Zero);
- base.Dispose (disposing);
- }
- #endregion
-
- }
-}
diff --git a/CVKL/src/base/ComputePipeline.cs b/CVKL/src/base/ComputePipeline.cs
deleted file mode 100644
index e57a7d0..0000000
--- a/CVKL/src/base/ComputePipeline.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// ComputePipeline.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- public sealed class ComputePipeline : Pipeline {
-
- public string SpirVPath;
-
- #region CTORS
- public ComputePipeline (Device dev, PipelineCache cache = null, string name = "compute pipeline") : base (dev, cache, name) {
- }
- /// <summary>
- /// Create a new Pipeline with supplied PipelineLayout
- /// </summary>
- public ComputePipeline (PipelineLayout layout, string spirvPath, PipelineCache cache = null, string name = "pipeline") : base(layout.Dev, cache, name)
- {
- SpirVPath = spirvPath;
- this.layout = layout;
-
- Activate ();
- }
- #endregion
-
- public override void Activate () {
- if (state != ActivableState.Activated) {
- layout.Activate ();
- Cache?.Activate ();
-
- using (ShaderInfo shader = new ShaderInfo (VkShaderStageFlags.Compute, SpirVPath)) {
- VkComputePipelineCreateInfo info = VkComputePipelineCreateInfo.New ();
- info.layout = layout.Handle;
- info.stage = shader.GetStageCreateInfo (Dev);
- info.basePipelineHandle = 0;
- info.basePipelineIndex = 0;
-
- Utils.CheckResult (Vk.vkCreateComputePipelines (Dev.VkDev, Cache == null ? VkPipelineCache.Null : Cache.handle, 1, ref info, IntPtr.Zero, out handle));
-
- Dev.DestroyShaderModule (info.stage.module);
- }
- }
- base.Activate ();
- }
-
- public override void Bind (CommandBuffer cmd) {
- vkCmdBindPipeline (cmd.Handle, VkPipelineBindPoint.Compute, handle);
- }
- public override void BindDescriptorSet (CommandBuffer cmd, DescriptorSet dset, uint firstSet = 0) {
- cmd.BindDescriptorSet (VkPipelineBindPoint.Compute, layout, dset, firstSet);
- }
- public void BindAndDispatch (CommandBuffer cmd, uint groupCountX, uint groupCountY = 1, uint groupCountZ = 1) {
- vkCmdBindPipeline (cmd.Handle, VkPipelineBindPoint.Compute, handle);
- vkCmdDispatch (cmd.Handle, groupCountX, groupCountY, groupCountZ);
- }
- }
-}
diff --git a/CVKL/src/base/DebuDrawPipeline.cs b/CVKL/src/base/DebuDrawPipeline.cs
deleted file mode 100644
index c974416..0000000
--- a/CVKL/src/base/DebuDrawPipeline.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL {
- public class DebugDrawPipeline : GraphicPipeline {
- public HostBuffer Vertices;
- uint vertexCount;
- uint vboLength;
-
- public DebugDrawPipeline (RenderPass renderPass, uint maxVertices = 100,
- VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1, PipelineCache pipelineCache = null) :
- base (renderPass, pipelineCache, "Debug draw pipeline") {
-
- vboLength = 100 * 6 * sizeof(float);
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.LineList, samples);
- cfg.rasterizationState.lineWidth = 1.0f;
- cfg.RenderPass = RenderPass;
- cfg.Layout = new PipelineLayout(Dev, new VkPushConstantRange(VkShaderStageFlags.Vertex, (uint)Marshal.SizeOf<Matrix4x4>() * 2));
- cfg.AddVertexBinding (0, 6 * sizeof(float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat);
- cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (true);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#CVKL.debug.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#CVKL.debug.frag.spv");
-
- layout = cfg.Layout;
-
- init (cfg);
-
- Vertices = new HostBuffer (Dev, VkBufferUsageFlags.VertexBuffer, vboLength);
- Vertices.Map ();
- }
-
- public void AddLine (Vector3 start, Vector3 end, float r, float g, float b) {
- float[] data = {
- start.X, start.Y, start.Z,
- r, g, b,
- end.X, end.Y, end.Z,
- r, g, b
- };
- Vertices.Update (data, 12 * sizeof (float), vertexCount * 6 * sizeof (float));
- vertexCount+=2;
- }
- public void UpdateLine (uint lineNum, Vector3 start, Vector3 end, float r, float g, float b) {
- float[] data = {
- start.X, start.Y, start.Z,
- r, g, b,
- end.X, end.Y, end.Z,
- r, g, b
- };
- Vertices.Update (data, 12 * sizeof (float), (lineNum-1) * 2 * 6 * sizeof (float));
- }
-
- public void RecordDraw (CommandBuffer cmd, Framebuffer fb, Matrix4x4 projection, Matrix4x4 view) {
-
- //cmd.SetViewport (fb.Width/ratio, fb.Height/ratio, (ratio-1) * (int)fb.Width / ratio, (ratio-1) * (int)fb.Height / ratio);
- //cmd.SetViewport (200, 200,100,100,-10,10);//, 4 * (int)fb.Width / 5, 4 * (int)fb.Height / 5);
- //cmd.SetScissor (fb.Width / ratio, fb.Height / ratio, (ratio-1) * (int)fb.Width / ratio, (ratio-1) * (int)fb.Height / ratio);
- //cmd.SetScissor (200, 200,100,100);
-
- Bind(cmd);
-
- cmd.PushConstant (layout, VkShaderStageFlags.Vertex, projection);
- cmd.PushConstant (layout, VkShaderStageFlags.Vertex, view, (uint)Marshal.SizeOf<Matrix4x4>());
-
- cmd.BindVertexBuffer (Vertices);
- cmd.Draw (vertexCount);
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- Vertices.Unmap ();
- Vertices.Dispose ();
- }
-
- base.Dispose (disposing);
- }
- }
-
-}
diff --git a/CVKL/src/base/DebugReport.cs b/CVKL/src/base/DebugReport.cs
deleted file mode 100644
index 3bda80b..0000000
--- a/CVKL/src/base/DebugReport.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-// DebugReport.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.InteropServices;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
-
- public class DebugReport : IDisposable {
- VkDebugReportCallbackEXT handle;
- Instance inst;
-
- PFN_vkDebugReportCallbackEXT debugCallbackDelegate = new PFN_vkDebugReportCallbackEXT (debugCallback);
-
- static VkBool32 debugCallback (VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, ulong obj,
- UIntPtr location, int messageCode, IntPtr pLayerPrefix, IntPtr pMessage, IntPtr pUserData) {
- string prefix = "";
- switch (flags) {
- case 0:
- prefix = "?";
- break;
- case VkDebugReportFlagsEXT.InformationEXT:
- Console.ForegroundColor = ConsoleColor.Gray;
- prefix = "INFO";
- break;
- case VkDebugReportFlagsEXT.WarningEXT:
- Console.ForegroundColor = ConsoleColor.DarkYellow;
- prefix = "WARN";
- break;
- case VkDebugReportFlagsEXT.PerformanceWarningEXT:
- Console.ForegroundColor = ConsoleColor.Yellow;
- prefix = "PERF";
- break;
- case VkDebugReportFlagsEXT.ErrorEXT:
- Console.ForegroundColor = ConsoleColor.DarkRed;
- prefix = "EROR";
- break;
- case VkDebugReportFlagsEXT.DebugEXT:
- Console.ForegroundColor = ConsoleColor.Red;
- prefix = "DBUG";
- break;
- }
- try {
- string msg = Marshal.PtrToStringAnsi (pMessage);
- string[] tmp = msg.Split ('|');
- Console.WriteLine ($"{prefix}:{tmp[1]} |{Marshal.PtrToStringAnsi (pLayerPrefix)}({messageCode}){objectType}:{tmp[0]}");
- } catch (Exception ex) {
- Console.WriteLine ("error parsing debug message: " + ex);
- }
- Console.ForegroundColor = ConsoleColor.White;
- return VkBool32.False;
- }
-
- public DebugReport (Instance instance, VkDebugReportFlagsEXT flags = VkDebugReportFlagsEXT.ErrorEXT | VkDebugReportFlagsEXT.WarningEXT) {
- inst = instance;
-
- VkDebugReportCallbackCreateInfoEXT dbgInfo = new VkDebugReportCallbackCreateInfoEXT {
- sType = VkStructureType.DebugReportCallbackCreateInfoEXT,
- flags = flags,
- pfnCallback = Marshal.GetFunctionPointerForDelegate (debugCallbackDelegate)
- };
-
- Utils.CheckResult (vkCreateDebugReportCallbackEXT (inst.Handle, ref dbgInfo, IntPtr.Zero, out handle));
- }
-
- #region IDisposable Support
- private bool disposedValue = false;
-
- protected virtual void Dispose (bool disposing) {
- if (!disposedValue) {
- if (disposing) {
- // TODO: supprimer l'état managé (objets managés).
- }
-
- vkDestroyDebugReportCallbackEXT (inst.Handle, handle, IntPtr.Zero);
-
- disposedValue = true;
- }
- }
-
- ~DebugReport () {
- Dispose (false);
- }
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/DebugUtilsMessenger.cs b/CVKL/src/base/DebugUtilsMessenger.cs
deleted file mode 100644
index b048c36..0000000
--- a/CVKL/src/base/DebugUtilsMessenger.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using VK;
-using static VK.Vk;
-
-namespace CVKL.DebugUtils {
-
- public class Messenger : IDisposable {
- Instance inst;
- VkDebugUtilsMessengerEXT handle;
- PFN_vkDebugUtilsMessengerCallbackEXT onMessage = new PFN_vkDebugUtilsMessengerCallbackEXT(HandlePFN_vkDebugUtilsMessengerCallbackEXT);
-
- static VkBool32 HandlePFN_vkDebugUtilsMessengerCallbackEXT (VkDebugUtilsMessageSeverityFlagsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, IntPtr pCallbackData, IntPtr pUserData) {
- //Console.WriteLine ("{0} {1}: {2}",messageSeverity, messageTypes, Marshal.PtrToStringAnsi(pUserData));
- Console.WriteLine ("MESSAGE RECEIVED");
- return false;
- }
-
-
-
- // PFN_vkDebugReportCallbackEXT debugCallbackDelegate = new PFN_vkDebugReportCallbackEXT (debugCallback);
-
- // static VkBool32 debugCallback (VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, ulong obj,
- // UIntPtr location, int messageCode, IntPtr pLayerPrefix, IntPtr pMessage, IntPtr pUserData) {
- // string prefix = "";
- // switch (flags) {
- // case 0:
- // prefix = "?";
- // break;
- // case VkDebugReportFlagsEXT.InformationEXT:
- // Console.ForegroundColor = ConsoleColor.Gray;
- // prefix = "INFO";
- // break;
- // case VkDebugReportFlagsEXT.WarningEXT:
- // Console.ForegroundColor = ConsoleColor.DarkYellow;
- // prefix = "WARN";
- // break;
- // case VkDebugReportFlagsEXT.PerformanceWarningEXT:
- // Console.ForegroundColor = ConsoleColor.Yellow;
- // prefix = "PERF";
- // break;
- // case VkDebugReportFlagsEXT.ErrorEXT:
- // Console.ForegroundColor = ConsoleColor.DarkRed;
- // prefix = "EROR";
- // break;
- // case VkDebugReportFlagsEXT.DebugEXT:
- // Console.ForegroundColor = ConsoleColor.Red;
- // prefix = "DBUG";
- // break;
- // }
-
- // Console.WriteLine ("{0} {1}: {2}",prefix, messageCode, Marshal.PtrToStringAnsi(pMessage));
- //Console.ForegroundColor = ConsoleColor.White;
- // return VkBool32.False;
- //}
-
- public Messenger (Instance instance,
- VkDebugUtilsMessageTypeFlagsEXT typeMask = VkDebugUtilsMessageTypeFlagsEXT.ValidationEXT,
- VkDebugUtilsMessageSeverityFlagsEXT severityMask = VkDebugUtilsMessageSeverityFlagsEXT.ErrorEXT | VkDebugUtilsMessageSeverityFlagsEXT.WarningEXT) {
-
- inst = instance;
- VkDebugUtilsMessengerCreateInfoEXT info = VkDebugUtilsMessengerCreateInfoEXT.New ();
- info.messageType = typeMask;
- info.messageSeverity = severityMask;
- info.pfnUserCallback = Marshal.GetFunctionPointerForDelegate (onMessage);
- info.pUserData = IntPtr.Zero;
-
- Utils.CheckResult (vkCreateDebugUtilsMessengerEXT (inst.VkInstance, ref info, IntPtr.Zero, out handle));
- }
-
- #region IDisposable Support
- private bool disposedValue;
-
- protected virtual void Dispose (bool disposing) {
- if (!disposedValue) {
- if (disposing) {
- // TODO: supprimer l'état managé (objets managés).
- }
-
- vkDestroyDebugUtilsMessengerEXT (inst.Handle, handle, IntPtr.Zero);
-
- disposedValue = true;
- }
- }
-
- ~Messenger () {
- Dispose (false);
- }
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize (this);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/DescriptorPool.cs b/CVKL/src/base/DescriptorPool.cs
deleted file mode 100644
index 6c9f9c4..0000000
--- a/CVKL/src/base/DescriptorPool.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Collections.Generic;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- public sealed class DescriptorPool : Activable {
- internal VkDescriptorPool handle;
- public readonly uint MaxSets;
-
- public List<VkDescriptorPoolSize> PoolSizes = new List<VkDescriptorPoolSize> ();
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT(VkDebugReportObjectTypeEXT.DescriptorPoolEXT, handle.Handle);
-
- #region CTORS
- public DescriptorPool (Device device, uint maxSets = 1) : base (device) {
- MaxSets = maxSets;
- }
- public DescriptorPool (Device device, uint maxSets = 1, params VkDescriptorPoolSize[] poolSizes)
- : this (device, maxSets) {
-
- PoolSizes.AddRange (poolSizes);
-
- Activate ();
- }
- #endregion
-
- public override void Activate () {
- if (state != ActivableState.Activated) {
- VkDescriptorPoolCreateInfo info = VkDescriptorPoolCreateInfo.New();
- info.poolSizeCount = (uint)PoolSizes.Count;
- info.pPoolSizes = PoolSizes.Pin ();
- info.maxSets = MaxSets;
-
- Utils.CheckResult (vkCreateDescriptorPool (Dev.VkDev, ref info, IntPtr.Zero, out handle));
- PoolSizes.Unpin ();
- }
- base.Activate ();
- }
-
- /// <summary>
- /// Create and allocate a new DescriptorSet
- /// </summary>
- public DescriptorSet Allocate (params DescriptorSetLayout[] layouts) {
- DescriptorSet ds = new DescriptorSet (this, layouts);
- Allocate (ds);
- return ds;
- }
- public void Allocate (DescriptorSet descriptorSet) {
- VkDescriptorSetAllocateInfo allocInfo = VkDescriptorSetAllocateInfo.New();
- allocInfo.descriptorPool = handle;
- allocInfo.descriptorSetCount = (uint)descriptorSet.descriptorSetLayouts.Count;
- allocInfo.pSetLayouts = descriptorSet.descriptorSetLayouts.Pin();
-
- Utils.CheckResult (vkAllocateDescriptorSets (Dev.VkDev, ref allocInfo, out descriptorSet.handle));
-
- descriptorSet.descriptorSetLayouts.Unpin ();
- }
- public void FreeDescriptorSet (params DescriptorSet[] descriptorSets) {
- if (descriptorSets.Length == 1) {
- Utils.CheckResult (vkFreeDescriptorSets (Dev.VkDev, handle, 1, ref descriptorSets[0].handle));
- return;
- }
- Utils.CheckResult (vkFreeDescriptorSets (Dev.VkDev, handle, (uint)descriptorSets.Length, descriptorSets.Pin()));
- descriptorSets.Unpin ();
- }
- public void Reset () {
- Utils.CheckResult (vkResetDescriptorPool (Dev.VkDev, handle, 0));
- }
-
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{handle.Handle.ToString("x")}]");
- }
-
- #region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (!disposing)
- System.Diagnostics.Debug.WriteLine ($"CVKL DescriptorPool '{name}' disposed by finalizer");
- if (state == ActivableState.Activated)
- vkDestroyDescriptorPool (Dev.VkDev, handle, IntPtr.Zero);
- base.Dispose (disposing);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/DescriptorSet.cs b/CVKL/src/base/DescriptorSet.cs
deleted file mode 100644
index 19b231c..0000000
--- a/CVKL/src/base/DescriptorSet.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System.Collections.Generic;
-using VK;
-
-namespace CVKL {
- public class DescriptorSet {
- internal VkDescriptorSet handle;
- public VkDescriptorSet Handle => handle;
- DescriptorPool pool;
- internal List<VkDescriptorSetLayout> descriptorSetLayouts = new List<VkDescriptorSetLayout> ();
-
- public DescriptorSet (DescriptorPool descriptorPool) {
- pool = descriptorPool;
- }
- public DescriptorSet (DescriptorPool descriptorPool, params DescriptorSetLayout[] layouts)
- : this (descriptorPool) {
-
- foreach (DescriptorSetLayout layout in layouts)
- descriptorSetLayouts.Add (layout.handle);
- }
-
- public void Free () {
- pool.FreeDescriptorSet (this);
- }
- }
-}
diff --git a/CVKL/src/base/DescriptorSetLayout.cs b/CVKL/src/base/DescriptorSetLayout.cs
deleted file mode 100644
index f63e5e2..0000000
--- a/CVKL/src/base/DescriptorSetLayout.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Collections.Generic;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- /// <summary>
- /// Descriptor set layout, automatically activated when used in pipeline creation, so don't allocate descriptor sets using
- /// this layout unless it has been activated.
- /// </summary>
- public sealed class DescriptorSetLayout : Activable {
- internal VkDescriptorSetLayout handle;
-
- public VkDescriptorSetLayoutCreateFlags Flags { get; private set; } = 0;
- public List<VkDescriptorSetLayoutBinding> Bindings { get; private set; } = new List<VkDescriptorSetLayoutBinding> ();
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT(VkDebugReportObjectTypeEXT.DescriptorSetLayoutEXT, handle.Handle);
-
- #region CTORS
- public DescriptorSetLayout (Device device, VkDescriptorSetLayoutCreateFlags flags) : base (device) {
- Flags = flags;
- }
- public DescriptorSetLayout (Device device, params VkDescriptorSetLayoutBinding[] bindings)
- : this (device, 0, bindings) {
- }
- public DescriptorSetLayout (Device device, VkDescriptorSetLayoutCreateFlags flags, params VkDescriptorSetLayoutBinding[] bindings)
- : this (device, flags) {
- foreach (VkDescriptorSetLayoutBinding b in bindings)
- Bindings.Add (b);
- }
- #endregion
-
- public override void Activate () {
- if (state != ActivableState.Activated) {
- VkDescriptorSetLayoutCreateInfo info = new VkDescriptorSetLayoutCreateInfo (Flags, (uint)Bindings.Count, Bindings.Pin());
- Utils.CheckResult (vkCreateDescriptorSetLayout (Dev.VkDev, ref info, IntPtr.Zero, out handle));
- Bindings.Unpin ();
- }
- base.Activate ();
- }
-
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{handle.Handle.ToString("x")}]");
- }
-
- #region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (!disposing)
- System.Diagnostics.Debug.WriteLine ("VKE DescriptorSetLayout disposed by finalizer");
- if (state == ActivableState.Activated)
- vkDestroyDescriptorSetLayout (Dev.VkDev, handle, IntPtr.Zero);
- base.Dispose (disposing);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/DescriptorSetWrites.cs b/CVKL/src/base/DescriptorSetWrites.cs
deleted file mode 100644
index b47d7d0..0000000
--- a/CVKL/src/base/DescriptorSetWrites.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-//
-// DescriptorSetWrites.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- /// <summary>
- /// Descriptor set writes is defined once, then update affect descriptors to write array
- /// </summary>
- public class DescriptorSetWrites {
- VkDescriptorSet? dstSetOverride = null;//when set, override target descriptors to update in each write
- public List<VkWriteDescriptorSet> WriteDescriptorSets = new List<VkWriteDescriptorSet> ();
-
- #region CTORS
- public DescriptorSetWrites () { }
- public DescriptorSetWrites (VkDescriptorSetLayoutBinding binding) {
- AddWriteInfo (binding);
- }
- public DescriptorSetWrites (DescriptorSet destSet, VkDescriptorSetLayoutBinding binding) {
- AddWriteInfo (destSet, binding);
- }
- public DescriptorSetWrites (params VkDescriptorSetLayoutBinding[] bindings) {
- AddWriteInfo (bindings);
- }
- public DescriptorSetWrites (DescriptorSet destSet, params VkDescriptorSetLayoutBinding[] bindings) {
- AddWriteInfo (destSet, bindings);
- }
- /// <summary>
- /// Configure the Write to update the full layout at once
- /// </summary>
- public DescriptorSetWrites (DescriptorSet destSet, DescriptorSetLayout layout) {
- foreach (VkDescriptorSetLayoutBinding binding in layout.Bindings) {
- AddWriteInfo (destSet, binding);
- }
- }
- /// <summary>
- /// Configure the Write to update the full layout at once
- /// </summary>
- public DescriptorSetWrites (DescriptorSetLayout layout) {
- foreach (VkDescriptorSetLayoutBinding binding in layout.Bindings) {
- AddWriteInfo (binding);
- }
- }
- #endregion
-
- /// <summary>
- /// Adds write info with a destination descriptor set, it could be overriden by calling Write
- /// with another descriptorSet in parametters
- /// </summary>
- public void AddWriteInfo (DescriptorSet destSet, params VkDescriptorSetLayoutBinding[] bindings) {
- foreach (VkDescriptorSetLayoutBinding binding in bindings)
- AddWriteInfo (destSet, binding);
- }
- /// <summary>
- /// Adds write info with a destination descriptor set, it could be overriden by calling Write
- /// with another descriptorSet in parametters
- /// </summary>
- public void AddWriteInfo (DescriptorSet destSet, VkDescriptorSetLayoutBinding binding) {
- VkWriteDescriptorSet wds = VkWriteDescriptorSet.New();
- wds.descriptorType = binding.descriptorType;
- wds.descriptorCount = binding.descriptorCount;
- wds.dstBinding = binding.binding;
- wds.dstSet = destSet.handle;
- WriteDescriptorSets.Add (wds);
- }
- /// <summary>
- /// Adds write info without specifying a destination descriptor set, this imply that on calling Write, you MUST
- /// provide a desDescriptor!
- /// </summary>
- public void AddWriteInfo (VkDescriptorSetLayoutBinding[] bindings) {
- foreach (VkDescriptorSetLayoutBinding binding in bindings)
- AddWriteInfo (binding);
- }
- /// <summary>
- /// Adds write info without specifying a destination descriptor set, this imply that on calling Write, you MUST
- /// provide a desDescriptor!
- /// </summary>
- public void AddWriteInfo (VkDescriptorSetLayoutBinding binding) {
- VkWriteDescriptorSet wds = VkWriteDescriptorSet.New();
- wds.descriptorType = binding.descriptorType;
- wds.descriptorCount = binding.descriptorCount;
- wds.dstBinding = binding.binding;
- WriteDescriptorSets.Add (wds);
- }
-
- /// <summary>
- /// execute the descriptors writes providing a target descriptorSet
- /// </summary>
- public void Write (Device dev, DescriptorSet set, params object[] descriptors) {
- dstSetOverride = set.handle;
- Write (dev, descriptors);
- }
-
- /// <summary>
- /// execute the descriptors writes targeting descriptorSets setted on AddWriteInfo call
- /// </summary>
- public void Write (Device dev, params object[] descriptors) {
- //if (descriptors.Length != WriteDescriptorSets.Count)
- // throw new Exception ("descriptors count must equal the WriteInfo count.");
- List<object> descriptorsLists = new List<object> ();//strore temp arrays of pDesc for unpinning
- //if descriptorCount>1
- int i = 0;
- int wdsPtr = 0;
- while (i < descriptors.Length) {
- int firstDescriptor = i;
- VkWriteDescriptorSet wds = WriteDescriptorSets[wdsPtr];
- if (dstSetOverride != null)
- wds.dstSet = dstSetOverride.Value.Handle;
- IntPtr pDescriptors = IntPtr.Zero;
-
- if (wds.descriptorCount > 1) {
- List<IntPtr> descPtrArray = new List<IntPtr> ();
- for (int d = 0; d < wds.descriptorCount; d++) {
- descPtrArray.Add (descriptors[i].Pin ());
- i++;
- }
- descriptorsLists.Add (descPtrArray);
- pDescriptors = descPtrArray.Pin ();
- } else {
- pDescriptors = descriptors[i].Pin ();
- i++;
- }
- if (descriptors[firstDescriptor] is VkDescriptorBufferInfo)
- wds.pBufferInfo = pDescriptors;
- else if (descriptors[firstDescriptor] is VkDescriptorImageInfo)
- wds.pImageInfo = pDescriptors;
-
- WriteDescriptorSets[wdsPtr] = wds;
- wdsPtr++;
- }
- vkUpdateDescriptorSets (dev.VkDev, (uint)WriteDescriptorSets.Count, WriteDescriptorSets.Pin (), 0, IntPtr.Zero);
- WriteDescriptorSets.Unpin ();
- foreach (object descArray in descriptorsLists)
- descArray.Unpin ();
- for (i = 0; i < descriptors.Length; i++)
- descriptors[i].Unpin ();
- }
- }
- /// <summary>
- /// Descriptor set writes include descriptor in write addition with IDisposable model
- /// </summary>
- [Obsolete]
- public class DescriptorSetWrites2 : IDisposable {
- Device dev;
- List<VkWriteDescriptorSet> WriteDescriptorSets = new List<VkWriteDescriptorSet> ();
- List<object> descriptors = new List<object> ();
-
- public DescriptorSetWrites2 (Device device) {
- dev = device;
- }
- public void AddWriteInfo (DescriptorSet destSet, VkDescriptorSetLayoutBinding binding, VkDescriptorBufferInfo descriptor) {
- if (!descriptors.Contains (descriptor))
- descriptors.Add (descriptor);
- VkWriteDescriptorSet wds = VkWriteDescriptorSet.New();
- wds.descriptorType = binding.descriptorType;
- wds.descriptorCount = binding.descriptorCount;
- wds.dstBinding = binding.binding;
- wds.dstSet = destSet.handle;
- wds.pBufferInfo = descriptor.Pin ();
-
- WriteDescriptorSets.Add (wds);
- }
- public void AddWriteInfo (DescriptorSet destSet, VkDescriptorSetLayoutBinding binding, VkDescriptorImageInfo descriptor) {
- if (!descriptors.Contains (descriptor))
- descriptors.Add (descriptor);
- VkWriteDescriptorSet wds = VkWriteDescriptorSet.New();
- wds.descriptorType = binding.descriptorType;
- wds.descriptorCount = binding.descriptorCount;
- wds.dstBinding = binding.binding;
- wds.dstSet = destSet.handle;
- wds.pImageInfo = descriptor.Pin ();
-
- WriteDescriptorSets.Add (wds);
- }
-
- public void Update () {
- vkUpdateDescriptorSets (dev.VkDev, (uint)WriteDescriptorSets.Count, WriteDescriptorSets.Pin (), 0, IntPtr.Zero);
- WriteDescriptorSets.Unpin ();
- }
-
- #region IDisposable Support
- private bool disposedValue = false; // Pour détecter les appels redondants
-
- protected virtual void Dispose (bool disposing) {
- if (!disposedValue) {
- foreach (object descriptor in descriptors)
- descriptor.Unpin ();
- disposedValue = true;
- }
- }
- ~DescriptorSetWrites2() {
- Dispose(false);
- }
- // Ce code est ajouté pour implémenter correctement le modèle supprimable.
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize(this);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/Device.cs b/CVKL/src/base/Device.cs
deleted file mode 100644
index 299b288..0000000
--- a/CVKL/src/base/Device.cs
+++ /dev/null
@@ -1,328 +0,0 @@
-//
-// Device.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using VK;
-using static VK.Vk;
-
-
-namespace CVKL {
- /// <summary>
- /// Logical device encapsulating vulkan logical device handle. Implements only IDisposable an do not derive from
- /// Activable, so it may be activated only once and no reference counting on it is handled, and no reactivation is posible
- /// after being disposed.
- /// </summary>
- public class Device : IDisposable {
- public readonly PhysicalDevice phy;
-
- VkDevice dev;
- public VkDevice VkDev => dev;
- public IntPtr Handle => dev.Handle;
-
- internal List<Queue> queues = new List<Queue> ();
- internal bool debugMarkersEnabled;
-
-#if MEMORY_POOLS
- public ResourceManager resourceManager;
-#endif
-
- public Device (PhysicalDevice _phy) {
- phy = _phy;
- }
-
- public void Activate (VkPhysicalDeviceFeatures enabledFeatures, params string[] extensions) {
- List<VkDeviceQueueCreateInfo> qInfos = new List<VkDeviceQueueCreateInfo> ();
- List<List<float>> prioritiesLists = new List<List<float>> ();//store pinned lists for later unpin
-
- foreach (IGrouping<uint, Queue> qfams in queues.GroupBy (q => q.qFamIndex)) {
- int qTot = qfams.Count ();
- uint qIndex = 0;
- List<float> priorities = new List<float> ();
- bool qCountReached = false;//true when queue count of that family is reached
-
- foreach (Queue q in qfams) {
- if (!qCountReached)
- priorities.Add (q.priority);
- q.index = qIndex++;
- if (qIndex == phy.QueueFamilies[qfams.Key].queueCount) {
- qIndex = 0;
- qCountReached = true;
- }
- }
-
- qInfos.Add (new VkDeviceQueueCreateInfo {
- sType = VkStructureType.DeviceQueueCreateInfo,
- queueCount = qCountReached ? phy.QueueFamilies[qfams.Key].queueCount : qIndex,
- queueFamilyIndex = qfams.Key,
- pQueuePriorities = priorities.Pin ()
- });
- prioritiesLists.Add (priorities);//add for unpined
- }
-
- //enable only supported exceptions
- List<IntPtr> deviceExtensions = new List<IntPtr> ();
- for (int i = 0; i < extensions.Length; i++) {
- if (phy.GetDeviceExtensionSupported (extensions[i])) {
- deviceExtensions.Add (new FixedUtf8String (extensions[i]));
- //store in a bool to prevent frequent string test for debug marker ext presence
- if (extensions[i] == Ext.D.VK_EXT_debug_marker)
- debugMarkersEnabled = true;
- }
- }
-
- VkDeviceCreateInfo deviceCreateInfo = VkDeviceCreateInfo.New ();
- deviceCreateInfo.queueCreateInfoCount = (uint)qInfos.Count;
- deviceCreateInfo.pQueueCreateInfos = qInfos.Pin ();
- deviceCreateInfo.pEnabledFeatures = enabledFeatures.Pin ();
-
- if (deviceExtensions.Count > 0) {
- deviceCreateInfo.enabledExtensionCount = (uint)deviceExtensions.Count;
- deviceCreateInfo.ppEnabledExtensionNames = deviceExtensions.Pin ();
- }
-
- Utils.CheckResult (vkCreateDevice (phy.Handle, ref deviceCreateInfo, IntPtr.Zero, out dev));
- qInfos.Unpin ();
- enabledFeatures.Unpin ();
- foreach (List<float> fa in prioritiesLists)
- fa.Unpin ();
-
- deviceExtensions.Unpin ();
-
- //Vk.LoadDeviceFunctionPointers (dev);
-
- foreach (Queue q in queues)
- q.updateHandle ();
-
-#if MEMORY_POOLS
- resourceManager = new ResourceManager (this);
-#endif
- }
-
- public VkSemaphore CreateSemaphore () {
- VkSemaphore tmp;
- VkSemaphoreCreateInfo info = VkSemaphoreCreateInfo.New ();
- Utils.CheckResult (vkCreateSemaphore (dev, ref info, IntPtr.Zero, out tmp));
- return tmp;
- }
- public void DestroySemaphore (VkSemaphore semaphore) {
- vkDestroySemaphore (dev, semaphore, IntPtr.Zero);
- semaphore = 0;
- }
- public VkFence CreateFence (bool signaled = false) {
- VkFence tmp;
- VkFenceCreateInfo info = VkFenceCreateInfo.New ();
- info.flags = signaled ? VkFenceCreateFlags.Signaled : 0;
- Utils.CheckResult (vkCreateFence (dev, ref info, IntPtr.Zero, out tmp));
- return tmp;
- }
- /// <summary>Destroy the fence.</summary>
- /// <param name="fence">A valid fence handle.</param>
- public void DestroyFence (VkFence fence) {
- vkDestroyFence (dev, fence, IntPtr.Zero);
- fence = 0;
- }
- public void WaitForFence (VkFence fence, ulong timeOut = UInt64.MaxValue) {
- vkWaitForFences (dev, 1, ref fence, 1, timeOut);
- }
- public void ResetFence (VkFence fence) {
- vkResetFences (dev, 1, ref fence);
- }
- public void WaitForFences (VkFence[] fences, ulong timeOut = UInt64.MaxValue) {
- vkWaitForFences (dev, (uint)fences.Length, fences.Pin(), 1, timeOut);
- fences.Unpin ();
- }
- public void ResetFences (params VkFence[] fences) {
- vkResetFences (dev, (uint)fences.Length, fences.Pin());
- fences.Unpin ();
- }
-
- public void DestroyShaderModule (VkShaderModule module) {
- vkDestroyShaderModule (VkDev, module, IntPtr.Zero);
- module = 0;
- }
- public void WaitIdle () {
- Utils.CheckResult (vkDeviceWaitIdle (dev));
- }
- public VkRenderPass CreateRenderPass (VkRenderPassCreateInfo info) {
- VkRenderPass renderPass;
- Utils.CheckResult (vkCreateRenderPass (dev, ref info, IntPtr.Zero, out renderPass));
- return renderPass;
- }
- internal VkSwapchainKHR CreateSwapChain (VkSwapchainCreateInfoKHR infos) {
- VkSwapchainKHR newSwapChain;
- Utils.CheckResult (vkCreateSwapchainKHR (dev, ref infos, IntPtr.Zero, out newSwapChain));
- return newSwapChain;
- }
- internal void DestroySwapChain (VkSwapchainKHR swapChain) {
- vkDestroySwapchainKHR (dev, swapChain, IntPtr.Zero);
- }
- unsafe public VkImage[] GetSwapChainImages (VkSwapchainKHR swapchain) {
- uint imageCount = 0;
- Utils.CheckResult (vkGetSwapchainImagesKHR (dev, swapchain, out imageCount, IntPtr.Zero));
- if (imageCount == 0)
- throw new Exception ("Swapchain image count is 0.");
- VkImage[] imgs = new VkImage[imageCount];
-
- Utils.CheckResult (vkGetSwapchainImagesKHR (dev, swapchain, out imageCount, imgs.Pin ()));
- imgs.Unpin ();
-
- return imgs;
- }
- unsafe public VkImageView CreateImageView (VkImage image, VkFormat format, VkImageViewType viewType = VkImageViewType.ImageView2D, VkImageAspectFlags aspectFlags = VkImageAspectFlags.Color) {
- VkImageView view;
- VkImageViewCreateInfo infos = VkImageViewCreateInfo.New ();
- infos.image = image;
- infos.viewType = viewType;
- infos.format = format;
- infos.components = new VkComponentMapping { r = VkComponentSwizzle.R, g = VkComponentSwizzle.G, b = VkComponentSwizzle.B, a = VkComponentSwizzle.A };
- infos.subresourceRange = new VkImageSubresourceRange (aspectFlags);
-
- Utils.CheckResult (vkCreateImageView (dev, ref infos, IntPtr.Zero, out view));
- return view;
- }
- public void DestroyImageView (VkImageView view) {
- vkDestroyImageView (dev, view, IntPtr.Zero);
- }
- public void DestroySampler (VkSampler sampler) {
- vkDestroySampler (dev, sampler, IntPtr.Zero);
- }
- public void DestroyImage (VkImage img) {
- vkDestroyImage (dev, img, IntPtr.Zero);
- }
- public void DestroyFramebuffer (VkFramebuffer fb) {
- vkDestroyFramebuffer (dev, fb, IntPtr.Zero);
- }
- public void DestroyRenderPass (VkRenderPass rp) {
- vkDestroyRenderPass (dev, rp, IntPtr.Zero);
- }
- // This function is used to request a Device memory type that supports all the property flags we request (e.g. Device local, host visibile)
- // Upon success it will return the index of the memory type that fits our requestes memory properties
- // This is necessary as implementations can offer an arbitrary number of memory types with different
- // memory properties.
- // You can check http://vulkan.gpuinfo.org/ for details on different memory configurations
- internal uint GetMemoryTypeIndex (uint typeBits, VkMemoryPropertyFlags properties) {
- // Iterate over all memory types available for the Device used in this example
- for (uint i = 0; i < phy.memoryProperties.memoryTypeCount; i++) {
- if ((typeBits & 1) == 1) {
- if ((phy.memoryProperties.memoryTypes[i].propertyFlags & properties) == properties) {
- return i;
- }
- }
- typeBits >>= 1;
- }
-
- throw new InvalidOperationException ("Could not find a suitable memory type!");
- }
- public VkFormat GetSuitableDepthFormat () {
- VkFormat[] formats = new VkFormat[] { VkFormat.D32SfloatS8Uint, VkFormat.D32Sfloat, VkFormat.D24UnormS8Uint, VkFormat.D16UnormS8Uint, VkFormat.D16Unorm };
- foreach (VkFormat f in formats) {
- if (phy.GetFormatProperties (f).optimalTilingFeatures.HasFlag(VkFormatFeatureFlags.DepthStencilAttachment))
- return f;
- }
- throw new InvalidOperationException ("No suitable depth format found.");
- }
-
- public VkShaderModule LoadSPIRVShader (string filename) {
- VkShaderModule shaderModule;
- using (Stream stream = StaticGetStreamFromPath (filename)) {
- using (BinaryReader br = new BinaryReader (stream)) {
- byte[] shaderCode = br.ReadBytes ((int)stream.Length);
- ulong shaderSize = (ulong)shaderCode.Length;
-
- // Create a new shader module that will be used for Pipeline creation
- VkShaderModuleCreateInfo moduleCreateInfo = VkShaderModuleCreateInfo.New ();
- moduleCreateInfo.codeSize = new UIntPtr (shaderSize);
- moduleCreateInfo.pCode = shaderCode.Pin ();
-
- Utils.CheckResult (vkCreateShaderModule (VkDev, ref moduleCreateInfo, IntPtr.Zero, out shaderModule));
-
- shaderCode.Unpin ();
- }
-
- }
- return shaderModule;
-
- }
-
- public static Stream StaticGetStreamFromPath (string path) {
- Stream stream = null;
-
- if (path.StartsWith ("#", StringComparison.Ordinal)) {
- string resId = path.Substring (1);
- //first search entry assembly
- stream = Assembly.GetEntryAssembly ().GetManifestResourceStream (resId);
- if (stream != null)
- return stream;
- //if not found, search assembly named with the 1st element of the resId
- string assemblyName = resId.Split ('.')[0];
- Assembly a = AppDomain.CurrentDomain.GetAssemblies ().FirstOrDefault (aa => aa.GetName ().Name == assemblyName);
- if (a == null)
- throw new Exception ($"Assembly '{assemblyName}' not found for ressource '{path}'.");
- stream = a.GetManifestResourceStream (resId);
- if (stream == null)
- throw new Exception ("Resource not found: " + path);
- } else {
- if (!File.Exists (path))
- throw new FileNotFoundException ("File not found: ", path);
- stream = new FileStream (path, FileMode.Open, FileAccess.Read);
- }
- return stream;
- }
-
-#region IDisposable Support
- private bool disposedValue = false; // Pour détecter les appels redondants
-
- protected virtual void Dispose (bool disposing) {
- if (!disposedValue) {
- if (disposing) {
-#if MEMORY_POOLS
- resourceManager.Dispose ();
-#endif
- } else
- System.Diagnostics.Debug.WriteLine ("Device disposed by Finalizer.");
-
- vkDestroyDevice (dev, IntPtr.Zero);
-
- disposedValue = true;
- }
- }
-
- ~Device() {
- Dispose(false);
- }
-
- // Ce code est ajouté pour implémenter correctement le modèle supprimable.
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize(this);
- }
-#endregion
- }
-}
diff --git a/CVKL/src/base/FrameBuffer.cs b/CVKL/src/base/FrameBuffer.cs
deleted file mode 100644
index 2f668e0..0000000
--- a/CVKL/src/base/FrameBuffer.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// FrameBuffer.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using VK;
-
-using static VK.Vk;
-
-namespace CVKL {
-
- public class Framebuffer : Activable {
- internal VkFramebuffer handle;
- RenderPass renderPass;
-
- public List<Image> attachments = new List<Image> ();
- VkFramebufferCreateInfo createInfo = VkFramebufferCreateInfo.New();
-
- public uint Width => createInfo.width;
- public uint Height => createInfo.height;
- public uint Layers => createInfo.layers;
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT(VkDebugReportObjectTypeEXT.FramebufferEXT, handle.Handle);
-
- #region CTORS
- public Framebuffer (RenderPass _renderPass, uint _width, uint _height, uint _layers = 1) : base(_renderPass.Dev) {
- renderPass = _renderPass;
- createInfo.width = _width;
- createInfo.height = _height;
- createInfo.layers = _layers;
- createInfo.renderPass = renderPass.handle;
- }
-
- public Framebuffer (RenderPass _renderPass, uint _width, uint _height, params Image[] views)
- : this (_renderPass, _width, _height) {
- for (int i = 0; i < views.Length; i++) {
- Image v = views[i];
- if (v == null) {
- //automatically create attachment if not in unused state in the renderpass
- VkAttachmentDescription ad = renderPass.attachments[i];
- VkImageUsageFlags usage = 0;
- VkImageAspectFlags aspectFlags = 0;
-
- Utils.QueryLayoutRequirements (ad.initialLayout, ref usage, ref aspectFlags);
- Utils.QueryLayoutRequirements (ad.finalLayout, ref usage, ref aspectFlags);
- foreach (SubPass sp in renderPass.subpasses) {
- //TODO:check subpass usage
- }
-
- v = new Image (renderPass.Dev, ad.format, usage, VkMemoryPropertyFlags.DeviceLocal,
- _width, _height, VkImageType.Image2D, ad.samples, VkImageTiling.Optimal, 1, createInfo.layers);
- v.SetName ($"fbImg{i}");
- v.CreateView (VkImageViewType.ImageView2D, aspectFlags);
- } else
- v.Activate ();//increase ref and create handle if not already activated
-
- attachments.Add (v);
- }
- Activate ();
- }
- #endregion
-
- public override void Activate () {
- if (state != ActivableState.Activated) {
- VkImageView[] views = attachments.Select (a => a.Descriptor.imageView).ToArray ();
- createInfo.attachmentCount = (uint)views.Length;
- createInfo.pAttachments = views.Pin ();
-
- Utils.CheckResult (vkCreateFramebuffer (renderPass.Dev.VkDev, ref createInfo, IntPtr.Zero, out handle));
-
- views.Unpin ();
- }
- base.Activate ();
- }
-
-
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{handle.Handle.ToString("x")}]");
- }
-
-#region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (state == ActivableState.Activated)
- Dev.DestroyFramebuffer (handle);
- if (disposing) {
- foreach (Image img in attachments)
- img.Dispose();
- }else
- System.Diagnostics.Debug.WriteLine ("VKE Activable object disposed by finalizer");
-
- base.Dispose (disposing);
- }
-#endregion
-
- }
-}
diff --git a/CVKL/src/base/GPUBuffer.cs b/CVKL/src/base/GPUBuffer.cs
deleted file mode 100644
index 61504fd..0000000
--- a/CVKL/src/base/GPUBuffer.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// GPUBuffer.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL {
-
- /// <summary>
- /// Device local Buffer
- /// </summary>
- public class GPUBuffer : Buffer {
- public GPUBuffer (Device device, VkBufferUsageFlags usage, UInt64 size)
- : base (device, usage, VkMemoryPropertyFlags.DeviceLocal, size){
- }
- }
- /// <summary>
- /// Device local Buffer
- /// </summary>
- public class GPUBuffer<T> : GPUBuffer {
-
- public int ElementCount { get; private set; }
-
- public GPUBuffer (Device device, VkBufferUsageFlags usage, int elementCount)
- : base (device, usage, (ulong)(Marshal.SizeOf<T> () * elementCount)) {
- ElementCount = elementCount;
- }
- public GPUBuffer (Queue staggingQ, CommandPool staggingCmdPool, VkBufferUsageFlags usage, T[] elements)
- : base (staggingQ.Dev, usage | VkBufferUsageFlags.TransferDst, (ulong)(Marshal.SizeOf<T> () * elements.Length)) {
- using (HostBuffer<T> stagging = new HostBuffer<T> (Dev, VkBufferUsageFlags.TransferSrc, elements)) {
- CommandBuffer cmd = staggingCmdPool.AllocateCommandBuffer ();
- cmd.Start (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- stagging.CopyTo (cmd, this);
-
- cmd.End ();
-
- staggingQ.Submit (cmd);
- staggingQ.WaitIdle ();
-
- cmd.Free ();
- }
- }
- }
-}
diff --git a/CVKL/src/base/GraphicPipeline.cs b/CVKL/src/base/GraphicPipeline.cs
deleted file mode 100644
index 562e4fa..0000000
--- a/CVKL/src/base/GraphicPipeline.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-//
-// FrameBuffer.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- public class GraphicPipeline : Pipeline {
-
- public readonly RenderPass RenderPass;
- public VkSampleCountFlags Samples => RenderPass.Samples;
-
- #region CTORS
- protected GraphicPipeline (RenderPass renderPass, PipelineCache cache = null, string name = "graphic pipeline") : base(renderPass.Dev, cache, name) {
- RenderPass = renderPass;
- handle.SetDebugMarkerName (Dev, name);
- }
- /// <summary>
- /// Create a new Pipeline with supplied RenderPass
- /// </summary>
- public GraphicPipeline (GraphicPipelineConfig cfg, string name = "graphic pipeline") : this (cfg.RenderPass, cfg.Cache, name)
- {
- layout = cfg.Layout;
-
- init (cfg);
- }
-
- #endregion
-
- public override void Activate () => throw new NotSupportedException ("Please initialize graphic pipeline through the init method");
-
- protected void init (GraphicPipelineConfig cfg) {
- if (state != ActivableState.Activated) {
- Layout.Activate ();
- RenderPass.Activate ();
- Cache?.Activate ();
-
- List<VkPipelineShaderStageCreateInfo> shaderStages = new List<VkPipelineShaderStageCreateInfo> ();
- foreach (ShaderInfo shader in cfg.shaders)
- shaderStages.Add (shader.GetStageCreateInfo (Dev));
-
- VkPipelineColorBlendStateCreateInfo colorBlendInfo = VkPipelineColorBlendStateCreateInfo.New ();
- colorBlendInfo.attachmentCount = (uint)cfg.blendAttachments.Count;
- colorBlendInfo.pAttachments = cfg.blendAttachments.Pin ();
-
- VkPipelineDynamicStateCreateInfo dynStatesInfo = VkPipelineDynamicStateCreateInfo.New ();
- dynStatesInfo.dynamicStateCount = (uint)cfg.dynamicStates.Count;
- dynStatesInfo.pDynamicStates = cfg.dynamicStates.Pin ();
-
- VkPipelineVertexInputStateCreateInfo vertInputInfo = VkPipelineVertexInputStateCreateInfo.New ();
- vertInputInfo.vertexBindingDescriptionCount = (uint)cfg.vertexBindings.Count;
- vertInputInfo.pVertexBindingDescriptions = cfg.vertexBindings.Pin ();
- vertInputInfo.vertexAttributeDescriptionCount = (uint)cfg.vertexAttributes.Count;
- vertInputInfo.pVertexAttributeDescriptions = cfg.vertexAttributes.Pin ();
-
- VkGraphicsPipelineCreateInfo info = VkGraphicsPipelineCreateInfo.New ();
- info.renderPass = RenderPass.handle;
- info.layout = Layout.handle;
- info.pVertexInputState = vertInputInfo.Pin ();
- info.pInputAssemblyState = cfg.inputAssemblyState.Pin ();
- info.pRasterizationState = cfg.rasterizationState.Pin ();
- info.pColorBlendState = colorBlendInfo.Pin ();
- info.pMultisampleState = cfg.multisampleState.Pin ();
- info.pViewportState = cfg.viewportState.Pin ();
- info.pDepthStencilState = cfg.depthStencilState.Pin ();
- info.pDynamicState = dynStatesInfo.Pin ();
- info.stageCount = (uint)cfg.shaders.Count;
- info.pStages = shaderStages.Pin ();
- info.subpass = cfg.SubpassIndex;
-
- Utils.CheckResult (vkCreateGraphicsPipelines (Dev.VkDev, Cache == null ? VkPipelineCache.Null : Cache.handle, 1, ref info, IntPtr.Zero, out handle));
-
- for (int i = 0; i < cfg.shaders.Count; i++)
- Dev.DestroyShaderModule (shaderStages[i].module);
-
- vertInputInfo.Unpin ();
- cfg.inputAssemblyState.Unpin ();
- cfg.rasterizationState.Unpin ();
- colorBlendInfo.Unpin ();
- cfg.multisampleState.Unpin ();
- cfg.viewportState.Unpin ();
- cfg.depthStencilState.Unpin ();
- dynStatesInfo.Unpin ();
- shaderStages.Unpin ();
-
- cfg.vertexAttributes.Unpin ();
- cfg.vertexBindings.Unpin ();
- cfg.dynamicStates.Unpin ();
- cfg.blendAttachments.Unpin ();
- }
- base.Activate ();
- }
-
- public override void Bind (CommandBuffer cmd) {
- vkCmdBindPipeline (cmd.Handle, VkPipelineBindPoint.Graphics, handle);
- }
- public override void BindDescriptorSet (CommandBuffer cmd, DescriptorSet dset, uint firstSet = 0) {
- cmd.BindDescriptorSet (VkPipelineBindPoint.Graphics, layout, dset, firstSet);
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (state == ActivableState.Activated)
- RenderPass.Dispose ();
- }else
- System.Diagnostics.Debug.WriteLine ("GraphicPipeline disposed by finalizer");
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/CVKL/src/base/GraphicPipelineConfig.cs b/CVKL/src/base/GraphicPipelineConfig.cs
deleted file mode 100644
index 56b74ca..0000000
--- a/CVKL/src/base/GraphicPipelineConfig.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// PipelineConfig.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- public class GraphicPipelineConfig {
- public uint SubpassIndex;
- public PipelineLayout Layout;
- public RenderPass RenderPass;
- public PipelineCache Cache;
- public VkPipelineBindPoint bindPoint = VkPipelineBindPoint.Graphics;
- public VkPipelineInputAssemblyStateCreateInfo inputAssemblyState = VkPipelineInputAssemblyStateCreateInfo.New();
- public VkPipelineRasterizationStateCreateInfo rasterizationState = VkPipelineRasterizationStateCreateInfo.New();
- public VkPipelineViewportStateCreateInfo viewportState = VkPipelineViewportStateCreateInfo.New();
- public VkPipelineDepthStencilStateCreateInfo depthStencilState = VkPipelineDepthStencilStateCreateInfo.New();
- public VkPipelineMultisampleStateCreateInfo multisampleState = VkPipelineMultisampleStateCreateInfo.New();
- public List<VkPipelineColorBlendAttachmentState> blendAttachments = new List<VkPipelineColorBlendAttachmentState>();
- public List<VkDynamicState> dynamicStates = new List<VkDynamicState> ();
- public List<VkVertexInputBindingDescription> vertexBindings = new List<VkVertexInputBindingDescription> ();
- public List<VkVertexInputAttributeDescription> vertexAttributes = new List<VkVertexInputAttributeDescription> ();
- public readonly List<ShaderInfo> shaders = new List<ShaderInfo>();
-
- public VkSampleCountFlags Samples {
- get { return multisampleState.rasterizationSamples; }
- }
-
- public GraphicPipelineConfig () {
-
- }
-
- /// <summary>
- /// Create a default pipeline configuration with viewport and scissor as dynamic states. One blend attachment is
- /// added automatically with blending disabled. (cfg.blendAttachments[0])
- /// </summary>
- public static GraphicPipelineConfig CreateDefault (VkPrimitiveTopology topology = VkPrimitiveTopology.TriangleList,
- VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1, bool depthTestEnabled = true)
- {
- GraphicPipelineConfig cfg = new GraphicPipelineConfig ();
-
- cfg.inputAssemblyState.topology = topology;
- cfg.multisampleState.rasterizationSamples = samples;
-
- cfg.rasterizationState.polygonMode = VkPolygonMode.Fill;
- cfg.rasterizationState.cullMode = (uint)VkCullModeFlags.None;
- cfg.rasterizationState.frontFace = VkFrontFace.CounterClockwise;
- cfg.rasterizationState.depthClampEnable = False;
- cfg.rasterizationState.rasterizerDiscardEnable = False;
- cfg.rasterizationState.depthBiasEnable = False;
- cfg.rasterizationState.lineWidth = 1.0f;
-
- cfg.viewportState.viewportCount = 1;
- cfg.viewportState.scissorCount = 1;
-
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
-
- cfg.dynamicStates.Add (VkDynamicState.Viewport);
- cfg.dynamicStates.Add (VkDynamicState.Scissor);
-
- if (depthTestEnabled) {
- cfg.depthStencilState.depthTestEnable = True;
- cfg.depthStencilState.depthWriteEnable = True;
- cfg.depthStencilState.depthCompareOp = VkCompareOp.LessOrEqual;
- cfg.depthStencilState.depthBoundsTestEnable = False;
- cfg.depthStencilState.back.failOp = VkStencilOp.Keep;
- cfg.depthStencilState.back.passOp = VkStencilOp.Keep;
- cfg.depthStencilState.back.compareOp = VkCompareOp.Always;
- cfg.depthStencilState.stencilTestEnable = False;
- cfg.depthStencilState.front = cfg.depthStencilState.back;
- }
-
- return cfg;
- }
-
- uint currentAttributeIndex = 0;
- public void AddVertexAttributes (uint binding, params VkFormat[] attribsDesc) {
- uint currentAttributeoffset = 0;
- for (uint i = 0; i < attribsDesc.Length; i++) {
- vertexAttributes.Add (new VkVertexInputAttributeDescription (binding, i + currentAttributeIndex, attribsDesc[i], currentAttributeoffset));
- VkFormatSize fs;
- Utils.vkGetFormatSize (attribsDesc[i], out fs);
- currentAttributeoffset += fs.blockSizeInBits/8;
- }
- currentAttributeIndex += (uint)attribsDesc.Length;
- }
- public void AddVertexBinding (uint binding, uint stride, VkVertexInputRate inputRate = VkVertexInputRate.Vertex) {
- vertexBindings.Add (new VkVertexInputBindingDescription (binding, stride, inputRate));
- }
- public void AddVertexBinding<T> (uint binding = 0, VkVertexInputRate inputRate = VkVertexInputRate.Vertex) {
- vertexBindings.Add (new VkVertexInputBindingDescription (binding, (uint)Marshal.SizeOf<T> (), inputRate));
- }
- /// <summary>
- /// Automatically configure Attribute for that binding.
- /// </summary>
- public void AddVertex<T> (uint binding = 0, VkVertexInputRate inputRate = VkVertexInputRate.Vertex) {
- vertexBindings.Add (new VkVertexInputBindingDescription (binding, (uint)Marshal.SizeOf<T> (), inputRate));
- FieldInfo[] fields = typeof (T).GetFields ();
- VkFormat[] attribs = new VkFormat[fields.Length];
- for (int i = 0; i < fields.Length; i++)
- attribs[i] = fields[i].GetCustomAttribute<VertexAttributeAttribute> ().Format;
- AddVertexAttributes (binding, attribs);
- }
- public void AddShader (VkShaderStageFlags _stageFlags, string _spirvPath, SpecializationInfo specializationInfo = null, string _entryPoint = "main") {
- shaders.Add (new ShaderInfo (_stageFlags, _spirvPath, specializationInfo, _entryPoint));
- }
-
- public void ResetShadersAndVerticesInfos () {
- foreach (ShaderInfo shader in shaders)
- shader.Dispose ();
- currentAttributeIndex = 0;
- vertexBindings.Clear ();
- vertexAttributes.Clear ();
- shaders.Clear ();
- }
- }
-}
diff --git a/CVKL/src/base/HostBuffer.cs b/CVKL/src/base/HostBuffer.cs
deleted file mode 100644
index 20734c8..0000000
--- a/CVKL/src/base/HostBuffer.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-//
-// HostBuffer.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
-
- public class HostBuffer<T> : HostBuffer {
- int TSize;
-
- public HostBuffer (Device device, VkBufferUsageFlags usage, uint arrayElementCount, bool keepMapped = false, bool coherentMem = true)
- : base (device, usage, (ulong)(Marshal.SizeOf<T> () * arrayElementCount), keepMapped, coherentMem) {
- TSize = Marshal.SizeOf<T>();
- }
- public HostBuffer (Device device, VkBufferUsageFlags usage, IList<T> data, bool keepMapped = false, bool coherentMem = true)
- : base (device, usage, (ulong)(Marshal.SizeOf<T> () * data.Count), keepMapped, coherentMem) {
- TSize = Marshal.SizeOf<T>();
- Map();
- Update (data, createInfo.size);
- if (!keepMapped)
- Unmap ();
- }
- public HostBuffer (Device device, VkBufferUsageFlags usage, T[] data, bool keepMapped = false, bool coherentMem = true)
- : base (device, usage, (ulong)(Marshal.SizeOf<T> () * data.Length), keepMapped, coherentMem) {
- TSize = Marshal.SizeOf<T>();
- Map();
- Update (data, createInfo.size);
- if (!keepMapped)
- Unmap ();
- }
- public void Update (T[] data) {
- Update (data, (ulong)(TSize * data.Length));
- }
- public void Update (uint index, T data) {
- GCHandle ptr = GCHandle.Alloc(data, GCHandleType.Pinned);
- unsafe {
- System.Buffer.MemoryCopy(ptr.AddrOfPinnedObject().ToPointer(), (mappedData + (int)(TSize*index)).ToPointer(), TSize, TSize);
- }
- ptr.Free();
- }
- public void Flush (uint startIndex, uint endIndex) {
- VkMappedMemoryRange mr = new VkMappedMemoryRange
- {
- sType = VkStructureType.MappedMemoryRange,
-#if MEMORY_POOLS
- memory = memoryPool.vkMemory,
- offset = poolOffset + (ulong)(startIndex * TSize),
-#else
- memory = vkMemory,
- offset = (ulong)(startIndex * TSize),
-#endif
- size = (ulong)((endIndex - startIndex) * TSize)
- };
- vkFlushMappedMemoryRanges(Dev.VkDev, 1, ref mr);
- }
- }
- /// <summary>
- /// Mappable Buffer with HostVisble and HostCoherent memory flags
- /// </summary>
- public class HostBuffer : Buffer {
- public HostBuffer (Device device, VkBufferUsageFlags usage, UInt64 size, bool keepMapped = false, bool coherentMem = true)
- : base (device, usage, coherentMem ? VkMemoryPropertyFlags.HostVisible | VkMemoryPropertyFlags.HostCoherent : VkMemoryPropertyFlags.HostVisible, size) {
- if (keepMapped)
- Map();
- }
- public HostBuffer (Device device, VkBufferUsageFlags usage, object data, bool keepMapped = false, bool coherentMem = true)
- : base (device, usage, coherentMem ? VkMemoryPropertyFlags.HostVisible | VkMemoryPropertyFlags.HostCoherent : VkMemoryPropertyFlags.HostVisible, (ulong)Marshal.SizeOf(data)) {
- Map ();
- Update (data, createInfo.size);
- if (!keepMapped)
- Unmap ();
- }
- public HostBuffer (Device device, VkBufferUsageFlags usage, UInt64 size, IntPtr data, bool keepMapped = false, bool coherentMem = true)
- : base (device, usage, coherentMem ? VkMemoryPropertyFlags.HostVisible | VkMemoryPropertyFlags.HostCoherent : VkMemoryPropertyFlags.HostVisible, size) {
- Map ();
- unsafe {
- System.Buffer.MemoryCopy (data.ToPointer (), mappedData.ToPointer (), size, size);
- }
- if (!keepMapped)
- Unmap ();
- }
- }
-}
diff --git a/CVKL/src/base/Image.cs b/CVKL/src/base/Image.cs
deleted file mode 100644
index 3787e3c..0000000
--- a/CVKL/src/base/Image.cs
+++ /dev/null
@@ -1,643 +0,0 @@
-//
-// Buffer.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Diagnostics;
-using VK;
-
-using static VK.Vk;
-
-namespace CVKL {
- /// <summary>
- /// Combined Image/Descriptor class. Optional Sampler and View are disposed with the vkImage. If multiple view/sampler have to be
- /// created for the same vkImage, you may call the constructor accepting a vkImage as parameter to import an existing one. vkImage handle of
- /// such imported image will not be disposed with the sampler and the view.
- /// </summary>
- public class Image : Resource {
- public static VkFormat DefaultTextureFormat = VkFormat.R8g8b8a8Unorm;
-
- internal VkImage handle;
- VkImageCreateInfo info = VkImageCreateInfo.New();
-
- /// <summary>
- /// if true, the vkImage handle will not be destroyed on dispose, useful to create image for swapchain
- /// </summary>
- bool imported;
-
- public VkDescriptorImageInfo Descriptor;
- public VkImageCreateInfo CreateInfo => info;
- public VkExtent3D Extent => info.extent;
- public VkFormat Format => info.format;
- public VkImage Handle => handle;
- public uint Width => CreateInfo.extent.width;
- public uint Height => CreateInfo.extent.height;
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT(VkDebugReportObjectTypeEXT.ImageEXT, handle.Handle);
-
- #region CTORS
- public Image (Device device, VkFormat format, VkImageUsageFlags usage, VkMemoryPropertyFlags _memoryPropertyFlags,
- uint width, uint height,
- VkImageType type = VkImageType.Image2D, VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1,
- VkImageTiling tiling = VkImageTiling.Optimal, uint mipsLevels = 1, uint layers = 1, uint depth = 1,
- VkImageCreateFlags createFlags = 0)
- : base (device, _memoryPropertyFlags) {
-
- info.imageType = type;
- info.format = format;
- info.extent.width = width;
- info.extent.height = height;
- info.extent.depth = depth;
- info.mipLevels = mipsLevels;
- info.arrayLayers = layers;
- info.samples = samples;
- info.tiling = tiling;
- info.usage = usage;
- info.initialLayout = (tiling == VkImageTiling.Optimal) ? VkImageLayout.Undefined : VkImageLayout.Preinitialized;
- info.sharingMode = VkSharingMode.Exclusive;
- info.flags = createFlags;
-
- Activate ();//DONT OVERRIDE Activate in derived classes!!!!
- }
-
- /// <summary>
- /// Import vkImage handle into a new Image class, handle will be preserve on destruction.
- /// </summary>
- public Image (Device device, VkImage vkHandle, VkFormat format, VkImageUsageFlags usage, uint width, uint height)
- : base (device, VkMemoryPropertyFlags.DeviceLocal) {
- info.imageType = VkImageType.Image2D;
- info.format = format;
- info.extent.width = width;
- info.extent.height = height;
- info.extent.depth = 1;
- info.mipLevels = 1;
- info.arrayLayers = 1;
- info.samples = VkSampleCountFlags.SampleCount1;
- info.tiling = VkImageTiling.Optimal;
- info.usage = usage;
-
- handle = vkHandle;
- imported = true;
-
- state = ActivableState.Activated;
- references++;//increment ref because it is bound to swapchain
- }
- #endregion
-
- public static uint ComputeMipLevels(uint size) => (uint)Math.Floor (Math.Log (size)) + 1;
- public static uint ComputeMipLevels (int width, int height) => (uint)Math.Floor (Math.Log (Math.Max (width, height))) + 1;
-
- public static bool CheckFormatIsSupported (VkImageUsageFlags usage, VkFormatFeatureFlags phyFormatSupport) {
- if (usage.HasFlag (VkImageUsageFlags.TransferSrc) & !phyFormatSupport.HasFlag (VkFormatFeatureFlags.TransferSrc))
- return false;
- if (usage.HasFlag (VkImageUsageFlags.TransferDst) & !phyFormatSupport.HasFlag (VkFormatFeatureFlags.TransferSrc))
- return false;
- if (usage.HasFlag (VkImageUsageFlags.Sampled) & !phyFormatSupport.HasFlag (VkFormatFeatureFlags.SampledImage))
- return false;
- if (usage.HasFlag (VkImageUsageFlags.Storage) & !phyFormatSupport.HasFlag (VkFormatFeatureFlags.StorageImage))
- return false;
- if (usage.HasFlag (VkImageUsageFlags.ColorAttachment) & !phyFormatSupport.HasFlag (VkFormatFeatureFlags.ColorAttachment))
- return false;
- if (usage.HasFlag (VkImageUsageFlags.DepthStencilAttachment) & !phyFormatSupport.HasFlag (VkFormatFeatureFlags.DepthStencilAttachment))
- return false;
- /*if (usage.HasFlag (VkImageUsageFlags.TransientAttachment) ^ phyFormatSupport.HasFlag (VkFormatFeatureFlags.))
- return false;*/
- if (usage.HasFlag (VkImageUsageFlags.InputAttachment) & !phyFormatSupport.HasFlag (VkFormatFeatureFlags.SampledImage))
- return false;
- /*if (usage.HasFlag (VkImageUsageFlags.ShadingRateImageNV) ^ phyFormatSupport.HasFlag (VkFormatFeatureFlags.TransferSrc))
- return false;
- if (usage.HasFlag (VkImageUsageFlags.FragmentDensityMapEXT) ^ phyFormatSupport.HasFlag (VkFormatFeatureFlags.TransferSrc))
- return false;*/
- return true;
- }
- /// <summary>
- /// Load image from byte array containing full image file (jpg, png,...)
- /// </summary>
- public static Image Load (Device dev, Queue staggingQ, CommandPool staggingCmdPool,
- byte[] bitmap, VkFormat format = VkFormat.Undefined,
- VkMemoryPropertyFlags memoryProps = VkMemoryPropertyFlags.DeviceLocal,
- VkImageTiling tiling = VkImageTiling.Optimal, bool generateMipmaps = true,
- VkImageType imageType = VkImageType.Image2D,
- VkImageUsageFlags usage = VkImageUsageFlags.Sampled | VkImageUsageFlags.TransferSrc | VkImageUsageFlags.TransferDst) {
-
- Image img = Load (dev, staggingQ, staggingCmdPool, bitmap.Pin (), (ulong)bitmap.Length, format, memoryProps, tiling, generateMipmaps,
- imageType, usage);
- bitmap.Unpin ();
- return img;
- }
-
- #region bitmap loading
- /// <summary>
- /// Load image from data pointed by IntPtr pointer containing full image file (jpg, png,...)
- /// </summary>
- public static Image Load (Device dev, Queue staggingQ, CommandPool staggingCmdPool,
- IntPtr bitmap, ulong bitmapByteCount, VkFormat format = VkFormat.Undefined,
- VkMemoryPropertyFlags memoryProps = VkMemoryPropertyFlags.DeviceLocal,
- VkImageTiling tiling = VkImageTiling.Optimal, bool generateMipmaps = true,
- VkImageType imageType = VkImageType.Image2D,
- VkImageUsageFlags usage = VkImageUsageFlags.Sampled | VkImageUsageFlags.TransferSrc | VkImageUsageFlags.TransferDst) {
-
- if (format == VkFormat.Undefined)
- format = DefaultTextureFormat;
- if (tiling == VkImageTiling.Optimal)
- usage |= VkImageUsageFlags.TransferDst;
- if (generateMipmaps)
- usage |= (VkImageUsageFlags.TransferSrc | VkImageUsageFlags.TransferDst);
-
- using (StbImage stbi = new StbImage (bitmap, bitmapByteCount)) {
- uint mipLevels = generateMipmaps ? ComputeMipLevels (stbi.Width, stbi.Height) : 1;
-
- Image img = new Image (dev, format, usage, memoryProps, (uint)stbi.Width, (uint)stbi.Height, imageType,
- VkSampleCountFlags.SampleCount1, tiling, mipLevels);
-
- img.load (staggingQ, staggingCmdPool, stbi.Handle, generateMipmaps);
-
- return img;
- }
- }
-
- /// <summary>
- /// Load bitmap into Image with stagging and mipmap generation if necessary
- /// and usage.
- /// </summary>
- public static Image Load (Device dev, Queue staggingQ, CommandPool staggingCmdPool,
- string path, VkFormat format = VkFormat.Undefined,
- VkMemoryPropertyFlags memoryProps = VkMemoryPropertyFlags.DeviceLocal,
- VkImageTiling tiling = VkImageTiling.Optimal, bool generateMipmaps = true,
- VkImageType imageType = VkImageType.Image2D,
- VkImageUsageFlags usage = VkImageUsageFlags.Sampled | VkImageUsageFlags.TransferSrc | VkImageUsageFlags.TransferDst) {
-
- if (format == VkFormat.Undefined)
- format = DefaultTextureFormat;
- if (tiling == VkImageTiling.Optimal)
- usage |= VkImageUsageFlags.TransferDst;
- if (generateMipmaps)
- usage |= (VkImageUsageFlags.TransferSrc | VkImageUsageFlags.TransferDst);
-
- using (StbImage stbi = new StbImage (path)) {
- uint mipLevels = generateMipmaps ? ComputeMipLevels (stbi.Width, stbi.Height) : 1;
-
- Image img = new Image (dev, format, usage, memoryProps, (uint)stbi.Width, (uint)stbi.Height, imageType,
- VkSampleCountFlags.SampleCount1, tiling, mipLevels);
-
- img.load (staggingQ, staggingCmdPool, stbi.Handle, generateMipmaps);
-
- return img;
- }
- }
-
- /// <summary>
- /// create host visible linear image without command from path
- /// </summary>
- public static Image Load (Device dev,
- string path, VkImageUsageFlags usage = VkImageUsageFlags.Sampled, bool reserveSpaceForMipmaps = true, VkFormat format = VkFormat.Undefined,
- VkMemoryPropertyFlags memoryProps = VkMemoryPropertyFlags.HostVisible | VkMemoryPropertyFlags.HostCoherent,
- VkImageTiling tiling = VkImageTiling.Linear, VkImageType imageType = VkImageType.Image2D) {
-
- if (format == VkFormat.Undefined)
- format = DefaultTextureFormat;
-
- using (StbImage stbi = new StbImage (path)) {
- uint mipLevels = reserveSpaceForMipmaps ? ComputeMipLevels (stbi.Width, stbi.Height) : 1;
-
- Image img = new Image (dev, format, usage, memoryProps, (uint)stbi.Width, (uint)stbi.Height, imageType,
- VkSampleCountFlags.SampleCount1, tiling, mipLevels);
-
- img.Map ();
- stbi.CoptyTo (img.MappedData);
- img.Unmap ();
-
- return img;
- }
- }
- /// <summary>
- /// create host visible linear image without command from byte array
- /// </summary>
- public static Image Load (Device dev,
- byte[] bitmap, VkImageUsageFlags usage = VkImageUsageFlags.TransferSrc,
- VkFormat format = VkFormat.Undefined,
- VkMemoryPropertyFlags memoryProps = VkMemoryPropertyFlags.HostVisible | VkMemoryPropertyFlags.HostCoherent,
- VkImageTiling tiling = VkImageTiling.Linear, bool generateMipmaps = false,
- VkImageType imageType = VkImageType.Image2D) {
-
- Image img = Load (dev, bitmap.Pin (), (ulong)bitmap.Length, usage, format, memoryProps, tiling, generateMipmaps,
- imageType);
- bitmap.Unpin ();
- return img;
- }
- /// <summary>
- /// create host visible linear image without command from data pointed by IntPtr pointer containing full image file (jpg, png,...)
- /// </summary>
- public static Image Load (Device dev,
- IntPtr bitmap, ulong bitmapByteCount, VkImageUsageFlags usage = VkImageUsageFlags.TransferSrc,
- VkFormat format = VkFormat.Undefined,
- VkMemoryPropertyFlags memoryProps = VkMemoryPropertyFlags.HostVisible | VkMemoryPropertyFlags.HostCoherent,
- VkImageTiling tiling = VkImageTiling.Linear, bool generateMipmaps = false,
- VkImageType imageType = VkImageType.Image2D) {
-
- if (format == VkFormat.Undefined)
- format = DefaultTextureFormat;
- if (generateMipmaps)
- usage |= (VkImageUsageFlags.TransferSrc | VkImageUsageFlags.TransferDst);
-
- using (StbImage stbi = new StbImage (bitmap, bitmapByteCount)) {
- uint mipLevels = generateMipmaps ? ComputeMipLevels (stbi.Width, stbi.Height) : 1;
-
- Image img = new Image (dev, format, usage, memoryProps, (uint)stbi.Width, (uint)stbi.Height, imageType,
- VkSampleCountFlags.SampleCount1, tiling, mipLevels);
-
- img.Map ();
- stbi.CoptyTo (img.MappedData);
- img.Unmap ();
-
- return img;
- }
- }
-
- /// <summary>
- /// load bitmap from pointer
- /// </summary>
- void load (Queue staggingQ, CommandPool staggingCmdPool, IntPtr bitmap, bool generateMipmaps = true) {
- long size = info.extent.width * info.extent.height * 4 * info.extent.depth;
-
- if (MemoryFlags.HasFlag (VkMemoryPropertyFlags.HostVisible)) {
- Map ();
- unsafe {
- System.Buffer.MemoryCopy (bitmap.ToPointer (), MappedData.ToPointer (), size, size);
- }
- Unmap ();
-
- if (generateMipmaps)
- BuildMipmaps (staggingQ, staggingCmdPool);
- } else {
- using (HostBuffer stagging = new HostBuffer (Dev, VkBufferUsageFlags.TransferSrc, (UInt64)size, bitmap)) {
-
- CommandBuffer cmd = staggingCmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- stagging.CopyTo (cmd, this);
- if (generateMipmaps)
- BuildMipmaps (cmd);
-
- cmd.End ();
- staggingQ.Submit (cmd);
- staggingQ.WaitIdle ();
- cmd.Free ();
- }
- }
- }
-
- #endregion
-
- internal override void updateMemoryRequirements () {
- vkGetImageMemoryRequirements (Dev.VkDev, handle, out memReqs);
- }
- internal override void bindMemory () {
-#if MEMORY_POOLS
- Utils.CheckResult (vkBindImageMemory (Dev.VkDev, handle, memoryPool.vkMemory, poolOffset));
-#else
- Utils.CheckResult (vkBindImageMemory (Dev.VkDev, handle, vkMemory, 0));
-#endif
- }
- public override void Activate () {
- if (state != ActivableState.Activated) {
- Utils.CheckResult (vkCreateImage (Dev.VkDev, ref info, IntPtr.Zero, out handle));
-#if MEMORY_POOLS
- Dev.resourceManager.Add (this);
-#else
- updateMemoryRequirements ();
- allocateMemory ();
- bindMemory ();
-#endif
-
- }
- base.Activate ();
- }
-
- public void CreateView (VkImageViewType type = VkImageViewType.ImageView2D, VkImageAspectFlags aspectFlags = VkImageAspectFlags.Color,
- uint layerCount = 1,
- uint baseMipLevel = 0, int levelCount = -1, uint baseArrayLayer = 0,
- VkComponentSwizzle r = VkComponentSwizzle.R,
- VkComponentSwizzle g = VkComponentSwizzle.G,
- VkComponentSwizzle b = VkComponentSwizzle.B,
- VkComponentSwizzle a = VkComponentSwizzle.A) {
-
- VkImageView view = default(VkImageView);
- VkImageViewCreateInfo viewInfo = VkImageViewCreateInfo.New();
- viewInfo.image = handle;
- viewInfo.viewType = type;
- viewInfo.format = Format;
- viewInfo.components.r = r;
- viewInfo.components.g = g;
- viewInfo.components.b = b;
- viewInfo.components.a = a;
- viewInfo.subresourceRange.aspectMask = aspectFlags;
- viewInfo.subresourceRange.baseMipLevel = baseMipLevel;
- viewInfo.subresourceRange.levelCount = levelCount < 0 ? info.mipLevels : (uint)levelCount;
- viewInfo.subresourceRange.baseArrayLayer = baseArrayLayer;
- viewInfo.subresourceRange.layerCount = layerCount;
-
- Utils.CheckResult (vkCreateImageView (Dev.VkDev, ref viewInfo, IntPtr.Zero, out view));
-
- if (Descriptor.imageView.Handle != 0)
- Dev.DestroyImageView (Descriptor.imageView);
- Descriptor.imageView = view;
- }
-
- public void CreateSampler (VkSamplerAddressMode addressMode, VkFilter minFilter = VkFilter.Linear,
- VkFilter magFilter = VkFilter.Linear, VkSamplerMipmapMode mipmapMode = VkSamplerMipmapMode.Linear,
- float maxAnisotropy = 1.0f, float minLod = 0.0f, float maxLod = -1f) {
- CreateSampler (minFilter, magFilter, mipmapMode, addressMode, maxAnisotropy, minLod, maxLod);
- }
-
- public void CreateSampler (VkFilter minFilter = VkFilter.Linear, VkFilter magFilter = VkFilter.Linear,
- VkSamplerMipmapMode mipmapMode = VkSamplerMipmapMode.Linear, VkSamplerAddressMode addressMode = VkSamplerAddressMode.Repeat,
- float maxAnisotropy = 1.0f, float minLod = 0.0f, float maxLod = -1f) {
- VkSampler sampler;
- VkSamplerCreateInfo sampInfo = VkSamplerCreateInfo.New();
- sampInfo.maxAnisotropy = maxAnisotropy;
- sampInfo.maxAnisotropy = 1.0f;// device->enabledFeatures.samplerAnisotropy ? device->properties.limits.maxSamplerAnisotropy : 1.0f;
- //samplerInfo.anisotropyEnable = device->enabledFeatures.samplerAnisotropy;
- sampInfo.addressModeU = addressMode;
- sampInfo.addressModeV = addressMode;
- sampInfo.addressModeW = addressMode;
- sampInfo.magFilter = magFilter;
- sampInfo.minFilter = minFilter;
- sampInfo.mipmapMode = mipmapMode;
- sampInfo.minLod = minLod;
- sampInfo.maxLod = maxLod < 0f ? info.mipLevels > 1 ? info.mipLevels : 0 : maxLod;
- sampInfo.compareOp = VkCompareOp.Never;
- sampInfo.borderColor = VkBorderColor.FloatOpaqueWhite;
-
- Utils.CheckResult (vkCreateSampler (Dev.VkDev, ref sampInfo, IntPtr.Zero, out sampler));
-
- if (Descriptor.sampler.Handle != 0)
- Dev.DestroySampler (Descriptor.sampler);
- Descriptor.sampler = sampler;
- }
-
- public void SetLayout (
- CommandBuffer cmdbuffer,
- VkImageAspectFlags aspectMask,
- VkImageLayout oldImageLayout,
- VkImageLayout newImageLayout,
- VkPipelineStageFlags srcStageMask = VkPipelineStageFlags.AllCommands,
- VkPipelineStageFlags dstStageMask = VkPipelineStageFlags.AllCommands) {
- VkImageSubresourceRange subresourceRange = new VkImageSubresourceRange {
- aspectMask = aspectMask,
- baseMipLevel = 0,
- levelCount = CreateInfo.mipLevels,
- layerCount = CreateInfo.arrayLayers,
- };
- SetLayout (cmdbuffer, oldImageLayout, newImageLayout, subresourceRange, srcStageMask, dstStageMask);
- }
- public void SetLayout (
- CommandBuffer cmdbuffer,
- VkImageAspectFlags aspectMask,
- VkAccessFlags srcAccessMask,
- VkAccessFlags dstAccessMask,
- VkImageLayout oldImageLayout,
- VkImageLayout newImageLayout,
- VkPipelineStageFlags srcStageMask = VkPipelineStageFlags.AllCommands,
- VkPipelineStageFlags dstStageMask = VkPipelineStageFlags.AllCommands) {
- VkImageSubresourceRange subresourceRange = new VkImageSubresourceRange {
- aspectMask = aspectMask,
- baseMipLevel = 0,
- levelCount = CreateInfo.mipLevels,
- layerCount = CreateInfo.arrayLayers,
- };
- SetLayout (cmdbuffer, srcAccessMask, dstAccessMask, oldImageLayout, newImageLayout, subresourceRange, srcStageMask, dstStageMask);
- }
- public void SetLayout (
- CommandBuffer cmdbuffer,
- VkAccessFlags srcAccessMask,
- VkAccessFlags dstAccessMask,
- VkImageLayout oldImageLayout,
- VkImageLayout newImageLayout,
- VkImageSubresourceRange subresourceRange,
- VkPipelineStageFlags srcStageMask = VkPipelineStageFlags.AllCommands,
- VkPipelineStageFlags dstStageMask = VkPipelineStageFlags.AllCommands) {
-
- VkImageMemoryBarrier imageMemoryBarrier = VkImageMemoryBarrier.New ();
- imageMemoryBarrier.srcQueueFamilyIndex = Vk.QueueFamilyIgnored;
- imageMemoryBarrier.dstQueueFamilyIndex = Vk.QueueFamilyIgnored;
- imageMemoryBarrier.oldLayout = oldImageLayout;
- imageMemoryBarrier.newLayout = newImageLayout;
- imageMemoryBarrier.image = handle;
- imageMemoryBarrier.subresourceRange = subresourceRange;
- imageMemoryBarrier.srcAccessMask = srcAccessMask;
- imageMemoryBarrier.dstAccessMask = dstAccessMask;
-
- Vk.vkCmdPipelineBarrier (
- cmdbuffer.Handle,
- srcStageMask,
- dstStageMask,
- 0,
- 0, IntPtr.Zero,
- 0, IntPtr.Zero,
- 1, ref imageMemoryBarrier);
-
- }
- // Create an image memory barrier for changing the layout of
- // an image and put it into an active command buffer
- // See chapter 11.4 "Image Layout" for details
- public void SetLayout (
- CommandBuffer cmdbuffer,
- VkImageLayout oldImageLayout,
- VkImageLayout newImageLayout,
- VkImageSubresourceRange subresourceRange,
- VkPipelineStageFlags srcStageMask = VkPipelineStageFlags.AllCommands,
- VkPipelineStageFlags dstStageMask = VkPipelineStageFlags.AllCommands) {
- // Create an image barrier object
- VkImageMemoryBarrier imageMemoryBarrier = VkImageMemoryBarrier.New();
- imageMemoryBarrier.srcQueueFamilyIndex = Vk.QueueFamilyIgnored;
- imageMemoryBarrier.dstQueueFamilyIndex = Vk.QueueFamilyIgnored;
- imageMemoryBarrier.oldLayout = oldImageLayout;
- imageMemoryBarrier.newLayout = newImageLayout;
- imageMemoryBarrier.image = handle;
- imageMemoryBarrier.subresourceRange = subresourceRange;
-
- // Source layouts (old)
- // Source access mask controls actions that have to be finished on the old layout
- // before it will be transitioned to the new layout
- switch (oldImageLayout) {
- case VkImageLayout.Undefined:
- // Image layout is undefined (or does not matter)
- // Only valid as initial layout
- // No flags required, listed only for completeness
- imageMemoryBarrier.srcAccessMask = 0;
- break;
-
- case VkImageLayout.Preinitialized:
- // Image is preinitialized
- // Only valid as initial layout for linear images, preserves memory contents
- // Make sure host writes have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.HostWrite;
- break;
-
- case VkImageLayout.ColorAttachmentOptimal:
- // Image is a color attachment
- // Make sure any writes to the color buffer have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.ColorAttachmentWrite;
- break;
-
- case VkImageLayout.DepthStencilAttachmentOptimal:
- // Image is a depth/stencil attachment
- // Make sure any writes to the depth/stencil buffer have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.DepthStencilAttachmentWrite;
- break;
-
- case VkImageLayout.TransferSrcOptimal:
- // Image is a transfer source
- // Make sure any reads from the image have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.TransferRead;
- break;
-
- case VkImageLayout.TransferDstOptimal:
- // Image is a transfer destination
- // Make sure any writes to the image have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.TransferWrite;
- break;
-
- case VkImageLayout.ShaderReadOnlyOptimal:
- // Image is read by a shader
- // Make sure any shader reads from the image have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.ShaderRead;
- break;
- }
-
- // Target layouts (new)
- // Destination access mask controls the dependency for the new image layout
- switch (newImageLayout) {
- case VkImageLayout.TransferDstOptimal:
- // Image will be used as a transfer destination
- // Make sure any writes to the image have been finished
- imageMemoryBarrier.dstAccessMask = VkAccessFlags.TransferWrite;
- break;
-
- case VkImageLayout.TransferSrcOptimal:
- // Image will be used as a transfer source
- // Make sure any reads from and writes to the image have been finished
- imageMemoryBarrier.srcAccessMask = imageMemoryBarrier.srcAccessMask | VkAccessFlags.TransferRead;
- imageMemoryBarrier.dstAccessMask = VkAccessFlags.TransferRead;
- break;
-
- case VkImageLayout.ColorAttachmentOptimal:
- // Image will be used as a color attachment
- // Make sure any writes to the color buffer have been finished
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.TransferRead;
- imageMemoryBarrier.dstAccessMask = VkAccessFlags.ColorAttachmentWrite;
- break;
-
- case VkImageLayout.DepthStencilAttachmentOptimal:
- // Image layout will be used as a depth/stencil attachment
- // Make sure any writes to depth/stencil buffer have been finished
- imageMemoryBarrier.dstAccessMask = imageMemoryBarrier.dstAccessMask | VkAccessFlags.DepthStencilAttachmentWrite;
- break;
-
- case VkImageLayout.ShaderReadOnlyOptimal:
- // Image will be read in a shader (sampler, input attachment)
- // Make sure any writes to the image have been finished
- if (imageMemoryBarrier.srcAccessMask == 0) {
- imageMemoryBarrier.srcAccessMask = VkAccessFlags.HostWrite | VkAccessFlags.TransferWrite;
- }
- imageMemoryBarrier.dstAccessMask = VkAccessFlags.ShaderRead;
- break;
- }
-
- // Put barrier inside setup command buffer
- Vk.vkCmdPipelineBarrier (
- cmdbuffer.Handle,
- srcStageMask,
- dstStageMask,
- 0,
- 0,IntPtr.Zero,
- 0, IntPtr.Zero,
- 1, ref imageMemoryBarrier);
- }
-
- public void BuildMipmaps (Queue copyQ, CommandPool copyCmdPool) {
- if (info.mipLevels == 1) {
- Debug.WriteLine ("Invoking BuildMipmaps on image that has only one mipLevel");
- return;
- }
- CommandBuffer cmd = copyCmdPool.AllocateCommandBuffer ();
-
- cmd.Start (VkCommandBufferUsageFlags.OneTimeSubmit);
- BuildMipmaps (cmd);
- cmd.End ();
-
- copyQ.Submit (cmd);
- copyQ.WaitIdle ();
-
- cmd.Free ();
- }
- public void BuildMipmaps (CommandBuffer cmd) {
- VkImageSubresourceRange mipSubRange = new VkImageSubresourceRange (VkImageAspectFlags.Color, 0, 1, 0, info.arrayLayers);
-
- for (int i = 1; i < info.mipLevels; i++) {
- VkImageBlit imageBlit = new VkImageBlit {
- srcSubresource = new VkImageSubresourceLayers(VkImageAspectFlags.Color, info.arrayLayers, (uint)i - 1),
- srcOffsets_1 = new VkOffset3D ((int)info.extent.width >> (i - 1), (int)info.extent.height >> (i - 1), 1),
- dstSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, info.arrayLayers, (uint)i),
- dstOffsets_1 = new VkOffset3D ((int)info.extent.width >> i, (int)info.extent.height >> i, 1)
- };
-
- SetLayout (cmd, VkImageLayout.TransferDstOptimal, VkImageLayout.TransferSrcOptimal, mipSubRange,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.Transfer);
- vkCmdBlitImage (cmd.Handle, handle, VkImageLayout.TransferSrcOptimal, handle, VkImageLayout.TransferDstOptimal, 1, ref imageBlit, VkFilter.Linear);
- mipSubRange.baseMipLevel = (uint)i;
- }
- SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.TransferSrcOptimal, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.FragmentShader);
- }
- public void BlitTo (CommandBuffer cmd, Image dest) {
- VkImageBlit imageBlit = new VkImageBlit {
- srcSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, info.arrayLayers, 0),
- srcOffsets_1 = new VkOffset3D ((int)info.extent.width, (int)info.extent.height, 1),
- dstSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, info.arrayLayers, 0),
- dstOffsets_1 = new VkOffset3D ((int)dest.info.extent.width, (int)dest.info.extent.height, 1)
- };
- vkCmdBlitImage (cmd.Handle, handle, VkImageLayout.TransferSrcOptimal, dest.handle, VkImageLayout.TransferDstOptimal, 1, ref imageBlit, VkFilter.Linear);
- }
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{handle.Handle.ToString("x")}]");
- }
- #region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (state == ActivableState.Activated) {
- if (Descriptor.sampler.Handle != 0)
- Dev.DestroySampler (Descriptor.sampler);
- if (Descriptor.imageView.Handle != 0)
- Dev.DestroyImageView (Descriptor.imageView);
- if (!imported) {
- base.Dispose (disposing);
- Dev.DestroyImage (handle);
- }
- }
- state = ActivableState.Disposed;
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/Instance.cs b/CVKL/src/base/Instance.cs
deleted file mode 100644
index d8a06d3..0000000
--- a/CVKL/src/base/Instance.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-//
-// Instance.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- /// <summary>
- /// Vulkan Instance disposable class
- /// </summary>
- public class Instance : IDisposable {
- /// <summary>If true, the VK_LAYER_KHRONOS_validation layer is loaded at startup; </summary>
- public static bool VALIDATION;
- /// <summary>If true, the VK_EXT_debug_utils and VK_EXT_debug_report instance extensions are enabled</summary>
- public static bool DEBUG_UTILS;
- /// <summary>If true, the VK_LAYER_RENDERDOC_Capture layer is loaded at startup; </summary>
- public static bool RENDER_DOC_CAPTURE;
-
- VkInstance inst;
-
- public IntPtr Handle => inst.Handle;
- public VkInstance VkInstance => inst;
-
-
- static class Strings {
- public static FixedUtf8String Name = "VKENGINE";
- public static FixedUtf8String VK_KHR_SURFACE_EXTENSION_NAME = "VK_KHR_surface";
- public static FixedUtf8String VK_KHR_WIN32_SURFACE_EXTENSION_NAME = "VK_KHR_win32_surface";
- public static FixedUtf8String VK_KHR_XCB_SURFACE_EXTENSION_NAME = "VK_KHR_xcb_surface";
- public static FixedUtf8String VK_KHR_XLIB_SURFACE_EXTENSION_NAME = "VK_KHR_xlib_surface";
- public static FixedUtf8String VK_KHR_SWAPCHAIN_EXTENSION_NAME = "VK_KHR_swapchain";
- public static FixedUtf8String VK_EXT_DEBUG_REPORT_EXTENSION_NAME = "VK_EXT_debug_report";
- public static FixedUtf8String VK_EXT_DEBUG_UTILS_EXTENSION_NAME = "VK_EXT_debug_utils";
- public static FixedUtf8String LayerValidation = "VK_LAYER_KHRONOS_validation";
- public static FixedUtf8String LayerValidation_old = "VK_LAYER_LUNARG_standard_validation";
- public static FixedUtf8String LayerMonitor = "VK_LAYER_LUNARG_monitor";
- public static FixedUtf8String VkTraceLayeName = "VK_LAYER_LUNARG_vktrace";
- public static FixedUtf8String RenderdocCaptureLayerName = "VK_LAYER_RENDERDOC_Capture";
- public static FixedUtf8String main = "main";
- }
-
- public Instance () {
- init ();
- }
-
- unsafe bool ExtensionIsSupported (FixedUtf8String layer, string extName) {
- uint count;
- Utils.CheckResult (vkEnumerateInstanceExtensionProperties ((IntPtr)layer, out count, IntPtr.Zero));
- VkExtensionProperties[] tmp = new VkExtensionProperties[count];
- Utils.CheckResult (vkEnumerateInstanceExtensionProperties (layer, out count, tmp.Pin ()));
- tmp.Unpin ();
-
- fixed (VkExtensionProperties* ep = tmp) {
- for (int i = 0; i < tmp.Length; i++) {
- IntPtr n = (IntPtr)ep[i].extensionName;
- if (Marshal.PtrToStringAnsi (n) == extName)
- return true;
- }
- }
- return false;
- }
-
-
-
- void init () {
- List<IntPtr> instanceExtensions = new List<IntPtr> ();
- List<IntPtr> enabledLayerNames = new List<IntPtr> ();
-
- instanceExtensions.Add (Strings.VK_KHR_SURFACE_EXTENSION_NAME);
- if (RuntimeInformation.IsOSPlatform (OSPlatform.Windows)) {
- instanceExtensions.Add (Strings.VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
- } else if (RuntimeInformation.IsOSPlatform (OSPlatform.Linux)) {
- instanceExtensions.Add (Strings.VK_KHR_XCB_SURFACE_EXTENSION_NAME);
- } else {
- throw new PlatformNotSupportedException ();
- }
-
- if (VALIDATION) {
- enabledLayerNames.Add (Strings.LayerValidation);
- //enabledLayerNames.Add (Strings.LayerValidation_old);
-
- if (DEBUG_UTILS) {
- //if (ExtensionIsSupported(Strings.LayerValidation, Strings.VK_EXT_DEBUG_UTILS_EXTENSION_NAME))
- //instanceExtensions.Add (Strings.VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
- instanceExtensions.Add (Strings.VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
- }
-
- }
- if (RENDER_DOC_CAPTURE)
- enabledLayerNames.Add (Strings.RenderdocCaptureLayerName);
-
-
- VkApplicationInfo appInfo = new VkApplicationInfo () {
- sType = VkStructureType.ApplicationInfo,
- apiVersion = new Vulkan.Version (1, 0, 0),
- pApplicationName = Strings.Name,
- pEngineName = Strings.Name,
- };
-
- VkInstanceCreateInfo instanceCreateInfo = VkInstanceCreateInfo.New ();
- instanceCreateInfo.pApplicationInfo = appInfo.Pin ();
-
- if (instanceExtensions.Count > 0) {
- instanceCreateInfo.enabledExtensionCount = (uint)instanceExtensions.Count;
- instanceCreateInfo.ppEnabledExtensionNames = instanceExtensions.Pin ();
- }
- if (enabledLayerNames.Count > 0) {
- instanceCreateInfo.enabledLayerCount = (uint)enabledLayerNames.Count;
- instanceCreateInfo.ppEnabledLayerNames = enabledLayerNames.Pin ();
- }
-
- VkResult result = vkCreateInstance (ref instanceCreateInfo, IntPtr.Zero, out inst);
- if (result != VkResult.Success)
- throw new InvalidOperationException ("Could not create Vulkan instance. Error: " + result);
-
- Vk.LoadInstanceFunctionPointers (inst);
-
- appInfo.Unpin ();
-
- if (instanceExtensions.Count > 0)
- instanceExtensions.Unpin ();
- if (enabledLayerNames.Count > 0)
- enabledLayerNames.Unpin ();
- }
-
- public PhysicalDeviceCollection GetAvailablePhysicalDevice () => new PhysicalDeviceCollection (inst);
- /// <summary>
- /// Create a new vulkan surface from native window pointer
- /// </summary>
- public VkSurfaceKHR CreateSurface (IntPtr hWindow) {
- ulong surf;
- Utils.CheckResult ((VkResult)Glfw.Glfw3.CreateWindowSurface (inst.Handle, hWindow, IntPtr.Zero, out surf), "Create Surface Failed.");
- return surf;
- }
- public void GetDelegate<T> (string name, out T del) {
- using (FixedUtf8String n = new FixedUtf8String (name)) {
- del = Marshal.GetDelegateForFunctionPointer<T> (vkGetInstanceProcAddr (Handle, (IntPtr)n));
- }
- }
-
- #region IDisposable Support
- private bool disposedValue = false;
-
- protected virtual void Dispose (bool disposing) {
- if (!disposedValue) {
- if (disposing) {
- // TODO: supprimer l'état managé (objets managés).
- } else
- System.Diagnostics.Debug.WriteLine ("Instance disposed by Finalizer");
-
- vkDestroyInstance (inst, IntPtr.Zero);
-
- disposedValue = true;
- }
- }
-
- ~Instance () {
- Dispose(false);
- }
-
- public void Dispose () {
- Dispose (true);
- GC.SuppressFinalize(this);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/PhysicalDevice.cs b/CVKL/src/base/PhysicalDevice.cs
deleted file mode 100644
index 265c6fa..0000000
--- a/CVKL/src/base/PhysicalDevice.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-//
-// PhysicalDevice.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using VK;
-using static VK.Vk;
-using static VK.Utils;
-using System.Collections;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-
-namespace CVKL {
- public class PhysicalDeviceCollection : IEnumerable<PhysicalDevice> {
- VkInstance inst;
- PhysicalDevice[] phys;
-
- public PhysicalDeviceCollection (VkInstance instance) {
- inst = instance;
- init ();
- }
-
- public PhysicalDevice this[int i] {
- get {
- return phys[i];
- }
- }
-
- public IEnumerator<PhysicalDevice> GetEnumerator () {
- return ((IEnumerable<PhysicalDevice>)phys).GetEnumerator ();
- }
-
- IEnumerator IEnumerable.GetEnumerator () {
- return ((IEnumerable<PhysicalDevice>)phys).GetEnumerator ();
- }
-
- void init () {
- uint gpuCount = 0;
- CheckResult (vkEnumeratePhysicalDevices (inst, out gpuCount, IntPtr.Zero));
- if (gpuCount <= 0)
- throw new Exception ("No GPU found");
-
- IntPtr gpus = Marshal.AllocHGlobal (Marshal.SizeOf<IntPtr> ()* (int)gpuCount);
- CheckResult (vkEnumeratePhysicalDevices (inst, out gpuCount, gpus), "Could not enumerate physical devices.");
-
- phys = new PhysicalDevice[gpuCount];
-
- for (int i = 0; i < gpuCount; i++)
- phys[i] = new PhysicalDevice (Marshal.ReadIntPtr(gpus + i * Marshal.SizeOf<IntPtr>()));
-
- Marshal.FreeHGlobal (gpus);
- }
- }
- public class PhysicalDevice {
- IntPtr phy;
-
- public VkPhysicalDeviceMemoryProperties memoryProperties { get; private set; }
- public VkQueueFamilyProperties[] QueueFamilies { get; private set; }
- public VkPhysicalDeviceProperties Properties {
- get {
- VkPhysicalDeviceProperties pdp;
- vkGetPhysicalDeviceProperties (phy, out pdp);
- return pdp;
- }
- }
- public VkPhysicalDeviceFeatures Features {
- get {
- VkPhysicalDeviceFeatures df;
- vkGetPhysicalDeviceFeatures (phy, out df);
- return df;
- }
- }
- public VkPhysicalDeviceLimits Limits => Properties.limits;
-
- public bool HasSwapChainSupport { get; private set; }
- public IntPtr Handle => phy;
-
- public PhysicalDevice (IntPtr vkPhy) {
- phy = vkPhy;
- init ();
- }
-
- unsafe void init () {
- // Gather physical Device memory properties
- IntPtr tmp = Marshal.AllocHGlobal (Marshal.SizeOf<VkPhysicalDeviceMemoryProperties>());
- vkGetPhysicalDeviceMemoryProperties (phy, tmp);
- memoryProperties = Marshal.PtrToStructure<VkPhysicalDeviceMemoryProperties> (tmp);
-
- uint queueFamilyCount = 0;
- vkGetPhysicalDeviceQueueFamilyProperties (phy, out queueFamilyCount, IntPtr.Zero);
- QueueFamilies = new VkQueueFamilyProperties[queueFamilyCount];
-
- if (queueFamilyCount <= 0)
- throw new Exception ("No queues found for physical device");
-
- vkGetPhysicalDeviceQueueFamilyProperties (phy, out queueFamilyCount, QueueFamilies.Pin ());
- QueueFamilies.Unpin ();
-
- uint propCount = 0;
-
- vkEnumerateDeviceExtensionProperties (phy, IntPtr.Zero, out propCount, IntPtr.Zero);
-
- VkExtensionProperties[] extProps = new VkExtensionProperties[propCount];
-
- vkEnumerateDeviceExtensionProperties (phy, IntPtr.Zero, out propCount, extProps.Pin ());
- extProps.Unpin ();
-
- for (int i = 0; i < extProps.Length; i++)
- {
- fixed (VkExtensionProperties* ep = extProps) {
- IntPtr n = (IntPtr)ep[i].extensionName;
- switch (Marshal.PtrToStringAnsi(n))
- {
- case "VK_KHR_swapchain":
- HasSwapChainSupport = true;
- break;
- }
- }
- }
- }
-
- public unsafe bool GetDeviceExtensionSupported (string extName) {
- uint propCount = 0;
-
- vkEnumerateDeviceExtensionProperties (phy, IntPtr.Zero, out propCount, IntPtr.Zero);
-
- VkExtensionProperties[] extProps = new VkExtensionProperties[propCount];
-
- vkEnumerateDeviceExtensionProperties (phy, IntPtr.Zero, out propCount, extProps.Pin ());
- extProps.Unpin ();
-
- for (int i = 0; i < extProps.Length; i++) {
- fixed (VkExtensionProperties* ep = extProps) {
- IntPtr n = (IntPtr)ep[i].extensionName;
- if (Marshal.PtrToStringAnsi (n) == extName)
- return true;
- }
- }
- Console.WriteLine ($"INFO: unsuported device extension: {extName}");
- return false;
- }
-
-
- public bool GetPresentIsSupported (uint qFamilyIndex, VkSurfaceKHR surf) {
- VkBool32 isSupported = false;
- vkGetPhysicalDeviceSurfaceSupportKHR (phy, qFamilyIndex, surf, out isSupported);
- return isSupported;
- }
-
- public VkSurfaceCapabilitiesKHR GetSurfaceCapabilities (VkSurfaceKHR surf) {
- VkSurfaceCapabilitiesKHR caps;
- vkGetPhysicalDeviceSurfaceCapabilitiesKHR (phy, surf, out caps);
- return caps;
- }
-
- unsafe public VkSurfaceFormatKHR[] GetSurfaceFormats (VkSurfaceKHR surf) {
- uint count = 0;
- vkGetPhysicalDeviceSurfaceFormatsKHR (phy, surf, out count, IntPtr.Zero);
- VkSurfaceFormatKHR[] formats = new VkSurfaceFormatKHR[count];
-
- vkGetPhysicalDeviceSurfaceFormatsKHR (phy, surf, out count, formats.Pin());
- formats.Unpin ();
-
- return formats;
- }
- unsafe public VkPresentModeKHR[] GetSurfacePresentModes (VkSurfaceKHR surf) {
- uint count = 0;
- vkGetPhysicalDeviceSurfacePresentModesKHR (phy, surf, out count, IntPtr.Zero);
- VkPresentModeKHR[] modes = new VkPresentModeKHR[count];
-
- vkGetPhysicalDeviceSurfacePresentModesKHR (phy, surf, out count, modes.Pin());
- modes.Unpin ();
-
- return modes;
- }
- public VkFormatProperties GetFormatProperties (VkFormat format) {
- VkFormatProperties properties;
- vkGetPhysicalDeviceFormatProperties (phy, format, out properties);
- return properties;
- }
- }
-}
diff --git a/CVKL/src/base/Pipeline.cs b/CVKL/src/base/Pipeline.cs
deleted file mode 100644
index 3e6eac3..0000000
--- a/CVKL/src/base/Pipeline.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// Pipeline.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- public abstract class Pipeline : Activable {
- protected VkPipeline handle;
- protected PipelineLayout layout;
- protected PipelineCache Cache;
-
- public VkPipeline Handle => handle;
- public PipelineLayout Layout => layout;
-
- protected readonly VkPipelineBindPoint bindPoint;
-
- #region CTORS
- protected Pipeline (Device dev, PipelineCache cache = null, string name = "custom pipeline") : base(dev, name) {
- this.Cache = cache;
- }
- #endregion
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.PipelineEXT, handle.Handle);
-
- public abstract void Bind (CommandBuffer cmd);
- public abstract void BindDescriptorSet (CommandBuffer cmd, DescriptorSet dset, uint firstSet = 0);
- public void PushConstant (CommandBuffer cmd, object obj, int rangeIndex = 0, uint offset = 0) {
- cmd.PushConstant (layout, layout.PushConstantRanges[rangeIndex].stageFlags, obj, offset);
- }
-
-
- protected override void Dispose (bool disposing) {
- if (state == ActivableState.Activated) {
- if (disposing) {
- layout.Dispose ();
- Cache?.Dispose ();
- } else
- System.Diagnostics.Debug.WriteLine ($"Pipeline '{name}' disposed by finalizer");
-
- vkDestroyPipeline (Dev.VkDev, handle, IntPtr.Zero);
- } else if (disposing)
- System.Diagnostics.Debug.WriteLine ($"Calling dispose on unactive Pipeline: {name}");
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/CVKL/src/base/PipelineCache.cs b/CVKL/src/base/PipelineCache.cs
deleted file mode 100644
index c139696..0000000
--- a/CVKL/src/base/PipelineCache.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-//
-// SpecializationConstant.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using VK;
-
-using static VK.Vk;
-
-namespace CVKL {
- /// <summary>
- /// Activable holding the pipeline cache handle. Activation is triggered by usage, so disposing pipelines that use this
- /// cache is enough to have the cache disposed correctly.
- /// </summary>
- /// <remarks>
- /// Restore and Saving of the cache may be controled through the two static members:
- /// - `SaveOnDispose`
- /// - `LoadOnActivation`
- /// </remarks>
- public sealed class PipelineCache : Activable {
- /// <summary>
- /// If true, cache will be saved on dispose
- /// </summary>
- public static bool SaveOnDispose;
- /// <summary>
- /// If true, cache will be restore on activation
- /// </summary>
- public static bool LoadOnActivation;
-
- internal VkPipelineCache handle;
- readonly string globalConfigPath;
- readonly string cacheFile;
-
- #region CTOR
- public PipelineCache (Device dev, string cacheFile = "pipelines.bin", string name = "pipeline cache") : base(dev, name) {
- string configRoot = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), ".config");
- string appName = Assembly.GetEntryAssembly ().GetName ().Name;
- globalConfigPath = Path.Combine (configRoot, appName);
-
- if (!Directory.Exists (globalConfigPath))
- Directory.CreateDirectory (globalConfigPath);
-
- this.cacheFile = cacheFile;
- }
- #endregion
-
- public override void Activate () {
- string path = Path.Combine (globalConfigPath, cacheFile);
-
- if (state != ActivableState.Activated) {
- VkPipelineCacheCreateInfo info = VkPipelineCacheCreateInfo.New ();
-
- if (File.Exists (path) && LoadOnActivation) {
- using (FileStream fs = File.Open (path, FileMode.Open)) {
- using (BinaryReader br = new BinaryReader (fs)) {
- int length = (int)br.BaseStream.Length;
- info.pInitialData = Marshal.AllocHGlobal (length);
- info.initialDataSize = (UIntPtr)br.BaseStream.Length;
- Marshal.Copy(br.ReadBytes (length),0, info.pInitialData, length);
- }
- }
- }
-
- Utils.CheckResult (vkCreatePipelineCache (Dev.VkDev, ref info, IntPtr.Zero, out handle));
-
- if (info.pInitialData != IntPtr.Zero)
- Marshal.FreeHGlobal (info.pInitialData);
- }
- base.Activate ();
- }
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.PipelineCacheEXT, handle.Handle);
-
-
- public void Delete () {
- string path = Path.Combine (globalConfigPath, cacheFile);
- if (File.Exists (path))
- File.Delete (path);
- }
-
- public void Save () {
- if (state != ActivableState.Activated)
- return;
-
- string path = Path.Combine (globalConfigPath, cacheFile);
-
- if (File.Exists (path))
- File.Delete (path);
-
- UIntPtr dataSize;
- Utils.CheckResult (vkGetPipelineCacheData (Dev.VkDev, handle, out dataSize, IntPtr.Zero));
- byte[] pData = new byte[(int)dataSize];
- Utils.CheckResult (vkGetPipelineCacheData (Dev.VkDev, handle, out dataSize, pData.Pin ()));
- pData.Unpin ();
-
- using (FileStream fs = File.Open (path, FileMode.CreateNew))
- using (BinaryWriter br = new BinaryWriter (fs))
- br.Write (pData, 0, (int)dataSize);
- }
-
-
- #region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (!disposing)
- System.Diagnostics.Debug.WriteLine ($"CVKL PipelineCache '{name}' disposed by finalizer");
- if (state == ActivableState.Activated) {
- if (SaveOnDispose)
- Save ();
- vkDestroyPipelineCache (Dev.VkDev, handle, IntPtr.Zero);
- }
- base.Dispose (disposing);
- }
- #endregion
-
- }
-}
diff --git a/CVKL/src/base/PipelineLayout.cs b/CVKL/src/base/PipelineLayout.cs
deleted file mode 100644
index 1c59f90..0000000
--- a/CVKL/src/base/PipelineLayout.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// PipelineLayout.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- public sealed class PipelineLayout : Activable {
- internal VkPipelineLayout handle;
- public VkPipelineLayout Handle => handle;
-
- public List<DescriptorSetLayout> DescriptorSetLayouts = new List<DescriptorSetLayout> ();
- public List<VkPushConstantRange> PushConstantRanges = new List<VkPushConstantRange> ();
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT(VkDebugReportObjectTypeEXT.PipelineLayoutEXT, handle.Handle);
-
- #region CTORS
- public PipelineLayout (Device device) : base (device) { }
- public PipelineLayout (Device device, VkPushConstantRange pushConstantRange, params DescriptorSetLayout[] descriptorSetLayouts)
- : this (device, descriptorSetLayouts) {
- PushConstantRanges.Add (pushConstantRange);
- }
- public PipelineLayout (Device device, VkPushConstantRange[] pushConstantRanges, params DescriptorSetLayout[] descriptorSetLayouts)
- : this (device, descriptorSetLayouts) {
- foreach (VkPushConstantRange pcr in pushConstantRanges)
- PushConstantRanges.Add (pcr);
- }
- public PipelineLayout (Device device, params DescriptorSetLayout[] descriptorSetLayouts)
- :this (device) {
-
- if (descriptorSetLayouts.Length > 0)
- DescriptorSetLayouts.AddRange (descriptorSetLayouts);
- }
- #endregion
-
- public void AddPushConstants (params VkPushConstantRange[] pushConstantRanges) {
- foreach (VkPushConstantRange pcr in pushConstantRanges)
- PushConstantRanges.Add (pcr);
- }
-
- public override void Activate () {
- if (state != ActivableState.Activated) {
- foreach (DescriptorSetLayout dsl in DescriptorSetLayouts)
- dsl.Activate ();
- VkPipelineLayoutCreateInfo info = VkPipelineLayoutCreateInfo.New();
- VkDescriptorSetLayout[] dsls = DescriptorSetLayouts.Select (dsl => dsl.handle).ToArray ();
-
- if (dsls.Length > 0) {
- info.setLayoutCount = (uint)dsls.Length;
- info.pSetLayouts = dsls.Pin ();
- }
- if (PushConstantRanges.Count > 0) {
- info.pushConstantRangeCount = (uint)PushConstantRanges.Count;
- info.pPushConstantRanges = PushConstantRanges.Pin();
- }
- Utils.CheckResult (vkCreatePipelineLayout (Dev.VkDev, ref info, IntPtr.Zero, out handle));
-
- if (dsls.Length > 0)
- dsls.Unpin ();
- if (PushConstantRanges.Count > 0)
- PushConstantRanges.Unpin ();
- }
- base.Activate ();
- }
-
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{handle.Handle.ToString("x")}]");
- }
-
- #region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (state == ActivableState.Activated) {
- if (disposing) {
- foreach (DescriptorSetLayout dsl in DescriptorSetLayouts)
- dsl.Dispose ();
- } else
- System.Diagnostics.Debug.WriteLine ("VKE Activable PipelineLayout disposed by finalizer");
-
- vkDestroyPipelineLayout (Dev.VkDev, handle, IntPtr.Zero);
- }else if (disposing)
- System.Diagnostics.Debug.WriteLine ("Calling dispose on unactive PipelineLayout");
-
- base.Dispose (disposing);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/QueryPool.cs b/CVKL/src/base/QueryPool.cs
deleted file mode 100644
index 1d95174..0000000
--- a/CVKL/src/base/QueryPool.cs
+++ /dev/null
@@ -1,164 +0,0 @@
-//
-// CommandPool.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- public class TimestampQueryPool : QueryPool {
- public readonly float Period;
-
- #region CTORS
- public TimestampQueryPool (Device device, uint count = 2)
- : base (device, VkQueryType.Timestamp, 0, count)
- {
- Period = Dev.phy.Limits.timestampPeriod;
-
- resultLength = 1;
-
- Activate ();
- }
- #endregion
-
- public void Write (CommandBuffer cmd, uint query, VkPipelineStageFlags stageFlags = VkPipelineStageFlags.BottomOfPipe) {
- vkCmdWriteTimestamp (cmd.Handle, stageFlags, handle, query);
- }
- public void Start (CommandBuffer cmd, VkPipelineStageFlags stageFlags = VkPipelineStageFlags.BottomOfPipe) {
- vkCmdWriteTimestamp (cmd.Handle, stageFlags, handle, 0);
- }
- public void End (CommandBuffer cmd, VkPipelineStageFlags stageFlags = VkPipelineStageFlags.BottomOfPipe) {
- vkCmdWriteTimestamp (cmd.Handle, stageFlags, handle, 1);
- }
- public float ElapsedMiliseconds {
- get {
- ulong[] res = GetResults ();
- return (res[1] - res[0]) * Period / 1000000f;
- }
- }
- }
- public class PipelineStatisticsQueryPool : QueryPool {
-
- public readonly VkQueryPipelineStatisticFlags[] RequestedStats;
-
- #region CTORS
- public PipelineStatisticsQueryPool (Device device, VkQueryPipelineStatisticFlags statisticFlags, uint count = 1)
- : base (device, VkQueryType.PipelineStatistics, statisticFlags, count)
- {
- List<VkQueryPipelineStatisticFlags> requests = new List<VkQueryPipelineStatisticFlags> ();
-
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.InputAssemblyVertices))
- requests.Add (VkQueryPipelineStatisticFlags.InputAssemblyVertices);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.InputAssemblyPrimitives))
- requests.Add (VkQueryPipelineStatisticFlags.InputAssemblyPrimitives);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.VertexShaderInvocations))
- requests.Add (VkQueryPipelineStatisticFlags.VertexShaderInvocations);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.GeometryShaderInvocations))
- requests.Add (VkQueryPipelineStatisticFlags.GeometryShaderInvocations);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.GeometryShaderPrimitives))
- requests.Add (VkQueryPipelineStatisticFlags.GeometryShaderPrimitives);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.ClippingInvocations))
- requests.Add (VkQueryPipelineStatisticFlags.ClippingInvocations);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.ClippingPrimitives))
- requests.Add (VkQueryPipelineStatisticFlags.ClippingPrimitives);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.FragmentShaderInvocations))
- requests.Add (VkQueryPipelineStatisticFlags.FragmentShaderInvocations);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.TessellationControlShaderPatches))
- requests.Add (VkQueryPipelineStatisticFlags.TessellationControlShaderPatches);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.TessellationEvaluationShaderInvocations))
- requests.Add (VkQueryPipelineStatisticFlags.TessellationEvaluationShaderInvocations);
- if (statisticFlags.HasFlag (VkQueryPipelineStatisticFlags.ComputeShaderInvocations))
- requests.Add (VkQueryPipelineStatisticFlags.ComputeShaderInvocations);
-
- RequestedStats = requests.ToArray ();
-
- resultLength = (uint)requests.Count;
-
- Activate ();
- }
- #endregion
-
- public void Begin (CommandBuffer cmd, uint query = 0) {
- vkCmdBeginQuery (cmd.Handle, handle, query, VkQueryControlFlags.Precise);
- }
- public void End (CommandBuffer cmd, uint query = 0) {
- vkCmdEndQuery (cmd.Handle, handle, query);
- }
- }
-
- public abstract class QueryPool : Activable {
- protected VkQueryPool handle;
- protected readonly VkQueryPoolCreateInfo createInfos;
- public readonly VkQueryType QueryType;
- protected uint resultLength;
-
- #region CTORS
- protected QueryPool (Device device, VkQueryType queryType, VkQueryPipelineStatisticFlags statisticFlags, uint count = 1)
- : base(device)
- {
- createInfos = VkQueryPoolCreateInfo.New (queryType, statisticFlags, count);
-
- //Activate ();
- }
-
- #endregion
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT(VkDebugReportObjectTypeEXT.QueryPoolEXT, handle.Handle);
-
- public override void Activate () {
- if (state != ActivableState.Activated) {
- VkQueryPoolCreateInfo infos = createInfos;
- Utils.CheckResult (vkCreateQueryPool (Dev.VkDev, ref infos, IntPtr.Zero, out handle));
- }
- base.Activate ();
- }
-
- public ulong[] GetResults () {
- ulong[] results = new ulong[resultLength * createInfos.queryCount];
- IntPtr ptr = results.Pin ();
- vkGetQueryPoolResults (Dev.VkDev, handle, 0, createInfos.queryCount, (UIntPtr)(resultLength * createInfos.queryCount* sizeof (ulong)), ptr, sizeof (ulong), VkQueryResultFlags.QueryResult64);
- results.Unpin ();
- return results;
- }
-
-
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{handle.Handle.ToString("x")}]");
- }
-
- #region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (!disposing)
- System.Diagnostics.Debug.WriteLine ("VKE QueryPool disposed by finalizer");
- if (state == ActivableState.Activated)
- vkDestroyQueryPool (Dev.VkDev, handle, IntPtr.Zero);
- base.Dispose (disposing);
- }
- #endregion
-
- }
-}
diff --git a/CVKL/src/base/Queue.cs b/CVKL/src/base/Queue.cs
deleted file mode 100644
index 93444ae..0000000
--- a/CVKL/src/base/Queue.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-//
-// Queue.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections;
-using VK;
-
-using static VK.Vk;
-
-namespace CVKL {
-
- public class PresentQueue : Queue {
- public readonly VkSurfaceKHR Surface;
-
- public PresentQueue (Device _dev, VkQueueFlags requestedFlags, VkSurfaceKHR _surface, float _priority = 0.0f) {
- dev = _dev;
- priority = _priority;
- Surface = _surface;
-
- qFamIndex = searchQFamily (requestedFlags);
- dev.queues.Add (this);
- }
-
- uint searchQFamily (VkQueueFlags requestedFlags) {
- //search for dedicated Q
- for (uint i = 0; i < dev.phy.QueueFamilies.Length; i++) {
- if (dev.phy.QueueFamilies[i].queueFlags == requestedFlags && dev.phy.GetPresentIsSupported (i, Surface))
- return i;
- }
- //search Q having flags
- for (uint i = 0; i < dev.phy.QueueFamilies.Length; i++) {
- if ((dev.phy.QueueFamilies[i].queueFlags & requestedFlags) == requestedFlags && dev.phy.GetPresentIsSupported (i, Surface))
- return i;
- }
-
- throw new Exception (string.Format ("No Queue with flags {0} found", requestedFlags));
- }
-
- public void Present (VkPresentInfoKHR present) {
- Utils.CheckResult (vkQueuePresentKHR (handle, ref present));
- }
- public void Present (SwapChain swapChain, VkSemaphore wait) {
- VkPresentInfoKHR present = VkPresentInfoKHR.New();
-
- uint idx = swapChain.currentImageIndex;
- VkSwapchainKHR sc = swapChain.Handle;
- present.swapchainCount = 1;
- present.pSwapchains = sc.Pin();
- present.waitSemaphoreCount = 1;
- present.pWaitSemaphores = wait.Pin();
- present.pImageIndices = idx.Pin();
-
- vkQueuePresentKHR (handle, ref present);
-
- sc.Unpin ();
- wait.Unpin ();
- idx.Unpin ();
- }
- }
-
- public class Queue {
-
- internal VkQueue handle;
- internal Device dev;
- public Device Dev => dev;
-
- VkQueueFlags flags => dev.phy.QueueFamilies[qFamIndex].queueFlags;
- public uint qFamIndex;
- public uint index;//index in queue family
- public float priority;
-
- protected Queue () { }
- public Queue (Device _dev, VkQueueFlags requestedFlags, float _priority = 0.0f) {
- dev = _dev;
- priority = _priority;
-
- qFamIndex = searchQFamily (requestedFlags);
- dev.queues.Add (this);
- }
- /// <summary>
- /// End command recording, submit, and wait queue idle
- /// </summary>
- public void EndSubmitAndWait (CommandBuffer cmd) {
- cmd.End ();
- Submit (cmd);
- WaitIdle ();
- }
- public void Submit (CommandBuffer cmd, VkSemaphore wait = default(VkSemaphore), VkSemaphore signal = default (VkSemaphore), VkFence fence = default (VkFence)) {
- cmd.Submit (handle, wait, signal, fence);
- }
- public void WaitIdle () {
- Utils.CheckResult (vkQueueWaitIdle (handle));
- }
-
- uint searchQFamily (VkQueueFlags requestedFlags) {
- //search for dedicated Q
- for (uint i = 0; i < dev.phy.QueueFamilies.Length; i++) {
- if (dev.phy.QueueFamilies[i].queueFlags == requestedFlags)
- return i;
- }
- //search Q having flags
- for (uint i = 0; i < dev.phy.QueueFamilies.Length; i++) {
- if ((dev.phy.QueueFamilies[i].queueFlags & requestedFlags) == requestedFlags)
- return i;
- }
-
- throw new Exception (string.Format ("No Queue with flags {0} found", requestedFlags));
- }
-
- internal void updateHandle () {
- vkGetDeviceQueue (dev.VkDev, qFamIndex, index, out handle);
- }
- }
-}
diff --git a/CVKL/src/base/RenderPass.cs b/CVKL/src/base/RenderPass.cs
deleted file mode 100644
index c5662f9..0000000
--- a/CVKL/src/base/RenderPass.cs
+++ /dev/null
@@ -1,260 +0,0 @@
-//
-// RenderPass.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using VK;
-
-using static VK.Vk;
-
-namespace CVKL {
- public class RenderPass : Activable {
- internal VkRenderPass handle;
-
- public readonly VkSampleCountFlags Samples;
-
- internal List<VkAttachmentDescription> attachments = new List<VkAttachmentDescription> ();
- public List<VkClearValue> ClearValues = new List<VkClearValue> ();
- internal List<SubPass> subpasses = new List<SubPass> ();
- List<VkSubpassDependency> dependencies = new List<VkSubpassDependency> ();
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT(VkDebugReportObjectTypeEXT.RenderPassEXT, handle.Handle);
-
- #region CTORS
-
- public RenderPass (Device device, VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1) : base(device) {
- Samples = samples;
- }
-
- /// <summary>
- /// Create renderpass with a single color attachment and a resolve one if needed
- /// </summary>
- public RenderPass (Device device, VkFormat colorFormat, VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1, VkAttachmentLoadOp loadOp = VkAttachmentLoadOp.Clear)
- : this (device) {
- Samples = samples;
-
- AddAttachment (colorFormat, (samples == VkSampleCountFlags.SampleCount1) ? VkImageLayout.PresentSrcKHR : VkImageLayout.ColorAttachmentOptimal, samples,
- loadOp, VkAttachmentStoreOp.Store);
- ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
-
- SubPass subpass0 = new SubPass ();
- subpass0.AddColorReference (0, VkImageLayout.ColorAttachmentOptimal);
-
- if (samples != VkSampleCountFlags.SampleCount1) {
- AddAttachment (colorFormat, VkImageLayout.PresentSrcKHR, VkSampleCountFlags.SampleCount1);
- ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- subpass0.AddResolveReference (1, VkImageLayout.ColorAttachmentOptimal);
- }
-
- AddSubpass (subpass0);
-
- AddDependency (Vk.SubpassExternal, 0,
- VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.ColorAttachmentOutput,
- VkAccessFlags.MemoryRead, VkAccessFlags.ColorAttachmentWrite);
- AddDependency (0, Vk.SubpassExternal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.BottomOfPipe,
- VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.MemoryRead);
-
- }
- /// <summary>
- /// Create default renderpass with one color and one depth attachments.
- /// </summary>
- public RenderPass (Device device, VkFormat colorFormat, VkFormat depthFormat, VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1)
- : this (device){
-
- Samples = samples;
-
- AddAttachment (colorFormat, (samples == VkSampleCountFlags.SampleCount1) ? VkImageLayout.PresentSrcKHR : VkImageLayout.ColorAttachmentOptimal, samples);
- AddAttachment (depthFormat, VkImageLayout.DepthStencilAttachmentOptimal, samples);
-
- ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- ClearValues.Add (new VkClearValue { depthStencil = new VkClearDepthStencilValue (1.0f, 0) });
-
- SubPass subpass0 = new SubPass ();
-
- subpass0.AddColorReference (0, VkImageLayout.ColorAttachmentOptimal);
- subpass0.SetDepthReference (1, VkImageLayout.DepthStencilAttachmentOptimal);
-
- if (samples != VkSampleCountFlags.SampleCount1) {
- AddAttachment (colorFormat, VkImageLayout.PresentSrcKHR, VkSampleCountFlags.SampleCount1);
- ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.2f) });
- subpass0.AddResolveReference (2, VkImageLayout.ColorAttachmentOptimal);
- }
-
- AddSubpass (subpass0);
-
- AddDependency (Vk.SubpassExternal, 0,
- VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.ColorAttachmentOutput,
- VkAccessFlags.MemoryRead, VkAccessFlags.ColorAttachmentRead | VkAccessFlags.ColorAttachmentWrite);
- AddDependency (0, Vk.SubpassExternal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.BottomOfPipe,
- VkAccessFlags.ColorAttachmentRead | VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.MemoryRead);
- }
- #endregion
-
- public override void Activate () {
- if (state != ActivableState.Activated) {
- List<VkSubpassDescription> spDescs = new List<VkSubpassDescription> ();
- foreach (SubPass sp in subpasses)
- spDescs.Add (sp.SubpassDescription);
-
- VkRenderPassCreateInfo renderPassInfo = VkRenderPassCreateInfo.New();
- renderPassInfo.attachmentCount = (uint)attachments.Count;
- renderPassInfo.pAttachments = attachments.Pin ();
- renderPassInfo.subpassCount = (uint)spDescs.Count;
- renderPassInfo.pSubpasses = spDescs.Pin ();
- renderPassInfo.dependencyCount = (uint)dependencies.Count;
- renderPassInfo.pDependencies = dependencies.Pin ();
-
- handle = Dev.CreateRenderPass (renderPassInfo);
-
- foreach (SubPass sp in subpasses)
- sp.UnpinLists ();
-
- attachments.Unpin ();
- spDescs.Unpin ();
- dependencies.Unpin ();
- }
- base.Activate ();
- }
-
-
- public void AddAttachment (VkFormat format,
- VkImageLayout finalLayout, VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1,
- VkAttachmentLoadOp loadOp = VkAttachmentLoadOp.Clear,
- VkAttachmentStoreOp storeOp = VkAttachmentStoreOp.Store,
- VkImageLayout initialLayout = VkImageLayout.Undefined) {
- attachments.Add (new VkAttachmentDescription {
- format = format,
- samples = samples,
- loadOp = loadOp,
- storeOp = storeOp,
- stencilLoadOp = VkAttachmentLoadOp.DontCare,
- stencilStoreOp = VkAttachmentStoreOp.DontCare,
- initialLayout = initialLayout,
- finalLayout = finalLayout,
- });
- }
- public void AddAttachment (VkFormat format, VkImageLayout finalLayout,
- VkAttachmentLoadOp stencilLoadOp,
- VkAttachmentStoreOp stencilStoreOp,
- VkAttachmentLoadOp loadOp = VkAttachmentLoadOp.DontCare,
- VkAttachmentStoreOp storeOp = VkAttachmentStoreOp.DontCare,
- VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1,
- VkImageLayout initialLayout = VkImageLayout.Undefined) {
- attachments.Add (new VkAttachmentDescription {
- format = format,
- samples = samples,
- loadOp = loadOp,
- storeOp = storeOp,
- stencilLoadOp = stencilLoadOp,
- stencilStoreOp = stencilStoreOp,
- initialLayout = initialLayout,
- finalLayout = finalLayout,
- });
- }
- //public void AddDependency (SubPass srcSubpass, SubPass dstSubpass,
- // VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask,
- // VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask,
- // VkDependencyFlags dependencyFlags = VkDependencyFlags.ByRegion) {
-
- // AddDependency (srcSubpass.Index, dstSubpass.Index, srcStageMask, dstStageMask,
- // srcAccessMask, dstAccessMask, dependencyFlags);
- //}
-
- public void AddDependency (uint srcSubpass, uint dstSubpass,
- VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask,
- VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask,
- VkDependencyFlags dependencyFlags = VkDependencyFlags.ByRegion) {
- dependencies.Add (new VkSubpassDependency {
- srcSubpass = srcSubpass,
- dstSubpass = dstSubpass,
- srcStageMask = srcStageMask,
- dstStageMask = dstStageMask,
- srcAccessMask = srcAccessMask,
- dstAccessMask = dstAccessMask,
- dependencyFlags = dependencyFlags
- });
- }
- public void AddSubpass (params SubPass[] subPass) {
- for (uint i = 0; i < subPass.Length; i++) {
- subPass[i].Index = (uint)subpasses.Count + i;
- subpasses.Add (subPass[i]);
- }
- }
- /// <summary>
- /// Begin Render pass with framebuffer extent dimensions
- /// </summary>
- public void Begin (CommandBuffer cmd, Framebuffer frameBuffer) {
- Begin (cmd, frameBuffer, frameBuffer.Width, frameBuffer.Height);
- }
- /// <summary>
- /// Begin Render pass with custom render area
- /// </summary>
- public void Begin (CommandBuffer cmd, Framebuffer frameBuffer, uint width, uint height) {
-
- VkRenderPassBeginInfo info = VkRenderPassBeginInfo.New();
- info.renderPass = handle;
- info.renderArea.extent.width = width;
- info.renderArea.extent.height = height;
- info.clearValueCount = (uint)ClearValues.Count;
- info.pClearValues = ClearValues.Pin ();
- info.framebuffer = frameBuffer.handle;
-
- vkCmdBeginRenderPass (cmd.Handle, ref info, VkSubpassContents.Inline);
-
- ClearValues.Unpin ();
- }
- /// <summary>
- /// Switch to next subpass
- /// </summary>
- public void BeginSubPass (CommandBuffer cmd, VkSubpassContents subpassContents = VkSubpassContents.Inline) {
- vkCmdNextSubpass (cmd.Handle, subpassContents);
- }
- public void End (CommandBuffer cmd) {
- vkCmdEndRenderPass (cmd.Handle);
- }
-
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{handle.Handle.ToString("x")}]");
- }
-
- #region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (state == ActivableState.Activated) {
- if (disposing) {
- } else
- System.Diagnostics.Debug.WriteLine ("VKE Activable RenderPass disposed by finalizer");
-
- Dev.DestroyRenderPass (handle);
- }else if (disposing)
- System.Diagnostics.Debug.WriteLine ("Calling dispose on unactive RenderPass");
-
- base.Dispose (disposing);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/base/Resource.cs b/CVKL/src/base/Resource.cs
deleted file mode 100644
index f5b4c87..0000000
--- a/CVKL/src/base/Resource.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Runtime.InteropServices;
-using VK;
-
-using static VK.Vk;
-
-namespace CVKL {
- [DebuggerDisplay ("{previous.name} <- {name} -> {next.name}")]
- public abstract class Resource : Activable {
- protected VkMemoryRequirements memReqs;
-#if MEMORY_POOLS
- internal MemoryPool memoryPool;
- public ulong poolOffset;
-#else
- protected VkDeviceMemory vkMemory;
-#endif
-
- /// <summary> double linked list in memory pool </summary>
- internal Resource previous;
- public Resource next;
-
- public ulong AllocatedDeviceMemorySize => memReqs.size;
- public uint TypeBits => memReqs.memoryTypeBits;
- public ulong MemoryAlignment => memReqs.alignment;
-
- protected IntPtr mappedData;
- public IntPtr MappedData => mappedData;
-
- public readonly VkMemoryPropertyFlags MemoryFlags;
-
- protected Resource (Device device, VkMemoryPropertyFlags memoryFlags) : base (device) {
- MemoryFlags = memoryFlags;
- }
-
- internal abstract void updateMemoryRequirements ();
-
- internal abstract void bindMemory ();
-
- internal VkMappedMemoryRange MapRange => new VkMappedMemoryRange {
- sType = VkStructureType.MappedMemoryRange,
-#if MEMORY_POOLS
- memory = memoryPool.vkMemory,
- offset = poolOffset,
-#else
- memory = vkMemory,
- offset = 0,
-#endif
- size = AllocatedDeviceMemorySize
- };
-#if !MEMORY_POOLS
- protected void allocateMemory () {
- VkMemoryAllocateInfo memInfo = VkMemoryAllocateInfo.New ();
- memInfo.allocationSize = memReqs.size;
- memInfo.memoryTypeIndex = Dev.GetMemoryTypeIndex (memReqs.memoryTypeBits, MemoryFlags);
- Utils.CheckResult (vkAllocateMemory (Dev.VkDev, ref memInfo, IntPtr.Zero, out vkMemory));
- }
-#endif
-
-
- public void Map (ulong offset = 0) {
-#if MEMORY_POOLS
- if (!memoryPool.IsMapped)
- memoryPool.Map ();
- mappedData = new IntPtr(memoryPool.MappedData.ToInt64() + (long)(poolOffset + offset));
-#else
- Utils.CheckResult (vkMapMemory (Dev.VkDev, vkMemory, offset, AllocatedDeviceMemorySize, 0, ref mappedData));
-#endif
- }
- public void Unmap () {
-#if MEMORY_POOLS
-#else
- vkUnmapMemory (Dev.VkDev, vkMemory);
- mappedData = IntPtr.Zero;
-#endif
- }
- public void Update (object data, ulong size, ulong offset = 0) {
- GCHandle ptr = GCHandle.Alloc (data, GCHandleType.Pinned);
- unsafe {
- System.Buffer.MemoryCopy (ptr.AddrOfPinnedObject ().ToPointer (), (mappedData + (int)offset).ToPointer (), size, size);
- }
- ptr.Free ();
- }
- public void Flush () {
- VkMappedMemoryRange range = MapRange;
- vkFlushMappedMemoryRanges (Dev.VkDev, 1, ref range);
- }
-
-#region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (!disposing)
- System.Diagnostics.Debug.WriteLine ("VKE Activable object disposed by finalizer");
- if (state == ActivableState.Activated) {
- if (mappedData != IntPtr.Zero)
- Unmap ();
-#if MEMORY_POOLS
- memoryPool.Remove (this);
-#else
- vkFreeMemory (Dev.VkDev, vkMemory, IntPtr.Zero);
-#endif
-
- }
- base.Dispose (disposing);
- }
-#endregion
- }
-} \ No newline at end of file
diff --git a/CVKL/src/base/SubPass.cs b/CVKL/src/base/SubPass.cs
deleted file mode 100644
index 2396cdb..0000000
--- a/CVKL/src/base/SubPass.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// SubPass.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System.Collections.Generic;
-using VK;
-
-namespace CVKL {
- public class SubPass {
- public uint Index { get; internal set; }
- List<VkAttachmentReference> colorRefs = new List<VkAttachmentReference>();
- List<VkAttachmentReference> inputRefs = new List<VkAttachmentReference>();
- MarshaledObject<VkAttachmentReference> depthRef;
- List<VkAttachmentReference> resolveRefs = new List<VkAttachmentReference>();
- List<uint> preservedRefs = new List<uint>();
-
- public SubPass () {
- }
- public SubPass (params VkImageLayout[] layouts) {
- for (uint i = 0; i < layouts.Length; i++)
- AddColorReference (i, layouts[i]);
- }
-
- public void AddColorReference (uint attachment, VkImageLayout layout = VkImageLayout.DepthStencilAttachmentOptimal) {
- AddColorReference (new VkAttachmentReference { attachment = attachment, layout = layout });
- }
- public void AddColorReference (params VkAttachmentReference[] refs) {
- if (colorRefs == null)
- colorRefs = new List<VkAttachmentReference> ();
- for (int i = 0; i < refs.Length; i++)
- colorRefs.Add (refs[i]);
- }
- public void AddInputReference (params VkAttachmentReference[] refs) {
- inputRefs.AddRange (refs);
- }
- public void AddPreservedReference (params uint[] refs) {
- preservedRefs.AddRange (refs);
- }
- public void SetDepthReference (uint attachment, VkImageLayout layout = VkImageLayout.DepthStencilAttachmentOptimal) {
- DepthReference = new VkAttachmentReference { attachment = attachment, layout = layout };
- }
- public void AddResolveReference (params VkAttachmentReference[] refs) {
- resolveRefs.AddRange (refs);
- }
- public void AddResolveReference (uint attachment, VkImageLayout layout = VkImageLayout.ColorAttachmentOptimal) {
- AddResolveReference (new VkAttachmentReference { attachment = attachment, layout = layout });
- }
- public VkAttachmentReference DepthReference {
- set {
- if (depthRef != null)
- depthRef.Dispose ();
- depthRef = new MarshaledObject<VkAttachmentReference> (value);
- }
- }
-
- /// <summary>
- /// after having fetched the vkSubpassDescription structure, the lists of attachment are pinned,
- /// so it is mandatory to call the UnpinLists methods after.
- /// </summary>
- public VkSubpassDescription SubpassDescription {
- get {
- VkSubpassDescription subpassDescription = new VkSubpassDescription ();
- subpassDescription.pipelineBindPoint = VkPipelineBindPoint.Graphics;
- if (colorRefs.Count > 0) {
- subpassDescription.colorAttachmentCount = (uint)colorRefs.Count;
- subpassDescription.pColorAttachments = colorRefs.Pin(); ;
- }
- if (inputRefs.Count > 0) {
- subpassDescription.inputAttachmentCount = (uint)inputRefs.Count;
- subpassDescription.pInputAttachments = inputRefs.Pin (); ;
- }
- if (preservedRefs.Count > 0) {
- subpassDescription.preserveAttachmentCount = (uint)preservedRefs.Count;
- subpassDescription.pPreserveAttachments = preservedRefs.Pin (); ;
- }
- if (resolveRefs.Count > 0)
- subpassDescription.pResolveAttachments = resolveRefs.Pin ();
-
- if (depthRef != null)
- subpassDescription.pDepthStencilAttachment = depthRef.Pointer;
-
- return subpassDescription;
- }
- }
-
- public void UnpinLists () {
- if (colorRefs.Count > 0)
- colorRefs.Unpin ();
- if (inputRefs.Count > 0)
- inputRefs.Unpin ();
- if (preservedRefs.Count > 0)
- preservedRefs.Unpin ();
- if (resolveRefs.Count > 0)
- resolveRefs.Unpin ();
- }
-
- public static implicit operator uint(SubPass sp) => sp.Index;
- }
-}
diff --git a/CVKL/src/base/SwapChain.cs b/CVKL/src/base/SwapChain.cs
deleted file mode 100644
index f519055..0000000
--- a/CVKL/src/base/SwapChain.cs
+++ /dev/null
@@ -1,189 +0,0 @@
-//
-// SwapChain.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using VK;
-using static VK.Vk;
-
-namespace CVKL {
- public class SwapChain : Activable {
- /// <summary>
- /// Set the default swapchain image format.
- /// </summary>
- public static VkFormat PREFERED_FORMAT = VkFormat.B8g8r8a8Srgb;
- /// <summary>
- /// Set additional usage flags for the swapchain images such as TransferDst.
- /// </summary>
- public static VkImageUsageFlags IMAGES_USAGE = VkImageUsageFlags.ColorAttachment;
-
- public VkSwapchainKHR Handle { get; private set; }
-
- internal uint currentImageIndex;
- VkSwapchainCreateInfoKHR createInfos;
- PresentQueue presentQueue;
-
- public VkSemaphore presentComplete;
- public Image[] images;
-
- protected override VkDebugMarkerObjectNameInfoEXT DebugMarkerInfo
- => new VkDebugMarkerObjectNameInfoEXT (VkDebugReportObjectTypeEXT.SwapchainKhrEXT, Handle.Handle);
-
- /// <summary>Swapchain images count.</summary>
- public uint ImageCount => (uint)images?.Length;
- public uint Width => createInfos.imageExtent.width;
- public uint Height => createInfos.imageExtent.height;
- public VkFormat ColorFormat => createInfos.imageFormat;
- public VkImageUsageFlags ImageUsage => createInfos.imageUsage;
-
- public SwapChain (PresentQueue _presentableQueue, uint width = 800, uint height = 600, VkFormat format = VkFormat.B8g8r8a8Unorm,
- VkPresentModeKHR presentMode = VkPresentModeKHR.FifoKHR)
- : base (_presentableQueue.dev){
-
- presentQueue = _presentableQueue;
- createInfos = VkSwapchainCreateInfoKHR.New();
-
- VkSurfaceFormatKHR[] formats = Dev.phy.GetSurfaceFormats (presentQueue.Surface);
- for (int i = 0; i < formats.Length; i++) {
- if (formats[i].format == format) {
- createInfos.imageFormat = format;
- createInfos.imageColorSpace = formats[i].colorSpace;
- break;
- }
- }
- if (createInfos.imageFormat == VkFormat.Undefined)
- throw new Exception ("Invalid format for swapchain: " + format);
-
- VkPresentModeKHR[] presentModes = Dev.phy.GetSurfacePresentModes (presentQueue.Surface);
- for (int i = 0; i < presentModes.Length; i++) {
- if (presentModes[i] == presentMode) {
- createInfos.presentMode = presentMode;
- break;
- }
- }
- if (createInfos.presentMode != presentMode)
- throw new Exception ("Invalid presentMode for swapchain: " + presentMode);
-
- createInfos.surface = presentQueue.Surface;
- createInfos.imageExtent = new VkExtent2D (width, height);
- createInfos.imageArrayLayers = 1;
- createInfos.imageUsage = IMAGES_USAGE;
- createInfos.imageSharingMode = VkSharingMode.Exclusive;
- createInfos.compositeAlpha = VkCompositeAlphaFlagsKHR.OpaqueKHR;
- createInfos.presentMode = presentMode;
- createInfos.clipped = 1;
- }
- public override void Activate () {
- if (state != ActivableState.Activated) {
- presentComplete = Dev.CreateSemaphore ();
- presentComplete.SetDebugMarkerName (Dev, "Semaphore PresentComplete");
- }
- base.Activate ();
- }
- /// <summary>
- /// Create swapchain and populate images array
- /// </summary>
- public void Create () {
- if (state != ActivableState.Activated)
- Activate ();
-
- Dev.WaitIdle ();
-
- VkSurfaceCapabilitiesKHR capabilities = Dev.phy.GetSurfaceCapabilities (presentQueue.Surface);
-
- createInfos.minImageCount = capabilities.minImageCount;
- createInfos.preTransform = capabilities.currentTransform;
- createInfos.oldSwapchain = Handle;
-
- if (capabilities.currentExtent.width == 0xFFFFFFFF) {
- if (createInfos.imageExtent.width < capabilities.minImageExtent.width)
- createInfos.imageExtent.width = capabilities.minImageExtent.width;
- else if (createInfos.imageExtent.width > capabilities.maxImageExtent.width)
- createInfos.imageExtent.width = capabilities.maxImageExtent.width;
-
- if (createInfos.imageExtent.height < capabilities.minImageExtent.height)
- createInfos.imageExtent.height = capabilities.minImageExtent.height;
- else if (createInfos.imageExtent.height > capabilities.maxImageExtent.height)
- createInfos.imageExtent.height = capabilities.maxImageExtent.height;
- } else
- createInfos.imageExtent = capabilities.currentExtent;
-
- VkSwapchainKHR newSwapChain = Dev.CreateSwapChain (createInfos);
- if (Handle.Handle != 0)
- _destroy ();
- Handle = newSwapChain;
-
- VkImage[] tmp = Dev.GetSwapChainImages (Handle);
- images = new Image[tmp.Length];
- for (int i = 0; i < tmp.Length; i++) {
- images[i] = new Image (Dev, tmp[i], ColorFormat, ImageUsage, Width, Height);
- images[i].CreateView ();
- images[i].SetName ("SwapChain Img" + i);
- images[i].Descriptor.imageView.SetDebugMarkerName (Dev, "SwapChain Img" + i + " view");
- }
- }
- /// <summary>
- /// Acquire next image, recreate swapchain if out of date or suboptimal error.
- /// </summary>
- /// <returns>Swapchain image index or -1 if failed</returns>
- /// <param name="fence">Fence param of 'vkAcquireNextImageKHR'</param>
- public int GetNextImage (VkFence fence = default(VkFence)) {
- VkResult res = vkAcquireNextImageKHR (Dev.VkDev, Handle, UInt64.MaxValue, presentComplete, fence, out currentImageIndex);
- if (res == VkResult.ErrorOutOfDateKHR || res == VkResult.SuboptimalKHR) {
- Create ();
- return -1;
- }
- Utils.CheckResult (res);
- return (int)currentImageIndex;
- }
-
- void _destroy () {
- for (int i = 0; i < ImageCount; i++)
- images[i].Dispose ();
-
- Dev.DestroySwapChain (Handle);
- }
-
- public override string ToString () {
- return string.Format ($"{base.ToString ()}[0x{Handle.Handle.ToString ("x")}]");
- }
-
- #region IDisposable Support
- protected override void Dispose (bool disposing) {
- if (state == ActivableState.Activated) {
- if (disposing) {
- } else
- System.Diagnostics.Debug.WriteLine ("VKE Swapchain disposed by finalizer");
-
- Dev.DestroySemaphore (presentComplete);
- _destroy ();
-
- } else if (disposing)
- System.Diagnostics.Debug.WriteLine ("Calling dispose on unactive Swapchain");
-
- base.Dispose (disposing);
- }
- #endregion
- }
-}
diff --git a/CVKL/src/gl.cs b/CVKL/src/gl.cs
deleted file mode 100644
index 89de221..0000000
--- a/CVKL/src/gl.cs
+++ /dev/null
@@ -1,982 +0,0 @@
-// C# port of the work from J.M.P. van Waveren by jp Bruyère
-//
-// Original licence is http://www.apache.org/licenses/LICENSE-2.0
-// C# port is under MIT licencing.
-//
-// Author:
-// J.M.P. van Waveren
-// JP Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-// Description : Vulkan format properties and conversion from OpenGL.
-// Author : J.M.P. van Waveren
-// Date : 07/17/2016
-// Language : C99
-// Format : Real tabs with the tab size equal to 4 spaces.
-// Copyright : Copyright (c) 2016 Oculus VR, LLC. All Rights reserved.
-// LICENSE
-// =======
-//
-// Copyright (c) 2016 Oculus VR, LLC.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-using System.Diagnostics;
-using VK;
-
-namespace KTX
-{
- public static class GLHelper {
-
- #region GL constants
- const uint GL_R8 = 0x8229;
- const uint GL_R8_SNORM = 0x8F94;
- const uint GL_RG8_SNORM = 0x8F95;
- const uint GL_RGB8_SNORM = 0x8F96;
- const uint GL_RGBA8_SNORM = 0x8F97;
- const uint GL_R8UI = 0x8232;
- const uint GL_RG8UI = 0x8238;
- const uint GL_RGB8UI = 0x8D7D;
- const uint GL_RGBA8UI = 0x8D7C;
- const uint GL_R8I = 0x8231;
- const uint GL_RG8I = 0x8237;
- const uint GL_RGB8I = 0x8D8F;
- const uint GL_RGBA8I = 0x8D8E;
- const uint GL_SR8 = 0x8FBD;
- const uint GL_SRG8 = 0x8FBE;
- const uint GL_SRGB8 = 0x8C41;
- const uint GL_SRGB8_ALPHA8 = 0x8C43;
- const uint GL_R16 = 0x822A;
- const uint GL_RG16 = 0x822C;
- const uint GL_RGB16 = 0x8054;
- const uint GL_RGBA16 = 0x805B;
- const uint GL_R16_SNORM = 0x8F98;
- const uint GL_RG16_SNORM = 0x8F99;
- const uint GL_RGB16_SNORM = 0x8F9A;
- const uint GL_RGBA16_SNORM = 0x8F9B;
- const uint GL_R16UI = 0x8234;
- const uint GL_RG16UI = 0x823A;
- const uint GL_RGB16UI = 0x8D77;
- const uint GL_RGBA16UI = 0x8D76;
- const uint GL_R16I = 0x8233;
- const uint GL_RG16I = 0x8239;
- const uint GL_RGB16I = 0x8D89;
- const uint GL_RGBA16I = 0x8D88;
- const uint GL_R16F = 0x822D;
- const uint GL_RG16F = 0x822F;
- const uint GL_RGB16F = 0x881B;
- const uint GL_RGBA16F = 0x881A;
- const uint GL_R32UI = 0x8236;
- const uint GL_RG32UI = 0x823C;
- const uint GL_RGB32UI = 0x8D71;
- const uint GL_RGBA32UI = 0x8D70;
- const uint GL_R32I = 0x8235;
- const uint GL_RG32I = 0x823B;
- const uint GL_RGB32I = 0x8D83;
- const uint GL_RGBA32I = 0x8D82;
- const uint GL_R32F = 0x822E;
- const uint GL_RG32F = 0x8230;
- const uint GL_RGB32F = 0x8815;
- const uint GL_RGBA32F = 0x8814;
- const uint GL_R3_G3_B2 = 0x2A10;
- const uint GL_RGB4 = 0x804F;
- const uint GL_RGB5 = 0x8050;
- const uint GL_RGB565 = 0x8D62;
- const uint GL_RGB10 = 0x8052;
- const uint GL_RGB12 = 0x8053;
- const uint GL_RGBA2 = 0x8055;
- const uint GL_RGBA4 = 0x8056;
- const uint GL_RGBA12 = 0x805A;
- const uint GL_RGB5_A1 = 0x8057;
- const uint GL_RGB10_A2 = 0x8059;
- const uint GL_RGB10_A2UI = 0x906F;
- const uint GL_R11F_G11F_B10F = 0x8C3A;
- const uint GL_RGB9_E5 = 0x8C3D;
- const uint GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
- const uint GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
- const uint GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
- const uint GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
- const uint GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C;
- const uint GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D;
- const uint GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E;
- const uint GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F;
- const uint GL_COMPRESSED_LUMINANCE_LATC1_EXT = 0x8C70;
- const uint GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C72;
- const uint GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = 0x8C71;
- const uint GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C73;
- const uint GL_COMPRESSED_RED_RGTC1 = 0x8DBB;
- const uint GL_COMPRESSED_RG_RGTC2 = 0x8DBD;
- const uint GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC;
- const uint GL_COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE;
- const uint GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F;
- const uint GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E;
- const uint GL_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C;
- const uint GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D;
- const uint GL_ETC1_RGB8_OES = 0x8D64;
- const uint GL_COMPRESSED_RGB8_ETC2 = 0x9274;
- const uint GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276;
- const uint GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278;
- const uint GL_COMPRESSED_SRGB8_ETC2 = 0x9275;
- const uint GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279;
- const uint GL_COMPRESSED_R11_EAC = 0x9270;
- const uint GL_COMPRESSED_RG11_EAC = 0x9272;
- const uint GL_COMPRESSED_SIGNED_R11_EAC = 0x9271;
- const uint GL_COMPRESSED_SIGNED_RG11_EAC = 0x9273;
- const uint GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01;
- const uint GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
- const uint GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;
- const uint GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
- const uint GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG = 0x9137;
- const uint GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG = 0x9138;
- const uint GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT = 0x8A54;
- const uint GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT = 0x8A55;
- const uint GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT = 0x8A56;
- const uint GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT = 0x8A57;
- const uint GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG = 0x93F0;
- const uint GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG = 0x93F1;
- const uint GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
- const uint GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
- const uint GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
- const uint GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
- const uint GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
- const uint GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
- const uint GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
- const uint GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
- const uint GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
- const uint GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
- const uint GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
- const uint GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
- const uint GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
- const uint GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
- const uint GL_COMPRESSED_RGBA_ASTC_3x3x3_OES = 0x93C0;
- const uint GL_COMPRESSED_RGBA_ASTC_4x3x3_OES = 0x93C1;
- const uint GL_COMPRESSED_RGBA_ASTC_4x4x3_OES = 0x93C2;
- const uint GL_COMPRESSED_RGBA_ASTC_4x4x4_OES = 0x93C3;
- const uint GL_COMPRESSED_RGBA_ASTC_5x4x4_OES = 0x93C4;
- const uint GL_COMPRESSED_RGBA_ASTC_5x5x4_OES = 0x93C5;
- const uint GL_COMPRESSED_RGBA_ASTC_5x5x5_OES = 0x93C6;
- const uint GL_COMPRESSED_RGBA_ASTC_6x5x5_OES = 0x93C7;
- const uint GL_COMPRESSED_RGBA_ASTC_6x6x5_OES = 0x93C8;
- const uint GL_COMPRESSED_RGBA_ASTC_6x6x6_OES = 0x93C9;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES = 0x93E0;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES = 0x93E1;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES = 0x93E2;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES = 0x93E3;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES = 0x93E4;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES = 0x93E5;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES = 0x93E6;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES = 0x93E7;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES = 0x93E8;
- const uint GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES = 0x93E9;
- const uint GL_ATC_RGB_AMD = 0x8C92;
- const uint GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = 0x8C93;
- const uint GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = 0x87EE;
- const uint GL_PALETTE4_RGB8_OES = 0x8B90;
- const uint GL_PALETTE4_RGBA8_OES = 0x8B91;
- const uint GL_PALETTE4_R5_G6_B5_OES = 0x8B92;
- const uint GL_PALETTE4_RGBA4_OES = 0x8B93;
- const uint GL_PALETTE4_RGB5_A1_OES = 0x8B94;
- const uint GL_PALETTE8_RGB8_OES = 0x8B95;
- const uint GL_PALETTE8_RGBA8_OES = 0x8B96;
- const uint GL_PALETTE8_R5_G6_B5_OES = 0x8B97;
- const uint GL_PALETTE8_RGBA4_OES = 0x8B98;
- const uint GL_PALETTE8_RGB5_A1_OES = 0x8B99;
- const uint GL_DEPTH_COMPONENT16 = 0x81A5;
- const uint GL_DEPTH_COMPONENT24 = 0x81A6;
- const uint GL_DEPTH_COMPONENT32 = 0x81A7;
- const uint GL_DEPTH_COMPONENT32F = 0x8CAC;
- const uint GL_DEPTH_COMPONENT32F_NV = 0x8DAB;
- const uint GL_STENCIL_INDEX1 = 0x8D46;
- const uint GL_STENCIL_INDEX4 = 0x8D47;
- const uint GL_STENCIL_INDEX8 = 0x8D48;
- const uint GL_STENCIL_INDEX16 = 0x8D49;
- const uint GL_DEPTH24_STENCIL8 = 0x88F0;
- const uint GL_DEPTH32F_STENCIL8 = 0x8CAD;
- const uint GL_DEPTH32F_STENCIL8_NV = 0x8DAC;
-
- const uint GL_UNSIGNED_BYTE = 0x1401;
- const uint GL_RED = 0x1903;
- const uint GL_RG = 0x8227;
- const uint GL_RGB = 0x1907;
- const uint GL_BGR = 0x80E0;
- const uint GL_RGBA = 0x1908;
- const uint GL_BGRA = 0x80E1;
- const uint GL_RED_INTEGER = 0x8D94;
- const uint GL_RG_INTEGER = 0x8228;
- const uint GL_RGB_INTEGER = 0x8D98;
- const uint GL_BGR_INTEGER = 0x8D9A;
- const uint GL_RGBA_INTEGER = 0x8D99;
- const uint GL_BGRA_INTEGER = 0x8D9B;
- const uint GL_STENCIL_INDEX = 0x1901;
- const uint GL_DEPTH_COMPONENT = 0x1902;
- const uint GL_DEPTH_STENCIL = 0x84F9;
- const uint GL_BYTE = 0x1400;
- const uint GL_UNSIGNED_SHORT = 0x1403;
- const uint GL_SHORT = 0x1402;
- const uint GL_HALF_FLOAT = 0x140B;
- const uint GL_HALF_FLOAT_OES = 0x8D61;
- const uint GL_UNSIGNED_INT = 0x1405;
- const uint GL_INT = 0x1404;
- const uint GL_FLOAT = 0x1406;
- const uint GL_UNSIGNED_INT64 = 0x8BC2;
- const uint GL_INT64 = 0x140E;
- const uint GL_DOUBLE = 0x140A;
- const uint GL_UNSIGNED_BYTE_3_3_2 = 0x8032;
- const uint GL_UNSIGNED_BYTE_2_3_3_REV = 0x8362;
- const uint GL_UNSIGNED_SHORT_5_6_5 = 0x8363;
- const uint GL_UNSIGNED_SHORT_5_6_5_REV = 0x8364;
- const uint GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033;
- const uint GL_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365;
- const uint GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034;
- const uint GL_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366;
- const uint GL_UNSIGNED_INT_8_8_8_8 = 0x8035;
- const uint GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367;
- const uint GL_UNSIGNED_INT_10_10_10_2 = 0x8036;
- const uint GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368;
- const uint GL_UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B;
- const uint GL_UNSIGNED_INT_5_9_9_9_REV = 0x8C3E;
- const uint GL_UNSIGNED_INT_24_8 = 0x84FA;
- const uint GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD;
- #endregion
-
- public static VkFormat vkGetFormatFromOpenGLInternalFormat(uint internalFormat)
- {
-
- switch (internalFormat)
- {
- //
- // 8 bits per component
- //
- case GL_R8: return VkFormat.R8Unorm; // 1-component, 8-bit unsigned normalized
- case GL_R8_SNORM: return VkFormat.R8Snorm; // 1-component, 8-bit signed normalized
- case GL_RG8_SNORM: return VkFormat.R8g8Snorm; // 2-component, 8-bit signed normalized
- case GL_RGB8_SNORM: return VkFormat.R8g8b8Snorm; // 3-component, 8-bit signed normalized
- case GL_RGBA8_SNORM: return VkFormat.R8g8b8a8Snorm; // 4-component, 8-bit signed normalized
-
- case GL_R8UI: return VkFormat.R8Uint; // 1-component, 8-bit unsigned integer
- case GL_RG8UI: return VkFormat.R8g8Uint; // 2-component, 8-bit unsigned integer
- case GL_RGB8UI: return VkFormat.R8g8b8Uint; // 3-component, 8-bit unsigned integer
- case GL_RGBA8UI: return VkFormat.R8g8b8a8Uint; // 4-component, 8-bit unsigned integer
-
- case GL_R8I: return VkFormat.R8Sint; // 1-component, 8-bit signed integer
- case GL_RG8I: return VkFormat.R8g8Sint; // 2-component, 8-bit signed integer
- case GL_RGB8I: return VkFormat.R8g8b8Sint; // 3-component, 8-bit signed integer
- case GL_RGBA8I: return VkFormat.R8g8b8a8Sint; // 4-component, 8-bit signed integer
-
- case GL_SR8: return VkFormat.R8Srgb; // 1-component, 8-bit sRGB
- case GL_SRG8: return VkFormat.R8g8Srgb; // 2-component, 8-bit sRGB
- case GL_SRGB8: return VkFormat.R8g8b8Srgb; // 3-component, 8-bit sRGB
- case GL_SRGB8_ALPHA8: return VkFormat.R8g8b8a8Srgb; // 4-component, 8-bit sRGB
-
- //
- // 16 bits per component
- //
- case GL_R16: return VkFormat.R16Unorm; // 1-component, 16-bit unsigned normalized
- case GL_RG16: return VkFormat.R16g16Unorm; // 2-component, 16-bit unsigned normalized
- case GL_RGB16: return VkFormat.R16g16b16Unorm; // 3-component, 16-bit unsigned normalized
- case GL_RGBA16: return VkFormat.R16g16b16a16Unorm; // 4-component, 16-bit unsigned normalized
-
- case GL_R16_SNORM: return VkFormat.R16Snorm; // 1-component, 16-bit signed normalized
- case GL_RG16_SNORM: return VkFormat.R16g16Snorm; // 2-component, 16-bit signed normalized
- case GL_RGB16_SNORM: return VkFormat.R16g16b16Snorm; // 3-component, 16-bit signed normalized
- case GL_RGBA16_SNORM: return VkFormat.R16g16b16a16Snorm; // 4-component, 16-bit signed normalized
-
- case GL_R16UI: return VkFormat.R16Uint; // 1-component, 16-bit unsigned integer
- case GL_RG16UI: return VkFormat.R16g16Uint; // 2-component, 16-bit unsigned integer
- case GL_RGB16UI: return VkFormat.R16g16b16Uint; // 3-component, 16-bit unsigned integer
- case GL_RGBA16UI: return VkFormat.R16g16b16a16Uint; // 4-component, 16-bit unsigned integer
-
- case GL_R16I: return VkFormat.R16Sint; // 1-component, 16-bit signed integer
- case GL_RG16I: return VkFormat.R16g16Sint; // 2-component, 16-bit signed integer
- case GL_RGB16I: return VkFormat.R16g16b16Sint; // 3-component, 16-bit signed integer
- case GL_RGBA16I: return VkFormat.R16g16b16a16Sint; // 4-component, 16-bit signed integer
-
- case GL_R16F: return VkFormat.R16Sfloat; // 1-component, 16-bit floating-point
- case GL_RG16F: return VkFormat.R16g16Sfloat; // 2-component, 16-bit floating-point
- case GL_RGB16F: return VkFormat.R16g16b16Sfloat; // 3-component, 16-bit floating-point
- case GL_RGBA16F: return VkFormat.R16g16b16a16Sfloat; // 4-component, 16-bit floating-point
-
- //
- // 32 bits per component
- //
- case GL_R32UI: return VkFormat.R32Uint; // 1-component, 32-bit unsigned integer
- case GL_RG32UI: return VkFormat.R32g32Uint; // 2-component, 32-bit unsigned integer
- case GL_RGB32UI: return VkFormat.R32g32b32Uint; // 3-component, 32-bit unsigned integer
- case GL_RGBA32UI: return VkFormat.R32g32b32a32Uint; // 4-component, 32-bit unsigned integer
-
- case GL_R32I: return VkFormat.R32Sint; // 1-component, 32-bit signed integer
- case GL_RG32I: return VkFormat.R32g32Sint; // 2-component, 32-bit signed integer
- case GL_RGB32I: return VkFormat.R32g32b32Sint; // 3-component, 32-bit signed integer
- case GL_RGBA32I: return VkFormat.R32g32b32a32Sint; // 4-component, 32-bit signed integer
-
- case GL_R32F: return VkFormat.R32Sfloat; // 1-component, 32-bit floating-point
- case GL_RG32F: return VkFormat.R32g32Sfloat; // 2-component, 32-bit floating-point
- case GL_RGB32F: return VkFormat.R32g32b32Sfloat; // 3-component, 32-bit floating-point
- case GL_RGBA32F: return VkFormat.R32g32b32a32Sfloat; // 4-component, 32-bit floating-point
-
- //
- // Packed
- //
- case GL_R3_G3_B2: return VkFormat.Undefined; // 3-component 3:3:2, unsigned normalized
- case GL_RGB4: return VkFormat.Undefined; // 3-component 4:4:4, unsigned normalized
- case GL_RGB5: return VkFormat.R5g5b5a1UnormPack16; // 3-component 5:5:5, unsigned normalized
- case GL_RGB565: return VkFormat.R5g6b5UnormPack16; // 3-component 5:6:5, unsigned normalized
- case GL_RGB10: return VkFormat.A2r10g10b10UnormPack32; // 3-component 10:10:10, unsigned normalized
- case GL_RGB12: return VkFormat.Undefined; // 3-component 12:12:12, unsigned normalized
- case GL_RGBA2: return VkFormat.Undefined; // 4-component 2:2:2:2, unsigned normalized
- case GL_RGBA4: return VkFormat.R4g4b4a4UnormPack16; // 4-component 4:4:4:4, unsigned normalized
- case GL_RGBA12: return VkFormat.Undefined; // 4-component 12:12:12:12, unsigned normalized
- case GL_RGB5_A1: return VkFormat.A1r5g5b5UnormPack16; // 4-component 5:5:5:1, unsigned normalized
- case GL_RGB10_A2: return VkFormat.A2r10g10b10UnormPack32; // 4-component 10:10:10:2, unsigned normalized
- case GL_RGB10_A2UI: return VkFormat.A2r10g10b10UintPack32; // 4-component 10:10:10:2, unsigned integer
- case GL_R11F_G11F_B10F: return VkFormat.B10g11r11UfloatPack32; // 3-component 11:11:10, floating-point
- case GL_RGB9_E5: return VkFormat.E5b9g9r9UfloatPack32; // 3-component/exp 9:9:9/5, floating-point
-
- //
- // S3TC/DXT/BC
- //
-
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return VkFormat.Bc1RgbUnormBlock; // line through 3D space, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return VkFormat.Bc1RgbaUnormBlock; // line through 3D space plus 1-bit alpha, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return VkFormat.Bc2UnormBlock; // line through 3D space plus line through 1D space, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return VkFormat.Bc3UnormBlock; // line through 3D space plus 4-bit alpha, 4x4 blocks, unsigned normalized
-
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: return VkFormat.Bc1RgbSrgbBlock; // line through 3D space, 4x4 blocks, sRGB
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return VkFormat.Bc1RgbaSrgbBlock; // line through 3D space plus 1-bit alpha, 4x4 blocks, sRGB
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return VkFormat.Bc2SrgbBlock; // line through 3D space plus line through 1D space, 4x4 blocks, sRGB
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return VkFormat.Bc3SrgbBlock; // line through 3D space plus 4-bit alpha, 4x4 blocks, sRGB
-
- case GL_COMPRESSED_LUMINANCE_LATC1_EXT: return VkFormat.Bc4UnormBlock; // line through 1D space, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: return VkFormat.Bc5UnormBlock; // two lines through 1D space, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: return VkFormat.Bc4SnormBlock; // line through 1D space, 4x4 blocks, signed normalized
- case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: return VkFormat.Bc5SnormBlock; // two lines through 1D space, 4x4 blocks, signed normalized
-
- case GL_COMPRESSED_RED_RGTC1: return VkFormat.Bc4UnormBlock; // line through 1D space, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RG_RGTC2: return VkFormat.Bc5UnormBlock; // two lines through 1D space, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_SIGNED_RED_RGTC1: return VkFormat.Bc4SnormBlock; // line through 1D space, 4x4 blocks, signed normalized
- case GL_COMPRESSED_SIGNED_RG_RGTC2: return VkFormat.Bc5SnormBlock; // two lines through 1D space, 4x4 blocks, signed normalized
-
- case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: return VkFormat.Bc6hUfloatBlock; // 3-component, 4x4 blocks, unsigned floating-point
- case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT: return VkFormat.Bc6hSfloatBlock; // 3-component, 4x4 blocks, signed floating-point
- case GL_COMPRESSED_RGBA_BPTC_UNORM: return VkFormat.Bc7UnormBlock; // 4-component, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM: return VkFormat.Bc7SrgbBlock; // 4-component, 4x4 blocks, sRGB
-
- //
- // ETC
- //
- case GL_ETC1_RGB8_OES: return VkFormat.Etc2R8g8b8UnormBlock; // 3-component ETC1, 4x4 blocks, unsigned normalized
-
- case GL_COMPRESSED_RGB8_ETC2: return VkFormat.Etc2R8g8b8UnormBlock; // 3-component ETC2, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: return VkFormat.Etc2R8g8b8a1UnormBlock; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA8_ETC2_EAC: return VkFormat.Etc2R8g8b8a8UnormBlock; // 4-component ETC2, 4x4 blocks, unsigned normalized
-
- case GL_COMPRESSED_SRGB8_ETC2: return VkFormat.Etc2R8g8b8SrgbBlock; // 3-component ETC2, 4x4 blocks, sRGB
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: return VkFormat.Etc2R8g8b8a1SrgbBlock; // 4-component ETC2 with 1-bit alpha, 4x4 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: return VkFormat.Etc2R8g8b8a8SrgbBlock; // 4-component ETC2, 4x4 blocks, sRGB
-
- case GL_COMPRESSED_R11_EAC: return VkFormat.EacR11UnormBlock; // 1-component ETC, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RG11_EAC: return VkFormat.EacR11g11UnormBlock; // 2-component ETC, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_SIGNED_R11_EAC: return VkFormat.EacR11SnormBlock; // 1-component ETC, 4x4 blocks, signed normalized
- case GL_COMPRESSED_SIGNED_RG11_EAC: return VkFormat.EacR11g11SnormBlock; // 2-component ETC, 4x4 blocks, signed normalized
-
- //
- // PVRTC
- //
- case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: return VkFormat.Undefined; // 3-component PVRTC, 16x8 blocks, unsigned normalized
- case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: return VkFormat.Undefined; // 3-component PVRTC, 8x8 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: return VkFormat.Undefined; // 4-component PVRTC, 16x8 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: return VkFormat.Undefined; // 4-component PVRTC, 8x8 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG: return VkFormat.Undefined; // 4-component PVRTC, 8x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG: return VkFormat.Undefined; // 4-component PVRTC, 4x4 blocks, unsigned normalized
-
- case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT: return VkFormat.Undefined; // 3-component PVRTC, 16x8 blocks, sRGB
- case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT: return VkFormat.Undefined; // 3-component PVRTC, 8x8 blocks, sRGB
- case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT: return VkFormat.Undefined; // 4-component PVRTC, 16x8 blocks, sRGB
- case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT: return VkFormat.Undefined; // 4-component PVRTC, 8x8 blocks, sRGB
- case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG: return VkFormat.Undefined; // 4-component PVRTC, 8x4 blocks, sRGB
- case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG: return VkFormat.Undefined; // 4-component PVRTC, 4x4 blocks, sRGB
-
- //
- // ASTC
- //
- case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: return VkFormat.Astc4x4UnormBlock; // 4-component ASTC, 4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: return VkFormat.Astc5x4UnormBlock; // 4-component ASTC, 5x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: return VkFormat.Astc5x5UnormBlock; // 4-component ASTC, 5x5 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: return VkFormat.Astc6x5UnormBlock; // 4-component ASTC, 6x5 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: return VkFormat.Astc6x6UnormBlock; // 4-component ASTC, 6x6 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: return VkFormat.Astc8x5UnormBlock; // 4-component ASTC, 8x5 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: return VkFormat.Astc8x6UnormBlock; // 4-component ASTC, 8x6 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: return VkFormat.Astc8x8UnormBlock; // 4-component ASTC, 8x8 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: return VkFormat.Astc10x5UnormBlock; // 4-component ASTC, 10x5 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: return VkFormat.Astc10x6UnormBlock; // 4-component ASTC, 10x6 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: return VkFormat.Astc10x8UnormBlock; // 4-component ASTC, 10x8 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: return VkFormat.Astc10x10UnormBlock; // 4-component ASTC, 10x10 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: return VkFormat.Astc12x10UnormBlock; // 4-component ASTC, 12x10 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: return VkFormat.Astc12x12UnormBlock; // 4-component ASTC, 12x12 blocks, unsigned normalized
-
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: return VkFormat.Astc4x4SrgbBlock; // 4-component ASTC, 4x4 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: return VkFormat.Astc5x4SrgbBlock; // 4-component ASTC, 5x4 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: return VkFormat.Astc5x5SrgbBlock; // 4-component ASTC, 5x5 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: return VkFormat.Astc6x5SrgbBlock; // 4-component ASTC, 6x5 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: return VkFormat.Astc6x6SrgbBlock; // 4-component ASTC, 6x6 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: return VkFormat.Astc8x5SrgbBlock; // 4-component ASTC, 8x5 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: return VkFormat.Astc8x6SrgbBlock; // 4-component ASTC, 8x6 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: return VkFormat.Astc8x8SrgbBlock; // 4-component ASTC, 8x8 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: return VkFormat.Astc10x5SrgbBlock; // 4-component ASTC, 10x5 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: return VkFormat.Astc10x6SrgbBlock; // 4-component ASTC, 10x6 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: return VkFormat.Astc10x8SrgbBlock; // 4-component ASTC, 10x8 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: return VkFormat.Astc10x10SrgbBlock; // 4-component ASTC, 10x10 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: return VkFormat.Astc12x10SrgbBlock; // 4-component ASTC, 12x10 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: return VkFormat.Astc12x12SrgbBlock; // 4-component ASTC, 12x12 blocks, sRGB
-
- case GL_COMPRESSED_RGBA_ASTC_3x3x3_OES: return VkFormat.Undefined; // 4-component ASTC, 3x3x3 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_4x3x3_OES: return VkFormat.Undefined; // 4-component ASTC, 4x3x3 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_4x4x3_OES: return VkFormat.Undefined; // 4-component ASTC, 4x4x3 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_4x4x4_OES: return VkFormat.Undefined; // 4-component ASTC, 4x4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_5x4x4_OES: return VkFormat.Undefined; // 4-component ASTC, 5x4x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_5x5x4_OES: return VkFormat.Undefined; // 4-component ASTC, 5x5x4 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_5x5x5_OES: return VkFormat.Undefined; // 4-component ASTC, 5x5x5 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_6x5x5_OES: return VkFormat.Undefined; // 4-component ASTC, 6x5x5 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_6x6x5_OES: return VkFormat.Undefined; // 4-component ASTC, 6x6x5 blocks, unsigned normalized
- case GL_COMPRESSED_RGBA_ASTC_6x6x6_OES: return VkFormat.Undefined; // 4-component ASTC, 6x6x6 blocks, unsigned normalized
-
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES: return VkFormat.Undefined; // 4-component ASTC, 3x3x3 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES: return VkFormat.Undefined; // 4-component ASTC, 4x3x3 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES: return VkFormat.Undefined; // 4-component ASTC, 4x4x3 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES: return VkFormat.Undefined; // 4-component ASTC, 4x4x4 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES: return VkFormat.Undefined; // 4-component ASTC, 5x4x4 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES: return VkFormat.Undefined; // 4-component ASTC, 5x5x4 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES: return VkFormat.Undefined; // 4-component ASTC, 5x5x5 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES: return VkFormat.Undefined; // 4-component ASTC, 6x5x5 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES: return VkFormat.Undefined; // 4-component ASTC, 6x6x5 blocks, sRGB
- case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES: return VkFormat.Undefined; // 4-component ASTC, 6x6x6 blocks, sRGB
-
- //
- // ATC
- //
- case GL_ATC_RGB_AMD: return VkFormat.Undefined; // 3-component, 4x4 blocks, unsigned normalized
- case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: return VkFormat.Undefined; // 4-component, 4x4 blocks, unsigned normalized
- case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: return VkFormat.Undefined; // 4-component, 4x4 blocks, unsigned normalized
-
- //
- // Palletized
- //
- case GL_PALETTE4_RGB8_OES: return VkFormat.Undefined; // 3-component 8:8:8, 4-bit palette, unsigned normalized
- case GL_PALETTE4_RGBA8_OES: return VkFormat.Undefined; // 4-component 8:8:8:8, 4-bit palette, unsigned normalized
- case GL_PALETTE4_R5_G6_B5_OES: return VkFormat.Undefined; // 3-component 5:6:5, 4-bit palette, unsigned normalized
- case GL_PALETTE4_RGBA4_OES: return VkFormat.Undefined; // 4-component 4:4:4:4, 4-bit palette, unsigned normalized
- case GL_PALETTE4_RGB5_A1_OES: return VkFormat.Undefined; // 4-component 5:5:5:1, 4-bit palette, unsigned normalized
- case GL_PALETTE8_RGB8_OES: return VkFormat.Undefined; // 3-component 8:8:8, 8-bit palette, unsigned normalized
- case GL_PALETTE8_RGBA8_OES: return VkFormat.Undefined; // 4-component 8:8:8:8, 8-bit palette, unsigned normalized
- case GL_PALETTE8_R5_G6_B5_OES: return VkFormat.Undefined; // 3-component 5:6:5, 8-bit palette, unsigned normalized
- case GL_PALETTE8_RGBA4_OES: return VkFormat.Undefined; // 4-component 4:4:4:4, 8-bit palette, unsigned normalized
- case GL_PALETTE8_RGB5_A1_OES: return VkFormat.Undefined; // 4-component 5:5:5:1, 8-bit palette, unsigned normalized
-
- //
- // Depth/stencil
- //
- case GL_DEPTH_COMPONENT16: return VkFormat.D16Unorm;
- case GL_DEPTH_COMPONENT24: return VkFormat.X8D24UnormPack32;
- case GL_DEPTH_COMPONENT32: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT32F: return VkFormat.D32Sfloat;
- case GL_DEPTH_COMPONENT32F_NV: return VkFormat.D32Sfloat;
- case GL_STENCIL_INDEX1: return VkFormat.Undefined;
- case GL_STENCIL_INDEX4: return VkFormat.Undefined;
- case GL_STENCIL_INDEX8: return VkFormat.S8Uint;
- case GL_STENCIL_INDEX16: return VkFormat.Undefined;
- case GL_DEPTH24_STENCIL8: return VkFormat.D24UnormS8Uint;
- case GL_DEPTH32F_STENCIL8: return VkFormat.D32SfloatS8Uint;
- case GL_DEPTH32F_STENCIL8_NV: return VkFormat.D32SfloatS8Uint;
-
- default: return VkFormat.Undefined;
- }
- }
-
- public static VkFormat vkGetFormatFromOpenGLFormat (uint format, uint type) {
- switch (type) {
- //
- // 8 bits per component
- //
- case GL_UNSIGNED_BYTE: {
- switch (format) {
- case GL_RED: return VkFormat.R8Unorm;
- case GL_RG: return VkFormat.R8g8Unorm;
- case GL_RGB: return VkFormat.R8g8b8Unorm;
- case GL_BGR: return VkFormat.B8g8r8Unorm;
- case GL_RGBA: return VkFormat.R8g8b8a8Unorm;
- case GL_BGRA: return VkFormat.B8g8r8a8Unorm;
- case GL_RED_INTEGER: return VkFormat.R8Uint;
- case GL_RG_INTEGER: return VkFormat.R8g8Uint;
- case GL_RGB_INTEGER: return VkFormat.R8g8b8Uint;
- case GL_BGR_INTEGER: return VkFormat.B8g8r8Uint;
- case GL_RGBA_INTEGER: return VkFormat.R8g8b8a8Uint;
- case GL_BGRA_INTEGER: return VkFormat.B8g8r8a8Uint;
- case GL_STENCIL_INDEX: return VkFormat.S8Uint;
- case GL_DEPTH_COMPONENT: return VkFormat.Undefined;
- case GL_DEPTH_STENCIL: return VkFormat.Undefined;
- }
- break;
- }
- case GL_BYTE: {
- switch (format) {
- case GL_RED: return VkFormat.R8Snorm;
- case GL_RG: return VkFormat.R8g8Snorm;
- case GL_RGB: return VkFormat.R8g8b8Snorm;
- case GL_BGR: return VkFormat.B8g8r8Snorm;
- case GL_RGBA: return VkFormat.R8g8b8a8Snorm;
- case GL_BGRA: return VkFormat.B8g8r8a8Snorm;
- case GL_RED_INTEGER: return VkFormat.R8Sint;
- case GL_RG_INTEGER: return VkFormat.R8g8Sint;
- case GL_RGB_INTEGER: return VkFormat.R8g8b8Sint;
- case GL_BGR_INTEGER: return VkFormat.B8g8r8Sint;
- case GL_RGBA_INTEGER: return VkFormat.R8g8b8a8Sint;
- case GL_BGRA_INTEGER: return VkFormat.B8g8r8a8Sint;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.Undefined;
- case GL_DEPTH_STENCIL: return VkFormat.Undefined;
- }
- break;
- }
-
- //
- // 16 bits per component
- //
- case GL_UNSIGNED_SHORT: {
- switch (format) {
- case GL_RED: return VkFormat.R16Unorm;
- case GL_RG: return VkFormat.R16g16Unorm;
- case GL_RGB: return VkFormat.R16g16b16Unorm;
- case GL_BGR: return VkFormat.Undefined;
- case GL_RGBA: return VkFormat.R16g16b16a16Unorm;
- case GL_BGRA: return VkFormat.Undefined;
- case GL_RED_INTEGER: return VkFormat.R16Uint;
- case GL_RG_INTEGER: return VkFormat.R16g16Uint;
- case GL_RGB_INTEGER: return VkFormat.R16g16b16Uint;
- case GL_BGR_INTEGER: return VkFormat.Undefined;
- case GL_RGBA_INTEGER: return VkFormat.R16g16b16a16Uint;
- case GL_BGRA_INTEGER: return VkFormat.Undefined;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.D16Unorm;
- case GL_DEPTH_STENCIL: return VkFormat.D16UnormS8Uint;
- }
- break;
- }
- case GL_SHORT: {
- switch (format) {
- case GL_RED: return VkFormat.R16Snorm;
- case GL_RG: return VkFormat.R16g16Snorm;
- case GL_RGB: return VkFormat.R16g16b16Snorm;
- case GL_BGR: return VkFormat.Undefined;
- case GL_RGBA: return VkFormat.R16g16b16a16Snorm;
- case GL_BGRA: return VkFormat.Undefined;
- case GL_RED_INTEGER: return VkFormat.R16Sint;
- case GL_RG_INTEGER: return VkFormat.R16g16Sint;
- case GL_RGB_INTEGER: return VkFormat.R16g16b16Sint;
- case GL_BGR_INTEGER: return VkFormat.Undefined;
- case GL_RGBA_INTEGER: return VkFormat.R16g16b16a16Sint;
- case GL_BGRA_INTEGER: return VkFormat.Undefined;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.Undefined;
- case GL_DEPTH_STENCIL: return VkFormat.Undefined;
- }
- break;
- }
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES: {
- switch (format) {
- case GL_RED: return VkFormat.R16Sfloat;
- case GL_RG: return VkFormat.R16g16Sfloat;
- case GL_RGB: return VkFormat.R16g16b16Sfloat;
- case GL_BGR: return VkFormat.Undefined;
- case GL_RGBA: return VkFormat.R16g16b16a16Sfloat;
- case GL_BGRA: return VkFormat.Undefined;
- case GL_RED_INTEGER: return VkFormat.Undefined;
- case GL_RG_INTEGER: return VkFormat.Undefined;
- case GL_RGB_INTEGER: return VkFormat.Undefined;
- case GL_BGR_INTEGER: return VkFormat.Undefined;
- case GL_RGBA_INTEGER: return VkFormat.Undefined;
- case GL_BGRA_INTEGER: return VkFormat.Undefined;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.Undefined;
- case GL_DEPTH_STENCIL: return VkFormat.Undefined;
- }
- break;
- }
-
- //
- // 32 bits per component
- //
- case GL_UNSIGNED_INT: {
- switch (format) {
- case GL_RED: return VkFormat.R32Uint;
- case GL_RG: return VkFormat.R32g32Uint;
- case GL_RGB: return VkFormat.R32g32b32Uint;
- case GL_BGR: return VkFormat.Undefined;
- case GL_RGBA: return VkFormat.R32g32b32a32Uint;
- case GL_BGRA: return VkFormat.Undefined;
- case GL_RED_INTEGER: return VkFormat.R32Uint;
- case GL_RG_INTEGER: return VkFormat.R32g32Uint;
- case GL_RGB_INTEGER: return VkFormat.R32g32b32Uint;
- case GL_BGR_INTEGER: return VkFormat.Undefined;
- case GL_RGBA_INTEGER: return VkFormat.R32g32b32a32Uint;
- case GL_BGRA_INTEGER: return VkFormat.Undefined;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.X8D24UnormPack32;
- case GL_DEPTH_STENCIL: return VkFormat.D24UnormS8Uint;
- }
- break;
- }
- case GL_INT: {
- switch (format) {
- case GL_RED: return VkFormat.R32Sint;
- case GL_RG: return VkFormat.R32g32Sint;
- case GL_RGB: return VkFormat.R32g32b32Sint;
- case GL_BGR: return VkFormat.Undefined;
- case GL_RGBA: return VkFormat.R32g32b32a32Sint;
- case GL_BGRA: return VkFormat.Undefined;
- case GL_RED_INTEGER: return VkFormat.R32Sint;
- case GL_RG_INTEGER: return VkFormat.R32g32Sint;
- case GL_RGB_INTEGER: return VkFormat.R32g32b32Sint;
- case GL_BGR_INTEGER: return VkFormat.Undefined;
- case GL_RGBA_INTEGER: return VkFormat.R32g32b32a32Sint;
- case GL_BGRA_INTEGER: return VkFormat.Undefined;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.Undefined;
- case GL_DEPTH_STENCIL: return VkFormat.Undefined;
- }
- break;
- }
- case GL_FLOAT: {
- switch (format) {
- case GL_RED: return VkFormat.R32Sfloat;
- case GL_RG: return VkFormat.R32g32Sfloat;
- case GL_RGB: return VkFormat.R32g32b32Sfloat;
- case GL_BGR: return VkFormat.Undefined;
- case GL_RGBA: return VkFormat.R32g32b32a32Sfloat;
- case GL_BGRA: return VkFormat.Undefined;
- case GL_RED_INTEGER: return VkFormat.Undefined;
- case GL_RG_INTEGER: return VkFormat.Undefined;
- case GL_RGB_INTEGER: return VkFormat.Undefined;
- case GL_BGR_INTEGER: return VkFormat.Undefined;
- case GL_RGBA_INTEGER: return VkFormat.Undefined;
- case GL_BGRA_INTEGER: return VkFormat.Undefined;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.D32Sfloat;
- case GL_DEPTH_STENCIL: return VkFormat.D32SfloatS8Uint;
- }
- break;
- }
-
- //
- // 64 bits per component
- //
- case GL_UNSIGNED_INT64: {
- switch (format) {
- case GL_RED: return VkFormat.R64Uint;
- case GL_RG: return VkFormat.R64g64Uint;
- case GL_RGB: return VkFormat.R64g64b64Uint;
- case GL_BGR: return VkFormat.Undefined;
- case GL_RGBA: return VkFormat.R64g64b64a64Uint;
- case GL_BGRA: return VkFormat.Undefined;
- case GL_RED_INTEGER: return VkFormat.Undefined;
- case GL_RG_INTEGER: return VkFormat.Undefined;
- case GL_RGB_INTEGER: return VkFormat.Undefined;
- case GL_BGR_INTEGER: return VkFormat.Undefined;
- case GL_RGBA_INTEGER: return VkFormat.Undefined;
- case GL_BGRA_INTEGER: return VkFormat.Undefined;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.Undefined;
- case GL_DEPTH_STENCIL: return VkFormat.Undefined;
- }
- break;
- }
- case GL_INT64: {
- switch (format) {
- case GL_RED: return VkFormat.R64Sint;
- case GL_RG: return VkFormat.R64g64Sint;
- case GL_RGB: return VkFormat.R64g64b64Sint;
- case GL_BGR: return VkFormat.Undefined;
- case GL_RGBA: return VkFormat.R64g64b64a64Sint;
- case GL_BGRA: return VkFormat.Undefined;
- case GL_RED_INTEGER: return VkFormat.R64Sint;
- case GL_RG_INTEGER: return VkFormat.R64g64Sint;
- case GL_RGB_INTEGER: return VkFormat.R64g64b64Sint;
- case GL_BGR_INTEGER: return VkFormat.Undefined;
- case GL_RGBA_INTEGER: return VkFormat.R64g64b64a64Sint;
- case GL_BGRA_INTEGER: return VkFormat.Undefined;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.Undefined;
- case GL_DEPTH_STENCIL: return VkFormat.Undefined;
- }
- break;
- }
- case GL_DOUBLE: {
- switch (format) {
- case GL_RED: return VkFormat.R64Sfloat;
- case GL_RG: return VkFormat.R64g64Sfloat;
- case GL_RGB: return VkFormat.R64g64b64Sfloat;
- case GL_BGR: return VkFormat.Undefined;
- case GL_RGBA: return VkFormat.R64g64b64a64Sfloat;
- case GL_BGRA: return VkFormat.Undefined;
- case GL_RED_INTEGER: return VkFormat.R64Sfloat;
- case GL_RG_INTEGER: return VkFormat.R64g64Sfloat;
- case GL_RGB_INTEGER: return VkFormat.R64g64b64Sfloat;
- case GL_BGR_INTEGER: return VkFormat.Undefined;
- case GL_RGBA_INTEGER: return VkFormat.R64g64b64a64Sfloat;
- case GL_BGRA_INTEGER: return VkFormat.Undefined;
- case GL_STENCIL_INDEX: return VkFormat.Undefined;
- case GL_DEPTH_COMPONENT: return VkFormat.Undefined;
- case GL_DEPTH_STENCIL: return VkFormat.Undefined;
- }
- break;
- }
-
- //
- // Packed
- //
-
- case GL_UNSIGNED_BYTE_3_3_2:
- Debug.Assert (format == GL_RGB || format == GL_RGB_INTEGER);
- return VkFormat.Undefined;
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- Debug.Assert (format == GL_BGR || format == GL_BGR_INTEGER);
- return VkFormat.Undefined;
- case GL_UNSIGNED_SHORT_5_6_5:
- Debug.Assert (format == GL_RGB || format == GL_RGB_INTEGER);
- return VkFormat.R5g6b5UnormPack16;
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- Debug.Assert (format == GL_BGR || format == GL_BGR_INTEGER);
- return VkFormat.B5g6r5UnormPack16;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- Debug.Assert (format == GL_RGB || format == GL_BGRA || format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER);
- return VkFormat.R4g4b4a4UnormPack16;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- Debug.Assert (format == GL_RGB || format == GL_BGRA || format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER);
- return VkFormat.B4g4r4a4UnormPack16;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- Debug.Assert (format == GL_RGB || format == GL_BGRA || format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER);
- return VkFormat.R5g5b5a1UnormPack16;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- Debug.Assert (format == GL_RGB || format == GL_BGRA || format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER);
- return VkFormat.A1r5g5b5UnormPack16;
- case GL_UNSIGNED_INT_8_8_8_8:
- Debug.Assert (format == GL_RGB || format == GL_BGRA || format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER);
- return (format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER) ? VkFormat.R8g8b8a8Uint : VkFormat.R8g8b8a8Unorm;
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- Debug.Assert (format == GL_RGB || format == GL_BGRA || format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER);
- return (format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER) ? VkFormat.A8b8g8r8UintPack32 : VkFormat.A8b8g8r8UnormPack32;
- case GL_UNSIGNED_INT_10_10_10_2:
- Debug.Assert (format == GL_RGB || format == GL_BGRA || format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER);
- return (format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER) ? VkFormat.A2r10g10b10UintPack32 : VkFormat.A2r10g10b10UnormPack32;
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- Debug.Assert (format == GL_RGB || format == GL_BGRA || format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER);
- return (format == GL_RGB_INTEGER || format == GL_BGRA_INTEGER) ? VkFormat.A2b10g10r10UintPack32 : VkFormat.A2b10g10r10UnormPack32;
- case GL_UNSIGNED_INT_10F_11F_11F_REV:
- Debug.Assert (format == GL_RGB || format == GL_BGR);
- return VkFormat.B10g11r11UfloatPack32;
- case GL_UNSIGNED_INT_5_9_9_9_REV:
- Debug.Assert (format == GL_RGB || format == GL_BGR);
- return VkFormat.E5b9g9r9UfloatPack32;
- case GL_UNSIGNED_INT_24_8:
- Debug.Assert (format == GL_DEPTH_STENCIL);
- return VkFormat.D24UnormS8Uint;
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
- Debug.Assert (format == GL_DEPTH_STENCIL);
- return VkFormat.D32SfloatS8Uint;
-
-
- }
-
- return VkFormat.Undefined;
- }
-
- public static VkFormat vkGetFormatFromOpenGLType( uint type, uint numComponents, bool normalized )
- {
- switch (type) {
- //
- // 8 bits per component
- //
- case GL_UNSIGNED_BYTE: {
- switch (numComponents) {
- case 1: return normalized ? VkFormat.R8Unorm : VkFormat.R8Uint;
- case 2: return normalized ? VkFormat.R8g8Unorm : VkFormat.R8g8Uint;
- case 3: return normalized ? VkFormat.R8g8b8Unorm : VkFormat.R8g8b8Uint;
- case 4: return normalized ? VkFormat.R8g8b8a8Unorm : VkFormat.R8g8b8a8Uint;
- }
- break;
- }
- case GL_BYTE: {
- switch (numComponents) {
- case 1: return normalized ? VkFormat.R8Snorm : VkFormat.R8Sint;
- case 2: return normalized ? VkFormat.R8g8Snorm : VkFormat.R8g8Sint;
- case 3: return normalized ? VkFormat.R8g8b8Snorm : VkFormat.R8g8b8Sint;
- case 4: return normalized ? VkFormat.R8g8b8a8Snorm : VkFormat.R8g8b8a8Sint;
- }
- break;
- }
-
- //
- // 16 bits per component
- //
- case GL_UNSIGNED_SHORT: {
- switch (numComponents) {
- case 1: return normalized ? VkFormat.R16Unorm : VkFormat.R16Uint;
- case 2: return normalized ? VkFormat.R16g16Unorm : VkFormat.R16g16Uint;
- case 3: return normalized ? VkFormat.R16g16b16Unorm : VkFormat.R16g16b16Uint;
- case 4: return normalized ? VkFormat.R16g16b16a16Unorm : VkFormat.R16g16b16a16Uint;
- }
- break;
- }
- case GL_SHORT: {
- switch (numComponents) {
- case 1: return normalized ? VkFormat.R16Snorm : VkFormat.R16Sint;
- case 2: return normalized ? VkFormat.R16g16Snorm : VkFormat.R16g16Sint;
- case 3: return normalized ? VkFormat.R16g16b16Snorm : VkFormat.R16g16b16Sint;
- case 4: return normalized ? VkFormat.R16g16b16a16Snorm : VkFormat.R16g16b16a16Sint;
- }
- break;
- }
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES: {
- switch (numComponents) {
- case 1: return VkFormat.R16Sfloat;
- case 2: return VkFormat.R16g16Sfloat;
- case 3: return VkFormat.R16g16b16Sfloat;
- case 4: return VkFormat.R16g16b16a16Sfloat;
- }
- break;
- }
-
- //
- // 32 bits per component
- //
- case GL_UNSIGNED_INT: {
- switch (numComponents) {
- case 1: return VkFormat.R32Uint;
- case 2: return VkFormat.R32g32Uint;
- case 3: return VkFormat.R32g32b32Uint;
- case 4: return VkFormat.R32g32b32a32Uint;
- }
- break;
- }
- case GL_INT: {
- switch (numComponents) {
- case 1: return VkFormat.R32Sint;
- case 2: return VkFormat.R32g32Sint;
- case 3: return VkFormat.R32g32b32Sint;
- case 4: return VkFormat.R32g32b32a32Sint;
- }
- break;
- }
- case GL_FLOAT: {
- switch (numComponents) {
- case 1: return VkFormat.R32Sfloat;
- case 2: return VkFormat.R32g32Sfloat;
- case 3: return VkFormat.R32g32b32Sfloat;
- case 4: return VkFormat.R32g32b32a32Sfloat;
- }
- break;
- }
-
- //
- // 64 bits per component
- //
- case GL_UNSIGNED_INT64: {
- switch (numComponents) {
- case 1: return VkFormat.R64Uint;
- case 2: return VkFormat.R64g64Uint;
- case 3: return VkFormat.R64g64b64Uint;
- case 4: return VkFormat.R64g64b64a64Uint;
- }
- break;
- }
- case GL_INT64: {
- switch (numComponents) {
- case 1: return VkFormat.R64Sint;
- case 2: return VkFormat.R64g64Sint;
- case 3: return VkFormat.R64g64b64Sint;
- case 4: return VkFormat.R64g64b64a64Sint;
- }
- break;
- }
- case GL_DOUBLE: {
- switch (numComponents) {
- case 1: return VkFormat.R64Sfloat;
- case 2: return VkFormat.R64g64Sfloat;
- case 3: return VkFormat.R64g64b64Sfloat;
- case 4: return VkFormat.R64g64b64a64Sfloat;
- }
- break;
- }
-
- //
- // Packed
- //
- case GL_UNSIGNED_BYTE_3_3_2: return VkFormat.Undefined;
- case GL_UNSIGNED_BYTE_2_3_3_REV: return VkFormat.Undefined;
- case GL_UNSIGNED_SHORT_5_6_5: return VkFormat.R5g6b5UnormPack16;
- case GL_UNSIGNED_SHORT_5_6_5_REV: return VkFormat.B5g6r5UnormPack16;
- case GL_UNSIGNED_SHORT_4_4_4_4: return VkFormat.R4g4b4a4UnormPack16;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV: return VkFormat.B4g4r4a4UnormPack16;
- case GL_UNSIGNED_SHORT_5_5_5_1: return VkFormat.R5g5b5a1UnormPack16;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV: return VkFormat.A1r5g5b5UnormPack16;
- case GL_UNSIGNED_INT_8_8_8_8: return normalized ? VkFormat.R8g8b8a8Unorm : VkFormat.R8g8b8a8Uint;
- case GL_UNSIGNED_INT_8_8_8_8_REV: return normalized ? VkFormat.A8b8g8r8UnormPack32 : VkFormat.A8b8g8r8UintPack32;
- case GL_UNSIGNED_INT_10_10_10_2: return normalized ? VkFormat.A2r10g10b10UnormPack32 : VkFormat.A2r10g10b10UintPack32;
- case GL_UNSIGNED_INT_2_10_10_10_REV: return normalized ? VkFormat.A2b10g10r10UnormPack32 : VkFormat.A2b10g10r10UintPack32;
- case GL_UNSIGNED_INT_10F_11F_11F_REV: return VkFormat.B10g11r11UfloatPack32;
- case GL_UNSIGNED_INT_5_9_9_9_REV: return VkFormat.E5b9g9r9UfloatPack32;
- case GL_UNSIGNED_INT_24_8: return VkFormat.D24UnormS8Uint;
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return VkFormat.D32SfloatS8Uint;
- }
-
- return VkFormat.Undefined;
- }
-
-
-
- }
-}
diff --git a/CVKL/src/glfw/CodePoint.cs b/CVKL/src/glfw/CodePoint.cs
deleted file mode 100644
index 09a60c9..0000000
--- a/CVKL/src/glfw/CodePoint.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Glfw
-{
- /// <summary>
- /// Represents a native UTF32 codepoint.
- /// </summary>
- [StructLayout (LayoutKind.Explicit)]
- public struct CodePoint
- {
- /// <summary>
- /// The numeric value of the codepoint.
- /// </summary>
- [FieldOffset (0)] public readonly uint Value;
- [FieldOffset (0)] readonly byte byte0;
- [FieldOffset (1)] readonly byte byte1;
- [FieldOffset (2)] readonly byte byte2;
- [FieldOffset (3)] readonly byte byte3;
- /// <summary>
- /// Casts the codepoint to System.Char.
- /// </summary>
- /// <returns>
- /// The character representation of the codepoint.
- /// </returns>
- public char ToChar() => Encoding.UTF32.GetChars (new byte[] { byte0, byte0, byte0, byte0 })[0];
- /// <summary>
- /// Converts the value of this instance to its equivalent string representation.
- /// </summary>
- /// <returns>
- /// A string containing the character representation of the codepoint.
- /// </returns>
- public override string ToString() => ToChar().ToString();
- }
-}
diff --git a/CVKL/src/glfw/Delegates.cs b/CVKL/src/glfw/Delegates.cs
deleted file mode 100644
index bfcbb0e..0000000
--- a/CVKL/src/glfw/Delegates.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)using System;
-using System;
-using System.Runtime.InteropServices;
-
-namespace Glfw {
- /// <summary>
- /// The function signature for keyboard key callback functions.
- /// </summary>
- /// <param name="window">
- /// The window that received the event.
- /// </param>
- /// <param name="key">
- /// The keyboard key that was pressed or released.
- /// </param>
- /// <param name="scanCode">
- /// The system-specific scancode of the key.
- /// </param>
- /// <param name="action">
- /// The input action that occured.
- /// </param>
- /// <param name="modifiers">
- /// Bit field describing which modifier keys were held down.
- /// </param>
- public delegate void KeyDelegate (IntPtr window, Key key, int scanCode, InputAction action, Modifier modifiers);
- /// <summary>
- /// A delegate representing character events on a WindowHandle.
- /// </summary>
- /// <param name="window">
- /// The window raising the event.
- /// </param>
- /// <param name="codepoint">
- /// The Unicode codepoint of the character.
- /// </param>
- public delegate void CharDelegate (IntPtr window, CodePoint codepoint);
- /// <summary>
- /// A delegate representing character events with modifiers on a WindowHandle.
- /// </summary>
- /// <param name="window">
- /// The window raising the event.
- /// </param>
- /// <param name="codepoint">
- /// The Unicode codepoint of the character.
- /// </param>
- /// <param name="modifiers">
- /// The modifiers applied to the character.
- /// </param>
- public delegate void CharModsDelegate (IntPtr window, CodePoint codepoint, Modifier modifiers);
- /// <summary>
- /// The function signature for cursor position callback functions.
- /// </summary>
- /// <param name="window">
- /// The window that received the event.
- /// </param>
- /// <param name="xPosition">
- /// The new cursor x-coordinate, relative to the left edge of the client area.
- /// </param>
- /// <param name="yPosition">
- /// The new cursor y-coordinate, relative to the top edge of the client area.
- /// </param>
- public delegate void CursorPosDelegate (IntPtr window, double xPosition, double yPosition);
- /// <summary>
- /// The function signature for error callbacks.
- /// </summary>
- /// <param name="error">An error code giving the general category of the error.</param>
- /// <param name="description">A string description of the error.</param>
- [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- public delegate void ErrorDelegate (ErrorCode error, [MarshalAs (UnmanagedType.LPStr)] string description);
- /// <summary>
- /// The function signature for monitor configuration callback functions.
- /// </summary>
- /// <param name="monitor">
- /// The monitor that was connected or disconnected.
- /// </param>
- /// <param name="eventStatus">
- /// The event that was raised.
- /// </param>
- [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- public delegate void MonitorEventDelegate (MonitorHandle monitor, MonitorEvent eventStatus);
- /// <summary>
- /// The function signature for mouse button callback functions.
- /// </summary>
- /// <param name="window">
- /// The window that received the event.
- /// </param>
- /// <param name="button">
- /// The mouse button that was pressed or released.
- /// </param>
- /// <param name="action">
- /// One of <see cref="InputAction.Press"/> or <see cref="InputAction.Release"/>.
- /// </param>
- /// <param name="mods">
- /// Bit field describing which modifier keys were held down.
- /// </param>
- public delegate void MouseButtonDelegate (IntPtr window, MouseButton button, InputAction action, Modifier mods);
- /// <summary>
- /// The function signature for scroll callback functions.
- /// </summary>
- /// <param name="window">
- /// The window that received the event.
- /// </param>
- /// <param name="xOffset">
- /// The scroll offset along the x-axis.
- /// </param>
- /// <param name="yOffset">
- /// The scroll offset along the y-axis.
- /// </param>
- public delegate void ScrollDelegate (IntPtr window, double xOffset, double yOffset);
- /// <summary>
- /// The function signature for window size callback functions.
- /// </summary>
- /// <param name="window">
- /// The window that was resized.
- /// </param>
- /// <param name="width">
- /// The new width, in screen coordinates, of the window.
- /// </param>
- /// <param name="height">
- /// The new height, in screen coordinates, of the window.
- /// </param>
- [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- public delegate void WindowSizeDelegate (IntPtr window, int width, int height);
-
-}
-
diff --git a/CVKL/src/glfw/ErrorCode.cs b/CVKL/src/glfw/ErrorCode.cs
deleted file mode 100644
index ef76890..0000000
--- a/CVKL/src/glfw/ErrorCode.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-namespace Glfw
-{
- /// <summary>
- /// Indicates the general category of an error.
- /// </summary>
- public enum ErrorCode
- {
- /// <summary>
- /// GLFW has not been initialized.
- /// </summary>
- NotInitialised = 0x00010001,
- /// <summary>
- /// No context is current for this thread.
- /// </summary>
- NoCurrentContext,
- /// <summary>
- /// One of the arguments to the function was an invalid enum value.
- /// </summary>
- InvalidEnum,
- /// <summary>
- /// One of the arguments to the function was an invalid value.
- /// </summary>
- InvalidValue,
- /// <summary>
- /// A memory allocation failed.
- /// </summary>
- OutOfMemory,
- /// <summary>
- /// GLFW could not find support for the requested API on the system.
- /// </summary>
- ApiUnavailable,
- /// <summary>
- /// The requested OpenGL or OpenGL ES version is not available.
- /// </summary>
- VersionUnavailable,
- /// <summary>
- /// A platform-specific error occurred that does not match any of the more specific categories.
- /// </summary>
- PlatformError,
- /// <summary>
- /// The requested format is not supported or available.
- /// </summary>
- FormatUnavailable,
- /// <summary>
- /// The specified window does not have an OpenGL or OpenGL ES context.
- /// </summary>
- NoWindowContext
- }
-}
diff --git a/CVKL/src/glfw/Glfw3.cs b/CVKL/src/glfw/Glfw3.cs
deleted file mode 100644
index 1531d79..0000000
--- a/CVKL/src/glfw/Glfw3.cs
+++ /dev/null
@@ -1,533 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Runtime.InteropServices;
-
-namespace Glfw {
- public enum CursorShape
- {
- Arrow = 0x00036001,
- IBeam = 0x00036002,
- Crosshair = 0x00036003,
- Hand = 0x00036004,
- HResize = 0x00036005,
- VResize = 0x00036006
- }
- /// <summary>
- /// Interop functions for the GLFW3 API.
- /// </summary>
- public static class Glfw3
- {
- /// <summary>
- /// The base name for the GLFW3 library.
- /// </summary>
- public const string GlfwDll = "glfw";
-
- /// <summary>
- /// Initializes the GLFW library.
- /// </summary>
- /// <returns>
- /// True if successful, otherwise false.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwInit")]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool Init();
-
- /// <summary>
- /// This function destroys all remaining windows and cursors, restores
- /// any modified gamma ramps and frees any other allocated resources.
- /// </summary>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwTerminate")]
- public static extern void Terminate();
-
- /// <summary>
- /// This function retrieves the major, minor and revision numbers of
- /// the GLFW library.
- /// </summary>
- /// <param name="major">
- /// The major version number.
- /// </param>
- /// <param name="minor">
- /// The minor version number.
- /// </param>
- /// <param name="rev">
- /// The revision number.
- /// </param>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetVersion")]
- public static extern void GetVersion(out int major, out int minor, out int rev);
-
-
- /// <summary>
- /// Returns the compile-time generated version string of the GLFW
- /// library binary. It describes the version, platform, compiler and
- /// any platform-specific compile-time options.
- /// </summary>
- /// <returns>
- /// The compile-time generated version string of the GLFW library
- /// binary.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetVersionString")]
- public static extern NativeString GetVersionString();
-
- /// <summary>
- /// Creates a window and its associated OpenGL or OpenGL ES context.
- /// Most of the options controlling how the window and its context
- /// should be created are specified with window hints.
- /// </summary>
- /// <param name="width">
- /// The desired width, in screen coordinates, of the window. This must
- /// be greater than zero.
- /// </param>
- /// <param name="height">
- /// The desired height, in screen coordinates, of the window. This must
- /// be greater than zero.
- /// </param>
- /// <param name="title">
- /// The initial window title.
- /// </param>
- /// <param name="monitor">
- /// The monitor to use for full screen mode, or Null for windowed mode.
- /// </param>
- /// <param name="share">
- /// The window whose context to share resources with, or Null to not share resources.
- /// </param>
- /// <returns>
- /// The handle of the created window, or Null if an error occurred.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwCreateWindow")]
- public static extern IntPtr CreateWindow(int width, int height, [MarshalAs(UnmanagedType.LPStr)] string title, MonitorHandle monitor, IntPtr share);
-
- /// <summary>
- /// Destroys the specified window and its context. On calling this
- /// function, no further callbacks will be called for that window.
- /// </summary>
- /// <param name="window">
- /// The window to destroy.
- /// </param>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwDestroyWindow")]
- public static extern void DestroyWindow(IntPtr window);
-
- /// <summary>
- /// Processes events in the event queue and then returns immediately.
- /// Processing events will cause the window and input callbacks
- /// associated with those events to be called.
- /// </summary>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwPollEvents")]
- public static extern void PollEvents();
-
- /// <summary>
- /// Sets hints for the next call to CreateWindow. The hints, once set,
- /// retain their values until changed by a call to WindowHint or
- /// DefaultWindowHints, or until the library is terminated.
- /// </summary>
- /// <param name="hint">
- /// The window hint to set.
- /// </param>
- /// <param name="value">
- /// The new value of the window hint.
- /// </param>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwWindowHint")]
- public static extern void WindowHint(WindowAttribute hint, int value);
-
- /// <summary>
- /// Returns the value of the close flag of the specified window.
- /// </summary>
- /// <param name="window">
- /// The window to query.
- /// </param>
- /// <returns>
- /// The value of the close flag.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwWindowShouldClose")]
- public static extern bool WindowShouldClose(IntPtr window);
-
- [DllImport (GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetWindowShouldClose")]
- public static extern void SetWindowShouldClose (IntPtr window, int value);
-
- [DllImport (GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetWindowTitle")]
- public static extern void SetWindowTitle (IntPtr window, [MarshalAs (UnmanagedType.LPStr)] string title);
-
- /// <summary>
- /// Creates a Vulkan surface for the specified window.
- /// </summary>
- /// <param name="instance">
- /// The Vulkan instance to create the surface in.
- /// </param>
- /// <param name="window">
- /// The window to create the surface for.
- /// </param>
- /// <param name="pAllocator">
- /// The allocator to use, or NULL to use the default allocator.
- /// </param>
- /// <param name="surface">
- /// Where to store the handle of the surface. This is set to
- /// VK_NULL_HANDLE if an error occurred.
- /// </param>
- /// <returns>
- /// Result.Success if successful, or a Vulkan error code if an error
- /// occurred.
- /// </returns>
- [DllImport (GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwCreateWindowSurface")]
- public static extern int CreateWindowSurface(IntPtr instance, IntPtr window, IntPtr pAllocator, out ulong surface);
-
- /// <summary>
- /// Returns an array of names of Vulkan instance extensions required by
- /// GLFW for creating Vulkan surfaces for GLFW windows. If successful,
- /// the list will always contains VK_KHR_surface, so if you don't
- /// require any additional extensions you can pass this list directly
- /// to the InstanceCreateInfo struct.
- /// </summary>
- /// <param name="count">
- /// Where to store the number of extensions in the returned array. This
- /// is set to zero if an error occurred.
- /// </param>
- /// <returns>
- /// An array of extension names, or Null if an error occurred.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetRequiredInstanceExtensions")]
- public static extern IntPtr GetRequiredInstanceExtensions(out int count);
-
- /// <summary>
- /// Sets the size callback of the specified window, which is called
- /// when the window is resized. The callback is provided with the size,
- /// in screen coordinates, of the client area of the window.
- /// </summary>
- /// <param name="window">
- /// The window whose callback to set.
- /// </param>
- /// <param name="callback">
- /// The new callback, or Null to remove the currently set callback.
- /// </param>
- /// <returns></returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetWindowSizeCallback")]
- public static extern WindowSizeDelegate SetWindowSizeCallback(IntPtr window, WindowSizeDelegate callback);
-
- /// <summary>
- /// Sets the error callback, which is called with an error code and a
- /// human-readable description each time a GLFW error occurs.
- /// </summary>
- /// <param name="callback">
- /// The new callback, or Null to remove the currently set callback.
- /// </param>
- /// <returns>
- /// The previously set callback, or Null if no callback was set.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetErrorCallback")]
- public static extern ErrorDelegate SetErrorCallback(ErrorDelegate callback);
-
- /// <summary>
- /// Returns an array of handles for all currently connected monitors.
- /// The primary monitor is always first in the returned array. If no
- /// monitors were found, this function returns Null.
- /// </summary>
- /// <param name="count">
- /// Where to store the number of monitors in the returned array. This
- /// is set to zero if an error occurred.
- /// </param>
- /// <returns>
- /// An array of monitor handles, or Null if no monitors were found or
- /// if an error occurred.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetMonitors")]
- public static extern IntPtr GetMonitors(out int count);
-
- /// <summary>
- /// Returns the primary monitor. This is usually the monitor where
- /// elements like the task bar or global menu bar are located.
- /// </summary>
- /// <returns>
- /// The primary monitor, or Null if no monitors were found or if an
- /// error occurred.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetPrimaryMonitor")]
- public static extern MonitorHandle GetPrimaryMonitor();
-
- /// <summary>
- /// Returns the position, in screen coordinates, of the upper-left
- /// corner of the specified monitor.
- /// </summary>
- /// <param name="monitor">
- /// The monitor to query.
- /// </param>
- /// <param name="xPos">
- /// Returns the monitor x-coordinate.
- /// </param>
- /// <param name="yPos">
- /// Returns the monitor y-coordinate.
- /// </param>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetMonitorPos")]
- public static extern void GetMonitorPos(MonitorHandle monitor, out int xPos, out int yPos);
-
- /// <summary>
- /// Returns the size, in millimetres, of the display area of the
- /// specified monitor.
- /// </summary>
- /// <param name="monitor">
- /// The monitor to query.
- /// </param>
- /// <param name="widthMm">
- /// The width, in millimetres, of the monitor's display area.
- /// </param>
- /// <param name="heightMm">
- /// The width, in millimetres, of the monitor's display area.
- /// </param>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetMonitorPhysicalSize")]
- public static extern void GetMonitorPhysicalSize(MonitorHandle monitor, out int widthMm, out int heightMm);
-
- /// <summary>
- /// Returns a human-readable name, of the specified monitor. The name
- /// typically reflects the make and model of the monitor and is not
- /// guaranteed to be unique among the connected monitors.
- /// </summary>
- /// <param name="monitor">
- /// The monitor to query.
- /// </param>
- /// <returns>
- /// The name of the monitor, or Null if an error occurred.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetMonitorName")]
- public static extern NativeString GetMonitorName(MonitorHandle monitor);
-
- /// <summary>
- /// Sets the monitor configuration callback, or removes the currently
- /// set callback. This is called when a monitor is connected to or
- /// disconnected from the system.
- /// </summary>
- /// <param name="callback">
- /// The new callback, or Null to remove the currently set callback.
- /// </param>
- /// <returns>
- /// The previously set callback, or NULL if no callback was set or the
- /// library had not been initialized.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetMonitorCallback")]
- public static extern MonitorEventDelegate SetMonitorCallback(MonitorEventDelegate callback);
-
- /// <summary>
- /// Returns an array of all video modes supported by the specified
- /// monitor. The returned array is sorted in ascending order, first by
- /// color bit depth (the sum of all channel depths) and then by
- /// resolution area (the product of width and height).
- /// </summary>
- /// <param name="monitor">
- /// The monitor to query.
- /// </param>
- /// <param name="count">
- /// Tthe number of video modes in the returned array. This is set to
- /// zero if an error occurred.
- /// </param>
- /// <returns>
- /// An array of video modes, or Null if an error occurred.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetVideoModes")]
- public static extern IntPtr GetVideoModes(MonitorHandle monitor, out int count);
-
- /// <summary>
- /// Returns the current video mode of the specified monitor. If you
- /// have created a full screen window for that monitor, the return
- /// value will depend on whether that window is iconified.
- /// </summary>
- /// <param name="monitor">
- /// The monitor to query.
- /// </param>
- /// <returns>
- /// A wrapped pointer to the current mode of the monitor, or Null if
- /// an error occurred.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetVideoMode")]
- public static extern VideoModePointer GetVideoMode(MonitorHandle monitor);
-
- /// <summary>
- /// Generates a 256-element gamma ramp from the specified exponent and
- /// then calls glfwSetGammaRamp with it. The value must be a finite
- /// number greater than zero.
- /// </summary>
- /// <param name="monitor">
- /// The monitor whose gamma ramp to set.
- /// </param>
- /// <param name="gamma">
- /// The desired exponent.
- /// </param>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetGamma")]
- public static extern void SetGamma(MonitorHandle monitor, float gamma);
-
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetInputMode")]
- public static extern int GetInputMode(IntPtr window, int mode);
-
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetInputMode")]
- public static extern void SetInputMode(IntPtr window, int mode, int value);
-
- /// <summary>
- /// Returns the localized name of the specified printable key. This is
- /// intended for displaying key bindings to the user.
- /// </summary>
- /// <param name="key">
- /// The key to query, or Key.Unknown.
- /// </param>
- /// <param name="scancode">
- /// The scancode of the key to query, if key is Key.Unknown.
- /// </param>
- /// <returns>
- /// The localized name of the key, or Null.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetKeyName")]
- public static extern NativeString GetKeyName(Key key, int scancode);
-
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetKey")]
- public static extern InputAction GetKey(IntPtr window, Key key);
-
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetMouseButton")]
- public static extern InputAction GetMouseButton(IntPtr window, MouseButton button);
-
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwGetCursorPos")]
- public static extern void GetCursorPosition(IntPtr window, out double xPosition, out double yPosition);
-
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetCursorPos")]
- public static extern void SetCursorPosition(IntPtr window, double xPosition, double yPosition);
-
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetKeyCallback")]
- public static extern KeyDelegate SetKeyCallback(IntPtr window, KeyDelegate callback);
-
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetCharCallback")]
- public static extern KeyDelegate SetCharCallback(IntPtr window, CharDelegate callback);
-
- /// <summary>
- /// <para>Sets a callback for Mouse movement events. Use this for full
- /// mouse path resolution between PollEvents() calls.</para>
- /// <para>From GLFW Documentation: The callback functions receives the
- /// cursor position, measured in screen coordinates but relative to the
- /// top-left corner of the window client area. On platforms that
- /// provide it, the full sub-pixel cursor position is passed on.</para>
- /// </summary>
- /// <returns>
- /// The previously set callback, or NULL if no callback was set or the
- /// library had not been initialized.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetCursorPosCallback")]
- public static extern CursorPosDelegate SetCursorPosCallback(IntPtr window, CursorPosDelegate callback);
-
- /// <summary>
- /// <para>Sets a Callback for Button Events (i.e. clicks). This also
- /// detects mouse press and release events done between PollEvents()
- /// calls.</para>
- /// <para>From GLFW Documentation: Whenever you poll state, you risk
- /// missing the state change you are looking for. If a pressed mouse
- /// button is released again before you poll its state, you will have
- /// missed the button press. The recommended solution for this is to
- /// use a mouse button callback, but there is also the
- /// GLFW_STICKY_MOUSE_BUTTONS input mode.</para>
- /// </summary>
- /// <returns>
- /// The previously set callback, or NULL if no callback was set or the
- /// library had not been initialized.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetMouseButtonCallback")]
- public static extern MouseButtonDelegate SetMouseButtonPosCallback(IntPtr window, MouseButtonDelegate callback);
-
- /// <summary>
- /// Sets a Callback for Mouse Scrolling Events. (i.e. scroll wheel)
- /// There is no polling support for this, so if youre interested in the wheel, you have to set this callback
- /// NOTE: your normal desktop mouse variant likely only reports Y-Coordinate
- /// </summary>
- /// <returns>
- /// The previously set callback, or NULL if no callback was set or the
- /// library had not been initialized.
- /// </returns>
- [DllImport(GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetScrollCallback")]
- public static extern ScrollDelegate SetScrollCallback(IntPtr window, ScrollDelegate callback);
-
- /// <summary>
- /// Returns an array of names of Vulkan instance extensions required by
- /// GLFW for creating Vulkan surfaces for GLFW windows. If successful,
- /// the list will always contains VK_KHR_surface, so if you don't
- /// require any additional extensions you can pass this list directly
- /// to the InstanceCreateInfo struct.
- /// </summary>
- /// <returns>
- /// An array of extension names, or Null if an error occurred.
- /// </returns>
- public static string[] GetRequiredInstanceExtensions()
- {
- IntPtr names = GetRequiredInstanceExtensions(out int count);
-
- var result = new string[count];
-
- for (int nameIndex = 0; nameIndex < count; nameIndex++)
- {
- IntPtr name = Marshal.ReadIntPtr (names, nameIndex);
- result[nameIndex] = Marshal.PtrToStringAnsi(name);
- }
-
- return result;
- }
-
- /// <summary>
- /// Returns an array of handles for all currently connected monitors.
- /// The primary monitor is always first in the returned array. If no
- /// monitors were found, this function returns Null.
- /// </summary>
- /// <returns>
- /// An array of monitor handles, or Null if no monitors were found or
- /// if an error occurred.
- /// </returns>
- public static MonitorHandle[] GetMonitors()
- {
- IntPtr monitors = GetMonitors(out int count);
-
- var result = new MonitorHandle[count];
-
- for (int i = 0; i < count; i++)
- result[i] = new MonitorHandle(Marshal.ReadIntPtr(monitors, i));
-
- return result;
- }
-
- /// <summary>
- /// Returns an array of all video modes supported by the specified
- /// monitor. The returned array is sorted in ascending order, first by
- /// color bit depth (the sum of all channel depths) and then by
- /// resolution area (the product of width and height).
- /// </summary>
- /// <param name="monitor">
- /// The monitor to query.
- /// </param>
- /// <returns>
- /// An array of video modes, or Null if an error occurred.
- /// </returns>
- public static VideoMode[] GetVideoModes(MonitorHandle monitor)
- {
- IntPtr videoModes = GetVideoModes(monitor, out int count);
-
- var result = new VideoMode[count];
-
- for (int i = 0; i < count; i++)
- result[i] = Marshal.PtrToStructure<VideoMode>(Marshal.ReadIntPtr(videoModes, i));
-
- return result;
- }
-
- /// <summary>
- /// This function retrieves the version number of the GLFW library.
- /// </summary>
- /// <returns>
- /// The version number of the GLFW library.
- /// </returns>
- public static Version GetVersion()
- {
- GetVersion(out int major, out int minor, out int revision);
-
- return new Version(major, minor, revision);
- }
-
- [DllImport (GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwCreateStandardCursor")]
- public static extern IntPtr CreateStandardCursor (CursorShape shape);
-
- [DllImport (GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwDestroyCursor")]
- public static extern void DestroyCursor (IntPtr cursor);
-
- [DllImport (GlfwDll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "glfwSetCursor")]
- public static extern void SetCursor (IntPtr window, IntPtr cursor);
- }
-}
diff --git a/CVKL/src/glfw/InputAction.cs b/CVKL/src/glfw/InputAction.cs
deleted file mode 100644
index 3ee57f7..0000000
--- a/CVKL/src/glfw/InputAction.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-namespace Glfw
-{
- /// <summary>
- /// Represents the action of an input key event or the state of a key.
- /// </summary>
- public enum InputAction
- {
- /// <summary>
- /// The key was released or is not pressed.
- /// </summary>
- Release = 0,
- /// <summary>
- /// The key was or is pressed.
- /// </summary>
- Press = 1,
- /// <summary>
- /// The key has been held down long enough to repeat.
- /// </summary>
- Repeat = 2
- }
-}
diff --git a/CVKL/src/glfw/Key.cs b/CVKL/src/glfw/Key.cs
deleted file mode 100644
index 1e8c19d..0000000
--- a/CVKL/src/glfw/Key.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-namespace Glfw
-{
- /// <summary>
- /// Represents a key on a keyboard.
- /// </summary>
- public enum Key
- {
- Unknown = -1,
- Space = 32,
- Apostrophe = 39,
- Comma = 44,
- Minus = 45,
- Period = 46,
- Slash = 47,
- Num0 = 48,
- Num1 = 49,
- Num2 = 50,
- Num3 = 51,
- Num4 = 52,
- Num5 = 53,
- Num6 = 54,
- Num7 = 55,
- Num8 = 56,
- Num9 = 57,
- Semicolon = 59,
- Equal = 61,
- A = 65,
- B = 66,
- C = 67,
- D = 68,
- E = 69,
- F = 70,
- G = 71,
- H = 72,
- I = 73,
- J = 74,
- K = 75,
- L = 76,
- M = 77,
- N = 78,
- O = 79,
- P = 80,
- Q = 81,
- R = 82,
- S = 83,
- T = 84,
- U = 85,
- V = 86,
- W = 87,
- X = 88,
- Y = 89,
- Z = 90,
- LeftBracket = 91,
- Backslash = 92,
- RightBracket = 93,
- GraveAccent = 96,
- World1 = 161,
- World2 = 162,
- Escape = 256,
- Enter = 257,
- Tab = 258,
- Backspace = 259,
- Insert = 260,
- Delete = 261,
- Right = 262,
- Left = 263,
- Down = 264,
- Up = 265,
- PageUp = 266,
- PageDown = 267,
- Home = 268,
- End = 269,
- CapsLock = 280,
- ScrollLock = 281,
- NumLock = 282,
- PrintScreen = 283,
- Pause = 284,
- F1 = 290,
- F2 = 291,
- F3 = 292,
- F4 = 293,
- F5 = 294,
- F6 = 295,
- F7 = 296,
- F8 = 297,
- F9 = 298,
- F10 = 299,
- F11 = 300,
- F12 = 301,
- F13 = 302,
- F14 = 303,
- F15 = 304,
- F16 = 305,
- F17 = 306,
- F18 = 307,
- F19 = 308,
- F20 = 309,
- F21 = 310,
- F22 = 311,
- F23 = 312,
- F24 = 313,
- F25 = 314,
- Keypad0 = 320,
- Keypad1 = 321,
- Keypad2 = 322,
- Keypad3 = 323,
- Keypad4 = 324,
- Keypad5 = 325,
- Keypad6 = 326,
- Keypad7 = 327,
- Keypad8 = 328,
- Keypad9 = 329,
- KeypadDecimal = 330,
- KeypadDivide = 331,
- KeypadMultiply = 332,
- KeypadSubtract = 333,
- KeypadAdd = 334,
- KeypadEnter = 335,
- KeypadEqual = 336,
- LeftShift = 340,
- LeftControl = 341,
- LeftAlt = 342,
- LeftSuper = 343,
- RightShift = 344,
- RightControl = 345,
- RightAlt = 346,
- RightSuper = 347,
- Menu = 348,
- }
-}
diff --git a/CVKL/src/glfw/Modifier.cs b/CVKL/src/glfw/Modifier.cs
deleted file mode 100644
index 98205c7..0000000
--- a/CVKL/src/glfw/Modifier.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-
-namespace Glfw
-{
- /// <summary>
- /// Bitmask indicating modifer keys.
- /// </summary>
- [Flags]
- public enum Modifier
- {
- Shift = 0x1,
- Control = 0x2,
- Alt = 0x4,
- Super = 0x8,
- }
-} \ No newline at end of file
diff --git a/CVKL/src/glfw/MonitorEvent.cs b/CVKL/src/glfw/MonitorEvent.cs
deleted file mode 100644
index d93397b..0000000
--- a/CVKL/src/glfw/MonitorEvent.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-namespace Glfw
-{
- /// <summary>
- /// Events that may be raised from a monitor callback.
- /// </summary>
- public enum MonitorEvent
- {
- /// <summary>
- /// The monitor was connected.
- /// </summary>
- Connected = 0x00040001,
- /// <summary>
- /// The monitor was disconnected.
- /// </summary>
- Disconnected = 0x00040002
- }
-}
diff --git a/CVKL/src/glfw/MonitorHandle.cs b/CVKL/src/glfw/MonitorHandle.cs
deleted file mode 100644
index 38ed035..0000000
--- a/CVKL/src/glfw/MonitorHandle.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-
-namespace Glfw
-{
- /// <summary>
- /// Opaque monitor handle.
- /// </summary>
- public struct MonitorHandle
- {
- readonly IntPtr handle;
-
- internal MonitorHandle(IntPtr handle)
- {
- this.handle = handle;
- }
- /// <summary>
- /// Gets the underlying native pointer to the monitor object.
- /// </summary>
- public IntPtr RawHandle => handle;
- /// <summary>
- /// A read-only field that represents a MonitorHandle that has been
- /// inititalised to zero.
- /// </summary>
- public static readonly MonitorHandle Zero = new MonitorHandle (IntPtr.Zero);
- }
-}
diff --git a/CVKL/src/glfw/MouseButton.cs b/CVKL/src/glfw/MouseButton.cs
deleted file mode 100644
index b29184a..0000000
--- a/CVKL/src/glfw/MouseButton.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-namespace Glfw
-{
- /// <summary>
- /// The index and name of mouse buttons for callbacks.
- /// </summary>
- public enum MouseButton
- {
- /// <summary>
- /// The first mouse button.
- /// </summary>
- Button1 = 0,
- /// <summary>
- /// The second mouse button.
- /// </summary>
- Button2 = 1,
- /// <summary>
- /// The third mouse button.
- /// </summary>
- Button3 = 2,
- /// <summary>
- /// The fourth mouse button.
- /// </summary>
- Button4 = 3,
- /// <summary>
- /// The fifth mouse button.
- /// </summary>
- Button5 = 4,
- /// <summary>
- /// The sixth mouse button.
- /// </summary>
- Button6 = 5,
- /// <summary>
- /// The seven mouse button.
- /// </summary>
- Button7 = 6,
- /// <summary>
- /// The eighth mouse button.
- /// </summary>
- Button8 = 7,
- /// <summary>
- /// The left mouse button.
- /// </summary>
- Left = Button1,
- /// <summary>
- /// The right mouse button.
- /// </summary>
- Right = Button2,
- /// <summary>
- /// The middle mouse button.
- /// </summary>
- Middle = Button3,
- /// <summary>
- /// The highest-indexed mouse button.
- /// </summary>
- Last = Button8
- }
-}
diff --git a/CVKL/src/glfw/NativeString.cs b/CVKL/src/glfw/NativeString.cs
deleted file mode 100644
index 02181cb..0000000
--- a/CVKL/src/glfw/NativeString.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-namespace Glfw
-{
- /// <summary>
- /// Wraps a pointer to a native, null-terminated ANSI string.
- /// </summary>
- public struct NativeString
- {
- internal NativeString(IntPtr pointer)
- {
- this.pointer = pointer;
- }
-
- readonly IntPtr pointer;
-
- /// <summary>
- /// Gets the marshalled string value for this native string.
- /// </summary>
- public string Value => IsNull ? throw new NullReferenceException () : Marshal.PtrToStringAnsi (this.pointer);
- /// <summary>
- /// Gets a value indicating whether the pointer wrapped by this
- /// instance is null.
- /// </summary>
- public bool IsNull => pointer == IntPtr.Zero;
-
- /// <summary>
- /// The underlying pointer wrapped by this instance.
- /// </summary>
- public IntPtr RawPointer => pointer;
-
- public override string ToString()
- {
- return Value;
- }
- }
-}
diff --git a/CVKL/src/glfw/VideoMode.cs b/CVKL/src/glfw/VideoMode.cs
deleted file mode 100644
index baeb196..0000000
--- a/CVKL/src/glfw/VideoMode.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Glfw
-{
- /// <summary>
- /// Represents a single video mode.
- /// </summary>
- [StructLayout(LayoutKind.Sequential)]
- public struct VideoMode
- {
- private readonly int width;
- private readonly int height;
- private readonly int redBits;
- private readonly int greenBits;
- private readonly int blueBits;
-
- /// <summary>
- /// The resolution, in screen coordinates, of the video mode.
- /// </summary>
- public (int Width, int Height) Resolution => (this.width, this.height);
-
- /// <summary>
- /// The bit depth of the red channel of the video mode.
- /// </summary>
- public (int Red, int Green, int Blue) Bits => (this.redBits, this.greenBits, this.blueBits);
-
- /// <summary>
- /// The refresh rate, in Hz, of the video mode.
- /// </summary>
- public int RefreshRate;
-
- /// <summary>
- /// Returns a string representation of this video mode.
- /// </summary>
- /// <returns>
- /// A string representation of this video mode.
- /// </returns>
- public override string ToString()
- {
- return $"[Resolution: {this.Resolution}, Bit Depth: {this.Bits}, Refresh Rate: {this.RefreshRate}Hz]";
- }
- }
-}
diff --git a/CVKL/src/glfw/VideoModePointer.cs b/CVKL/src/glfw/VideoModePointer.cs
deleted file mode 100644
index 66631c6..0000000
--- a/CVKL/src/glfw/VideoModePointer.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Runtime.InteropServices;
-
-namespace Glfw
-{
- /// <summary>
- /// Wraps a pointer to a VideoMode struct.
- /// </summary>
- public struct VideoModePointer
- {
- private readonly IntPtr pointer;
- internal VideoModePointer (IntPtr pointer)
- {
- this.pointer = pointer;
- }
- /// <summary>
- /// Gets the VideoMode value at the referenced memory location.
- /// </summary>
- public VideoMode Value => IsNull ? throw new NullReferenceException() : Marshal.PtrToStructure<VideoMode>(pointer);
- /// <summary>
- /// Gets a value indicating whether the pointer wrapped by this
- /// instance is null.
- /// </summary>
- public bool IsNull => pointer == IntPtr.Zero;
- /// <summary>
- /// The underlying pointer wrapped by this instance.
- /// </summary>
- public IntPtr RawPointer => pointer;
- }
-}
diff --git a/CVKL/src/glfw/WindowAttribute.cs b/CVKL/src/glfw/WindowAttribute.cs
deleted file mode 100644
index f772667..0000000
--- a/CVKL/src/glfw/WindowAttribute.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright (c) 2019 Andrew Armstrong/FacticiusVir
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-namespace Glfw
-{
- /// <summary>
- /// Attributes of a window or its framebuffer or context, that can be
- /// configured/queried at runtime or hinted at creation.
- /// </summary>
- public enum WindowAttribute
- {
- /// <summary>
- /// Whether the specified window has input focus. This hint is ignored
- /// for full screen and initially hidden windows.
- /// </summary>
- Focused = 0x00020001,
- /// <summary>
- /// Whether the specified window is iconified (minimized).
- /// </summary>
- Iconified = 0x00020002,
- /// <summary>
- /// Whether the specified window is resizable by the user. This is set
- /// on creation.
- /// </summary>
- Resizable = 0x00020003,
- /// <summary>
- /// Whether the specified window is visible.
- /// </summary>
- Visible = 0x00020004,
- /// <summary>
- /// Whether the specified window has decorations such as a border, a
- /// close widget, etc. This is set on creation.
- /// </summary>
- Decorated = 0x00020005,
- /// <summary>
- /// Whether the full screen window will automatically iconify and
- /// restore the previous default framebuffer on input focus loss. This hint is
- /// ignored for windowed mode windows.
- /// </summary>
- AutoIconify = 0x00020006,
- /// <summary>
- /// Whether the windowed mode window will be floating above other
- /// regular windows, also called topmost or always-on-top. This is
- /// intended primarily for debugging purposes and cannot be used to
- /// implement proper full screen windows. This hint is ignored for full
- /// screen windows.
- /// </summary>
- Floating = 0x00020007,
- /// <summary>
- /// Whether the specified window is maximized.
- /// </summary>
- Maximized = 0x00020008,
- /// <summary>
- /// The bit depth of the red channel of the default framebuffer.
- /// </summary>
- RedBits = 0x00021001,
- /// <summary>
- /// The bit depth of the green channel of the default framebuffer.
- /// </summary>
- GreenBits = 0x00021002,
- /// <summary>
- /// The bit depth of the blue channel of the default framebuffer.
- /// </summary>
- BlueBits = 0x00021003,
- /// <summary>
- /// The bit depth of the alpha channel of the default framebuffer.
- /// </summary>
- AlphaBits = 0x00021004,
- /// <summary>
- /// The bit depth of the depth channel of the default framebuffer.
- /// </summary>
- DepthBits = 0x00021005,
- /// <summary>
- /// The bit depth of the stencil channel of the default framebuffer.
- /// </summary>
- StencilBits = 0x00021006,
- /// <summary>
- /// The desired bit depth of the red channel of the accumulation
- /// buffer. Accumulation buffers are a legacy OpenGL feature and
- /// should not be used in new code.
- /// </summary>
- AccumRedBits = 0x00021007,
- /// <summary>
- /// The desired bit depth of the green channel of the accumulation
- /// buffer. Accumulation buffers are a legacy OpenGL feature and
- /// should not be used in new code.
- /// </summary>
- AccumGreenBits = 0x00021008,
- /// <summary>
- /// The desired bit depth of the blue channel of the accumulation
- /// buffer. Accumulation buffers are a legacy OpenGL feature and
- /// should not be used in new code.
- /// </summary>
- AccumBlueBits = 0x00021009,
- /// <summary>
- /// The desired bit depth of the alpha channel of the accumulation
- /// buffer. Accumulation buffers are a legacy OpenGL feature and
- /// should not be used in new code.
- /// </summary>
- AccumAlphaBits = 0x0002100A,
- /// <summary>
- /// The desired number of auxiliary buffers. Auxiliary buffers are a
- /// legacy OpenGL feature and should not be used in new code.
- /// </summary>
- AuxBuffers = 0x0002100B,
- /// <summary>
- /// Whether to use stereoscopic rendering.
- /// </summary>
- Stereo = 0x0002100C,
- /// <summary>
- /// The desired number of samples to use for multisampling. Zero
- /// disables multisampling.
- /// </summary>
- Samples = 0x0002100D,
- /// <summary>
- /// Whether the framebuffer should be sRGB capable.
- /// </summary>
- SrgbCapable = 0x0002100E,
- /// <summary>
- /// The desired refresh rate for full screen windows. This hint is
- /// ignored for windowed mode windows.
- /// </summary>
- RefreshRate = 0x0002100F,
- /// <summary>
- /// Whether the framebuffer should be double buffered.
- /// </summary>
- DoubleBuffer = 0x00021010,
- /// <summary>
- /// Specifies which client API to create the context for.
- /// </summary>
- ClientApi = 0x00022001,
- /// <summary>
- /// Specifies the major component of the client API version of the
- /// window's context.
- /// </summary>
- ContextVersionMajor = 0x00022002,
- /// <summary>
- /// Specifies the minor component of the client API version of the
- /// window's context.
- /// </summary>
- ContextVersionMinor = 0x00022003,
- /// <summary>
- /// Specifies the revision component of the client API version of the
- /// window's context.
- /// </summary>
- ContextRevision = 0x00022004,
- /// <summary>
- /// The robustness strategy used by the context.
- /// </summary>
- ContextRobustness = 0x00022005,
- /// <summary>
- /// Specifies whether the OpenGL context should be forward-compatible,
- /// i.e. one where all functionality deprecated in the requested
- /// version of OpenGL is removed. If OpenGL ES is requested, this hint
- /// is ignored.
- /// </summary>
- OpenGlForwardCompat = 0x00022006,
- /// <summary>
- /// Specifies whether to create a debug OpenGL context, which may have
- /// additional error and performance issue reporting functionality. If
- /// OpenGL ES is requested, this hint is ignored.
- /// </summary>
- OpenGlDebugContext = 0x00022007,
- /// <summary>
- /// The OpenGL profile used by the context.
- /// </summary>
- OpenGlProfile = 0x00022008,
- /// <summary>
- /// Specifies the release behavior to be used by the context.
- /// </summary>
- ContextReleaseBehavior = 0x00022009,
- /// <summary>
- /// Specifies whether errors should be generated by the context. If
- /// enabled, situations that would have generated errors instead cause
- /// undefined behavior.
- /// </summary>
- ContextNoError = 0x0002200A,
- /// <summary>
- /// The context creation API used to create the window's context.
- /// </summary>
- ContextCreationApi = 0x0002200B
- }
-}
diff --git a/CVKL/src/ktx.cs b/CVKL/src/ktx.cs
deleted file mode 100644
index 4ea7c41..0000000
--- a/CVKL/src/ktx.cs
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.IO;
-
-using VK;
-using CVKL;
-using System.Runtime.InteropServices;
-using System.Collections.Generic;
-
-namespace KTX {
-
- public class KtxException : Exception {
- public KtxException (string message) : base (message) { }
- }
-
- public class KTX {
- static byte[] ktxSignature = { 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A };
-
- public static Image Load (Queue staggingQ, CommandPool staggingCmdPool, string ktxPath, VkImageUsageFlags usage = VkImageUsageFlags.Sampled,
- VkMemoryPropertyFlags memoryProperty = VkMemoryPropertyFlags.DeviceLocal, bool generateMipmaps = true,
- VkImageTiling tiling = VkImageTiling.Optimal) {
- Image img = null;
-
- using (Stream ktxStream = File.Open (ktxPath, FileMode.Open, FileAccess.Read)) {
- using (BinaryReader br = new BinaryReader (ktxStream)) {
- if (!br.ReadBytes (12).AreEquals (ktxSignature))
- throw new KtxException ("Not a ktx file: " + ktxPath);
-
- UInt32 endianness = br.ReadUInt32 ();
- UInt32 glType = br.ReadUInt32 ();
- UInt32 glTypeSize = br.ReadUInt32 ();
- UInt32 glFormat = br.ReadUInt32 ();
- UInt32 glInternalFormat = br.ReadUInt32 ();
- UInt32 glBaseInternalFormat = br.ReadUInt32 ();
- UInt32 pixelWidth = br.ReadUInt32 ();
- UInt32 pixelHeight = br.ReadUInt32 ();
- UInt32 pixelDepth = Math.Max (1, br.ReadUInt32 ());
- UInt32 numberOfArrayElements = br.ReadUInt32 ();//only for array text, else 0
- UInt32 numberOfFaces = br.ReadUInt32 ();//only for cube map, else 1
- UInt32 numberOfMipmapLevels = Math.Max (1, br.ReadUInt32 ());
- UInt32 bytesOfKeyValueData = br.ReadUInt32 ();
-
- VkFormat vkFormat = GLHelper.vkGetFormatFromOpenGLInternalFormat (glInternalFormat);
- if (vkFormat == VkFormat.Undefined) {
- vkFormat = GLHelper.vkGetFormatFromOpenGLFormat (glFormat, glType);
- if (vkFormat == VkFormat.Undefined)
- throw new KtxException ("Undefined format: " + ktxPath);
- }
- VkFormatProperties formatProperties = staggingQ.Dev.phy.GetFormatProperties (vkFormat);
- VkFormatFeatureFlags phyFormatSupport = (tiling == VkImageTiling.Linear) ?
- formatProperties.linearTilingFeatures :
- formatProperties.optimalTilingFeatures;
-
- uint requestedMipsLevels = numberOfMipmapLevels;
- if (numberOfMipmapLevels == 1)
- requestedMipsLevels = (generateMipmaps && phyFormatSupport.HasFlag (VkFormatFeatureFlags.BlitSrc | VkFormatFeatureFlags.BlitDst)) ?
- (uint)Math.Floor (Math.Log (Math.Max (pixelWidth, pixelHeight))) + 1 : 1 ;
-
- if (tiling == VkImageTiling.Optimal)
- usage |= VkImageUsageFlags.TransferDst;
- if (generateMipmaps)
- usage |= (VkImageUsageFlags.TransferSrc | VkImageUsageFlags.TransferDst);
-
- VkImageCreateFlags createFlags = 0;
-
- VkImageType imgType =
- (pixelWidth == 0) ? throw new KtxException ("pixelWidth must be > 0") :
- (pixelHeight == 0) ? imgType = VkImageType.Image1D :
- (pixelDepth == 1) ? imgType = VkImageType.Image2D : imgType = VkImageType.Image3D;
-
-
- VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1;
-
- if (numberOfFaces > 1) {
- if (imgType != VkImageType.Image2D)
- throw new KtxException ("cubemap faces must be 2D textures");
- createFlags = VkImageCreateFlags.CubeCompatible;
- samples = VkSampleCountFlags.SampleCount1;
- numberOfArrayElements = numberOfFaces;
- } else {
- numberOfFaces = 1;
- if (numberOfArrayElements == 0)
- numberOfArrayElements = 1;
- }
-
- if (!Image.CheckFormatIsSupported (usage, phyFormatSupport))
- throw new Exception ($"Unsupported image format: {vkFormat}, {tiling}, {usage}");
-
- img = new Image (staggingQ.Dev, vkFormat, usage, memoryProperty, pixelWidth, pixelHeight, imgType, samples,
- tiling, requestedMipsLevels, numberOfArrayElements, pixelDepth, createFlags);
-
- byte[] keyValueDatas = br.ReadBytes ((int)bytesOfKeyValueData);
-
-
- if (memoryProperty.HasFlag (VkMemoryPropertyFlags.DeviceLocal)) {
- ulong staggingSize = (ulong)ktxStream.Length;//img.AllocatedDeviceMemorySize;
-
- using (HostBuffer stagging = new HostBuffer (staggingQ.Dev, VkBufferUsageFlags.TransferSrc, staggingSize)) {
- stagging.Map ();
-
- CommandBuffer cmd = staggingCmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
- img.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
- VkPipelineStageFlags.AllCommands, VkPipelineStageFlags.Transfer);
-
- List<VkBufferImageCopy> buffCopies = new List<VkBufferImageCopy> ();
-
- VkBufferImageCopy bufferCopyRegion = new VkBufferImageCopy {
- imageExtent = img.CreateInfo.extent,
- imageSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, img.CreateInfo.arrayLayers, 0)
- };
-
- ulong bufferOffset = 0;
- uint imgWidth = img.CreateInfo.extent.width;
- uint imgHeight = img.CreateInfo.extent.height;
-
- for (int mips = 0; mips < numberOfMipmapLevels; mips++) {
- UInt32 imgSize = br.ReadUInt32 ();
-
- bufferCopyRegion.bufferImageHeight = imgHeight;
- bufferCopyRegion.bufferRowLength = imgWidth;
- bufferCopyRegion.bufferOffset = bufferOffset;
- bufferCopyRegion.imageSubresource.mipLevel = (uint)mips;
- bufferCopyRegion.imageExtent.width = imgWidth;
- bufferCopyRegion.imageExtent.height = imgHeight;
-
- if (createFlags.HasFlag (VkImageCreateFlags.CubeCompatible)) {
- for (uint face = 0; face < numberOfFaces; face++) {
- Marshal.Copy (br.ReadBytes ((int)imgSize), 0, stagging.MappedData + (int)bufferOffset, (int)imgSize);
- uint faceOffset = imgSize + (imgSize % 4);//cube padding
- bufferOffset += faceOffset;
- }
- buffCopies.Add (bufferCopyRegion);
- bufferCopyRegion.bufferOffset = bufferOffset;
- } else {
- Marshal.Copy (br.ReadBytes ((int)imgSize), 0, stagging.MappedData + (int)bufferOffset, (int)imgSize);
- buffCopies.Add (bufferCopyRegion);
- bufferOffset += imgSize;
- }
-
- imgWidth /= 2;
- imgHeight /= 2;
- }
- stagging.Unmap ();
-
- Vk.vkCmdCopyBufferToImage (cmd.Handle, stagging.handle, img.handle, VkImageLayout.TransferDstOptimal,
- (uint)buffCopies.Count, buffCopies.Pin());
- buffCopies.Unpin ();
-
- if (requestedMipsLevels > numberOfMipmapLevels)
- img.BuildMipmaps (cmd);
- else
- img.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferDstOptimal, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.FragmentShader);
-
- cmd.End ();
-
- staggingQ.Submit (cmd);
- staggingQ.WaitIdle ();
-
- cmd.Free ();
-
- }
- } else {
- }
- }
- }
-
- return img;
- }
- }
-}
-
-
-/*VkFormatFeatureFlags phyFormatSupport = (tiling == VkImageTiling.Linear) ?
- dev.phy.GetFormatProperties (vkFormat).linearTilingFeatures :
- dev.phy.GetFormatProperties (vkFormat).optimalTilingFeatures;
-
-VkFormatFeatureFlags requiredFlags = VkFormatFeatureFlags.None;
-if (usage.HasFlag (VkImageUsageFlags.ColorAttachment))
- requiredFlags |= VkFormatFeatureFlags.ColorAttachment;
-
-if (!phyFormatSupport.HasFlag (requiredFlags))
- throw new KtxException ("Unsupported format: " + ktxPath);*/ \ No newline at end of file
diff --git a/CVKL/src/model/BoundingBox.cs b/CVKL/src/model/BoundingBox.cs
deleted file mode 100644
index 07747c8..0000000
--- a/CVKL/src/model/BoundingBox.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// BoundingBox
-//
-// Authors:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-// https://github.com/mellinoe
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System.Numerics;
-/* code derived from https://github.com/mellinoe*/
-namespace CVKL {
- public struct BoundingBox {
- public Vector3 min;
- public Vector3 max;
- public bool isValid;
- public BoundingBox (Vector3 min, Vector3 max, bool isValid = false) {
- this.min = min;
- this.max = max;
- this.isValid = isValid;
- }
- public BoundingBox getAABB (Matrix4x4 m) {
- if (!isValid)
- return default (BoundingBox);
- Vector3 mini = new Vector3 (m.M41, m.M42, m.M43);
- Vector3 maxi = mini;
- Vector3 v0, v1;
-
- Vector3 right = new Vector3 (m.M11, m.M12, m.M13);
- v0 = right * this.min.X;
- v1 = right * this.max.X;
- mini += Vector3.Min (v0, v1);
- maxi += Vector3.Max (v0, v1);
-
- Vector3 up = new Vector3 (m.M21, m.M22, m.M23);
- v0 = up * this.min.Y;
- v1 = up * this.max.Y;
- mini += Vector3.Min (v0, v1);
- maxi += Vector3.Max (v0, v1);
-
- Vector3 back = new Vector3 (m.M31, m.M32, m.M33);
- v0 = back * this.min.Z;
- v1 = back * this.max.Z;
- mini += Vector3.Min (v0, v1);
- maxi += Vector3.Max (v0, v1);
-
- return new BoundingBox (mini, maxi, true);
- }
-
- public float Width => max.X - min.X;
- public float Height => max.Y - min.Y;
- public float Depth => max.Z - min.Z;
-
- public Vector3 Center => new Vector3 (Width / 2f + min.X, Height / 2f + min.Y, Depth / 2f + min.Z);
-
- public static BoundingBox operator +(BoundingBox bb1, BoundingBox bb2) {
- return bb1.isValid ? bb2.isValid ? new BoundingBox (Vector3.Min (bb1.min, bb2.min), Vector3.Min (bb1.max, bb2.max),true) : bb1 : bb2.isValid ? bb2 : default(BoundingBox);
- }
- public override string ToString () => isValid ? string.Format ($" {min}->{max}") : "Invalid";
- }
-}
diff --git a/CVKL/src/model/IModelLoader.cs b/CVKL/src/model/IModelLoader.cs
deleted file mode 100644
index 36f8108..0000000
--- a/CVKL/src/model/IModelLoader.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using VK;
-
-namespace CVKL {
- public interface IModelLoader {
- void GetVertexCount (out ulong vertexCount, out ulong indexCount, out VkIndexType largestIndexType);
- Model.Mesh[] LoadMeshes<TVertex> (VkIndexType indexType, Buffer vbo, ulong vboOffset, Buffer ibo, ulong iboOffset);
- Model.Scene[] LoadScenes (out int defaultScene);
- Image[] LoadImages ();
- //Material[] LoadMaterial ();
- }
-}
diff --git a/CVKL/src/model/Model.cs b/CVKL/src/model/Model.cs
deleted file mode 100644
index 0bc56e8..0000000
--- a/CVKL/src/model/Model.cs
+++ /dev/null
@@ -1,171 +0,0 @@
-//
-// Model.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using VK;
-
-namespace CVKL {
-
- public enum AlphaMode : UInt32 {
- Opaque,
- Mask,
- Blend
- };
- /// <summary>
- /// Model base class, does not implement Vulkan objects (vbo, ibo, descSets,...)
- /// </summary>
- public class Model {
- #region nested structs and classes
- public struct Vertex {
- [VertexAttribute (VertexAttributeType.Position, VkFormat.R32g32b32Sfloat)]
- public Vector3 pos;
- [VertexAttribute (VertexAttributeType.Normal, VkFormat.R32g32b32Sfloat)]
- public Vector3 normal;
- [VertexAttribute (VertexAttributeType.UVs, VkFormat.R32g32Sfloat)]
- public Vector2 uv;
- public override string ToString () {
- return pos.ToString () + ";" + normal.ToString () + ";" + uv.ToString ();
- }
- };
-
- public struct Dimensions {
- public Vector3 min;
- public Vector3 max;
-
- public Dimensions (Vector3 _min, Vector3 _max) {
- min = _min;
- max = _max;
- }
- }
-
- public class InstancedCmd
- {
- public int meshIdx;
- public uint count;
- }
-
- public class Primitive {
- public string name;
- public UInt32 indexBase;
- public Int32 vertexBase;
- public UInt32 vertexCount;
- public UInt32 indexCount;
- public UInt32 material;
- public BoundingBox bb;
- }
-
- public class Mesh {
- public string Name;
- public List<Primitive> Primitives = new List<Primitive> ();
- public BoundingBox bb;
-
- /// <summary>
- /// add primitive and update mesh bounding box
- /// </summary>
- public void AddPrimitive (Primitive p) {
- if (Primitives.Count == 0)
- bb = p.bb;
- else
- bb += p.bb;
- Primitives.Add (p);
- }
- }
-
- public class Scene {
- public string Name;
- public Node Root;
- public List<Node> GetNodes () => Root?.Children;
- public Node FindNode(string name) => Root == null ? null : Root.FindNode (name);
-
- public BoundingBox AABB => Root.GetAABB (Matrix4x4.Identity);
- }
-
- public class Node {
- public string Name;
- public Node Parent;
- public List<Node> Children;
- public Matrix4x4 localMatrix;
- public Mesh Mesh;
-
- public Node FindNode(string name)
- {
- if (Name == name)
- return this;
- if (Children == null)
- return null;
- foreach (Node child in Children) {
- Node n = child.FindNode(name);
- if (n != null)
- return n;
- }
- return null;
- }
-
- public Matrix4x4 Matrix {
- get { return Parent == null ? localMatrix : Parent.Matrix * localMatrix; }
- }
-
- public BoundingBox GetAABB (Matrix4x4 currentTransform) {
- Matrix4x4 curTransform = localMatrix * currentTransform;
- BoundingBox aabb = new BoundingBox();
-
- if (Mesh != null)
- aabb = Mesh.bb.getAABB (curTransform);
-
- if (Children != null) {
- for (int i = 0; i < Children.Count; i++)
- aabb += Children[i].GetAABB (curTransform);
- }
- return aabb;
- }
- }
- #endregion
-
- protected Device dev;
- protected int defaultSceneIndex;
-
- public VkIndexType IndexBufferType;
-
- public Scene DefaultScene => Scenes[defaultSceneIndex];
- public List<Mesh> Meshes;
- public List<Scene> Scenes;
- public Dimensions dimensions = new Dimensions (new Vector3 (float.MaxValue), new Vector3 (float.MinValue));
-
-
- public Node FindNode(string name) {
- foreach (Scene scene in Scenes)
- {
- Node n = scene.FindNode(name);
- if (n != null)
- return n;
- }
- return null;
- }
-
-
- }
-}
diff --git a/README.md b/README.md
index ca18dbd..5b9c21e 100644
--- a/README.md
+++ b/README.md
@@ -1,104 +1,12 @@
<h1 align="center">
- Vulkan in C#
+ Vulkan.net
<br>
<p align="center">
+ <a href="https://www.nuget.org/packages/Vulkan"><img src="https://buildstats.info/nuget/Vulkan"></a>
<a href="https://www.paypal.me/GrandTetraSoftware">
<img src="https://img.shields.io/badge/Donate-PayPal-green.svg">
</a>
</p>
</h1>
-# Vulkan net low-level bindings.
-<a href="https://www.nuget.org/packages/Vulkan"><img src="https://buildstats.info/nuget/Vulkan"></a>
-
Autogenerated low level Vulkan c# binding derived from the work of https://github.com/mellinoe. The nuget package is available under the name **Vulkan**.
-
-<p align="center">
- <a href="https://github.com/jpbruyere/vk.net/blob/master/samples/pbr/screenshot.png">
- <kbd><img src="https://raw.githubusercontent.com/jpbruyere/vk.net/master/samples/pbr/screenshot.png" height="300"></kbd>
- </a>
- <br>Port of the gltfPBR from Sacha Willems</br>
-</p>
-
-# CVKL - C# VulKan Library
-<a href="https://www.nuget.org/packages/CVKL"><img src="https://buildstats.info/nuget/CVKL"></a>
-
-High level classes encapsulating vulkan objects with `IDispose` model and **reference counting**. [GLFW](https://www.glfw.org/) handles the windowing system.
-
-### Requirements
-- [GLFW](https://www.glfw.org/)
-- [libstb](https://github.com/nothings/stb), on debian install **libstb-dev**.
-- [Vulkan Sdk](https://www.lunarg.com/vulkan-sdk/), **glslc** has to be in the path.
-- optionaly for ui, you will need [vkvg](https://github.com/jpbruyere/vkvg).
-
-### Features
-
-- physicaly based rendering, direct and deferred
-- glTF 2.0
-- ktx image loading.
-- Memory pools
-
-### VkWindow class
-
-To create a new vulkan application, derrive your application from `VkWindow`. Validation and
-debug reports may be activated with the static Fields of the `Instance` class.
-
-```csharp
-class Program : VkWindow {
- static void Main (string[] args) {
- Instance.VALIDATION = true;
-
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-}
-```
-
-### Enabling features
-
-Override the `configureEnabledFeatures` method of `VkWindow` to enable features.
-```csharp
-protected override void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures enabled_features) {
- enabled_features.samplerAnisotropy = available_features.samplerAnisotropy;
-}
-```
-### Creating queues
-
-To create queues, override the `createQueues` method of `VkWindow`. This function is called before the logical device creation and will take care of physically available queues, creating duplicates if count exceed availability. The `base` method will create a default presentable queue.
-
-```csharp
-protected override void createQueues () {
- base.createQueues ();
- transferQ = new Queue (dev, VkQueueFlags.Transfer);
-}
-```
-### Rendering
-
-The constructor of the `VkWIndow` will finish the vulkan initialisation, so that you may create pipelines, buffers, and so on in your constructor.
-
-VkWindow will provide the default swapchain, but it's up to you to create the frame buffers. For the triangle example, create them in the `OnResize` override.
-```csharp
-Framebuffer[] frameBuffers;
-
-protected override void OnResize () {
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i] = new Framebuffer (pipeline.RenderPass, swapChain.Width, swapChain.Height,
- (pipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- null
- } : new Image[] {
- null,
- null,
- swapChain.images[i]
- });
-
- buildCommandBuffers ();
-}
-```
-
diff --git a/SpirVTasks/CompileGLSLTask.cs b/SpirVTasks/CompileGLSLTask.cs
deleted file mode 100644
index cac29fc..0000000
--- a/SpirVTasks/CompileGLSLTask.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using Microsoft.Build.Framework;
-
-namespace SpirVTasks {
-
- public class IncludeFileNotFound : FileNotFoundException {
- public string SourceFile;
- public int SourceLine;
-
- public IncludeFileNotFound(string srcFileName, int srcLine, string includeFileName) :
- base ("include file not found", includeFileName) {
-
- SourceFile = srcFileName;
- SourceLine = srcLine;
- }
- }
-
- public class CompileGLSLTask : Microsoft.Build.Utilities.Task {
-
- [Required]
- public ITaskItem SourceFile {
- get;
- set;
- }
- [Required]
- public ITaskItem TempDirectory {
- get;
- set;
- }
- public ITaskItem AdditionalIncludeDirectories {
- get;
- set;
- }
- public ITaskItem SpirVCompilerPath {
- get;
- set;
- }
- [Required]
- [Output]
- public ITaskItem DestinationFile {
- get;
- set;
- }
-
- volatile bool success;
-
- bool tryFindInclude (string include, out string incFile) {
- if (!string.IsNullOrEmpty (AdditionalIncludeDirectories?.ItemSpec)) {
- foreach (string incDir in AdditionalIncludeDirectories.ItemSpec.Split (';', ',', '|')) {
- incFile = Path.Combine (incDir, include);
- if (File.Exists (incFile))
- return true;
- }
- }
- incFile = "";
- return false;
- }
-
- void build_source (string src, StreamWriter temp) {
- using (StreamReader sr = new StreamReader (File.OpenRead (src))) {
- int srcLine = 0;
- while (!sr.EndOfStream) {
- string line = sr.ReadLine ();
- if (line.Trim ().StartsWith ("#include", StringComparison.Ordinal)) {
- string include = line.Split ('"', '<', '>')[1];
- string incFile = Path.Combine (Path.GetDirectoryName (src), include);
- if (!File.Exists (incFile)) {
- if (!tryFindInclude(include, out incFile))
- throw new IncludeFileNotFound (src, srcLine, include);
- }
- build_source (incFile, temp);
- } else
- temp.WriteLine (line);
- srcLine++;
- }
- }
- }
-
- bool tryFindGlslcExecutable (out string glslcPath) {
- if (!string.IsNullOrEmpty (SpirVCompilerPath?.ItemSpec)) {
- glslcPath = SpirVCompilerPath.ItemSpec;
- if (!File.Exists (glslcPath))
- return false;
- }
-
- string glslcExec = "glslc";
- if (Environment.OSVersion.Platform.ToString ().StartsWith ("Win", StringComparison.Ordinal))
- glslcExec = glslcExec + "exe";
-
- glslcPath = Path.Combine (Environment.GetEnvironmentVariable ("VULKAN_SDK"), "bin");
- glslcPath = Path.Combine (glslcPath, glslcExec);
- if (File.Exists (glslcPath))
- return true;
-
- string envStrPathes = Environment.GetEnvironmentVariable ("PATH");
- if (!string.IsNullOrEmpty (envStrPathes)) {
- foreach (string path in envStrPathes.Split (';')) {
- glslcPath = Path.Combine (path, glslcExec);
- if (File.Exists (glslcPath))
- return true;
- }
- }
- return false;
- }
-
-
- public override bool Execute () {
-
- success = true;
-
- if (!tryFindGlslcExecutable(out string glslcPath)) {
- BuildErrorEventArgs err = new BuildErrorEventArgs ("execute", "VK001", BuildEngine.ProjectFileOfTaskNode, 0, 0, 0, 0, $"glslc command not found: {glslcPath}", "Set 'VULKAN_SDK' environment variable", "SpirVTasks");
- BuildEngine.LogErrorEvent (err);
- return false;
- }
-
- string tempFile = Path.Combine (TempDirectory.ItemSpec, SourceFile.ItemSpec);
- if (File.Exists (tempFile))
- File.Delete (tempFile);
- try {
- Directory.CreateDirectory (Path.GetDirectoryName (tempFile));
- using (StreamWriter sw = new StreamWriter (File.OpenWrite(tempFile))) {
- string src = SourceFile.ItemSpec;
- build_source (SourceFile.ItemSpec, sw);
- }
- } catch (IncludeFileNotFound ex) {
- BuildErrorEventArgs err = new BuildErrorEventArgs ("include", "VK002", ex.SourceFile, ex.SourceLine, 0, 0, 0, $"include file not found: {ex.FileName}", "", "SpirVTasks");
- BuildEngine.LogErrorEvent (err);
- return false;
- }catch (Exception ex) {
- BuildErrorEventArgs err = new BuildErrorEventArgs ("include", "VK000", SourceFile.ItemSpec, 0, 0, 0, 0, ex.ToString(), "", "SpirVTasks");
- BuildEngine.LogErrorEvent (err);
- return false;
- }
-
- Directory.CreateDirectory (Path.GetDirectoryName (DestinationFile.ItemSpec));
-
- Process glslc = new Process();
- //glslc.StartInfo.StandardOutputEncoding = System.Text.Encoding.ASCII;
- //glslc.StartInfo.StandardErrorEncoding = System.Text.Encoding.ASCII;
- glslc.StartInfo.UseShellExecute = false;
- glslc.StartInfo.RedirectStandardOutput = true;
- glslc.StartInfo.RedirectStandardError = true;
- glslc.StartInfo.FileName = glslcPath;
- glslc.StartInfo.Arguments = $"{tempFile} -o {DestinationFile.ItemSpec}";
- glslc.StartInfo.CreateNoWindow = true;
-
- glslc.EnableRaisingEvents = true;
- glslc.OutputDataReceived += Glslc_OutputDataReceived;
- glslc.ErrorDataReceived += Glslc_ErrorDataReceived;
-
- glslc.Start ();
-
- glslc.BeginErrorReadLine ();
- glslc.BeginOutputReadLine ();
-
- DestinationFile.SetMetadata ("LogicalName", $"FromCS.{SourceFile.ItemSpec.Replace (Path.DirectorySeparatorChar, '.')}");
-
- glslc.WaitForExit ();
-
- return success;
- }
-
- void Glslc_ErrorDataReceived (object sender, DataReceivedEventArgs e) {
- if (e.Data == null)
- return;
-
- if (string.Equals (e.Data, "(0)", StringComparison.Ordinal))
- return;
-
- string[] tmp = e.Data.Split (':');
-
- Log.LogMessage (MessageImportance.High, $"glslc: {e.Data}");
-
- if (tmp.Length == 5) {
- string srcFile = SourceFile.ItemSpec;
- int line = Math.Max (0, int.Parse (tmp[1]) - 1);
-
- BuildErrorEventArgs err = new BuildErrorEventArgs ("compile", tmp[2], srcFile, line, 0, 0, 0, $"{tmp[3]} {tmp[4]}", "no help", "SpirVTasks");
- BuildEngine.LogErrorEvent (err);
- success = false;
- } else {
- Log.LogMessage (MessageImportance.High, $"{e.Data}");
- }
- }
-
-
- void Glslc_OutputDataReceived (object sender, DataReceivedEventArgs e) {
- if (e.Data == null)
- return;
- if (string.Equals (e.Data, "(0)", StringComparison.Ordinal))
- return;
-
- Log.LogMessage (MessageImportance.High, $"data:{e.Data}");
-
- BuildWarningEventArgs taskEvent = new BuildWarningEventArgs ("glslc", "0", BuildEngine.ProjectFileOfTaskNode, 0, 0, 0, 0, $"{e.Data}", "no help", "SpirVTasks");
- BuildEngine.LogWarningEvent (taskEvent);
- }
-
- }
-}
diff --git a/SpirVTasks/README.md b/SpirVTasks/README.md
deleted file mode 100644
index 226e438..0000000
--- a/SpirVTasks/README.md
+++ /dev/null
@@ -1,62 +0,0 @@
-<h1 align="center">
- SpirVTasks MSBuild add-on
- <br>
-<p align="center">
- <a href="https://www.nuget.org/packages/SpirVTasks">
- <img src="https://buildstats.info/nuget/SpirVTasks">
- </a>
- <a href="https://www.paypal.me/GrandTetraSoftware">
- <img src="https://img.shields.io/badge/Donate-PayPal-green.svg">
- </a>
-</p>
-</h1>
-
-**SpirVTasks** package add **SpirV** compilation support to msbuild project. Error and warning
-are routed to the **IDE**.
-
-
-#### Usage
-```xml
-<ItemGroup>
- <GLSLShader Include="shaders\*.frag;shaders\*.vert;shaders\*.comp;shaders\*.geom" />
-</ItemGroup>
-```
-Resulting `.spv` files are embedded with resource ID = **ProjectName.file.ext.spv**. You can override the default resource id by adding a custom LogicalName.
-```xml
-<ItemGroup>
- <GLSLShader Include="shaders\skybox.vert">
- <LogicalName>NewName.vert.spv</LogicalName>
- </GLSLShader>
-</ItemGroup>
-```
-**VULKAN_SDK**/bin then **PATH** are searched for the **glslc** executable. You can also use **`SpirVglslcPath`** property.
-```xml
-<PropertyGroup>
- <SpirVglslcPath>bin\glslc.exe</SpirVglslcPath>
-</PropertyGroup>
-```
-
-
-#### Include in glsl
-```glsl
-#include <preamble.inc>
-
-layout (location = 0) in vec3 inColor;
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = vec4(inColor, 1.0);
-}
-```
-
-Included files are searched from the location of the current parsed file, then in the **`<SpirVAdditionalIncludeDirectories>`** directories if present.
-
-```xml
-<PropertyGroup>
- <SpirVAdditionalIncludeDirectories>$(MSBuildThisFileDirectory)common;testdir;../anotherdir</SpirVAdditionalIncludeDirectories>
-</PropertyGroup>
-```
-
-#### todo
-- Error source file and line with included files.
diff --git a/SpirVTasks/SpirVTasks.csproj b/SpirVTasks/SpirVTasks.csproj
deleted file mode 100644
index 314ddc7..0000000
--- a/SpirVTasks/SpirVTasks.csproj
+++ /dev/null
@@ -1,39 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
- <TargetFrameworks>net471;netstandard2.0</TargetFrameworks>
- <AssemblyVersion>0.1.9</AssemblyVersion>
- <Description>MSBuild addon to compile and embed spirV shaders</Description>
-
- <PackageId>SpirVTasks</PackageId>
- <PackageTags>vulkan msbuild spirv glsl addons</PackageTags>
- <PackageVersion>$(AssemblyVersion)-beta</PackageVersion>
- <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
- <PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
- <PackageProjectUrl>https://github.com/jpbruyere/vk.net/blob/master/SpirVTasks/README.md</PackageProjectUrl>
- <License>MIT</License>
- <Authors>Jean-Philippe Bruyère</Authors>
- <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
-
- <IncludeDefaultNoneItems>false</IncludeDefaultNoneItems>
- <EnableDefaultContentItems>false</EnableDefaultContentItems>
- <EnableDefaultNoneItems>false</EnableDefaultNoneItems>
- <EnableDefaultCompileItems>true</EnableDefaultCompileItems>
-
- <AssemblyName>SpirVTasks_$(TargetFramework)</AssemblyName>
- </PropertyGroup>
- <ItemGroup>
- <PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.0.461" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="SpirVTasks.targets">
- <Pack>true</Pack>
- <IncludeInPackage>true</IncludeInPackage>
- <PackagePath>build\</PackagePath>
- </Content>
- <Content Include="spirv.xml">
- <Pack>true</Pack>
- <IncludeInPackage>true</IncludeInPackage>
- <PackagePath>build</PackagePath>
- </Content>
- </ItemGroup>
-</Project>
diff --git a/SpirVTasks/SpirVTasks.targets b/SpirVTasks/SpirVTasks.targets
deleted file mode 100644
index 6825c47..0000000
--- a/SpirVTasks/SpirVTasks.targets
+++ /dev/null
@@ -1,30 +0,0 @@
-<Project>
- <UsingTask AssemblyFile="$(MSBuildThisFileDirectory)..\lib\$(TargetFramework)\SpirVTasks_$(TargetFramework).dll" TaskName="SpirVTasks.CompileGLSLTask" />
- <ItemGroup>
- <PropertyPageSchema Include="$(MSBuildThisFileDirectory)spirv.xml" />
- <AvailableItemName Include="GLSLShader">
- <Targets>DXC</Targets>
- </AvailableItemName>
- </ItemGroup>
- <Target Name="CompileShaders" BeforeTargets="BeforeBuild" Condition="'@(GLSLShader)'!=''" Outputs="@(CompiledShaders)">
- <CompileGLSLTask SourceFile="%(GLSLShader.Identity)"
- AdditionalIncludeDirectories="$(SpirVAdditionalIncludeDirectories)"
- TempDirectory="$(IntermediateOutputPath)"
- DestinationFile="$(IntermediateOutputPath)%(RelativeDir)%(Filename)%(Extension).spv" />
- <CreateItem Condition=" '%(GLSLShader.LogicalName)'!='' "
- Include="$(IntermediateOutputPath)%(RelativeDir)%(Filename)%(Extension).spv"
- AdditionalMetadata="LogicalName=%(GLSLShader.LogicalName)">
- <Output
- TaskParameter="Include"
- ItemName="EmbeddedResource"/>
- </CreateItem>
- <CreateItem Condition=" '%(GLSLShader.LogicalName)'=='' "
- Include="$(IntermediateOutputPath)%(RelativeDir)%(Filename)%(Extension).spv"
- AdditionalMetadata="LogicalName=$(AssemblyName).%(GLSLShader.Filename)%(Extension).spv">
- <Output
- TaskParameter="Include"
- ItemName="EmbeddedResource"/>
- </CreateItem>
- <Message Importance="High" Text="%(GLSLShader.Identity) -> $(AssemblyName).%(Filename)%(Extension).spv (Embedded Resource)" />
- </Target>
-</Project>
diff --git a/SpirVTasks/spirv.xml b/SpirVTasks/spirv.xml
deleted file mode 100644
index 9635ad6..0000000
--- a/SpirVTasks/spirv.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties">
- <ItemType Name="GLSLShader" DisplayName="GLSL Shader" />
- <ContentType Name="GLSLShader" ItemType="GLSLShader" DisplayName="GLSL Shader" />
- <FileExtension Name=".comp" ContentType="GLSLShader" />
- <FileExtension Name=".geom" ContentType="GLSLShader" />
- <FileExtension Name=".frag" ContentType="GLSLShader" />
- <FileExtension Name=".vert" ContentType="GLSLShader" />
-</ProjectSchemaDefinitions>
diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props
deleted file mode 100644
index 144a6ae..0000000
--- a/samples/Directory.Build.props
+++ /dev/null
@@ -1,39 +0,0 @@
-<Project>
- <PropertyGroup>
- <RootDirectory>$(MSBuildThisFileDirectory)../</RootDirectory>
- <Deterministic>true</Deterministic>
-
- <TargetFrameworks>net471;netstandard2.0</TargetFrameworks>
-
- <RepositoryUrl>https://github.com/jpbruyere/vk.net</RepositoryUrl>
- <License>MIT</License>
- <Authors>Jean-Philippe Bruyère</Authors>
-
- <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
- <OutputType>Exe</OutputType>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <IncludeDefaultNoneItems>false</IncludeDefaultNoneItems>
-
- <SpirVAdditionalIncludeDirectories>$(MSBuildThisFileDirectory)common\shaders</SpirVAdditionalIncludeDirectories>
-
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DefineConstants>TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0;_WITH_SHADOWS;WITH_VKVG</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DefineConstants>NETSTANDARD;NETSTANDARD2_0;WITH_SHADOWS;_WITH_VKVG</DefineConstants>
- </PropertyGroup>
-
-
- <ItemGroup>
- <PackageReference Include="CVKL" Version="0.1.7-beta" />
- <PackageReference Include="SpirVTasks" Version="0.1.9-beta" />
- <PackageReference Include="Vulkan" Version="0.1.4" />
- </ItemGroup>
-
- <ItemGroup>
- <GLSLShader Include="shaders\**\*.frag;shaders\**\*.vert;shaders\**\*.comp;shaders\**\*.geom" />
- </ItemGroup>
-
-</Project>
diff --git a/samples/DistanceFieldFontTest/DistanceFieldFontTest.csproj b/samples/DistanceFieldFontTest/DistanceFieldFontTest.csproj
deleted file mode 100644
index e16b3e1..0000000
--- a/samples/DistanceFieldFontTest/DistanceFieldFontTest.csproj
+++ /dev/null
@@ -1,9 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
- <ItemGroup>
- <ProjectReference Include="..\..\CVKL.Addons\DistanceFieldFont\DistanceFieldFont.csproj" />
- </ItemGroup>
- <ItemGroup>
- <Folder Include="shaders\" />
- </ItemGroup>
-</Project>
diff --git a/samples/DistanceFieldFontTest/Program.cs b/samples/DistanceFieldFontTest/Program.cs
deleted file mode 100644
index 5820a02..0000000
--- a/samples/DistanceFieldFontTest/Program.cs
+++ /dev/null
@@ -1,314 +0,0 @@
-using System.Collections.Generic;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using Glfw;
-
-using VK;
-using CVKL;
-using CVKL.DistanceFieldFont;
-
-namespace DistanceFieldFontTest {
-
-
-
- class Program : VkWindow {
- static void Main (string[] args) {
- SwapChain.PREFERED_FORMAT = VkFormat.B8g8r8a8Unorm;
-#if DEBUG
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = false;
-#endif
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- float rotSpeed = 0.01f, zoomSpeed = 0.01f;
- float rotX, rotY, rotZ = 0f, zoom = 1f;
-
- float rotAnim = 1f;
-
- struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 view;
- public Matrix4x4 model;
- }
-
- Matrices matrices;
-
- HostBuffer uboMats;
- GPUBuffer<float> vbo;
- GPUBuffer<ushort> ibo;
-
- DescriptorPool descriptorPool;
- DescriptorSetLayout dsLayout;
- DescriptorSet descriptorSet;
-
- GraphicPipeline pipeline;
- Framebuffer[] frameBuffers;
-
- Image fontTexture;
-
- struct Vertex {
- public Vector3 pos;
- public Vector2 uv;
- public Vertex (float x, float y, float z, float u, float v) {
- pos.X = x; pos.Y = y; pos.Z = z;
- uv.X = u; uv.Y = v;
- }
- }
-
- BMFont font;
- Vector4 textColor = new Vector4 (1.0f, 1.0f, 0.0f, 1.0f);//alpha => 0:disabled 1:enabled
- Vector4 outlineColor = new Vector4 (1.0f, 0.0f, 0.0f, 0.6f);//alpha => 0:disabled 1:enabled
-
- Program () : base () {
-
- font = new BMFont ("../data/font.fnt");
-
- vbo = new GPUBuffer<float> (dev, VkBufferUsageFlags.VertexBuffer, 1024);
- ibo = new GPUBuffer<ushort> (dev, VkBufferUsageFlags.IndexBuffer, 2048);
-
- descriptorPool = new DescriptorPool (dev, 1,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer),
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler)
- );
-
- dsLayout = new DescriptorSetLayout (dev, 0,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex, VkDescriptorType.UniformBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount4, false);
-
- cfg.Layout = new PipelineLayout (dev, dsLayout);
- cfg.Layout.AddPushConstants (new VkPushConstantRange (VkShaderStageFlags.Fragment, (uint)Marshal.SizeOf<Vector4> () * 2));
-
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, cfg.Samples);
-
- cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (
- true, VkBlendFactor.One, VkBlendFactor.OneMinusSrcAlpha, VkBlendOp.Add, VkBlendFactor.One, VkBlendFactor.Zero);
-
- cfg.AddVertexBinding (0, 5 * sizeof (float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#DistanceFieldFontTest.main.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#DistanceFieldFontTest.main.frag.spv");
-
- pipeline = new GraphicPipeline (cfg);
-
- uboMats = new HostBuffer (dev, VkBufferUsageFlags.UniformBuffer, matrices);
- uboMats.Map ();//permanent map
-
- descriptorSet = descriptorPool.Allocate (dsLayout);
-
- fontTexture = font.GetPageTexture (0, presentQueue, cmdPool);
- fontTexture.CreateView ();
- fontTexture.CreateSampler ();
- fontTexture.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- DescriptorSetWrites dsUpdate = new DescriptorSetWrites (descriptorSet, dsLayout);
- dsUpdate.Write (dev, uboMats.Descriptor, fontTexture.Descriptor);
-
- generateText ("Vulkan", out HostBuffer<Vertex> staggingVbo, out HostBuffer<ushort> staggingIbo);
-
- CommandBuffer cmd = cmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- staggingVbo.CopyTo (cmd, vbo);
- staggingIbo.CopyTo (cmd, ibo);
-
- presentQueue.EndSubmitAndWait (cmd);
-
- staggingVbo.Dispose ();
- staggingIbo.Dispose ();
-
- UpdateFrequency = 10;
- }
-
-
- // Creates a vertex buffer containing quads for the passed text
- void generateText (string text, out HostBuffer<Vertex> svbo, out HostBuffer<ushort> sibo) {
- List<Vertex> vertices = new List<Vertex> ();
- List<ushort> indices = new List<ushort> ();
- ushort indexOffset = 0;
-
- float w = fontTexture.Width;
-
- float posx = 0.0f;
- float posy = 0.0f;
-
- for (int i = 0; i < text.Length; i++) {
- BMChar charInfo = font.CharMap[text[i]];
-
-
- if (charInfo.width == 0)
- charInfo.width = 36;
-
- float charw = ((float)(charInfo.width) / 36.0f);
- float dimx = 1.0f * charw;
- float charh = ((float)(charInfo.height) / 36.0f);
- float dimy = 1.0f * charh;
- posy = 1.0f - charh;
-
- float us = charInfo.x / w;
- float ue = (charInfo.x + charInfo.width) / w;
- float ts = charInfo.y / w;
- float te = (charInfo.y + charInfo.height) / w;
-
- float xo = charInfo.xoffset / 36.0f;
- float yo = charInfo.yoffset / 36.0f;
-
- vertices.Add (new Vertex (posx + dimx + xo, posy + dimy, 0.0f, ue, te));
- vertices.Add (new Vertex (posx + xo, posy + dimy, 0.0f, us, te));
- vertices.Add (new Vertex (posx + xo, posy, 0.0f, us, ts));
- vertices.Add (new Vertex (posx + dimx + xo, posy, 0.0f, ue, ts));
-
- indices.AddRange (new ushort[] { indexOffset, (ushort)(indexOffset + 1), (ushort)(indexOffset + 2), (ushort)(indexOffset + 2), (ushort)(indexOffset + 3), indexOffset });
- indexOffset += 4;
-
- float advance = charInfo.xadvance / 36.0f;
- posx += advance;
- }
-
- Vertex[] vx = vertices.ToArray ();
-
- // Center
- for (int i = 0; i < vx.Length; i++) {
- vx[i].pos.X -= posx / 2.0f;
- vx[i].pos.Y -= 0.5f;
- }
-
- svbo = new HostBuffer<Vertex> (dev, VkBufferUsageFlags.TransferSrc, vx);
- sibo = new HostBuffer<ushort> (dev, VkBufferUsageFlags.TransferSrc, indices.ToArray());
- }
-
- bool rebuildBuffers;
-
- public override void Update () {
- if (rebuildBuffers) {
- buildCommandBuffers ();
- rebuildBuffers = false;
- }
- if (rotAnim < 0.000001f)
- return;
- rotY += rotAnim;
- rotAnim *= 0.95f;
- updateViewRequested = true;
- }
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
- cmds[i] = cmdPool.AllocateAndStart ();
-
- recordDraw (cmds[i], frameBuffers[i]);
-
- cmds[i].End ();
- }
- }
-
- void recordDraw (CommandBuffer cmd, Framebuffer fb) {
- pipeline.RenderPass.Begin (cmd, fb);
-
- cmd.SetViewport (fb.Width, fb.Height);
- cmd.SetScissor (fb.Width, fb.Height);
-
- cmd.BindPipeline (pipeline, descriptorSet);
-
- cmd.PushConstant (pipeline, textColor);
- cmd.PushConstant (pipeline, outlineColor, 0, 16);
-
- cmd.BindVertexBuffer (vbo, 0);
- cmd.BindIndexBuffer (ibo, VkIndexType.Uint16);
- cmd.DrawIndexed ((uint)ibo.ElementCount,1,0,0,0);
-
- pipeline.RenderPass.End (cmd);
- }
-
-
- public override void UpdateView () {
- matrices.projection = Matrix4x4.CreatePerspectiveFieldOfView (Utils.DegreesToRadians (60f), (float)swapChain.Width / (float)swapChain.Height, 0.1f, 256.0f);
- matrices.view = Matrix4x4.CreateTranslation (0, 0, -2.5f * zoom);
- matrices.model =
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotZ) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotY) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotX);
-
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> ());
-
- updateViewRequested = false;
- }
-
- protected override void onMouseMove (double xPos, double yPos) {
- double diffX = lastMouseX - xPos;
- double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- rotY -= rotSpeed * (float)diffX;
- rotX += rotSpeed * (float)diffY;
- } else if (MouseButton[1]) {
- zoom += zoomSpeed * (float)diffY;
- }
-
- updateViewRequested = true;
- }
-
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.Space:
- rotAnim += 0.1f;
- break;
- case Key.F2:
- if (modifiers.HasFlag (Modifier.Shift))
- outlineColor.W -= 0.01f;
- else
- outlineColor.W += 0.01f;
- rebuildBuffers = true;
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- break;
- }
- }
- protected override void OnResize () {
- base.OnResize ();
-
- updateViewRequested = true;
-
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (pipeline.RenderPass, swapChain.Width, swapChain.Height,
- (pipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- } : new Image[] {
- null,
- swapChain.images[i]
- });
- }
-
- buildCommandBuffers ();
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
- pipeline.Dispose ();
- dsLayout.Dispose ();
- for (int i = 0; i < swapChain.ImageCount; i++)
- frameBuffers[i].Dispose ();
- descriptorPool.Dispose ();
- fontTexture?.Dispose ();
- vbo.Dispose ();
- ibo.Dispose ();
- uboMats.Dispose ();
- }
- }
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/DistanceFieldFontTest/shaders/main.frag b/samples/DistanceFieldFontTest/shaders/main.frag
deleted file mode 100644
index fa1f6c6..0000000
--- a/samples/DistanceFieldFontTest/shaders/main.frag
+++ /dev/null
@@ -1,32 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (binding = 1) uniform sampler2D samplerColor;
-
-layout (push_constant) uniform PushConsts {
- vec4 color;
- vec4 outlineColor;
-};
-
-layout (location = 0) in vec2 inUV;
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- float distance = texture(samplerColor, inUV).a;
- float smoothWidth = fwidth(distance);
- float alpha = smoothstep(0.5 - smoothWidth, 0.5 + smoothWidth, distance);
- vec3 rgb = color.rgb * vec3(alpha);
-
- if (outlineColor.a > 0.0)
- {
- float w = 1.0 - outlineColor.a;
- alpha = smoothstep(w - smoothWidth, w + smoothWidth, distance);
- rgb += mix(vec3(alpha), outlineColor.rgb, alpha);
- }
-
- outFragColor = vec4(rgb, alpha * color.a);
-
-} \ No newline at end of file
diff --git a/samples/DistanceFieldFontTest/shaders/main.vert b/samples/DistanceFieldFontTest/shaders/main.vert
deleted file mode 100644
index 3b395bf..0000000
--- a/samples/DistanceFieldFontTest/shaders/main.vert
+++ /dev/null
@@ -1,28 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec3 inColor;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projectionMatrix;
- mat4 viewMatrix;
- mat4 modelMatrix;
-} ubo;
-
-layout (location = 0) out vec3 outColor;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-
-void main()
-{
- outColor = inColor;
- gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos.xyz, 1.0);
-}
diff --git a/samples/Model/Model.csproj b/samples/Model/Model.csproj
deleted file mode 100644
index c938f67..0000000
--- a/samples/Model/Model.csproj
+++ /dev/null
@@ -1,7 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
- <ItemGroup>
- <ProjectReference Include="..\..\CVKL.Addons\gltfLoader\gltfLoader.csproj" />
- </ItemGroup>
-
-</Project>
diff --git a/samples/Model/data/DamagedHelmet.bin b/samples/Model/data/DamagedHelmet.bin
deleted file mode 100644
index 662eacc..0000000
--- a/samples/Model/data/DamagedHelmet.bin
+++ /dev/null
Binary files differ
diff --git a/samples/Model/data/DamagedHelmet.gltf b/samples/Model/data/DamagedHelmet.gltf
deleted file mode 100644
index c61145a..0000000
--- a/samples/Model/data/DamagedHelmet.gltf
+++ /dev/null
@@ -1,204 +0,0 @@
-{
- "accessors" : [
- {
- "bufferView" : 0,
- "componentType" : 5123,
- "count" : 46356,
- "max" : [
- 14555
- ],
- "min" : [
- 0
- ],
- "type" : "SCALAR"
- },
- {
- "bufferView" : 1,
- "componentType" : 5126,
- "count" : 14556,
- "max" : [
- 0.9424954056739807,
- 0.8128451108932495,
- 0.900973916053772
- ],
- "min" : [
- -0.9474585652351379,
- -1.18715500831604,
- -0.9009949564933777
- ],
- "type" : "VEC3"
- },
- {
- "bufferView" : 2,
- "componentType" : 5126,
- "count" : 14556,
- "max" : [
- 1.0,
- 1.0,
- 1.0
- ],
- "min" : [
- -1.0,
- -1.0,
- -1.0
- ],
- "type" : "VEC3"
- },
- {
- "bufferView" : 3,
- "componentType" : 5126,
- "count" : 14556,
- "max" : [
- 0.9999759793281555,
- 1.998665988445282
- ],
- "min" : [
- 0.002448640065267682,
- 1.0005531199858524
- ],
- "type" : "VEC2"
- }
- ],
- "asset" : {
- "generator" : "Khronos Blender glTF 2.0 exporter",
- "version" : "2.0"
- },
- "bufferViews" : [
- {
- "buffer" : 0,
- "byteLength" : 92712,
- "byteOffset" : 0,
- "target" : 34963
- },
- {
- "buffer" : 0,
- "byteLength" : 174672,
- "byteOffset" : 92712,
- "target" : 34962
- },
- {
- "buffer" : 0,
- "byteLength" : 174672,
- "byteOffset" : 267384,
- "target" : 34962
- },
- {
- "buffer" : 0,
- "byteLength" : 116448,
- "byteOffset" : 442056,
- "target" : 34962
- }
- ],
- "buffers" : [
- {
- "byteLength" : 558504,
- "uri" : "DamagedHelmet.bin"
- }
- ],
- "images" : [
- {
- "uri" : "Default_albedo.jpg"
- },
- {
- "uri" : "Default_metalRoughness.jpg"
- },
- {
- "uri" : "Default_emissive.jpg"
- },
- {
- "uri" : "Default_AO.jpg"
- },
- {
- "uri" : "Default_normal.jpg"
- }
- ],
- "materials" : [
- {
- "emissiveFactor" : [
- 1.0,
- 1.0,
- 1.0
- ],
- "emissiveTexture" : {
- "index" : 2
- },
- "name" : "Material_MR",
- "normalTexture" : {
- "index" : 4
- },
- "occlusionTexture" : {
- "index" : 3
- },
- "pbrMetallicRoughness" : {
- "baseColorTexture" : {
- "index" : 0
- },
- "metallicRoughnessTexture" : {
- "index" : 1
- }
- }
- }
- ],
- "meshes" : [
- {
- "name" : "mesh_helmet_LP_13930damagedHelmet",
- "primitives" : [
- {
- "attributes" : {
- "NORMAL" : 2,
- "POSITION" : 1,
- "TEXCOORD_0" : 3
- },
- "indices" : 0,
- "material" : 0
- }
- ]
- }
- ],
- "nodes" : [
- {
- "mesh" : 0,
- "name" : "node_damagedHelmet_-6514",
- "rotation" : [
- 0.7071068286895752,
- 0.0,
- -0.0,
- 0.7071068286895752
- ]
- }
- ],
- "samplers" : [
- {}
- ],
- "scene" : 0,
- "scenes" : [
- {
- "name" : "Scene",
- "nodes" : [
- 0
- ]
- }
- ],
- "textures" : [
- {
- "sampler" : 0,
- "source" : 0
- },
- {
- "sampler" : 0,
- "source" : 1
- },
- {
- "sampler" : 0,
- "source" : 2
- },
- {
- "sampler" : 0,
- "source" : 3
- },
- {
- "sampler" : 0,
- "source" : 4
- }
- ]
-}
diff --git a/samples/Model/data/Default_AO.jpg b/samples/Model/data/Default_AO.jpg
deleted file mode 100644
index 419f628..0000000
--- a/samples/Model/data/Default_AO.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/Model/data/Default_albedo.jpg b/samples/Model/data/Default_albedo.jpg
deleted file mode 100644
index 15d6485..0000000
--- a/samples/Model/data/Default_albedo.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/Model/data/Default_emissive.jpg b/samples/Model/data/Default_emissive.jpg
deleted file mode 100644
index 2de59e8..0000000
--- a/samples/Model/data/Default_emissive.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/Model/data/Default_metalRoughness.jpg b/samples/Model/data/Default_metalRoughness.jpg
deleted file mode 100644
index 04874cb..0000000
--- a/samples/Model/data/Default_metalRoughness.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/Model/data/Default_normal.jpg b/samples/Model/data/Default_normal.jpg
deleted file mode 100644
index 94ca20a..0000000
--- a/samples/Model/data/Default_normal.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/Model/main.cs b/samples/Model/main.cs
deleted file mode 100644
index c8e6c42..0000000
--- a/samples/Model/main.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-using System.Collections.Generic;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using CVKL;
-using CVKL.glTF;
-using VK;
-
-namespace ModelSample {
- class Program : VkWindow {
- static void Main (string[] args) {
-#if DEBUG
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = false;
-#endif
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 view;
- public Matrix4x4 model;
- //public Vector4 lightPos;
- }
-
- public struct PushConstants {
- public Matrix4x4 matrix;
- }
-
- Matrices matrices;
-
- HostBuffer uboMats;
-
- DescriptorPool descriptorPool;
- DescriptorSet dsMatrices, dsTextures;
- DescriptorSetLayout descLayoutMatrix;
- DescriptorSetLayout descLayoutTextures;
-
- Framebuffer[] frameBuffers;
-
- GraphicPipeline pipeline;
-
- VkSampleCountFlags NUM_SAMPLES = VkSampleCountFlags.SampleCount1;
-
- float rotSpeed = 0.01f, zoomSpeed = 0.01f;
- float rotX, rotY, rotZ = 0f, zoom = 2f;
-
- SimpleModel helmet;
- CVKL.DebugUtils.Messenger dbgmsg;
-
- Program () : base () {
-
-
- descriptorPool = new DescriptorPool (dev, 2,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer),
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler, 3));
-
- descLayoutMatrix = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex, VkDescriptorType.UniformBuffer));
-
- descLayoutTextures = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
-
- VkPushConstantRange pushConstantRange = new VkPushConstantRange {
- stageFlags = VkShaderStageFlags.Vertex,
- size = (uint)Marshal.SizeOf<PushConstants>(),
- offset = 0
- };
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, NUM_SAMPLES);
- cfg.rasterizationState.cullMode = VkCullModeFlags.Back;
- if (NUM_SAMPLES != VkSampleCountFlags.SampleCount1) {
- cfg.multisampleState.sampleShadingEnable = true;
- cfg.multisampleState.minSampleShading = 0.5f;
- }
-
- cfg.Layout = new PipelineLayout (dev, pushConstantRange, descLayoutMatrix, descLayoutTextures);
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), cfg.Samples);
- cfg.AddVertexBinding<Model.Vertex> (0);
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat, VkFormat.R32g32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#Model.model.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#Model.model.frag.spv");
-
- pipeline = new GraphicPipeline (cfg);
-
- helmet = new SimpleModel (presentQueue, "../data/models/DamagedHelmet/glTF/DamagedHelmet.gltf");
- //helmet = new SimpleModel (presentQueue, "../data/models/Hubble.glb");
-
- //helmet = new SimpleModel (presentQueue, "/mnt/devel/vulkan/Lugdunum/resources/models/Box.gltf");
-
- dsMatrices = descriptorPool.Allocate (descLayoutMatrix);
- dsTextures = descriptorPool.Allocate (descLayoutTextures);
-
- uboMats = new HostBuffer (dev, VkBufferUsageFlags.UniformBuffer, matrices);
- //matrices.lightPos = new Vector4 (0.0f, 0.0f, -2.0f, 1.0f);
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (dsMatrices, descLayoutMatrix);
- uboUpdate.Write (dev, uboMats.Descriptor);
-
- DescriptorSetWrites texturesUpdate = new DescriptorSetWrites (dsTextures, descLayoutTextures);
- texturesUpdate.Write (dev,
- helmet.textures[0].Descriptor,
- helmet.textures[1].Descriptor,
- helmet.textures[2].Descriptor);
-
- uboMats.Map ();//permanent map
- }
-
- public override void UpdateView () {
- matrices.projection = Matrix4x4.CreatePerspectiveFieldOfView (Utils.DegreesToRadians (45f),
- (float)swapChain.Width / (float)swapChain.Height, 0.1f, 256.0f) * Camera.VKProjectionCorrection;
- matrices.view =
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotZ) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotY) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotX) *
- Matrix4x4.CreateTranslation (0, 0, -3f * zoom);
- matrices.model = Matrix4x4.Identity;
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> ());
- updateViewRequested = false;
- }
-
- protected override void onMouseMove (double xPos, double yPos) {
- double diffX = lastMouseX - xPos;
- double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- rotY -= rotSpeed * (float)diffX;
- rotX += rotSpeed * (float)diffY;
- } else if (MouseButton[1]) {
- zoom += zoomSpeed * (float)diffY;
- }
- updateViewRequested = true;
- }
- void buildCommandBuffers () {
- cmdPool.Reset (VkCommandPoolResetFlags.ReleaseResources);
- cmds = cmdPool.AllocateCommandBuffer (swapChain.ImageCount);
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- Framebuffer fb = frameBuffers[i];
- cmds[i].Start ();
-
- pipeline.RenderPass.Begin (cmds[i], fb);
-
- cmds[i].SetViewport (swapChain.Width, swapChain.Height);
- cmds[i].SetScissor (swapChain.Width, swapChain.Height);
-
- cmds[i].BindDescriptorSet (pipeline.Layout, dsMatrices);
- cmds[i].BindDescriptorSet (pipeline.Layout, dsTextures, 1);
-
- PushConstants pc = new PushConstants { matrix = Matrix4x4.Identity };
- cmds[i].PushConstant (pipeline.Layout, VkShaderStageFlags.Vertex, pc, (uint)Marshal.SizeOf<Matrix4x4> ());
-
- cmds[i].BindPipeline (pipeline);
-
- helmet.DrawAll (cmds[i], pipeline.Layout);
-
- pipeline.RenderPass.End (cmds[i]);
-
- cmds[i].End ();
- }
- }
-
- protected override void OnResize () {
- base.OnResize ();
-
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i] = new Framebuffer (pipeline.RenderPass, swapChain.Width, swapChain.Height,
- (pipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- null
- } : new Image[] {
- null,
- null,
- swapChain.images[i]
- });
-
- buildCommandBuffers ();
- }
-
- class SimpleModel : PbrModel {
- public new struct Vertex {
- [VertexAttribute (VertexAttributeType.Position, VkFormat.R32g32b32Sfloat)]
- public Vector3 pos;
- [VertexAttribute (VertexAttributeType.Normal, VkFormat.R32g32b32Sfloat)]
- public Vector3 normal;
- [VertexAttribute (VertexAttributeType.UVs, VkFormat.R32g32Sfloat)]
- public Vector2 uv;
- public override string ToString () {
- return pos.ToString () + ";" + normal.ToString () + ";" + uv.ToString ();
- }
- };
- public Image[] textures;
-
- public SimpleModel (Queue transferQ, string path) {
- dev = transferQ.Dev;
-
- using (CommandPool cmdPool = new CommandPool (dev, transferQ.index)) {
- using (CVKL.glTF.glTFLoader ctx = new CVKL.glTF.glTFLoader(path, transferQ, cmdPool)) {
- loadSolids<Vertex> (ctx);
- textures = ctx.LoadImages ();
- }
- }
- }
-
- public void DrawAll (CommandBuffer cmd, PipelineLayout pipelineLayout) {
- //helmet.Meshes
- cmd.BindVertexBuffer (vbo);
- cmd.BindIndexBuffer (ibo, IndexBufferType);
- foreach (Mesh m in Meshes) {
- foreach (var p in m.Primitives) {
- cmd.DrawIndexed (p.indexCount,1,p.indexBase,p.vertexBase);
- }
- }
-
- //foreach (Scene sc in Scenes) {
- // foreach (Node node in sc.Root.Children)
- // RenderNode (cmd, pipelineLayout, node, sc.Root.localMatrix, shadowPass);
- //}
- }
-
- public override void RenderNode (CommandBuffer cmd, PipelineLayout pipelineLayout, Node node, Matrix4x4 currentTransform, bool shadowPass = false) {
- throw new System.NotImplementedException ();
- }
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- helmet.vbo.Dispose ();
- helmet.ibo.Dispose ();
- foreach (var t in helmet.textures)
- t.Dispose ();
-
- pipeline.Dispose ();
- descLayoutMatrix.Dispose ();
- descLayoutTextures.Dispose ();
- for (int i = 0; i < swapChain.ImageCount; i++)
- frameBuffers[i]?.Dispose ();
- descriptorPool.Dispose ();
- uboMats.Dispose ();
- dbgmsg?.Dispose ();
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/Model/shaders/model.frag b/samples/Model/shaders/model.frag
deleted file mode 100644
index 7083a06..0000000
--- a/samples/Model/shaders/model.frag
+++ /dev/null
@@ -1,84 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (set = 1, binding = 0) uniform sampler2D samplerColor;
-layout (set = 1, binding = 1) uniform sampler2D samplerNormal;
-layout (set = 1, binding = 2) uniform sampler2D samplerOcclusion;
-
-layout (location = 0) in vec2 inUV;
-layout (location = 1) in vec3 inN;
-layout (location = 2) in vec3 inV;//ViewDir
-layout (location = 3) in vec3 inL;
-
-layout (location = 0) out vec4 outFragColor;
-
-
-
-// http://www.thetenthplanet.de/archives/1180
-mat3 cotangent_frame(vec3 N, vec3 p, vec2 uv)
-{
- // get edge vectors of the pixel triangle
- vec3 dp1 = dFdx( p );
- vec3 dp2 = dFdy( p );
- vec2 duv1 = dFdx( uv );
- vec2 duv2 = dFdy( uv );
-
- // solve the linear system
- vec3 dp2perp = cross( dp2, N );
- vec3 dp1perp = cross( N, dp1 );
- vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;
- vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;
-
- // construct a scale-invariant frame
- float invmax = inversesqrt( max( dot(T,T), dot(B,B) ) );
- return mat3( T * invmax, B * invmax, N );
-}
-
-vec3 perturb_normal( vec3 N, vec3 V, vec2 texcoord )
-{
- // assume N, the interpolated vertex normal and
- // V, the view vector (vertex to eye)
- vec3 map = texture(samplerNormal, texcoord).xyz;
- map = map * 255./127. - 128./127.;
- mat3 TBN = cotangent_frame(N, -V, texcoord);
- return normalize(TBN * map);
-}
-
-
-void main()
-{
- vec4 color = texture(samplerColor, inUV);
-
- vec3 N = normalize(inN);
- vec3 L = normalize(inL);
- vec3 V = normalize(inV);
- vec3 R = reflect(-L, N);
- vec3 diffuse = max(dot(N, L), 0.0) * vec3(0.9);
- vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75);
- outFragColor = vec4(diffuse * color.rgb + specular, 1.0);
-}
-/*void main()
-{
- vec4 diff = texture(samplerColor, inUV);
-
- vec3 n = normalize(inN);
- vec3 l = normalize(-light);
- vec3 pn = perturb_normal(n, inV, inUV);
-
- float lambert = max(0.0, dot(pn, l));
-
- //diff.rgb *= lambert * texture(samplerOcclusion, inUV).rgb;
- vec3 spec = vec3(0);
- vec3 amb = vec3(0.1);
- if (lambert >= 0.0) {
- vec3 rd = reflect(l, pn);
- float s = dot(rd, normalize(inV));
- spec = vec3(0.9,0.9,0.9)* //light.specular.xyz * material.specular.xyz *
- pow(max(0.0, s), 10.5); //0.5 = mat shininess
- }
- //outFragColor = vec4(1.0); //
- //outFragColor = vec4(diff.rgb , 1.0); //
- outFragColor = vec4(diff.rgb + amb + spec , diff.a); //
-}*/ \ No newline at end of file
diff --git a/samples/Model/shaders/model.vert b/samples/Model/shaders/model.vert
deleted file mode 100644
index c4dbfb8..0000000
--- a/samples/Model/shaders/model.vert
+++ /dev/null
@@ -1,50 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec3 inNormal;
-layout (location = 2) in vec2 inUV;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projectionMatrix;
- mat4 viewMatrix;
- mat4 modelMatrix;
-} ubo;
-
-layout (location = 0) out vec2 outUV;
-layout (location = 1) out vec3 outN;
-layout (location = 2) out vec3 outV;//ViewDir
-layout (location = 3) out vec3 outL;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-layout(push_constant) uniform PushConsts {
- mat4 model;
-} pc;
-
-vec3 light = vec3(2.0,2.0,-2.0);
-
-void main()
-{
- outUV = inUV;
-
- mat4 mod = ubo.modelMatrix;// * pc.model;
- vec4 pos = mod * vec4(inPos.xyz, 1.0);
- vec3 lPos = mat3(mod) * light;
-
- //outN = normalize(transpose(inverse(mat3(mod))) * inNormal);
- outN = mat3(mod)* inNormal;
-
- //mat4 viewInv = inverse(ubo.viewMatrix);
-
- outV = -pos.xyz;//normalize(vec3(viewInv * vec4(0.0, 0.0, 0.0, 1.0) - pos));
- outL = lPos - pos.xyz;
-
- gl_Position = ubo.projectionMatrix * ubo.viewMatrix * pos;
-}
diff --git a/samples/Textured/Textured.csproj b/samples/Textured/Textured.csproj
deleted file mode 100644
index 1785b4a..0000000
--- a/samples/Textured/Textured.csproj
+++ /dev/null
@@ -1,8 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
-
- <ItemGroup>
- <PackageReference Include="glTF2Loader" Version="1.1.3-alpha" />
- </ItemGroup>
-
-</Project>
diff --git a/samples/Textured/main.cs b/samples/Textured/main.cs
deleted file mode 100644
index 988203f..0000000
--- a/samples/Textured/main.cs
+++ /dev/null
@@ -1,267 +0,0 @@
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using Glfw;
-using CVKL;
-using VK;
-
-namespace Textured {
- class Program : VkWindow {
- static void Main (string[] args) {
-#if DEBUG
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = true;
-#endif
-
- foreach (string s in System.Reflection.Assembly.GetEntryAssembly ().GetManifestResourceNames ())
- Console.WriteLine (s);
-
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
- protected override void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures features) {
- base.configureEnabledFeatures (available_features, ref features);
- features.textureCompressionBC = available_features.textureCompressionBC;
- features.textureCompressionASTC_LDR = available_features.textureCompressionASTC_LDR;
- }
-
- float rotSpeed = 0.01f, zoomSpeed = 0.01f;
- float rotX, rotY, rotZ = 0f, zoom = 1f;
-
- struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 view;
- public Matrix4x4 model;
- }
-
- Matrices matrices;
-
- HostBuffer uboMats;
- GPUBuffer<float> vbo;
- GPUBuffer<ushort> ibo;
-
- DescriptorPool descriptorPool;
- DescriptorSetLayout dsLayout;
- DescriptorSet descriptorSet;
-
- GraphicPipeline pipeline;
- Framebuffer[] frameBuffers;
-
- Image texture;
- Image nextTexture;
-
- float[] vertices = {
- 1.0f, 1.0f, 0.0f , 1.0f, 0.0f,
- -1.0f, 1.0f, 0.0f , 0.0f, 0.0f,
- -1.0f, -1.0f, 0.0f , 0.0f, 1.0f,
- 1.0f, -1.0f, 0.0f , 1.0f, 1.0f,
- };
- ushort[] indices = { 0, 1, 2, 2, 0, 3 };
- int currentImgIndex = 0;
- string[] imgPathes = {
- "/mnt/devel/vulkan/VulkanExamples/data/models/voyager/voyager_rgba_unorm.ktx",
- "/mnt/devel/vulkan/vulkanExUpstream/data/models/voyager/voyager_astc_8x8_unorm.ktx",
- "../data/font.ktx",
- "/mnt/devel/vulkan/vulkanExUpstream/data/textures/trail_astc_8x8_unorm.ktx",
- "../data/textures/texturearray_rocks_bc3_unorm.ktx",
- "../data/textures/texture.jpg",
- "../data/textures/tex256.jpg",
- };
-
- Program () : base () {
-
- loadTexture (imgPathes[currentImgIndex]);
-
- vbo = new GPUBuffer<float> (presentQueue, cmdPool, VkBufferUsageFlags.VertexBuffer, vertices);
- ibo = new GPUBuffer<ushort> (presentQueue, cmdPool, VkBufferUsageFlags.IndexBuffer, indices);
-
- descriptorPool = new DescriptorPool (dev, 1,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer),
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler)
- );
-
- dsLayout = new DescriptorSetLayout (dev, 0,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex, VkDescriptorType.UniformBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount4);
-
- cfg.Layout = new PipelineLayout (dev, dsLayout);
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), cfg.Samples);
-
- cfg.AddVertexBinding (0, 5 * sizeof(float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#Textured.main.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#Textured.main.frag.spv");
-
- pipeline = new GraphicPipeline (cfg);
-
-
- uboMats = new HostBuffer (dev, VkBufferUsageFlags.UniformBuffer, matrices);
- uboMats.Map ();//permanent map
-
- descriptorSet = descriptorPool.Allocate (dsLayout);
-
- updateTextureSet ();
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descriptorSet, dsLayout.Bindings[0]);
- uboUpdate.Write (dev, uboMats.Descriptor);
- }
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
- cmds[i] = cmdPool.AllocateAndStart ();
-
- recordDraw (cmds[i], frameBuffers[i]);
-
- cmds[i].End ();
- }
- }
- void recordDraw (CommandBuffer cmd, Framebuffer fb) {
- pipeline.RenderPass.Begin (cmd, fb);
-
- cmd.SetViewport (fb.Width, fb.Height);
- cmd.SetScissor (fb.Width, fb.Height);
- cmd.BindDescriptorSet (pipeline.Layout, descriptorSet);
-
- pipeline.Bind (cmd);
-
- cmd.BindVertexBuffer (vbo, 0);
- cmd.BindIndexBuffer (ibo, VkIndexType.Uint16);
- cmd.DrawIndexed ((uint)indices.Length);
-
- pipeline.RenderPass.End (cmd);
- }
-
- VkMemoryPropertyFlags imgProp = VkMemoryPropertyFlags.DeviceLocal;
- bool genMipMaps = true;
- VkImageTiling tiling = VkImageTiling.Optimal;
-
- //in the thread of the keyboard
- void loadTexture (string path) {
- try {
- Console.WriteLine ($"Loading:{path}");
- if (path.EndsWith ("ktx", StringComparison.OrdinalIgnoreCase))
- nextTexture = KTX.KTX.Load (presentQueue, cmdPool, path,
- VkImageUsageFlags.Sampled, imgProp, genMipMaps, tiling);
- else
- nextTexture = Image.Load (dev, presentQueue, cmdPool, path, VkFormat.R8g8b8a8Unorm, imgProp, tiling, genMipMaps);
- updateViewRequested = true;
- } catch (Exception ex) {
- Console.WriteLine (ex);
- nextTexture = null;
- }
- }
-
- //in the main vulkan thread
- void updateTextureSet (){
- nextTexture.CreateView ();
- nextTexture.CreateSampler ();
- nextTexture.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descriptorSet, dsLayout.Bindings[1]);
- uboUpdate.Write (dev, nextTexture.Descriptor);
-
- texture?.Dispose ();
- texture = nextTexture;
- nextTexture = null;
- }
- void updateMatrices () {
- matrices.projection = Matrix4x4.CreatePerspectiveFieldOfView (Utils.DegreesToRadians (60f), (float)swapChain.Width / (float)swapChain.Height, 0.1f, 256.0f);
- matrices.view = Matrix4x4.CreateTranslation (0, 0, -2.5f * zoom);
- matrices.model =
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotZ) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotY) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotX);
-
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> ());
- }
-
- public override void UpdateView () {
- if (nextTexture != null) {
- updateTextureSet ();
- buildCommandBuffers ();
- }else
- updateMatrices ();
-
- updateViewRequested = false;
- }
-
- protected override void onMouseMove (double xPos, double yPos) {
- double diffX = lastMouseX - xPos;
- double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- rotY -= rotSpeed * (float)diffX;
- rotX += rotSpeed * (float)diffY;
- } else if (MouseButton[1]) {
- zoom += zoomSpeed * (float)diffY;
- }
-
- updateViewRequested = true;
- }
-
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.Space:
- currentImgIndex++;
- if (currentImgIndex == imgPathes.Length)
- currentImgIndex = 0;
- loadTexture (imgPathes[currentImgIndex]);
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- break;
- }
- }
-
- protected override void OnResize () {
- base.OnResize ();
-
- updateMatrices ();
-
- if (frameBuffers!=null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (pipeline.RenderPass, swapChain.Width, swapChain.Height,
- (pipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- null
- } : new Image[] {
- null,
- null,
- swapChain.images[i]
- });
- }
-
- buildCommandBuffers ();
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
- pipeline.Dispose ();
- dsLayout.Dispose ();
- for (int i = 0; i < swapChain.ImageCount; i++)
- frameBuffers[i].Dispose ();
- descriptorPool.Dispose ();
- texture?.Dispose ();
- nextTexture?.Dispose ();
- vbo.Dispose ();
- ibo.Dispose ();
- uboMats.Dispose ();
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/Textured/shaders/main.frag b/samples/Textured/shaders/main.frag
deleted file mode 100644
index 73dfd79..0000000
--- a/samples/Textured/shaders/main.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (binding = 1) uniform sampler2D samplerColor;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = texture(samplerColor, inUV);
-} \ No newline at end of file
diff --git a/samples/Textured/shaders/main.vert b/samples/Textured/shaders/main.vert
deleted file mode 100644
index 3b395bf..0000000
--- a/samples/Textured/shaders/main.vert
+++ /dev/null
@@ -1,28 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec3 inColor;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projectionMatrix;
- mat4 viewMatrix;
- mat4 modelMatrix;
-} ubo;
-
-layout (location = 0) out vec3 outColor;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-
-void main()
-{
- outColor = inColor;
- gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos.xyz, 1.0);
-}
diff --git a/samples/TexturedCube/TexturedCube.csproj b/samples/TexturedCube/TexturedCube.csproj
deleted file mode 100644
index 990df32..0000000
--- a/samples/TexturedCube/TexturedCube.csproj
+++ /dev/null
@@ -1,7 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
- <ItemGroup>
- <ProjectReference Include="..\..\CVKL.Addons\VkvgPipeline\VkvgPipeline.csproj" />
- </ItemGroup>
-</Project>
-
diff --git a/samples/TexturedCube/main.cs b/samples/TexturedCube/main.cs
deleted file mode 100644
index 445a06b..0000000
--- a/samples/TexturedCube/main.cs
+++ /dev/null
@@ -1,330 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using Glfw;
-using CVKL;
-using VK;
-using Buffer = CVKL.Buffer;
-
-namespace TextureCube {
- class Program : VkWindow {
- static void Main (string[] args) {
-#if DEBUG
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = false;
-#endif
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- float rotSpeed = 0.01f, zoomSpeed = 0.01f;
- float rotX, rotY, rotZ = 0f, zoom = 1f;
-
- struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 view;
- }
-
- Matrices matrices;
-
- HostBuffer uboMats;
- GPUBuffer<float> vbo;
- DescriptorPool descriptorPool;
- DescriptorSetLayout dsLayout;
- DescriptorSet descriptorSet, dsVkvg;
- GraphicPipeline pipeline;
- Framebuffer[] frameBuffers;
-
- Image texture;
- Image nextTexture;
-
- static float[] g_vertex_buffer_data = {
- -1.0f,-1.0f,-1.0f, 0.0f, 1.0f, // -X side
- -1.0f,-1.0f, 1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
- -1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
- -1.0f, 1.0f,-1.0f, 0.0f, 0.0f,
- -1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
-
- -1.0f,-1.0f,-1.0f, 1.0f, 1.0f, // -Z side
- 1.0f, 1.0f,-1.0f, 0.0f, 0.0f,
- 1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
- -1.0f,-1.0f,-1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f,-1.0f, 1.0f, 0.0f,
- 1.0f, 1.0f,-1.0f, 0.0f, 0.0f,
-
- -1.0f,-1.0f,-1.0f, 1.0f, 0.0f, // -Y side
- 1.0f,-1.0f,-1.0f, 1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f, 0.0f, 1.0f,
- -1.0f,-1.0f,-1.0f, 1.0f, 0.0f,
- 1.0f,-1.0f, 1.0f, 0.0f, 1.0f,
- -1.0f,-1.0f, 1.0f, 0.0f, 0.0f,
-
- -1.0f, 1.0f,-1.0f, 1.0f, 0.0f, // +Y side
- -1.0f, 1.0f, 1.0f, 0.0f, 0.0f,
- 1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
- -1.0f, 1.0f,-1.0f, 1.0f, 0.0f,
- 1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, 1.0f,-1.0f, 1.0f, 1.0f,
-
- 1.0f, 1.0f,-1.0f, 1.0f, 0.0f, // +X side
- 1.0f, 1.0f, 1.0f, 0.0f, 0.0f,
- 1.0f,-1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f,-1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f,-1.0f,-1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f,-1.0f, 1.0f, 0.0f,
-
- -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, // +Z side
- -1.0f,-1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
- -1.0f,-1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f,-1.0f, 1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
- };
- int currentImgIndex = 4;
- string[] imgPathes = {
- "../data/textures/uffizi_cube.ktx",
- "../data/textures/papermill.ktx",
- "../data/textures/cubemap_yokohama_bc3_unorm.ktx",
- "../data/textures/gcanyon_cube.ktx",
- "../data/textures/pisa_cube.ktx",
- };
-
- VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1;
-
-#if WITH_VKVG
- VkvgPipeline.VkvgPipeline vkvgPipeline;
-
- void vkvgDraw () {
- using (vkvg.Context ctx = vkvgPipeline.CreateContext()) {
- ctx.Operator = vkvg.Operator.Clear;
- ctx.Paint ();
- ctx.Operator = vkvg.Operator.Over;
- vkvgPipeline.DrawResources (ctx, (int)swapChain.Width, (int)swapChain.Height);
- }
- }
-
-
-#endif
-
-
-
- Program () : base () {
- vbo = new GPUBuffer<float> (presentQueue, cmdPool, VkBufferUsageFlags.VertexBuffer, g_vertex_buffer_data);
-
- descriptorPool = new DescriptorPool (dev, 2,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer, 2),
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler, 2)
- );
-
- dsLayout = new DescriptorSetLayout (dev, 0,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex, VkDescriptorType.UniformBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, samples);
-
- cfg.Layout = new PipelineLayout (dev, dsLayout);
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), cfg.Samples);
-
- cfg.AddVertexBinding (0, 5 * sizeof (float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#TexturedCube.skybox.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#TexturedCube.skybox.frag.spv");
-
- pipeline = new GraphicPipeline (cfg);
-
- uboMats = new HostBuffer (dev, VkBufferUsageFlags.UniformBuffer, matrices);
- uboMats.Map ();//permanent map
-
- descriptorSet = descriptorPool.Allocate (dsLayout);
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descriptorSet, dsLayout.Bindings[0]);
- uboUpdate.Write (dev, uboMats.Descriptor);
-
- loadTexture (imgPathes[currentImgIndex]);
- if (nextTexture != null)
- updateTextureSet ();
-
-
-#if WITH_VKVG
- dsVkvg = descriptorPool.Allocate (pipeline.Layout.DescriptorSetLayouts[0]);
- vkvgPipeline = new VkvgPipeline.VkvgPipeline (instance, dev, presentQueue, pipeline);
- }
-
- public override void Update () {
- vkvgDraw ();
-#endif
- }
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
- cmds[i] = cmdPool.AllocateCommandBuffer ();
- cmds[i].Start ();
-
- recordDraw (cmds[i], frameBuffers[i]);
-
- cmds[i].End ();
- }
- }
- void recordDraw (CommandBuffer cmd, Framebuffer fb) {
- pipeline.RenderPass.Begin (cmd, fb);
-
- cmd.SetViewport (fb.Width, fb.Height);
- cmd.SetScissor (fb.Width, fb.Height);
- cmd.BindDescriptorSet (pipeline.Layout, descriptorSet);
-
- pipeline.Bind (cmd);
-
- cmd.BindVertexBuffer (vbo, 0);
- cmd.Draw (36);
-
-#if WITH_VKVG
- cmd.BindDescriptorSet (pipeline.Layout, dsVkvg);
- vkvgPipeline.RecordDraw (cmd);
-#endif
-
- pipeline.RenderPass.End (cmd);
- }
-
- //in the thread of the keyboard
- void loadTexture (string path) {
- try {
- if (path.EndsWith ("ktx", StringComparison.OrdinalIgnoreCase))
- nextTexture = KTX.KTX.Load (presentQueue, cmdPool, path,
- VkImageUsageFlags.Sampled, VkMemoryPropertyFlags.DeviceLocal, true);
- else
- nextTexture = Image.Load (dev, path);
- updateViewRequested = true;
- } catch (Exception ex) {
- Console.WriteLine (ex);
- nextTexture = null;
- }
- }
-
- //in the main vulkan thread
- void updateTextureSet (){
- nextTexture.CreateView (VkImageViewType.Cube,VkImageAspectFlags.Color,6);
- nextTexture.CreateSampler ();
-
- nextTexture.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descriptorSet, dsLayout.Bindings[1]);
- uboUpdate.Write (dev, nextTexture.Descriptor);
-
- texture?.Dispose ();
- texture = nextTexture;
- nextTexture = null;
- }
- void updateMatrices () {
- matrices.projection = Matrix4x4.CreatePerspectiveFieldOfView (Utils.DegreesToRadians (60f), (float)swapChain.Width / (float)swapChain.Height, 0.1f, 5.0f);
- matrices.view =
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotZ) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotY) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotX);
-
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> ());
- }
-
- protected override void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures enabled_features) {
- base.configureEnabledFeatures (available_features, ref enabled_features);
- enabled_features.textureCompressionBC = available_features.textureCompressionBC;
- }
-
- public override void UpdateView () {
- if (nextTexture != null) {
- dev.WaitIdle ();
- updateTextureSet ();
- buildCommandBuffers ();
- }else
- updateMatrices ();
-
- updateViewRequested = false;
- dev.WaitIdle ();
- }
-
- protected override void onMouseMove (double xPos, double yPos) {
- double diffX = lastMouseX - xPos;
- double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- rotY -= rotSpeed * (float)diffX;
- rotX += rotSpeed * (float)diffY;
- } else if (MouseButton[1]) {
- zoom += zoomSpeed * (float)diffY;
- }
-
- updateViewRequested = true;
- }
-
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.Space:
- currentImgIndex++;
- if (currentImgIndex == imgPathes.Length)
- currentImgIndex = 0;
- loadTexture (imgPathes[currentImgIndex]);
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- break;
- }
- }
-
- protected override void OnResize () {
- base.OnResize ();
-
-#if WITH_VKVG
- vkvgPipeline.Resize ((int)Width, (int)Height, new DescriptorSetWrites (dsVkvg, dsLayout.Bindings[1]));
-#endif
-
- updateMatrices ();
-
- if (frameBuffers!=null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (pipeline.RenderPass, swapChain.Width, swapChain.Height,
- (pipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- null
- } : new Image[] {
- null,
- null,
- swapChain.images[i]
- });
- }
-
- buildCommandBuffers ();
-
- dev.WaitIdle ();
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
- pipeline.Dispose ();
- for (int i = 0; i < swapChain.ImageCount; i++)
- frameBuffers[i].Dispose ();
- descriptorPool.Dispose ();
- texture.Dispose ();
- uboMats.Dispose ();
- vbo.Dispose ();
-
-#if WITH_VKVG
- vkvgPipeline.Dispose ();
-#endif
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/TexturedCube/shaders/FullScreenQuad.vert b/samples/TexturedCube/shaders/FullScreenQuad.vert
deleted file mode 100644
index 826720b..0000000
--- a/samples/TexturedCube/shaders/FullScreenQuad.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-#version 450
-
-layout (location = 0) out vec2 outUV;
-
-void main()
-{
- outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
- gl_Position = vec4(outUV * 2.0f + -1.0f, 0.0f, 1.0f);
- //gl_Position = vec4(outUV -1.0f, 0.0f, 1.0f);
-}
diff --git a/samples/TexturedCube/shaders/main.frag b/samples/TexturedCube/shaders/main.frag
deleted file mode 100644
index 73dfd79..0000000
--- a/samples/TexturedCube/shaders/main.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (binding = 1) uniform sampler2D samplerColor;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = texture(samplerColor, inUV);
-} \ No newline at end of file
diff --git a/samples/TexturedCube/shaders/main.vert b/samples/TexturedCube/shaders/main.vert
deleted file mode 100644
index 3b395bf..0000000
--- a/samples/TexturedCube/shaders/main.vert
+++ /dev/null
@@ -1,28 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec3 inColor;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projectionMatrix;
- mat4 viewMatrix;
- mat4 modelMatrix;
-} ubo;
-
-layout (location = 0) out vec3 outColor;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-
-void main()
-{
- outColor = inColor;
- gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos.xyz, 1.0);
-}
diff --git a/samples/TexturedCube/shaders/simpletexture.frag b/samples/TexturedCube/shaders/simpletexture.frag
deleted file mode 100644
index cee63cb..0000000
--- a/samples/TexturedCube/shaders/simpletexture.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (set = 0, binding = 1) uniform sampler2D samplerColor;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = texture(samplerColor, inUV);
-}
diff --git a/samples/TexturedCube/shaders/skybox.frag b/samples/TexturedCube/shaders/skybox.frag
deleted file mode 100644
index bdd272d..0000000
--- a/samples/TexturedCube/shaders/skybox.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (binding = 1) uniform samplerCube skybox;
-
-layout (location = 0) in vec3 TexCoords;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = textureLod(skybox, TexCoords,0);
-}
diff --git a/samples/TexturedCube/shaders/skybox.vert b/samples/TexturedCube/shaders/skybox.vert
deleted file mode 100644
index 2d6a6b6..0000000
--- a/samples/TexturedCube/shaders/skybox.vert
+++ /dev/null
@@ -1,26 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec2 inUV;
-
-layout (location = 0) out vec3 outUVW;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projection;
- mat4 view;
-} ubo;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-void main()
-{
- outUVW = inPos;
- gl_Position = ubo.projection * ubo.view * vec4(inPos, 1.0);
-}
diff --git a/samples/Triangle/Triangle.csproj b/samples/Triangle/Triangle.csproj
deleted file mode 100644
index dbb4bc8..0000000
--- a/samples/Triangle/Triangle.csproj
+++ /dev/null
@@ -1,6 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
- <PropertyGroup>
- <IncludeDefaultNoneItems>false</IncludeDefaultNoneItems>
- </PropertyGroup>
-</Project>
diff --git a/samples/Triangle/main.cs b/samples/Triangle/main.cs
deleted file mode 100644
index 2dcb68f..0000000
--- a/samples/Triangle/main.cs
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System.Numerics;
-using System.Runtime.InteropServices;
-using CVKL;
-using VK;
-
-namespace Triangle {
- class Program : VkWindow {
- static void Main (string[] args) {
-#if DEBUG
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = false;
-#endif
-
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- float rotSpeed = 0.01f, zoomSpeed = 0.01f;
- float rotX, rotY, rotZ = 0f, zoom = 1f;
-
- struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 view;
- public Matrix4x4 model;
- }
- struct Vertex {
- Vector3 position;
- Vector3 color;
-
- public Vertex (float x, float y, float z, float r, float g, float b) {
- position = new Vector3 (x, y, z);
- color = new Vector3 (r, g, b);
- }
- }
-
- Matrices matrices;
-
- HostBuffer ibo;
- HostBuffer vbo;
- HostBuffer uboMats;
-
- DescriptorPool descriptorPool;
- DescriptorSetLayout dsLayout;
- DescriptorSet descriptorSet;
-
- Framebuffer[] frameBuffers;
- GraphicPipeline pipeline;
-
- Vertex[] vertices = {
- new Vertex (-1.0f, -1.0f, 0.0f , 1.0f, 0.0f, 0.0f),
- new Vertex ( 1.0f, -1.0f, 0.0f , 0.0f, 1.0f, 0.0f),
- new Vertex ( 0.0f, 1.0f, 0.0f , 0.0f, 0.0f, 1.0f),
- };
- ushort[] indices = new ushort[] { 0, 1, 2 };
-
- Program () : base () {
- vbo = new HostBuffer<Vertex> (dev, VkBufferUsageFlags.VertexBuffer, vertices);
- ibo = new HostBuffer<ushort> (dev, VkBufferUsageFlags.IndexBuffer, indices);
- uboMats = new HostBuffer (dev, VkBufferUsageFlags.UniformBuffer, matrices);
-
- descriptorPool = new DescriptorPool (dev, 1, new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer));
- dsLayout = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, VkDescriptorType.UniformBuffer));
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1,false);
-
- cfg.Layout = new PipelineLayout (dev, dsLayout);
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, cfg.Samples);
- cfg.AddVertexBinding<Vertex> (0);
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#Triangle.main.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#Triangle.main.frag.spv");
-
- pipeline = new GraphicPipeline (cfg);
-
- //note that descriptor set is allocated after the pipeline creation that use this layout, layout is activated
- //automaticaly on pipeline creation, and will be disposed automatically when no longuer in use.
- descriptorSet = descriptorPool.Allocate (dsLayout);
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descriptorSet, dsLayout);
- uboUpdate.Write (dev, uboMats.Descriptor);
-
- uboMats.Map ();
- }
-
- public override void UpdateView () {
- matrices.projection = Matrix4x4.CreatePerspectiveFieldOfView (Utils.DegreesToRadians (45f),
- (float)swapChain.Width / (float)swapChain.Height, 0.1f, 256.0f) * Camera.VKProjectionCorrection;
- matrices.view =
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitZ, rotZ) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitY, rotY) *
- Matrix4x4.CreateFromAxisAngle (Vector3.UnitX, rotX) *
- Matrix4x4.CreateTranslation (0, 0, -3f * zoom);
- matrices.model = Matrix4x4.Identity;
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> ());
- updateViewRequested = false;
- }
-
- protected override void onMouseMove (double xPos, double yPos) {
- double diffX = lastMouseX - xPos;
- double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- rotY -= rotSpeed * (float)diffX;
- rotX += rotSpeed * (float)diffY;
- } else if (MouseButton[1]) {
- zoom += zoomSpeed * (float)diffY;
- }
- updateViewRequested = true;
- }
- void buildCommandBuffers() {
- cmdPool.Reset (VkCommandPoolResetFlags.ReleaseResources);
- cmds = cmdPool.AllocateCommandBuffer (swapChain.ImageCount);
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- Framebuffer fb = frameBuffers[i];
- cmds[i].Start ();
-
- pipeline.RenderPass.Begin (cmds[i], fb);
-
- cmds[i].SetViewport (swapChain.Width, swapChain.Height);
- cmds[i].SetScissor (swapChain.Width, swapChain.Height);
-
- cmds[i].BindDescriptorSet (pipeline.Layout, descriptorSet);
-
- cmds[i].BindPipeline (pipeline);
-
- cmds[i].BindVertexBuffer (vbo);
- cmds[i].BindIndexBuffer (ibo, VkIndexType.Uint16);
- cmds[i].DrawIndexed ((uint)indices.Length);
-
- pipeline.RenderPass.End (cmds[i]);
-
- cmds[i].End ();
- }
- }
-
- protected override void OnResize () {
- base.OnResize ();
-
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i] = new Framebuffer (pipeline.RenderPass, swapChain.Width, swapChain.Height,
- (pipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- } : new Image[] {
- null,
- swapChain.images[i]
- });
-
- buildCommandBuffers ();
- }
-
- protected override void Dispose (bool disposing) {
- dev.WaitIdle ();
- if (disposing) {
- if (!isDisposed) {
- pipeline.Dispose ();
- for (int i = 0; i < swapChain.ImageCount; i++)
- frameBuffers[i].Dispose ();
- descriptorPool.Dispose ();
- vbo.Dispose ();
- ibo.Dispose ();
- uboMats.Dispose ();
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/Triangle/shaders/main.frag b/samples/Triangle/shaders/main.frag
deleted file mode 100644
index 5b2c3af..0000000
--- a/samples/Triangle/shaders/main.frag
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <preamble.inc>
-
-layout (location = 0) in vec3 inColor;
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = vec4(inColor, 0.5);
-} \ No newline at end of file
diff --git a/samples/Triangle/shaders/main.vert b/samples/Triangle/shaders/main.vert
deleted file mode 100644
index 542d015..0000000
--- a/samples/Triangle/shaders/main.vert
+++ /dev/null
@@ -1,30 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec3 inColor;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projectionMatrix;
- mat4 viewMatrix;
- mat4 modelMatrix;
-} ubo;
-
-layout (location = 0) out vec3 outColor;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-
-void main()
-{
- outColor = inColor;
- gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos.xyz, 1.0);
- //gl_Position.y = -gl_Position.y;
- //gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0;
-}
diff --git a/samples/common/CrowWin.cs b/samples/common/CrowWin.cs
deleted file mode 100644
index 0a9809e..0000000
--- a/samples/common/CrowWin.cs
+++ /dev/null
@@ -1,254 +0,0 @@
-using System;
-using Glfw;
-using VK;
-using System.Threading;
-
-namespace Crow {
- public class CrowWin : CVKL.VkWindow, IValueChange {
- #region IValueChange implementation
- public event EventHandler<ValueChangeEventArgs> ValueChanged;
- public virtual void NotifyValueChanged (string MemberName, object _value) {
- if (ValueChanged != null)
- ValueChanged.Invoke (this, new ValueChangeEventArgs (MemberName, _value));
- }
- #endregion
-
- CVKL.DescriptorPool descriptorPool;
- CVKL.DescriptorSetLayout descLayout;
- CVKL.DescriptorSet dsCrow;
-
- CVKL.GraphicPipeline uiPipeline;
- CVKL.Framebuffer[] uiFrameBuffers;
-
- protected Interface crow;
- protected vkvg.Device vkvgDev;
- protected CVKL.Image uiImage;
- protected bool isRunning, rebuildBuffers;
-
- protected CrowWin (string name = "CrowWin", uint _width = 1024, uint _height = 768, bool vSync = false) :
- base (name, _width, _height, vSync) {
-
- Thread crowThread = new Thread (crow_thread_func);
- crowThread.IsBackground = true;
- crowThread.Start ();
-
- while (crow == null)
- Thread.Sleep (2);
-
- initUISurface ();
-
- initUIPipeline ();
- }
-
- protected override void render () {
- int idx = swapChain.GetNextImage ();
-
- if (idx < 0) {
- OnResize ();
- return;
- }
-
- lock (crow.RenderMutex) {
- presentQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx]);
- presentQueue.Present (swapChain, drawComplete[idx]);
- presentQueue.WaitIdle ();
- }
- Thread.Sleep (1);
- }
-
- void initUIPipeline (VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1) {
- descriptorPool = new CVKL.DescriptorPool (dev, 1, new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler));
- descLayout = new CVKL.DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
-
- CVKL.GraphicPipelineConfig cfg = CVKL.GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, samples, false);
- cfg.Layout = new CVKL.PipelineLayout (dev, descLayout);
- cfg.RenderPass = new CVKL.RenderPass (dev, swapChain.ColorFormat, samples);
- cfg.AddShader (VkShaderStageFlags.Vertex, "#deferred.FullScreenQuad.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.simpletexture.frag.spv");
-
- cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (true);
-
- uiPipeline = new CVKL.GraphicPipeline (cfg);
-
- dsCrow = descriptorPool.Allocate (descLayout);
- }
- void initUISurface () {
- lock (crow.UpdateMutex) {
- uiImage?.Dispose ();
- uiImage = new CVKL.Image (dev, new VkImage ((ulong)crow.surf.VkImage.ToInt64 ()), VkFormat.B8g8r8a8Unorm,
- VkImageUsageFlags.Sampled, swapChain.Width, swapChain.Height);
- uiImage.SetName ("uiImage");
- uiImage.CreateView (VkImageViewType.ImageView2D, VkImageAspectFlags.Color);
- uiImage.CreateSampler (VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder);
- uiImage.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- }
- }
-
- void crow_thread_func () {
- vkvgDev = new vkvg.Device (instance.Handle, phy.Handle, dev.Handle, presentQueue.qFamIndex,
- vkvg.SampleCount.Sample_4, presentQueue.index);
-
- crow = new Interface (vkvgDev, (int)swapChain.Width, (int)swapChain.Height);
-
- isRunning = true;
- while (isRunning) {
- crow.Update ();
- Thread.Sleep (2);
- }
-
- dev.WaitIdle ();
- crow.Dispose ();
- vkvgDev.Dispose ();
- crow = null;
- }
-
- protected void loadWindow (string path, object dataSource = null) {
- try {
- Widget w = crow.FindByName (path);
- if (w != null) {
- crow.PutOnTop (w);
- return;
- }
- w = crow.Load (path);
- w.Name = path;
- w.DataSource = dataSource;
-
- } catch (Exception ex) {
- System.Diagnostics.Debug.WriteLine (ex.ToString ());
- }
- }
- protected virtual void recordDraw (CVKL.CommandBuffer cmd, int imageIndex) { }
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
- cmds[i] = cmdPool.AllocateAndStart ();
-
- CVKL.CommandBuffer cmd = cmds[i];
-
- recordDraw (cmd, i);
-
- uiPipeline.RenderPass.Begin (cmd, uiFrameBuffers[i]);
-
- uiPipeline.Bind (cmd);
- cmd.BindDescriptorSet (uiPipeline.Layout, dsCrow);
-
- uiImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ColorAttachmentOptimal, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader);
-
- cmd.Draw (3, 1, 0, 0);
-
- uiImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ShaderReadOnlyOptimal, VkImageLayout.ColorAttachmentOptimal,
- VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.BottomOfPipe);
-
- uiPipeline.RenderPass.End (cmd);
-
- cmds[i].End ();
- }
- }
-
- /// <summary>
- /// rebuild command buffers if needed
- /// </summary>
- public override void Update () {
- if (rebuildBuffers) {
- buildCommandBuffers ();
- rebuildBuffers = false;
- }
- }
-
- protected override void OnResize () {
- dev.WaitIdle ();
-
- crow.ProcessResize (new Rectangle (0, 0, (int)swapChain.Width, (int)swapChain.Height));
-
- initUISurface ();
-
- CVKL.DescriptorSetWrites uboUpdate = new CVKL.DescriptorSetWrites (dsCrow, descLayout);
- uboUpdate.Write (dev, uiImage.Descriptor);
-
- if (uiFrameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- uiFrameBuffers[i]?.Dispose ();
-
- uiFrameBuffers = new CVKL.Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- uiFrameBuffers[i] = new CVKL.Framebuffer (uiPipeline.RenderPass, swapChain.Width, swapChain.Height,
- (uiPipeline.Samples == VkSampleCountFlags.SampleCount1) ? new CVKL.Image[] {
- swapChain.images[i],
- } : new CVKL.Image[] {
- null,
- swapChain.images[i]
- });
- uiFrameBuffers[i].SetName ("ui FB " + i);
- }
-
- buildCommandBuffers ();
- dev.WaitIdle ();
- }
-
- #region Mouse and keyboard
- protected override void onScroll (double xOffset, double yOffset) {
- if (KeyModifiers.HasFlag (Modifier.Shift))
- crow.ProcessMouseWheelChanged ((float)xOffset);
- else
- crow.ProcessMouseWheelChanged ((float)yOffset);
- }
- protected override void onMouseMove (double xPos, double yPos) {
- if (crow.ProcessMouseMove ((int)xPos, (int)yPos))
- return;
- base.onMouseMove (xPos, yPos);
- }
- protected override void onMouseButtonDown (Glfw.MouseButton button) {
- if (crow.ProcessMouseButtonDown ((MouseButton)button))
- return;
- base.onMouseButtonDown (button);
- }
- protected override void onMouseButtonUp (Glfw.MouseButton button) {
- if (crow.ProcessMouseButtonUp ((MouseButton)button))
- return;
- base.onMouseButtonUp (button);
- }
- protected override void onKeyDown (Glfw.Key key, int scanCode, Modifier modifiers) {
- if (crow.ProcessKeyDown ((Key)key))
- return;
- base.onKeyDown (key, scanCode, modifiers);
- }
- protected override void onKeyUp (Glfw.Key key, int scanCode, Modifier modifiers) {
- if (crow.ProcessKeyUp ((Key)key))
- return;
- }
- protected override void onChar (CodePoint cp) {
- if (crow.ProcessKeyPress (cp.ToChar ()))
- return;
- }
- #endregion
-
- #region dispose
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
- isRunning = false;
-
- for (int i = 0; i < swapChain.ImageCount; ++i)
- uiFrameBuffers[i]?.Dispose ();
-
- uiPipeline.Dispose ();
- descLayout.Dispose ();
- descriptorPool.Dispose ();
-
- uiImage?.Dispose ();
- while (crow != null)
- Thread.Sleep (1);
- }
- }
-
- base.Dispose (disposing);
- }
- #endregion
- }
-}
diff --git a/samples/common/shaders/preamble.inc b/samples/common/shaders/preamble.inc
deleted file mode 100644
index da434f8..0000000
--- a/samples/common/shaders/preamble.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
diff --git a/samples/compute/compute.csproj b/samples/compute/compute.csproj
deleted file mode 100644
index e1734ff..0000000
--- a/samples/compute/compute.csproj
+++ /dev/null
@@ -1,10 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
- <PropertyGroup>
- <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
- </PropertyGroup>
-
- <ItemGroup>
- <Compile Include="delaunay.cs" />
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/samples/compute/delaunay.cs b/samples/compute/delaunay.cs
deleted file mode 100644
index a01cd85..0000000
--- a/samples/compute/delaunay.cs
+++ /dev/null
@@ -1,329 +0,0 @@
-using System;
-using Glfw;
-using VK;
-using CVKL;
-
-namespace delaunay {
- class Program : VkWindow {
- static void Main (string[] args) {
-#if DEBUG
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = false;
-#endif
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- Framebuffer[] frameBuffers;
- GraphicPipeline grPipeline;
-
- Image imgResult;
-
- Queue computeQ, transferQ;
-
- GPUBuffer inBuff, outBuff;
- HostBuffer<float> stagingDataBuff;
- DescriptorPool dsPool;
- DescriptorSetLayout dslCompute, dslImage;
- DescriptorSet dsetPing, dsetPong, dsImage;
-
- ComputePipeline plCompute, plNormalize;
-
- DebugReport dbgReport;
-
- const uint imgDim = 256;
- uint zoom = 2;
- int invocationCount = 8;
-
- uint data_size => imgDim * imgDim * 4;
-
- float[] datas;
-
- uint seedCount;
-
- void addSeed (uint x, uint y) {
- uint ptr = (y * imgDim + x) * 4;
- datas[ptr] = ++seedCount;//seedId
- datas[ptr + 1] = x;
- datas[ptr + 2] = y;
- datas[ptr + 3] = 1;
-
- }
-
-
- public Program () : base () {
- if (Instance.DEBUG_UTILS)
- dbgReport = new DebugReport (instance,
- VkDebugReportFlagsEXT.ErrorEXT
- | VkDebugReportFlagsEXT.DebugEXT
- | VkDebugReportFlagsEXT.WarningEXT
- | VkDebugReportFlagsEXT.PerformanceWarningEXT
-
- );
- imgResult = new Image (dev, VkFormat.R32g32b32a32Sfloat, VkImageUsageFlags.TransferDst | VkImageUsageFlags.Sampled, VkMemoryPropertyFlags.DeviceLocal,
- imgDim, imgDim);
- imgResult.CreateView ();
- imgResult.CreateSampler (VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder);
- imgResult.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- datas = new float[data_size];
-
- addSeed (imgDim / 2 - 1, imgDim / 2 - 1);
-
-
- stagingDataBuff = new HostBuffer<float> (dev, VkBufferUsageFlags.TransferSrc, datas);
- stagingDataBuff.Map ();
-
- inBuff = new GPUBuffer<float> (dev, VkBufferUsageFlags.StorageBuffer | VkBufferUsageFlags.TransferSrc | VkBufferUsageFlags.TransferDst, (int)data_size);
- outBuff = new GPUBuffer<float> (dev, VkBufferUsageFlags.StorageBuffer | VkBufferUsageFlags.TransferSrc, (int)data_size);
-
- dsPool = new DescriptorPool (dev, 3,
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler),
- new VkDescriptorPoolSize (VkDescriptorType.StorageBuffer, 4));
- dslImage = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
- dslCompute = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer)
- );
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1);
-
- cfg.Layout = new PipelineLayout (dev, dslImage);
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), VkSampleCountFlags.SampleCount1);
- cfg.RenderPass.ClearValues[0] = new VkClearValue { color = new VkClearColorValue (0.0f, 0.1f, 0.0f) };
-
- cfg.ResetShadersAndVerticesInfos ();
- cfg.AddShader (VkShaderStageFlags.Vertex, "#compute.FullScreenQuad.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#compute.simpletexture.frag.spv");
-
- cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (true);
-
- grPipeline = new GraphicPipeline (cfg);
-
- plCompute = new ComputePipeline (
- new PipelineLayout (dev, new VkPushConstantRange (VkShaderStageFlags.Compute, 2 * sizeof (int)), dslCompute),
- "#compute.computeTest.comp.spv");
- plNormalize = new ComputePipeline (
- plCompute.Layout,
- "#compute.normalize.comp.spv");
-
- dsImage = dsPool.Allocate (dslImage);
- dsetPing = dsPool.Allocate (dslCompute);
- dsetPong = dsPool.Allocate (dslCompute);
-
- DescriptorSetWrites dsUpdate = new DescriptorSetWrites (dsetPing, dslCompute);
- dsUpdate.Write (dev, inBuff.Descriptor, outBuff.Descriptor);
- dsUpdate.Write (dev, dsetPong, outBuff.Descriptor, inBuff.Descriptor);
- dsUpdate = new DescriptorSetWrites (dsImage, dslImage);
- dsUpdate.Write (dev, imgResult.Descriptor);
-
- UpdateFrequency = 5;
- }
-
- protected override void createQueues () {
- computeQ = new Queue (dev, VkQueueFlags.Compute);
- transferQ = new Queue (dev, VkQueueFlags.Transfer);
-
- base.createQueues ();
- }
-
- protected override void OnResize () {
-
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (grPipeline.RenderPass, swapChain.Width, swapChain.Height,
- (grPipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- null
- } : new Image[] {
- null,
- null,
- swapChain.images[i]
- });
-
- cmds[i] = cmdPool.AllocateCommandBuffer ();
- cmds[i].Start ();
-
- imgResult.SetLayout (cmds[i], VkImageAspectFlags.Color,
- VkImageLayout.Undefined, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.AllCommands, VkPipelineStageFlags.FragmentShader);
-
- grPipeline.RenderPass.Begin (cmds[i], frameBuffers[i]);
-
- int xPad = (int)swapChain.Width / 2 - (int)imgDim * (int)zoom / 2;
- int yPad = (int)swapChain.Height / 2- (int)imgDim * (int)zoom / 2;
-
- cmds[i].SetViewport (imgDim * zoom, imgDim * zoom, xPad, yPad);
- cmds[i].SetScissor (imgDim * zoom, imgDim * zoom, Math.Max (0, xPad), Math.Max (0, yPad));
-
- cmds[i].BindDescriptorSet (grPipeline.Layout, dsImage);
- cmds[i].BindPipeline (grPipeline);
- cmds[i].Draw (3, 1, 0, 0);
-
- grPipeline.RenderPass.End (cmds[i]);
-
- cmds[i].End ();
- }
- }
- bool pong;
-
- public override void Update () {
- initGpuBuffers ();
-
- using (CommandPool cmdPoolCompute = new CommandPool (dev, computeQ.qFamIndex)) {
-
- CommandBuffer cmd = cmdPoolCompute.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- pong = false;
- uint stepSize = imgDim / 2;
-
- plCompute.Bind (cmd);
- cmd.PushConstant (plCompute.Layout, VkShaderStageFlags.Compute, imgDim, sizeof(int));
-
- int pass = 0;
- while (stepSize > 0 && pass < invocationCount) {
- cmd.PushConstant (plCompute.Layout, VkShaderStageFlags.Compute, stepSize);
-
- if (pong)
- plCompute.BindDescriptorSet (cmd, dsetPong);
- else
- plCompute.BindDescriptorSet (cmd, dsetPing);
-
- cmd.Dispatch (imgDim, imgDim);
-
- VkMemoryBarrier memBar = VkMemoryBarrier.New ();
- memBar.srcAccessMask = VkAccessFlags.ShaderWrite;
- memBar.dstAccessMask = VkAccessFlags.ShaderRead;
- Vk.vkCmdPipelineBarrier (cmd.Handle, VkPipelineStageFlags.ComputeShader, VkPipelineStageFlags.ComputeShader, VkDependencyFlags.ByRegion,
- 1, ref memBar, 0, IntPtr.Zero, 0, IntPtr.Zero);
-
- pong = !pong;
- stepSize /= 2;
- pass++;
- }
-
- plNormalize.Bind (cmd);
- if (pong)
- plNormalize.BindDescriptorSet (cmd, dsetPong);
- else
- plNormalize.BindDescriptorSet (cmd, dsetPing);
- cmd.Dispatch (imgDim, imgDim);
- pong = !pong;
-
- cmd.End ();
-
- computeQ.Submit (cmd);
- computeQ.WaitIdle ();
- }
-
- printResults ();
- }
-
- protected override void onMouseButtonDown (MouseButton button) {
- int xPad = (int)swapChain.Width / 2 - (int)imgDim * (int)zoom / 2;
- int yPad = (int)swapChain.Height / 2 - (int)imgDim * (int)zoom / 2;
-
- int localX = (int)((lastMouseX - xPad) / zoom);
- int localY = (int)((lastMouseY - yPad) / zoom);
-
- if (localX < 0 || localY < 0 || localX >= imgDim || localY >= imgDim)
- base.onMouseButtonDown (button);
- else {
- addSeed ((uint)localX, (uint)localY);
- stagingDataBuff.Update (datas);
- }
- }
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.Delete:
- datas = new float[data_size];
- stagingDataBuff.Update (datas);
- seedCount = 0;
- break;
- case Key.KeypadAdd:
- invocationCount++;
- break;
- case Key.KeypadSubtract:
- if (invocationCount>0)
- invocationCount--;
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- break;
- }
- Console.WriteLine ($"break after {invocationCount} step");
- }
-
- void printResults () {
- dev.WaitIdle ();
- using (CommandPool cmdPoolTransfer = new CommandPool (dev, transferQ.qFamIndex)) {
-
- CommandBuffer cmd = cmdPoolTransfer.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- imgResult.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.ShaderReadOnlyOptimal, VkImageLayout.TransferDstOptimal,
- VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.Transfer);
-
- if (pong)
- outBuff.CopyTo (cmd, imgResult, VkImageLayout.ShaderReadOnlyOptimal);
- else
- inBuff.CopyTo (cmd, imgResult, VkImageLayout.ShaderReadOnlyOptimal);
-
- cmd.End ();
-
- transferQ.Submit (cmd);
- transferQ.WaitIdle ();
- }
- }
-
- void initGpuBuffers () {
- using (CommandPool staggingCmdPool = new CommandPool (dev, transferQ.qFamIndex)) {
- CommandBuffer cmd = staggingCmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- stagingDataBuff.CopyTo (cmd, inBuff);
-
- transferQ.EndSubmitAndWait (cmd);
- }
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
-
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- grPipeline.Dispose ();
- plCompute.Dispose ();
- plNormalize.Dispose ();
-
- dslCompute.Dispose ();
- dslImage.Dispose ();
-
- dsPool.Dispose ();
-
- inBuff.Dispose ();
- outBuff.Dispose ();
- stagingDataBuff.Dispose ();
-
- imgResult.Dispose ();
-
- dbgReport?.Dispose ();
- }
- }
-
- base.Dispose (disposing);
- }
-
-
- }
-}
diff --git a/samples/compute/main.cs b/samples/compute/main.cs
deleted file mode 100644
index 02f7069..0000000
--- a/samples/compute/main.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using CVKL;
-using VK;
-using System.Linq;
-
-namespace SimpleCompute {
- class Program : IDisposable {
- VkPhysicalDeviceFeatures enabledFeatures = default (VkPhysicalDeviceFeatures);
- string[] enabledExtensions = { Ext.D.VK_KHR_swapchain };
-
- Instance instance;
- PhysicalDevice phy;
- Device dev;
- Queue computeQ;
-
- HostBuffer inBuff, outBuff;
- DescriptorPool dsPool;
- DescriptorSetLayout dsLayout;
- DescriptorSet dset;
-
- ComputePipeline plCompute;
-
- DebugReport dbgReport;
-
- const uint data_size = 256;
- int[] datas;
-
- public Program () {
- instance = new Instance ();
-
-#if DEBUG
- dbgReport = new DebugReport (instance,
- VkDebugReportFlagsEXT.ErrorEXT
- | VkDebugReportFlagsEXT.DebugEXT
- | VkDebugReportFlagsEXT.WarningEXT
- | VkDebugReportFlagsEXT.PerformanceWarningEXT
-
- );
-#endif
-
- phy = instance.GetAvailablePhysicalDevice ().FirstOrDefault ();
- dev = new Device (phy);
- computeQ = new Queue (dev, VkQueueFlags.Compute);
- dev.Activate (enabledFeatures, enabledExtensions);
-
- datas = new int[data_size];
- Random rnd = new Random ();
- for (uint i = 0; i < data_size; i++) {
- datas[i] = rnd.Next ();
- }
-
- inBuff = new HostBuffer<int> (dev, VkBufferUsageFlags.StorageBuffer, datas);
- outBuff = new HostBuffer<int> (dev, VkBufferUsageFlags.StorageBuffer, data_size);
-
- dsPool = new DescriptorPool (dev, 1, new VkDescriptorPoolSize (VkDescriptorType.StorageBuffer, 2));
- dsLayout = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer)
- );
-
- plCompute = new ComputePipeline (new PipelineLayout (dev, dsLayout), "shaders/compute.comp.spv" );
-
- dset = dsPool.Allocate (dsLayout);
- DescriptorSetWrites dsUpdate = new DescriptorSetWrites (dset, dsLayout);
- dsUpdate.Write (dev, inBuff.Descriptor, outBuff.Descriptor);
- }
-
-
-
- public void Run () {
- using (CommandPool cmdPool = new CommandPool (dev, computeQ.qFamIndex)) {
-
- CommandBuffer cmd = cmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- plCompute.Bind (cmd);
- plCompute.BindDescriptorSet (cmd, dset);
-
- cmd.Dispatch (data_size * sizeof (int));
-
- cmd.End ();
-
- computeQ.Submit (cmd);
- computeQ.WaitIdle ();
- }
-
- printResults ();
- }
-
- void printResults () {
- int[] results = new int[data_size];
-
- outBuff.Map ();
- Marshal.Copy (outBuff.MappedData, results, 0, results.Length);
-
- Console.ForegroundColor = ConsoleColor.DarkBlue;
- Console.Write ("IN :");
- for (int i = 0; i < data_size; i++) {
- Console.Write ($" {datas[i]} ");
- }
- Console.WriteLine ();
- Console.Write ("OUT:");
- for (int i = 0; i < data_size; i++) {
- Console.Write ($" {results[i]} ");
- }
- Console.WriteLine ();
- outBuff.Unmap ();
- }
-
- public void Dispose () {
- dev.WaitIdle ();
-
- plCompute.Dispose ();
- dsLayout.Dispose ();
- dsPool.Dispose ();
-
- inBuff.Dispose ();
- outBuff.Dispose ();
-
- dev.Dispose ();
-
-#if DEBUG
- dbgReport.Dispose ();
-#endif
- instance.Dispose ();
- }
-
- static void Main (string[] args) {
- using (Program vke = new Program ())
- vke.Run ();
- }
- }
-}
diff --git a/samples/compute/shaders/FullScreenQuad.vert b/samples/compute/shaders/FullScreenQuad.vert
deleted file mode 100644
index 826720b..0000000
--- a/samples/compute/shaders/FullScreenQuad.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-#version 450
-
-layout (location = 0) out vec2 outUV;
-
-void main()
-{
- outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
- gl_Position = vec4(outUV * 2.0f + -1.0f, 0.0f, 1.0f);
- //gl_Position = vec4(outUV -1.0f, 0.0f, 1.0f);
-}
diff --git a/samples/compute/shaders/compute.comp b/samples/compute/shaders/compute.comp
deleted file mode 100644
index 10cfddd..0000000
--- a/samples/compute/shaders/compute.comp
+++ /dev/null
@@ -1,23 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-
-layout(binding = 0) buffer buffIn {
- int dataIn[];
-};
-
-layout(binding = 1) buffer buffOut {
- int dataOut[];
-};
-
-//layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-
-void main()
-{
- uint i = gl_GlobalInvocationID.x;
- int d = dataIn[i];
-
- for (int j=0; j<8; j++)
- d += 1;
- dataOut[i] = d;
-}
diff --git a/samples/compute/shaders/computeTest.comp b/samples/compute/shaders/computeTest.comp
deleted file mode 100644
index f24bee3..0000000
--- a/samples/compute/shaders/computeTest.comp
+++ /dev/null
@@ -1,80 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-
-layout(binding = 0) buffer buffIn {
- vec4 dataIn[];
-};
-
-layout(binding = 1) buffer buffOut {
- vec4 dataOut[];
-};
-
-layout(set = 1, binding = 0) buffer VBO {
- vec2 vertices[];
-};
-
-layout(set = 1, binding = 1) buffer IBO {
- uint indices[];
-};
-
-
-layout(push_constant) uniform PushConsts {
- int iStepSize;
- int imgDim;
- int pointCount;
-};
-
-const ivec2 dirs[] = ivec2[8] (
- ivec2( 1, 0),
- ivec2( 1, 1),
- ivec2( 0, 1),
- ivec2(-1, 1),
- ivec2(-1, 0),
- ivec2(-1,-1),
- ivec2( 0,-1),
- ivec2( 1,-1)
-);
-
-layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-
-
-vec4 getPixel (ivec2 uv) {
- return dataIn[uv.y * imgDim + uv.x];
-}
-void setPixel (ivec2 uv, vec4 pix) {
- dataOut[uv.y * imgDim + uv.x] = pix;
-}
-
-void main()
-{
- ivec2 uv = ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.y);
- vec4 d = getPixel (uv);
-
- ivec2 thisSeedPos;
- if (d.r > 0.0)
- thisSeedPos = ivec2(int(d.g), int(d.b));
- else//no seed in current pixel
- thisSeedPos = ivec2(-1);
-
- for (int j=0; j<8; j++){
- ivec2 otherUV = uv + iStepSize * dirs[j];
- if (otherUV.x < 0 || otherUV.y < 0 || otherUV.x >= imgDim || otherUV.y >= imgDim)
- continue;
-
- vec4 other = getPixel (otherUV);
-
- if (other.r > 0.0) {//seed in other
- ivec2 otherSeedPos = ivec2(int(other.g), int(other.b));
- if (thisSeedPos.x < 0) {//replace current
- d = other;
- thisSeedPos = otherSeedPos;
- }else if (distance (uv, thisSeedPos) > distance (uv, otherSeedPos)) {
- d = other;
- thisSeedPos = otherSeedPos;
- }
- }
- }
-
- setPixel (uv, d);
-}
diff --git a/samples/compute/shaders/delaunay.comp b/samples/compute/shaders/delaunay.comp
deleted file mode 100644
index 410dcee..0000000
--- a/samples/compute/shaders/delaunay.comp
+++ /dev/null
@@ -1,70 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-
-layout(binding = 0) buffer buffIn {
- vec4 dataIn[];
-};
-
-layout(binding = 1) buffer buffOut {
- vec4 dataOut[];
-};
-
-layout(push_constant) uniform PushConsts {
- int iStepSize;
- int imgDim;
-};
-
-const ivec2 dirs[] = ivec2[8] (
- ivec2( 1, 0),
- ivec2( 1, 1),
- ivec2( 0, 1),
- ivec2(-1, 1),
- ivec2(-1, 0),
- ivec2(-1,-1),
- ivec2( 0,-1),
- ivec2( 1,-1)
-);
-
-layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-
-
-vec4 getPixel (ivec2 uv) {
- return dataIn[uv.y * imgDim + uv.x];
-}
-void setPixel (ivec2 uv, vec4 pix) {
- dataOut[uv.y * imgDim + uv.x] = pix;
-}
-
-void main()
-{
- ivec2 uv = ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.y);
- vec4 d = getPixel (uv);
-
- ivec2 thisSeedPos;
- if (d.r > 0.0)
- thisSeedPos = ivec2(int(d.g), int(d.b));
- else//no seed in current pixel
- thisSeedPos = ivec2(-1);
-
- for (int j=0; j<8; j++){
- ivec2 otherUV = uv + iStepSize * dirs[j];
- if (otherUV.x < 0 || otherUV.y < 0 || otherUV.x >= imgDim || otherUV.y >= imgDim)
- continue;
-
- vec4 other = getPixel (otherUV);
-
- if (other.r > 0.0) {//seed in other
- ivec2 otherSeedPos = ivec2(int(other.g), int(other.b));
- if (thisSeedPos.x < 0) {//replace current
- d = other;
- thisSeedPos = otherSeedPos;
- }else if (distance (uv, thisSeedPos) > distance (uv, otherSeedPos)) {
- d = other;
- thisSeedPos = otherSeedPos;
- }
- }
- }
-
- setPixel (uv, d);
-}
diff --git a/samples/compute/shaders/init.comp b/samples/compute/shaders/init.comp
deleted file mode 100644
index fc615ee..0000000
--- a/samples/compute/shaders/init.comp
+++ /dev/null
@@ -1,36 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-
-layout(binding = 0) buffer buffIn {
- vec4 dataIn[];
-};
-
-layout(binding = 1) buffer buffOut {
- vec4 dataOut[];
-};
-
-layout(set = 1, binding = 0) buffer VBO {
- vec2 vertices[];
-};
-
-layout(set = 1, binding = 1) buffer IBO {
- uint indices[];
-};
-
-layout(push_constant) uniform PushConsts {
- int iStepSize;
- int imgDim;
- int pointCount;
-};
-
-
-layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-
-void main()
-{
- vec2 v = vertices[gl_GlobalInvocationID.x];
- ivec2 uv = ivec2(int(v.x), int(v.y));
- dataIn[uv.y * imgDim + uv.x] = vec4 (gl_GlobalInvocationID.x + 1, uv.x, uv.y, 1.0);
-}
-
diff --git a/samples/compute/shaders/mandelbrot.comp b/samples/compute/shaders/mandelbrot.comp
deleted file mode 100644
index a03f4a0..0000000
--- a/samples/compute/shaders/mandelbrot.comp
+++ /dev/null
@@ -1,56 +0,0 @@
-#version 450
-#extension GL_ARB_separate_shader_objects : enable
-
-#define WIDTH 3200
-#define HEIGHT 2400
-#define WORKGROUP_SIZE 32
-layout (local_size_x = WORKGROUP_SIZE, local_size_y = WORKGROUP_SIZE, local_size_z = 1 ) in;
-
-struct Pixel{
- vec4 value;
-};
-
-layout(std140, binding = 0) buffer buf
-{
- Pixel imageData[];
-};
-
-void main() {
-
- /*
- In order to fit the work into workgroups, some unnecessary threads are launched.
- We terminate those threads here.
- */
- if(gl_GlobalInvocationID.x >= WIDTH || gl_GlobalInvocationID.y >= HEIGHT)
- return;
-
- float x = float(gl_GlobalInvocationID.x) / float(WIDTH);
- float y = float(gl_GlobalInvocationID.y) / float(HEIGHT);
-
- /*
- What follows is code for rendering the mandelbrot set.
- */
- vec2 uv = vec2(x,y);
- float n = 0.0;
- vec2 c = vec2(-.445, 0.0) + (uv - 0.5)*(2.0+ 1.7*0.2 ),
- z = vec2(0.0);
- const int M =128;
- for (int i = 0; i<M; i++)
- {
- z = vec2(z.x*z.x - z.y*z.y, 2.*z.x*z.y) + c;
- if (dot(z, z) > 2) break;
- n++;
- }
-
- // we use a simple cosine palette to determine color:
- // http://iquilezles.org/www/articles/palettes/palettes.htm
- float t = float(n) / float(M);
- vec3 d = vec3(0.3, 0.3 ,0.5);
- vec3 e = vec3(-0.2, -0.3 ,-0.5);
- vec3 f = vec3(2.1, 2.0, 3.0);
- vec3 g = vec3(0.0, 0.1, 0.0);
- vec4 color = vec4( d + e*cos( 6.28318*(f*t+g) ) ,1.0);
-
- // store the rendered mandelbrot set into a storage buffer:
- imageData[WIDTH * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x].value = color;
-} \ No newline at end of file
diff --git a/samples/compute/shaders/normalize.comp b/samples/compute/shaders/normalize.comp
deleted file mode 100644
index 2bc6aa6..0000000
--- a/samples/compute/shaders/normalize.comp
+++ /dev/null
@@ -1,73 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-
-layout(binding = 0) buffer buffIn {
- vec4 dataIn[];
-};
-
-layout(binding = 1) buffer buffOut {
- vec4 dataOut[];
-};
-
-layout(set = 1, binding = 0) buffer VBO {
- vec2 vertices[];
-};
-
-layout(set = 1, binding = 1) buffer IBO {
- uint indices[];
-};
-
-layout(push_constant) uniform PushConsts {
- int iStepSize;
- int imgDim;
- int pointCount;
-};
-
-layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-
-vec4 getPixel (ivec2 uv) {
- return dataIn[uv.y * imgDim + uv.x];
-}
-void setPixel (ivec2 uv, vec4 pix) {
- dataOut[uv.y * imgDim + uv.x] = pix;
-}
-
-const vec4[] colors = vec4[](
- vec4(1,0,0,1),
- vec4(0,1,0,1),
- vec4(0,0,1,1),
- vec4(1,0,1,1),
- vec4(0,1,1,1),
- vec4(1,1,0,1),
- vec4(0.5,0,0,1),
- vec4(0,0.5,0,1),
- vec4(0,0,0.5,1),
- vec4(0.5,0,0.5,1),
- vec4(0,0.5,0.5,1),
- vec4(0.5,0.5,0,1),
- vec4(0,0.5,0.5,1),
- vec4(0.1,0.9,0.2,1),
- vec4(0.3,0.7,0.4,1),
- vec4(0.5,0.5,0.6,1),
- vec4(0.7,0.3,0.8,1),
- vec4(0.9,0.1,0.0,1)
- );
-
-void main()
-{
- ivec2 uv = ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.y);
- vec4 d = getPixel (uv);
-
- if (d.r > 0.0) {
- if (int(d.g) == uv.x && int(d.b) == uv.y)
- d.a = 1.0;
- else
- d.a = 0.4;
-
- d.rgb = colors [int(d.r)].rgb;
- }
-
- setPixel (uv, d);
-}
-
diff --git a/samples/compute/shaders/simpletexture.frag b/samples/compute/shaders/simpletexture.frag
deleted file mode 100644
index a081876..0000000
--- a/samples/compute/shaders/simpletexture.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (set = 0, binding = 0) uniform sampler2D samplerColor;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = texture(samplerColor, inUV);
-}
diff --git a/samples/compute/shaders/test.comp b/samples/compute/shaders/test.comp
deleted file mode 100644
index 8ab1ec7..0000000
--- a/samples/compute/shaders/test.comp
+++ /dev/null
@@ -1,21 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-
-layout(binding = 0) buffer readonly buff {
- vec4 data[];
-};
-layout(binding = 1) buffer writeonly buffOut {
- vec4 dataOut[];
-};
-layout(push_constant) uniform PushConsts {
- int iStepSize;
- int imgDim;
-};
-
-
-void main()
-{
- ivec2 uv = ivec2(gl_GlobalInvocationID.x, gl_GlobalInvocationID.y);
-
-}
diff --git a/samples/compute/shaders/triangle2.frag b/samples/compute/shaders/triangle2.frag
deleted file mode 100644
index 3f905f7..0000000
--- a/samples/compute/shaders/triangle2.frag
+++ /dev/null
@@ -1,13 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-//layout (location = 0) in vec3 inColor;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = vec4(1.0, 1.0, 1.0, 1.0);
-} \ No newline at end of file
diff --git a/samples/compute/shaders/triangle2.vert b/samples/compute/shaders/triangle2.vert
deleted file mode 100644
index 2922694..0000000
--- a/samples/compute/shaders/triangle2.vert
+++ /dev/null
@@ -1,24 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec2 inPos;
-
-layout(push_constant) uniform PushConsts {
- int imgDim;
- int xPad;
- int yPad;
- int zoom;
-};
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-
-void main()
-{
- gl_Position = vec4(inPos.xy * vec2(2) / vec2(imgDim) - vec2(1), 0.0, 1.0);
-}
diff --git a/samples/compute/test.cs b/samples/compute/test.cs
deleted file mode 100644
index 80e66d4..0000000
--- a/samples/compute/test.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using CVKL;
-using VK;
-using System.Linq;
-
-namespace test {
- class Program : IDisposable {
- VkPhysicalDeviceFeatures enabledFeatures = default (VkPhysicalDeviceFeatures);
- string[] enabledExtensions = { Ext.D.VK_KHR_swapchain };
-
- static void Main (string[] args) {
- Instance.VALIDATION = true;
- //Instance.DEBUG_UTILS = true;
-
- using (Program vke = new Program ())
- vke.Run ();
- }
-
- Instance instance;
- PhysicalDevice phy;
- Device dev;
- Queue computeQ;
-
- HostBuffer inBuff, outBuff;
- DescriptorPool dsPool;
- DescriptorSetLayout dsLayoutCompute;
- DescriptorSet dsetPing, dsetPong;
-
- ComputePipeline plCompute;
-
- DebugReport dbgReport;
-
- const uint imgDim = 256;
-
- uint data_size => imgDim * imgDim * 4;
-
- float[] datas;
-
- public Program () {
- instance = new Instance ();
-
-#if DEBUG
- /*dbgReport = new DebugReport (instance,
- VkDebugReportFlagsEXT.ErrorEXT
- | VkDebugReportFlagsEXT.DebugEXT
- | VkDebugReportFlagsEXT.WarningEXT
- | VkDebugReportFlagsEXT.PerformanceWarningEXT
-
- );*/
-#endif
-
- phy = instance.GetAvailablePhysicalDevice ().FirstOrDefault ();
- dev = new Device (phy);
- computeQ = new Queue (dev, VkQueueFlags.Compute);
- dev.Activate (enabledFeatures, enabledExtensions);
-
- datas = new float[data_size];
- Random rnd = new Random ();
- for (uint i = 0; i < data_size; i++) {
- datas[i] = (float)rnd.NextDouble ();
- }
-
- inBuff = new HostBuffer<float> (dev, VkBufferUsageFlags.StorageBuffer, datas);
- outBuff = new HostBuffer<float> (dev, VkBufferUsageFlags.StorageBuffer, data_size);
-
- dsPool = new DescriptorPool (dev, 2, new VkDescriptorPoolSize (VkDescriptorType.StorageBuffer, 4));
- dsLayoutCompute = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer)
- );
-
- plCompute = new ComputePipeline (
- new PipelineLayout (dev, new VkPushConstantRange (VkShaderStageFlags.Compute, sizeof (int)), dsLayoutCompute),
- "#compute.computeTest.comp.spv" );
-
- dsetPing = dsPool.Allocate (dsLayoutCompute);
- dsetPong = dsPool.Allocate (dsLayoutCompute);
- DescriptorSetWrites dsUpdate = new DescriptorSetWrites (dsetPing, dsLayoutCompute);
- dsUpdate.Write (dev, inBuff.Descriptor, outBuff.Descriptor);
-
- dsUpdate.Write (dev, dsetPong, outBuff.Descriptor, inBuff.Descriptor);
- }
-
-
-
- public void Run () {
- using (CommandPool cmdPool = new CommandPool (dev, computeQ.qFamIndex)) {
-
- CommandBuffer cmd = cmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- bool pong = false;
-
- plCompute.Bind (cmd);
- cmd.PushConstant (plCompute.Layout, VkShaderStageFlags.Compute, imgDim);
-
- for (int i = 0; i < 4; i++) {
- if (pong)
- plCompute.BindDescriptorSet (cmd, dsetPong);
- else
- plCompute.BindDescriptorSet (cmd, dsetPing);
-
- cmd.Dispatch (imgDim, imgDim);
- }
-
- cmd.End ();
-
- computeQ.Submit (cmd);
- computeQ.WaitIdle ();
- }
-
- }
-
-
- public void Dispose () {
- dev.WaitIdle ();
-
- plCompute.Dispose ();
- dsLayoutCompute.Dispose ();
- dsPool.Dispose ();
-
- inBuff.Dispose ();
- outBuff.Dispose ();
-
- dev.Dispose ();
-
-#if DEBUG
- dbgReport?.Dispose ();
-#endif
- instance.Dispose ();
- }
- }
-}
diff --git a/samples/compute/test2.cs b/samples/compute/test2.cs
deleted file mode 100644
index 689e7e8..0000000
--- a/samples/compute/test2.cs
+++ /dev/null
@@ -1,389 +0,0 @@
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using Glfw;
-using VK;
-using CVKL;
-
-namespace triangulation {
- class Program : VkWindow {
- static void Main (string[] args) {
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- Framebuffer[] frameBuffers;
- GraphicPipeline grPipeline, trianglesPipeline;
-
- Image imgResult;
-
- Queue computeQ, transferQ;
-
- GPUBuffer inBuff, outBuff;
- HostBuffer<Vector2> staggingVBO;
- DescriptorPool dsPool;
- DescriptorSetLayout dslCompute, dslImage, dslVAO;
- DescriptorSet dsPing, dsPong, dsImage, dsVAO;
-
- ComputePipeline plCompute, plNormalize, plInit;
-
- DebugReport dbgReport;
-
-
- GPUBuffer<Vector2> vbo;
- GPUBuffer<uint> ibo;
-
- uint zoom = 2;
-
- const int MAX_VERTICES = 128;
- const uint IMG_DIM = 256;
-
- int invocationCount = 8;
-
- uint data_size => IMG_DIM * IMG_DIM * 4;
-
- Vector2[] points = new Vector2[MAX_VERTICES];
- uint pointCount;
- bool clear = true;//if true, inBuff will be fill with zeros
-
- bool pong;//ping-pong between buffers
-
- void addPoint (uint x, uint y) {
- points[pointCount] = new Vector2 (x, y);
- pointCount++;
- staggingVBO.Update (points, pointCount * (ulong)Marshal.SizeOf<Vector2> ());
-
-
- }
- void clearPoints () {
- pointCount = 0;
- clear = true;
- }
-
- public Program () : base () {
-#if DEBUG
- dbgReport = new DebugReport (instance,
- VkDebugReportFlagsEXT.ErrorEXT
- | VkDebugReportFlagsEXT.DebugEXT
- | VkDebugReportFlagsEXT.WarningEXT
- | VkDebugReportFlagsEXT.PerformanceWarningEXT
-
- );
-#endif
- imgResult = new Image (dev, VkFormat.R32g32b32a32Sfloat, VkImageUsageFlags.TransferDst | VkImageUsageFlags.Sampled, VkMemoryPropertyFlags.DeviceLocal,
- IMG_DIM, IMG_DIM);
- imgResult.CreateView ();
- imgResult.CreateSampler (VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder);
- imgResult.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
-
- staggingVBO = new HostBuffer<Vector2> (dev, VkBufferUsageFlags.TransferSrc, MAX_VERTICES);
- staggingVBO.Map ();
-
- vbo = new GPUBuffer<Vector2> (dev, VkBufferUsageFlags.VertexBuffer | VkBufferUsageFlags.StorageBuffer | VkBufferUsageFlags.TransferDst, MAX_VERTICES);
- ibo = new GPUBuffer<uint> (dev, VkBufferUsageFlags.IndexBuffer | VkBufferUsageFlags.StorageBuffer, MAX_VERTICES * 3);
-
- inBuff = new GPUBuffer<float> (dev, VkBufferUsageFlags.StorageBuffer | VkBufferUsageFlags.TransferSrc | VkBufferUsageFlags.TransferDst, (int)data_size);
- outBuff = new GPUBuffer<float> (dev, VkBufferUsageFlags.StorageBuffer | VkBufferUsageFlags.TransferSrc | VkBufferUsageFlags.TransferDst, (int)data_size);
-
- dsPool = new DescriptorPool (dev, 4,
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler),
- new VkDescriptorPoolSize (VkDescriptorType.StorageBuffer, 6));
- dslImage = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
- dslCompute = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer)
- );
- dslVAO = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Compute, VkDescriptorType.StorageBuffer)
- );
-
- plInit = new ComputePipeline (
- new PipelineLayout (dev, new VkPushConstantRange (VkShaderStageFlags.Compute, 3 * sizeof (int)), dslCompute, dslVAO),
- "shaders/init.comp.spv");
- plCompute = new ComputePipeline (plInit.Layout, "shaders/computeTest.comp.spv");
- plNormalize = new ComputePipeline (plInit.Layout, "shaders/normalize.comp.spv");
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1);
-
- cfg.Layout = new PipelineLayout (dev, dslImage);
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), VkSampleCountFlags.SampleCount1);
- cfg.RenderPass.ClearValues[0] = new VkClearValue { color = new VkClearColorValue (0.1f, 0.1f, 0.1f) };
- cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/FullScreenQuad.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/simpletexture.frag.spv");
-
- cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (true);
-
- grPipeline = new GraphicPipeline (cfg);
-
- cfg.ResetShadersAndVerticesInfos ();
- cfg.Layout = new PipelineLayout (dev, new VkPushConstantRange (VkShaderStageFlags.Vertex, 4 * sizeof (int)));
- cfg.inputAssemblyState.topology = VkPrimitiveTopology.LineStrip;
- cfg.AddVertexBinding<Vector2> (0);
- cfg.SetVertexAttributes (0, VkFormat.R32g32Sfloat);
- cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/triangle.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/triangle.frag.spv");
-
- trianglesPipeline = new GraphicPipeline (cfg);
-
- dsImage = dsPool.Allocate (dslImage);
- dsPing = dsPool.Allocate (dslCompute);
- dsPong = dsPool.Allocate (dslCompute);
- dsVAO = dsPool.Allocate (dslCompute);
-
-
- DescriptorSetWrites dsUpdate = new DescriptorSetWrites (dsPing, dslCompute);
- dsUpdate.Write (dev, inBuff.Descriptor, outBuff.Descriptor);
- dsUpdate.Write (dev, dsPong, outBuff.Descriptor, inBuff.Descriptor);
- dsUpdate = new DescriptorSetWrites (dsImage, dslImage);
- dsUpdate.Write (dev, imgResult.Descriptor);
- dsUpdate = new DescriptorSetWrites (dsVAO, dslVAO);
- dsUpdate.Write (dev, vbo.Descriptor, ibo.Descriptor);
-
- UpdateFrequency = 5;
-
- addPoint (IMG_DIM / 2 - 1, IMG_DIM / 2 - 1);
- }
-
- protected override void createQueues () {
- computeQ = new Queue (dev, VkQueueFlags.Compute);
- transferQ = new Queue (dev, VkQueueFlags.Transfer);
-
- base.createQueues ();
- }
-
- protected override void OnResize () {
-
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (grPipeline.RenderPass, swapChain.Width, swapChain.Height,
- (grPipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- null
- } : new Image[] {
- null,
- null,
- swapChain.images[i]
- });
-
- cmds[i] = cmdPool.AllocateCommandBuffer ();
- cmds[i].Start ();
-
- imgResult.SetLayout (cmds[i], VkImageAspectFlags.Color,
- VkImageLayout.Undefined, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.AllCommands, VkPipelineStageFlags.FragmentShader);
-
- grPipeline.RenderPass.Begin (cmds[i], frameBuffers[i]);
-
- int xPad = (int)swapChain.Width / 2 - (int)IMG_DIM * (int)zoom / 2;
- int yPad = (int)swapChain.Height / 2- (int)IMG_DIM * (int)zoom / 2;
-
- cmds[i].SetViewport (IMG_DIM * zoom, IMG_DIM * zoom, xPad, yPad);
- cmds[i].SetScissor (IMG_DIM * zoom, IMG_DIM * zoom, Math.Max (0, xPad), Math.Max (0, yPad));
-
- cmds[i].BindDescriptorSet (grPipeline.Layout, dsImage);
- cmds[i].BindPipeline (grPipeline);
- cmds[i].Draw (3, 1, 0, 0);
-
- trianglesPipeline.Bind (cmds[i]);
- cmds[i].PushConstant (trianglesPipeline.Layout, VkShaderStageFlags.Vertex, IMG_DIM);
- cmds[i].PushConstant (trianglesPipeline.Layout, VkShaderStageFlags.Vertex, xPad, sizeof(int));
- cmds[i].PushConstant (trianglesPipeline.Layout, VkShaderStageFlags.Vertex, yPad, 2 * sizeof (int));
- cmds[i].PushConstant (trianglesPipeline.Layout, VkShaderStageFlags.Vertex, zoom, 3 * sizeof (int));
-
- cmds[i].BindVertexBuffer (vbo);
- cmds[i].BindIndexBuffer (ibo, VkIndexType.Uint32);
- cmds[i].DrawIndexed (pointCount*3);
-
- grPipeline.RenderPass.End (cmds[i]);
-
- cmds[i].End ();
- }
- }
-
- public override void Update () {
- initGpuBuffers ();
-
- using (CommandPool cmdPoolCompute = new CommandPool (dev, computeQ.qFamIndex)) {
-
- CommandBuffer cmd = cmdPoolCompute.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- plInit.BindDescriptorSet (cmd, dsVAO, 1);
- cmd.PushConstant (plCompute.Layout, VkShaderStageFlags.Compute, IMG_DIM, sizeof (int));
- cmd.PushConstant (plCompute.Layout, VkShaderStageFlags.Compute, pointCount, 2 * sizeof (int));
-
- if (!pong)
- plInit.BindDescriptorSet (cmd, dsPong);
- else
- plInit.BindDescriptorSet (cmd, dsPing);
-
- plInit.Bind (cmd);
- cmd.Dispatch (pointCount);
-
- VkMemoryBarrier memBar = VkMemoryBarrier.New ();
- memBar.srcAccessMask = VkAccessFlags.ShaderWrite;
- memBar.dstAccessMask = VkAccessFlags.ShaderRead;
- Vk.vkCmdPipelineBarrier (cmd.Handle, VkPipelineStageFlags.ComputeShader, VkPipelineStageFlags.ComputeShader, VkDependencyFlags.ByRegion,
- 1, ref memBar, 0, IntPtr.Zero, 0, IntPtr.Zero);
-
- pong = false;
- uint stepSize = IMG_DIM / 2;
-
- plCompute.Bind (cmd);
-
-
- int pass = 0;
- while (stepSize > 0 && pass < invocationCount) {
- cmd.PushConstant (plCompute.Layout, VkShaderStageFlags.Compute, stepSize);
-
- if (pong)
- plCompute.BindDescriptorSet (cmd, dsPong);
- else
- plCompute.BindDescriptorSet (cmd, dsPing);
-
- cmd.Dispatch (IMG_DIM, IMG_DIM);
-
- Vk.vkCmdPipelineBarrier (cmd.Handle, VkPipelineStageFlags.ComputeShader, VkPipelineStageFlags.ComputeShader, VkDependencyFlags.ByRegion,
- 1, ref memBar, 0, IntPtr.Zero, 0, IntPtr.Zero);
-
- pong = !pong;
- stepSize /= 2;
- pass++;
- }
-
- plNormalize.Bind (cmd);
- if (pong)
- plNormalize.BindDescriptorSet (cmd, dsPong);
- else
- plNormalize.BindDescriptorSet (cmd, dsPing);
- cmd.Dispatch (IMG_DIM, IMG_DIM);
- pong = !pong;
-
- cmd.End ();
-
- computeQ.Submit (cmd);
- computeQ.WaitIdle ();
- }
-
- printResults ();
- }
-
- protected override void onMouseButtonDown (MouseButton button) {
- int xPad = (int)swapChain.Width / 2 - (int)IMG_DIM * (int)zoom / 2;
- int yPad = (int)swapChain.Height / 2 - (int)IMG_DIM * (int)zoom / 2;
-
- int localX = (int)((lastMouseX - xPad) / zoom);
- int localY = (int)((lastMouseY - yPad) / zoom);
-
- if (localX < 0 || localY < 0 || localX >= IMG_DIM || localY >= IMG_DIM)
- base.onMouseButtonDown (button);
- else {
- addPoint ((uint)localX, (uint)localY);
- }
- }
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.Delete:
- clearPoints ();
- break;
- case Key.KeypadAdd:
- invocationCount++;
- break;
- case Key.KeypadSubtract:
- if (invocationCount>0)
- invocationCount--;
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- break;
- }
- Console.WriteLine ($"break after {invocationCount} step");
- }
-
- void printResults () {
- dev.WaitIdle ();
- using (CommandPool cmdPoolTransfer = new CommandPool (dev, transferQ.qFamIndex)) {
-
- CommandBuffer cmd = cmdPoolTransfer.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- imgResult.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.ShaderReadOnlyOptimal, VkImageLayout.TransferDstOptimal,
- VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.Transfer);
-
- if (pong)
- outBuff.CopyTo (cmd, imgResult, VkImageLayout.ShaderReadOnlyOptimal);
- else
- inBuff.CopyTo (cmd, imgResult, VkImageLayout.ShaderReadOnlyOptimal);
-
- cmd.End ();
-
- transferQ.Submit (cmd);
- transferQ.WaitIdle ();
- }
- }
-
- void initGpuBuffers () {
- using (CommandPool staggingCmdPool = new CommandPool (dev, transferQ.qFamIndex)) {
- CommandBuffer cmd = staggingCmdPool.AllocateAndStart (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- if (clear) {
- if (pong)
- inBuff.Fill (cmd, 0);
- else
- outBuff.Fill (cmd, 0);
- }
-
- staggingVBO.CopyTo (cmd, vbo, pointCount * (ulong)Marshal.SizeOf<Vector2>());
-
- transferQ.EndSubmitAndWait (cmd);
- }
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
-
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- grPipeline.Dispose ();
- trianglesPipeline.Dispose ();
-
- plInit.Dispose ();
- plCompute.Dispose ();
- plNormalize.Dispose ();
-
- dslCompute.Dispose ();
- dslImage.Dispose ();
-
- dsPool.Dispose ();
-
- inBuff.Dispose ();
- outBuff.Dispose ();
- staggingVBO.Dispose ();
- vbo.Dispose ();
- ibo.Dispose ();
-
- imgResult.Dispose ();
-
-#if DEBUG
- dbgReport.Dispose ();
-#endif
- }
- }
-
- base.Dispose (disposing);
- }
-
-
- }
-}
diff --git a/samples/datas/Directory.Build.props b/samples/datas/Directory.Build.props
deleted file mode 100644
index faafd77..0000000
--- a/samples/datas/Directory.Build.props
+++ /dev/null
@@ -1,5 +0,0 @@
-<Project>
- <PropertyGroup>
- <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
- </PropertyGroup>
-</Project>
diff --git a/samples/datas/data/font.fnt b/samples/datas/data/font.fnt
deleted file mode 100644
index 81cb615..0000000
--- a/samples/datas/data/font.fnt
+++ /dev/null
@@ -1,343 +0,0 @@
-info face="Arial Black Standard" size=32 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=4,4,4,4 spacing=-8,-8
-common lineHeight=46 base=36 scaleW=512 scaleH=512 pages=1 packed=0
-page id=0 file="font.ktx"
-chars count=97
-char id=0 x=237 y=102 width=25 height=29 xoffset=-4 yoffset=11 xadvance=24 page=0 chnl=0
-char id=10 x=0 y=0 width=0 height=0 xoffset=-4 yoffset=0 xadvance=0 page=0 chnl=0
-char id=32 x=0 y=0 width=0 height=0 xoffset=-4 yoffset=0 xadvance=11 page=0 chnl=0
-char id=33 x=27 y=102 width=15 height=32 xoffset=-4 yoffset=8 xadvance=11 page=0 chnl=0
-char id=34 x=298 y=134 width=24 height=17 xoffset=-4 yoffset=8 xadvance=16 page=0 chnl=0
-char id=35 x=154 y=102 width=28 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=36 x=150 y=0 width=28 height=37 xoffset=-4 yoffset=6 xadvance=21 page=0 chnl=0
-char id=37 x=117 y=102 width=37 height=32 xoffset=-4 yoffset=8 xadvance=32 page=0 chnl=0
-char id=38 x=182 y=102 width=34 height=32 xoffset=-4 yoffset=8 xadvance=28 page=0 chnl=0
-char id=39 x=322 y=134 width=15 height=17 xoffset=-4 yoffset=8 xadvance=9 page=0 chnl=0
-char id=40 x=20 y=0 width=18 height=38 xoffset=-4 yoffset=8 xadvance=12 page=0 chnl=0
-char id=41 x=38 y=0 width=19 height=38 xoffset=-4 yoffset=8 xadvance=12 page=0 chnl=0
-char id=42 x=279 y=134 width=19 height=21 xoffset=-4 yoffset=8 xadvance=18 page=0 chnl=0
-char id=43 x=186 y=134 width=26 height=26 xoffset=-4 yoffset=11 xadvance=21 page=0 chnl=0
-char id=44 x=264 y=134 width=15 height=21 xoffset=-4 yoffset=25 xadvance=11 page=0 chnl=0
-char id=45 x=394 y=134 width=18 height=14 xoffset=-4 yoffset=20 xadvance=11 page=0 chnl=0
-char id=46 x=363 y=134 width=15 height=15 xoffset=-4 yoffset=25 xadvance=11 page=0 chnl=0
-char id=47 x=83 y=102 width=17 height=32 xoffset=-4 yoffset=8 xadvance=9 page=0 chnl=0
-char id=48 x=0 y=102 width=27 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=49 x=261 y=70 width=22 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=50 x=283 y=70 width=27 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=51 x=310 y=70 width=27 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=52 x=337 y=70 width=29 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=53 x=366 y=70 width=27 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=54 x=393 y=70 width=27 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=55 x=420 y=70 width=27 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=56 x=447 y=70 width=27 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=57 x=474 y=70 width=27 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=58 x=171 y=134 width=15 height=26 xoffset=-4 yoffset=14 xadvance=11 page=0 chnl=0
-char id=59 x=68 y=102 width=15 height=32 xoffset=-4 yoffset=14 xadvance=11 page=0 chnl=0
-char id=60 x=262 y=102 width=26 height=27 xoffset=-4 yoffset=11 xadvance=21 page=0 chnl=0
-char id=61 x=238 y=134 width=26 height=22 xoffset=-4 yoffset=13 xadvance=21 page=0 chnl=0
-char id=62 x=288 y=102 width=26 height=27 xoffset=-4 yoffset=11 xadvance=21 page=0 chnl=0
-char id=63 x=42 y=102 width=26 height=32 xoffset=-4 yoffset=8 xadvance=20 page=0 chnl=0
-char id=64 x=178 y=0 width=33 height=35 xoffset=-4 yoffset=8 xadvance=24 page=0 chnl=0
-char id=65 x=244 y=0 width=33 height=32 xoffset=-4 yoffset=8 xadvance=25 page=0 chnl=0
-char id=66 x=277 y=0 width=30 height=32 xoffset=-4 yoffset=8 xadvance=25 page=0 chnl=0
-char id=67 x=307 y=0 width=30 height=32 xoffset=-4 yoffset=8 xadvance=25 page=0 chnl=0
-char id=68 x=337 y=0 width=30 height=32 xoffset=-4 yoffset=8 xadvance=25 page=0 chnl=0
-char id=69 x=367 y=0 width=28 height=32 xoffset=-4 yoffset=8 xadvance=23 page=0 chnl=0
-char id=70 x=395 y=0 width=26 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=71 x=421 y=0 width=33 height=32 xoffset=-4 yoffset=8 xadvance=27 page=0 chnl=0
-char id=72 x=454 y=0 width=31 height=32 xoffset=-4 yoffset=8 xadvance=27 page=0 chnl=0
-char id=73 x=485 y=0 width=16 height=32 xoffset=-4 yoffset=8 xadvance=12 page=0 chnl=0
-char id=74 x=0 y=38 width=26 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=75 x=26 y=38 width=33 height=32 xoffset=-4 yoffset=8 xadvance=27 page=0 chnl=0
-char id=76 x=59 y=38 width=26 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=77 x=85 y=38 width=34 height=32 xoffset=-4 yoffset=8 xadvance=30 page=0 chnl=0
-char id=78 x=119 y=38 width=31 height=32 xoffset=-4 yoffset=8 xadvance=27 page=0 chnl=0
-char id=79 x=150 y=38 width=33 height=32 xoffset=-4 yoffset=8 xadvance=27 page=0 chnl=0
-char id=80 x=183 y=38 width=27 height=32 xoffset=-4 yoffset=8 xadvance=23 page=0 chnl=0
-char id=81 x=211 y=0 width=33 height=34 xoffset=-4 yoffset=8 xadvance=27 page=0 chnl=0
-char id=82 x=210 y=38 width=31 height=32 xoffset=-4 yoffset=8 xadvance=25 page=0 chnl=0
-char id=83 x=241 y=38 width=30 height=32 xoffset=-4 yoffset=8 xadvance=23 page=0 chnl=0
-char id=84 x=271 y=38 width=30 height=32 xoffset=-4 yoffset=8 xadvance=23 page=0 chnl=0
-char id=85 x=301 y=38 width=31 height=32 xoffset=-4 yoffset=8 xadvance=27 page=0 chnl=0
-char id=86 x=332 y=38 width=33 height=32 xoffset=-4 yoffset=8 xadvance=25 page=0 chnl=0
-char id=87 x=365 y=38 width=41 height=32 xoffset=-4 yoffset=8 xadvance=32 page=0 chnl=0
-char id=88 x=406 y=38 width=33 height=32 xoffset=-4 yoffset=8 xadvance=25 page=0 chnl=0
-char id=89 x=439 y=38 width=33 height=32 xoffset=-4 yoffset=8 xadvance=25 page=0 chnl=0
-char id=90 x=472 y=38 width=29 height=32 xoffset=-4 yoffset=8 xadvance=23 page=0 chnl=0
-char id=91 x=57 y=0 width=19 height=38 xoffset=-4 yoffset=8 xadvance=12 page=0 chnl=0
-char id=92 x=100 y=102 width=17 height=32 xoffset=-4 yoffset=8 xadvance=9 page=0 chnl=0
-char id=93 x=76 y=0 width=19 height=38 xoffset=-4 yoffset=8 xadvance=12 page=0 chnl=0
-char id=94 x=212 y=134 width=26 height=22 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=95 x=412 y=134 width=25 height=11 xoffset=-4 yoffset=33 xadvance=16 page=0 chnl=0
-char id=96 x=378 y=134 width=16 height=14 xoffset=-4 yoffset=8 xadvance=11 page=0 chnl=0
-char id=97 x=314 y=102 width=26 height=26 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=98 x=0 y=70 width=26 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=99 x=340 y=102 width=26 height=26 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=100 x=26 y=70 width=26 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=101 x=366 y=102 width=27 height=26 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=102 x=52 y=70 width=21 height=32 xoffset=-4 yoffset=8 xadvance=12 page=0 chnl=0
-char id=103 x=73 y=70 width=26 height=32 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=104 x=99 y=70 width=25 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=105 x=124 y=70 width=15 height=32 xoffset=-4 yoffset=8 xadvance=11 page=0 chnl=0
-char id=106 x=0 y=0 width=20 height=38 xoffset=-4 yoffset=8 xadvance=11 page=0 chnl=0
-char id=107 x=139 y=70 width=27 height=32 xoffset=-4 yoffset=8 xadvance=21 page=0 chnl=0
-char id=108 x=166 y=70 width=15 height=32 xoffset=-4 yoffset=8 xadvance=11 page=0 chnl=0
-char id=109 x=393 y=102 width=37 height=26 xoffset=-4 yoffset=14 xadvance=32 page=0 chnl=0
-char id=110 x=430 y=102 width=25 height=26 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=111 x=455 y=102 width=27 height=26 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=112 x=181 y=70 width=26 height=32 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=113 x=207 y=70 width=26 height=32 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=114 x=482 y=102 width=22 height=26 xoffset=-4 yoffset=14 xadvance=14 page=0 chnl=0
-char id=115 x=0 y=134 width=27 height=26 xoffset=-4 yoffset=14 xadvance=20 page=0 chnl=0
-char id=116 x=216 y=102 width=21 height=31 xoffset=-4 yoffset=9 xadvance=14 page=0 chnl=0
-char id=117 x=27 y=134 width=25 height=26 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=118 x=52 y=134 width=27 height=26 xoffset=-4 yoffset=14 xadvance=20 page=0 chnl=0
-char id=119 x=79 y=134 width=39 height=26 xoffset=-4 yoffset=14 xadvance=30 page=0 chnl=0
-char id=120 x=118 y=134 width=29 height=26 xoffset=-4 yoffset=14 xadvance=21 page=0 chnl=0
-char id=121 x=233 y=70 width=28 height=32 xoffset=-4 yoffset=14 xadvance=20 page=0 chnl=0
-char id=122 x=147 y=134 width=24 height=26 xoffset=-4 yoffset=14 xadvance=18 page=0 chnl=0
-char id=123 x=95 y=0 width=21 height=38 xoffset=-4 yoffset=8 xadvance=12 page=0 chnl=0
-char id=124 x=137 y=0 width=13 height=38 xoffset=-4 yoffset=8 xadvance=9 page=0 chnl=0
-char id=125 x=116 y=0 width=21 height=38 xoffset=-4 yoffset=8 xadvance=12 page=0 chnl=0
-char id=126 x=337 y=134 width=26 height=17 xoffset=-4 yoffset=15 xadvance=21 page=0 chnl=0
-kernings count=241
-kerning first=102 second=101 amount=-1
-kerning first=76 second=89 amount=-2
-kerning first=76 second=79 amount=-1
-kerning first=80 second=65 amount=-3
-kerning first=102 second=111 amount=-1
-kerning first=86 second=97 amount=-1
-kerning first=84 second=114 amount=-1
-kerning first=119 second=44 amount=-2
-kerning first=65 second=79 amount=-1
-kerning first=86 second=67 amount=-1
-kerning first=66 second=44 amount=1
-kerning first=84 second=45 amount=-2
-kerning first=80 second=46 amount=-6
-kerning first=65 second=89 amount=-3
-kerning first=67 second=46 amount=1
-kerning first=112 second=119 amount=-1
-kerning first=84 second=67 amount=-1
-kerning first=84 second=58 amount=-1
-kerning first=84 second=59 amount=-1
-kerning first=114 second=113 amount=1
-kerning first=102 second=63 amount=3
-kerning first=80 second=111 amount=-1
-kerning first=86 second=114 amount=-1
-kerning first=89 second=67 amount=-2
-kerning first=114 second=111 amount=1
-kerning first=88 second=71 amount=-1
-kerning first=80 second=101 amount=-1
-kerning first=87 second=46 amount=-2
-kerning first=75 second=117 amount=-1
-kerning first=114 second=100 amount=1
-kerning first=86 second=117 amount=-1
-kerning first=87 second=79 amount=-1
-kerning first=86 second=79 amount=-1
-kerning first=81 second=86 amount=-1
-kerning first=82 second=81 amount=-1
-kerning first=115 second=119 amount=-1
-kerning first=65 second=85 amount=-1
-kerning first=68 second=87 amount=1
-kerning first=112 second=46 amount=-1
-kerning first=81 second=89 amount=-2
-kerning first=114 second=97 amount=1
-kerning first=84 second=97 amount=-2
-kerning first=65 second=86 amount=-2
-kerning first=84 second=99 amount=-2
-kerning first=89 second=100 amount=-3
-kerning first=102 second=102 amount=1
-kerning first=114 second=103 amount=1
-kerning first=87 second=104 amount=1
-kerning first=86 second=105 amount=1
-kerning first=114 second=106 amount=1
-kerning first=74 second=111 amount=-1
-kerning first=99 second=108 amount=-1
-kerning first=84 second=109 amount=-1
-kerning first=114 second=110 amount=2
-kerning first=118 second=111 amount=-1
-kerning first=89 second=112 amount=-2
-kerning first=70 second=114 amount=-1
-kerning first=97 second=116 amount=-1
-kerning first=89 second=117 amount=-2
-kerning first=76 second=119 amount=-1
-kerning first=101 second=120 amount=-1
-kerning first=99 second=121 amount=-1
-kerning first=82 second=119 amount=1
-kerning first=66 second=65 amount=-1
-kerning first=81 second=84 amount=-1
-kerning first=80 second=44 amount=-6
-kerning first=97 second=103 amount=1
-kerning first=111 second=120 amount=-1
-kerning first=65 second=112 amount=1
-kerning first=84 second=46 amount=-5
-kerning first=86 second=101 amount=-2
-kerning first=119 second=104 amount=1
-kerning first=114 second=117 amount=1
-kerning first=121 second=44 amount=-3
-kerning first=121 second=46 amount=-3
-kerning first=89 second=97 amount=-3
-kerning first=75 second=101 amount=-1
-kerning first=65 second=118 amount=-1
-kerning first=70 second=97 amount=-1
-kerning first=119 second=113 amount=-1
-kerning first=75 second=111 amount=-1
-kerning first=75 second=71 amount=-1
-kerning first=87 second=97 amount=-1
-kerning first=101 second=103 amount=1
-kerning first=87 second=105 amount=1
-kerning first=81 second=46 amount=1
-kerning first=86 second=71 amount=-1
-kerning first=67 second=44 amount=1
-kerning first=114 second=99 amount=1
-kerning first=70 second=44 amount=-5
-kerning first=66 second=85 amount=-1
-kerning first=76 second=86 amount=-2
-kerning first=89 second=59 amount=-2
-kerning first=84 second=44 amount=-5
-kerning first=120 second=101 amount=-1
-kerning first=108 second=121 amount=1
-kerning first=89 second=101 amount=-3
-kerning first=114 second=46 amount=-2
-kerning first=121 second=99 amount=-1
-kerning first=114 second=101 amount=1
-kerning first=101 second=118 amount=-1
-kerning first=81 second=44 amount=1
-kerning first=74 second=121 amount=-1
-kerning first=82 second=79 amount=-1
-kerning first=89 second=113 amount=-3
-kerning first=119 second=46 amount=-3
-kerning first=68 second=89 amount=-1
-kerning first=119 second=111 amount=-1
-kerning first=102 second=46 amount=-2
-kerning first=86 second=44 amount=-4
-kerning first=114 second=109 amount=2
-kerning first=79 second=89 amount=-2
-kerning first=86 second=65 amount=-2
-kerning first=103 second=114 amount=1
-kerning first=102 second=33 amount=3
-kerning first=84 second=122 amount=-1
-kerning first=86 second=46 amount=-4
-kerning first=70 second=101 amount=-1
-kerning first=99 second=104 amount=-1
-kerning first=89 second=44 amount=-5
-kerning first=68 second=86 amount=-1
-kerning first=88 second=79 amount=-1
-kerning first=82 second=89 amount=-1
-kerning first=75 second=67 amount=-1
-kerning first=98 second=118 amount=-1
-kerning first=89 second=65 amount=-3
-kerning first=114 second=107 amount=1
-kerning first=84 second=101 amount=-2
-kerning first=89 second=79 amount=-2
-kerning first=114 second=118 amount=2
-kerning first=84 second=111 amount=-2
-kerning first=120 second=111 amount=-1
-kerning first=82 second=111 amount=-1
-kerning first=79 second=87 amount=-1
-kerning first=84 second=71 amount=-1
-kerning first=118 second=100 amount=-1
-kerning first=74 second=97 amount=-1
-kerning first=89 second=45 amount=-3
-kerning first=84 second=81 amount=-1
-kerning first=114 second=115 amount=1
-kerning first=68 second=46 amount=-1
-kerning first=79 second=44 amount=-1
-kerning first=121 second=100 amount=-1
-kerning first=114 second=112 amount=1
-kerning first=87 second=71 amount=-1
-kerning first=89 second=83 amount=-1
-kerning first=86 second=111 amount=-2
-kerning first=87 second=111 amount=-1
-kerning first=70 second=46 amount=-5
-kerning first=81 second=65 amount=1
-kerning first=114 second=58 amount=1
-kerning first=84 second=104 amount=1
-kerning first=114 second=116 amount=2
-kerning first=87 second=101 amount=-1
-kerning first=65 second=67 amount=-1
-kerning first=70 second=65 amount=-3
-kerning first=65 second=81 amount=-1
-kerning first=118 second=46 amount=-3
-kerning first=103 second=121 amount=1
-kerning first=87 second=67 amount=-1
-kerning first=74 second=46 amount=-1
-kerning first=76 second=67 amount=-1
-kerning first=75 second=79 amount=-1
-kerning first=87 second=44 amount=-1
-kerning first=89 second=58 amount=-2
-kerning first=86 second=59 amount=-1
-kerning first=114 second=121 amount=2
-kerning first=121 second=97 amount=-1
-kerning first=76 second=87 amount=-1
-kerning first=118 second=44 amount=-3
-kerning first=79 second=84 amount=-1
-kerning first=111 second=119 amount=-1
-kerning first=111 second=118 amount=-1
-kerning first=84 second=108 amount=1
-kerning first=82 second=117 amount=-1
-kerning first=89 second=46 amount=-5
-kerning first=111 second=122 amount=1
-kerning first=84 second=65 amount=-2
-kerning first=74 second=117 amount=-1
-kerning first=107 second=111 amount=-1
-kerning first=85 second=65 amount=-1
-kerning first=111 second=121 amount=-1
-kerning first=114 second=59 amount=1
-kerning first=65 second=84 amount=-2
-kerning first=89 second=118 amount=-1
-kerning first=86 second=58 amount=-1
-kerning first=87 second=100 amount=-1
-kerning first=76 second=84 amount=-2
-kerning first=102 second=32 amount=2
-kerning first=111 second=46 amount=-1
-kerning first=114 second=114 amount=1
-kerning first=82 second=86 amount=-1
-kerning first=74 second=44 amount=-1
-kerning first=118 second=99 amount=-1
-kerning first=86 second=81 amount=-1
-kerning first=79 second=88 amount=-2
-kerning first=85 second=44 amount=-1
-kerning first=118 second=101 amount=-1
-kerning first=88 second=67 amount=-1
-kerning first=79 second=86 amount=-1
-kerning first=75 second=118 amount=-1
-kerning first=76 second=85 amount=-1
-kerning first=107 second=101 amount=-1
-kerning first=84 second=117 amount=-1
-kerning first=120 second=99 amount=-1
-kerning first=75 second=121 amount=-1
-kerning first=84 second=115 amount=-2
-kerning first=114 second=44 amount=-2
-kerning first=82 second=71 amount=-1
-kerning first=85 second=46 amount=-1
-kerning first=70 second=111 amount=-1
-kerning first=97 second=118 amount=-1
-kerning first=121 second=111 amount=-1
-kerning first=79 second=65 amount=-1
-kerning first=82 second=101 amount=-1
-kerning first=65 second=71 amount=-1
-kerning first=102 second=44 amount=-2
-kerning first=112 second=121 amount=-1
-kerning first=74 second=101 amount=-1
-kerning first=86 second=45 amount=-1
-kerning first=121 second=101 amount=-1
-kerning first=84 second=79 amount=-1
-kerning first=89 second=111 amount=-3
-kerning first=118 second=113 amount=-1
-kerning first=74 second=65 amount=-1
-kerning first=76 second=71 amount=-1
-kerning first=79 second=46 amount=-1
-kerning first=68 second=65 amount=-1
-kerning first=114 second=108 amount=1
-kerning first=71 second=44 amount=1
-kerning first=110 second=118 amount=-1
-kerning first=82 second=85 amount=-1
-kerning first=87 second=117 amount=-1
-kerning first=120 second=100 amount=-1
-kerning first=80 second=97 amount=-1
-kerning first=99 second=107 amount=-1
-kerning first=66 second=46 amount=1
-kerning first=89 second=71 amount=-2
-kerning first=107 second=121 amount=1
-kerning first=82 second=67 amount=-1
-kerning first=84 second=121 amount=-1
diff --git a/samples/datas/data/font.ktx b/samples/datas/data/font.ktx
deleted file mode 100644
index b7c03f5..0000000
--- a/samples/datas/data/font.ktx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:391f71939ea518c23b31fc6efbe9d86957e318f5e04788fd1b2366f4507b745c
-size 1398236
diff --git a/samples/datas/data/models/Box.gltf b/samples/datas/data/models/Box.gltf
deleted file mode 100644
index 8f9e0d3..0000000
--- a/samples/datas/data/models/Box.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f98a369e29ffc754cc897f78d695754ac6812ba7ddcd23705dd8d4e258f5f13b
-size 3791
diff --git a/samples/datas/data/models/Bricks16_col.jpg b/samples/datas/data/models/Bricks16_col.jpg
deleted file mode 100644
index be8ee22..0000000
--- a/samples/datas/data/models/Bricks16_col.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5e904f8d3789b210a7575d228f75145cc4200d73443012ab56f80f8959de9d1a
-size 14958650
diff --git a/samples/datas/data/models/Bricks16_nrm.jpg b/samples/datas/data/models/Bricks16_nrm.jpg
deleted file mode 100644
index 3ef28fc..0000000
--- a/samples/datas/data/models/Bricks16_nrm.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:fb9d6f65649480c9d2b1a910d0b05f22831dd2caaece164b45e75afc3fd852fe
-size 23383625
diff --git a/samples/datas/data/models/DamagedHelmet/glTF-Embedded/DamagedHelmet.gltf b/samples/datas/data/models/DamagedHelmet/glTF-Embedded/DamagedHelmet.gltf
deleted file mode 100644
index 0f51039..0000000
--- a/samples/datas/data/models/DamagedHelmet/glTF-Embedded/DamagedHelmet.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c0fa7be52a4c63e96af2be05735caba968b04a633a9c5eaf1b4c95fb25588003
-size 5033556
diff --git a/samples/datas/data/models/DamagedHelmet/glTF/DamagedHelmet.bin b/samples/datas/data/models/DamagedHelmet/glTF/DamagedHelmet.bin
deleted file mode 100644
index 662eacc..0000000
--- a/samples/datas/data/models/DamagedHelmet/glTF/DamagedHelmet.bin
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/DamagedHelmet/glTF/DamagedHelmet.gltf b/samples/datas/data/models/DamagedHelmet/glTF/DamagedHelmet.gltf
deleted file mode 100644
index d685d77..0000000
--- a/samples/datas/data/models/DamagedHelmet/glTF/DamagedHelmet.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:efe99dfac198094a30c71dc02a4d3421f0eef6bf335aeb695daa4d62134cd93f
-size 4537
diff --git a/samples/datas/data/models/DamagedHelmet/glTF/Default_AO.jpg b/samples/datas/data/models/DamagedHelmet/glTF/Default_AO.jpg
deleted file mode 100644
index e3af145..0000000
--- a/samples/datas/data/models/DamagedHelmet/glTF/Default_AO.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7024051b65ed2ead8d24ebc9bd5ea61d4c21639a57b15dab29870668bcc6b90f
-size 361678
diff --git a/samples/datas/data/models/DamagedHelmet/glTF/Default_albedo.jpg b/samples/datas/data/models/DamagedHelmet/glTF/Default_albedo.jpg
deleted file mode 100644
index 4a15713..0000000
--- a/samples/datas/data/models/DamagedHelmet/glTF/Default_albedo.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2dc95e87aeb0cd7c8a65ef0eb8b23212388da0534ca379811427a9a8780511f5
-size 935629
diff --git a/samples/datas/data/models/DamagedHelmet/glTF/Default_emissive.jpg b/samples/datas/data/models/DamagedHelmet/glTF/Default_emissive.jpg
deleted file mode 100644
index 5e74d6b..0000000
--- a/samples/datas/data/models/DamagedHelmet/glTF/Default_emissive.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:dd0057989f22f93a4ab796d06ebf85a7c12fbfae1d59a86ae8b0c54770dc1159
-size 97499
diff --git a/samples/datas/data/models/DamagedHelmet/glTF/Default_metalRoughness.jpg b/samples/datas/data/models/DamagedHelmet/glTF/Default_metalRoughness.jpg
deleted file mode 100644
index c35deb4..0000000
--- a/samples/datas/data/models/DamagedHelmet/glTF/Default_metalRoughness.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0f05e7ffbeaa974f7d2c83436b04109969966d64ab188cbc3a19a265a0a69ae0
-size 1300661
diff --git a/samples/datas/data/models/DamagedHelmet/glTF/Default_normal.jpg b/samples/datas/data/models/DamagedHelmet/glTF/Default_normal.jpg
deleted file mode 100644
index 6bfe6d4..0000000
--- a/samples/datas/data/models/DamagedHelmet/glTF/Default_normal.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f253ba09a90a86ffd8a807dc45d7953111f8b3421e15d7a21d1e915b01dd33c1
-size 517757
diff --git a/samples/datas/data/models/Hubble.glb b/samples/datas/data/models/Hubble.glb
deleted file mode 100644
index 9d19921..0000000
--- a/samples/datas/data/models/Hubble.glb
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e6a40640d6846e8f5d9438821ebe2d7de730c8dadba1cc9dfdbcc148ff1052cd
-size 11463124
diff --git a/samples/datas/data/models/ISS_stationary.glb b/samples/datas/data/models/ISS_stationary.glb
deleted file mode 100644
index 40badd9..0000000
--- a/samples/datas/data/models/ISS_stationary.glb
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:26dba905b4b7555edbcb0c5f5a61b5c18659f5166076ab27dbb0e64025759fca
-size 44495916
diff --git a/samples/datas/data/models/MER_static.glb b/samples/datas/data/models/MER_static.glb
deleted file mode 100644
index 63de553..0000000
--- a/samples/datas/data/models/MER_static.glb
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:99ee9e2cec3698f6c09a5d3ac61d3924e1a8f0f1a4915e0af05c60c5534d6e49
-size 11909924
diff --git a/samples/datas/data/models/Sponza/README.md b/samples/datas/data/models/Sponza/README.md
deleted file mode 100644
index 89e3787..0000000
--- a/samples/datas/data/models/Sponza/README.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# Sponza
-
-## Screenshot
-
-Lights are shown here, they are not part of the model.
-
-![screenshot](screenshot/large.jpg)
-
-## Model notes
-
-Tangents have been computed using MikkTSpace, as the original OBJ model did not have them.
-I have manually inspected the normals, and it looks correct to me.
-Be aware that W is -1.0 for most of the tangent signs, you will need to handle tangent W for correct results.
-
-
-## Sources
-
-### http://www.crytek.com/cryengine/cryengine3/downloads
-- http://www.crytek.com/download/sponza\_obj.rar
-- http://www.crytek.com/download/sponza\_textures.rar
-
-### http://www.alexandre-pestana.com/pbr-textures-sponza/
-- http://www.alexandre-pestana.com/downloads/SponzaPBR\_Textures.rar
-
-I needed to resize some of the alpha mask textures to the 1024x1024 resolution used by the new texture pack,
-and merge in diffuse with alpha.
-I also repacked the separate metallic/roughness textures into the glTF layout (G - roughness, B - metallic).
-The images are also re-encoded as PNG instead of TGA.
-All the materials also had a constant diffuse factor of about 0.58. I assume it was supposed to be there, so I kept it.
-I also ran the vertices and indices through a mesh optimizer.
-
-## Licensing notes
-
-Taken from copyright.txt in SponzaPBR\_Textures.rar
-
-```
-PBR textures for the Sponza model.
-For more informations: www.alexandre-pestana.com
-
-
-Original copyright:
-
-July 14, 2011 Morgan McGuire modified the model from Crytek's OBJ
-export to correct some small errors. He computed bump maps from the
-normal maps using <a
-href="http://cs.williams.edu/~morgan/code/">normal2bump.cpp</a> (since
-MTL files expect height bumps, not normals), put the "mask" textures
-into the alpha channel of the associated diffuse texture, cleaned up
-noise in the masks, created the missing gi_flag.tga texture, and
-removed the long untextured banner floating in the middle of the
-atrium that appears in the file but in none of the published images of
-the model. The banner is in banner.obj.
-
-
-
-http://www.crytek.com/cryengine/cryengine3/downloads
-
-
-Sponza Model
-August 19, 2010
-The Atrium Sponza Palace, Dubrovnik, is an elegant and improved model created by Frank Meinl. The original Sponza model was created by Marko Dabrovic in early 2002. Over the years, the Sponza Atrium scene has become one of the most popular 3D scenes for testing global illumination and radiosity due to it's specific architectural structure which is particularly complex for global illumination light.
-
-However, nowadays it is considered as a simple model, thus it was decided to crate a new model with highly improved appearance and scene complexity. It is donated to the public for radiosity and is represented in several different formats (3ds, Obj) for use with various commercial 3D applications and renderers.
-
-
-Screenshot from the I3D paper
-http://crytek.com/sites/default/files/20100301_lpv.pdf
-```
diff --git a/samples/datas/data/models/Sponza/glTF/10381718147657362067.jpg b/samples/datas/data/models/Sponza/glTF/10381718147657362067.jpg
deleted file mode 100644
index de57580..0000000
--- a/samples/datas/data/models/Sponza/glTF/10381718147657362067.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:728dd0fe3b570103e51dbfcc1eac64ad09916a7a31603c62a4090a2f2afaa6f8
-size 876227
diff --git a/samples/datas/data/models/Sponza/glTF/10388182081421875623.jpg b/samples/datas/data/models/Sponza/glTF/10388182081421875623.jpg
deleted file mode 100644
index 8a8fba3..0000000
--- a/samples/datas/data/models/Sponza/glTF/10388182081421875623.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e309f1e6310dc0bb85df0a5f3b139207876f067378796a7aa666b0bb169587ae
-size 919134
diff --git a/samples/datas/data/models/Sponza/glTF/11474523244911310074.jpg b/samples/datas/data/models/Sponza/glTF/11474523244911310074.jpg
deleted file mode 100644
index 406d620..0000000
--- a/samples/datas/data/models/Sponza/glTF/11474523244911310074.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:23c32277c33d8eac091cd73daf81561ebe3640eede49b037546ed5c244a01347
-size 1079152
diff --git a/samples/datas/data/models/Sponza/glTF/11490520546946913238.jpg b/samples/datas/data/models/Sponza/glTF/11490520546946913238.jpg
deleted file mode 100644
index 8ede3e8..0000000
--- a/samples/datas/data/models/Sponza/glTF/11490520546946913238.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:98e4c4a091fea684cd693f3ae7ebe83e491969b501b4cd6e1fdd6a3cc1fa5cab
-size 321375
diff --git a/samples/datas/data/models/Sponza/glTF/11872827283454512094.jpg b/samples/datas/data/models/Sponza/glTF/11872827283454512094.jpg
deleted file mode 100644
index dc414f0..0000000
--- a/samples/datas/data/models/Sponza/glTF/11872827283454512094.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:da2a0b308b4d6d57ffbcf4bb7509d4afe91156d5d86d0396e83d7cac883a4857
-size 668962
diff --git a/samples/datas/data/models/Sponza/glTF/11968150294050148237.jpg b/samples/datas/data/models/Sponza/glTF/11968150294050148237.jpg
deleted file mode 100644
index da82e39..0000000
--- a/samples/datas/data/models/Sponza/glTF/11968150294050148237.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bee42826d56d3ff719c4908c11ef65584fbe19e08273862fde7ec1408e44ba25
-size 530384
diff --git a/samples/datas/data/models/Sponza/glTF/1219024358953944284.jpg b/samples/datas/data/models/Sponza/glTF/1219024358953944284.jpg
deleted file mode 100644
index c918da1..0000000
--- a/samples/datas/data/models/Sponza/glTF/1219024358953944284.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9cbd61fcb8047f1c21450eff05207b29d71824edd75483267b5fbc2f7b21378c
-size 329124
diff --git a/samples/datas/data/models/Sponza/glTF/12501374198249454378.jpg b/samples/datas/data/models/Sponza/glTF/12501374198249454378.jpg
deleted file mode 100644
index 23b8b1d..0000000
--- a/samples/datas/data/models/Sponza/glTF/12501374198249454378.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:81ede4ce51045540817c1efb83dbb65a9a9701f1abd78fa130def51d227162fc
-size 421442
diff --git a/samples/datas/data/models/Sponza/glTF/13196865903111448057.jpg b/samples/datas/data/models/Sponza/glTF/13196865903111448057.jpg
deleted file mode 100644
index 3058c29..0000000
--- a/samples/datas/data/models/Sponza/glTF/13196865903111448057.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8c26ae9523cfae7a062fd074f74e0ddbb61630772f9a2130489e1d6e4724c38b
-size 281980
diff --git a/samples/datas/data/models/Sponza/glTF/13824894030729245199.jpg b/samples/datas/data/models/Sponza/glTF/13824894030729245199.jpg
deleted file mode 100644
index 90621f9..0000000
--- a/samples/datas/data/models/Sponza/glTF/13824894030729245199.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9158388312a76ba25a40d3b57978e1ace224882e53198a766494d98f9118aeba
-size 313460
diff --git a/samples/datas/data/models/Sponza/glTF/13982482287905699490.jpg b/samples/datas/data/models/Sponza/glTF/13982482287905699490.jpg
deleted file mode 100644
index da701b8..0000000
--- a/samples/datas/data/models/Sponza/glTF/13982482287905699490.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:70d85bff3bc017177124942ae187db117ba2588e490746f440f2cef085852956
-size 357112
diff --git a/samples/datas/data/models/Sponza/glTF/14118779221266351425.jpg b/samples/datas/data/models/Sponza/glTF/14118779221266351425.jpg
deleted file mode 100644
index 88ee024..0000000
--- a/samples/datas/data/models/Sponza/glTF/14118779221266351425.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e5166a5fba339e44a9d197dedc168683971f8acb2156034248a80674cbba0dd5
-size 1607263
diff --git a/samples/datas/data/models/Sponza/glTF/14170708867020035030.jpg b/samples/datas/data/models/Sponza/glTF/14170708867020035030.jpg
deleted file mode 100644
index 127484f..0000000
--- a/samples/datas/data/models/Sponza/glTF/14170708867020035030.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:763740af8d22f0bfc6a43bd46050ef24bb661833bcace92f1f3326b9d5d7dc16
-size 137384
diff --git a/samples/datas/data/models/Sponza/glTF/14267839433702832875.jpg b/samples/datas/data/models/Sponza/glTF/14267839433702832875.jpg
deleted file mode 100644
index 0304c61..0000000
--- a/samples/datas/data/models/Sponza/glTF/14267839433702832875.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3a2c2aeb87a490a9bd37a8aa912a00e5f5c13974879fcb4f4f0ef39b17c52a7a
-size 718904
diff --git a/samples/datas/data/models/Sponza/glTF/14650633544276105767.jpg b/samples/datas/data/models/Sponza/glTF/14650633544276105767.jpg
deleted file mode 100644
index 95900bd..0000000
--- a/samples/datas/data/models/Sponza/glTF/14650633544276105767.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e8b68080eb4c5709536dfb7858d595d51d4bb725003e11b0f383acf76a7e05a3
-size 521947
diff --git a/samples/datas/data/models/Sponza/glTF/15295713303328085182.jpg b/samples/datas/data/models/Sponza/glTF/15295713303328085182.jpg
deleted file mode 100644
index 20f8871..0000000
--- a/samples/datas/data/models/Sponza/glTF/15295713303328085182.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5bbd0cbf2da7416d5620514ebb0c4837b0ccc841b649cf4070281aa333ff8520
-size 520162
diff --git a/samples/datas/data/models/Sponza/glTF/15722799267630235092.jpg b/samples/datas/data/models/Sponza/glTF/15722799267630235092.jpg
deleted file mode 100644
index 549b3a7..0000000
--- a/samples/datas/data/models/Sponza/glTF/15722799267630235092.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d54c520da7e60e2a62630e9cf946faf139648a7ab831c4531272238e4ade8fa8
-size 557865
diff --git a/samples/datas/data/models/Sponza/glTF/16275776544635328252.png b/samples/datas/data/models/Sponza/glTF/16275776544635328252.png
deleted file mode 100644
index 987e8d0..0000000
--- a/samples/datas/data/models/Sponza/glTF/16275776544635328252.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/Sponza/glTF/16299174074766089871.jpg b/samples/datas/data/models/Sponza/glTF/16299174074766089871.jpg
deleted file mode 100644
index f83f46e..0000000
--- a/samples/datas/data/models/Sponza/glTF/16299174074766089871.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0821ec8dc8226fd5ac70f068e134d014a9952276a7100cc7f0660853471b39f6
-size 339486
diff --git a/samples/datas/data/models/Sponza/glTF/16885566240357350108.jpg b/samples/datas/data/models/Sponza/glTF/16885566240357350108.jpg
deleted file mode 100644
index b7dfccb..0000000
--- a/samples/datas/data/models/Sponza/glTF/16885566240357350108.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5562f0e76ca213d72295e48b8a14a59ee1971f58a47f95e5c022a4e78371c5aa
-size 12575
diff --git a/samples/datas/data/models/Sponza/glTF/17556969131407844942.jpg b/samples/datas/data/models/Sponza/glTF/17556969131407844942.jpg
deleted file mode 100644
index 0cce3eb..0000000
--- a/samples/datas/data/models/Sponza/glTF/17556969131407844942.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:cb09708202859d08764601acc9c9ea3b5254b2c4fd39dcc6b6055768c77aee9b
-size 370061
diff --git a/samples/datas/data/models/Sponza/glTF/17876391417123941155.jpg b/samples/datas/data/models/Sponza/glTF/17876391417123941155.jpg
deleted file mode 100644
index ae58b3b..0000000
--- a/samples/datas/data/models/Sponza/glTF/17876391417123941155.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:005b774a968c1f6af00e4bf97afd668a6a045126a94f524df722ba19edc77d61
-size 1151448
diff --git a/samples/datas/data/models/Sponza/glTF/2051777328469649772.jpg b/samples/datas/data/models/Sponza/glTF/2051777328469649772.jpg
deleted file mode 100644
index 28e407a..0000000
--- a/samples/datas/data/models/Sponza/glTF/2051777328469649772.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:86defcb4c007b80b9d23bcc9fdccd994f6a68f710eb75f11396d92faa2fbe368
-size 206244
diff --git a/samples/datas/data/models/Sponza/glTF/2185409758123873465.jpg b/samples/datas/data/models/Sponza/glTF/2185409758123873465.jpg
deleted file mode 100644
index f5b06c8..0000000
--- a/samples/datas/data/models/Sponza/glTF/2185409758123873465.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:88861c8c7f10517c1d7942f316aae3b74dc5b8ae2faa2021d9dfe9d2c09fb24f
-size 780166
diff --git a/samples/datas/data/models/Sponza/glTF/2299742237651021498.jpg b/samples/datas/data/models/Sponza/glTF/2299742237651021498.jpg
deleted file mode 100644
index 8a8c289..0000000
--- a/samples/datas/data/models/Sponza/glTF/2299742237651021498.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:62a52f200082c02a0fbfa25c0bc40ea7d105a21f10d5aa0ec9408c4f45523794
-size 772201
diff --git a/samples/datas/data/models/Sponza/glTF/2374361008830720677.jpg b/samples/datas/data/models/Sponza/glTF/2374361008830720677.jpg
deleted file mode 100644
index 35885a1..0000000
--- a/samples/datas/data/models/Sponza/glTF/2374361008830720677.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:231d919288db7c977fda3091549195c1bd5197e9e63c039e972da8764f5435c1
-size 844768
diff --git a/samples/datas/data/models/Sponza/glTF/2411100444841994089.jpg b/samples/datas/data/models/Sponza/glTF/2411100444841994089.jpg
deleted file mode 100644
index 97c19f4..0000000
--- a/samples/datas/data/models/Sponza/glTF/2411100444841994089.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:12e1f2ea3c2714a6ec455fa8e623a702e33ef95765ebd09f7874a68fa55fd104
-size 399963
diff --git a/samples/datas/data/models/Sponza/glTF/2775690330959970771.jpg b/samples/datas/data/models/Sponza/glTF/2775690330959970771.jpg
deleted file mode 100644
index e859740..0000000
--- a/samples/datas/data/models/Sponza/glTF/2775690330959970771.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:751606c94a5fe5bda3bf6709e7f6a74363bd7902bf2353d54e55ef3b50007487
-size 785678
diff --git a/samples/datas/data/models/Sponza/glTF/2969916736137545357.jpg b/samples/datas/data/models/Sponza/glTF/2969916736137545357.jpg
deleted file mode 100644
index 1e9b6f6..0000000
--- a/samples/datas/data/models/Sponza/glTF/2969916736137545357.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:dfa17f2dee2cd2d850585673d19d5cda477a63e21659b346d8730e80edd3b347
-size 822373
diff --git a/samples/datas/data/models/Sponza/glTF/332936164838540657.jpg b/samples/datas/data/models/Sponza/glTF/332936164838540657.jpg
deleted file mode 100644
index 35885a1..0000000
--- a/samples/datas/data/models/Sponza/glTF/332936164838540657.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:231d919288db7c977fda3091549195c1bd5197e9e63c039e972da8764f5435c1
-size 844768
diff --git a/samples/datas/data/models/Sponza/glTF/3371964815757888145.jpg b/samples/datas/data/models/Sponza/glTF/3371964815757888145.jpg
deleted file mode 100644
index 145dc9d..0000000
--- a/samples/datas/data/models/Sponza/glTF/3371964815757888145.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d939d2e8bf11c2cf375154129f861b982c786b83db79cb9fde1a2b94b46caf62
-size 682743
diff --git a/samples/datas/data/models/Sponza/glTF/3455394979645218238.jpg b/samples/datas/data/models/Sponza/glTF/3455394979645218238.jpg
deleted file mode 100644
index d3918da..0000000
--- a/samples/datas/data/models/Sponza/glTF/3455394979645218238.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:967005ccfbf4d38f674df41aebb3e58ac1fdcd91f554ead7acfcc132372f8ec6
-size 551432
diff --git a/samples/datas/data/models/Sponza/glTF/3628158980083700836.jpg b/samples/datas/data/models/Sponza/glTF/3628158980083700836.jpg
deleted file mode 100644
index 6dad587..0000000
--- a/samples/datas/data/models/Sponza/glTF/3628158980083700836.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9552937c9fa0481a07dc66768958b4be382544add46d1d66a687af54c51ab6da
-size 547553
diff --git a/samples/datas/data/models/Sponza/glTF/3827035219084910048.jpg b/samples/datas/data/models/Sponza/glTF/3827035219084910048.jpg
deleted file mode 100644
index 154b1fa..0000000
--- a/samples/datas/data/models/Sponza/glTF/3827035219084910048.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8af8fb0810bf3493242491da44f7ae14f7c0bfa6cbacea4be01f6f4261db4559
-size 618837
diff --git a/samples/datas/data/models/Sponza/glTF/4477655471536070370.jpg b/samples/datas/data/models/Sponza/glTF/4477655471536070370.jpg
deleted file mode 100644
index bcdd65e..0000000
--- a/samples/datas/data/models/Sponza/glTF/4477655471536070370.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b93291121303b5a24a488a3e29e0645a24bb471413cfd25c0917d306dff1d038
-size 208352
diff --git a/samples/datas/data/models/Sponza/glTF/4601176305987539675.jpg b/samples/datas/data/models/Sponza/glTF/4601176305987539675.jpg
deleted file mode 100644
index cd11761..0000000
--- a/samples/datas/data/models/Sponza/glTF/4601176305987539675.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3af8848a1a952ad8cc83199bbda0c095f9ed136be839659aa668f72afac91508
-size 1034060
diff --git a/samples/datas/data/models/Sponza/glTF/466164707995436622.jpg b/samples/datas/data/models/Sponza/glTF/466164707995436622.jpg
deleted file mode 100644
index e505337..0000000
--- a/samples/datas/data/models/Sponza/glTF/466164707995436622.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:21bb124f5b5d4d5e9c8d9773cd31dedfc41b30eb302af36e7257cf930152908e
-size 486634
diff --git a/samples/datas/data/models/Sponza/glTF/4675343432951571524.jpg b/samples/datas/data/models/Sponza/glTF/4675343432951571524.jpg
deleted file mode 100644
index 63ca00b..0000000
--- a/samples/datas/data/models/Sponza/glTF/4675343432951571524.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9d5fd79619a52db0232edb2287f5f05c0124c304355e3b035a4e48c0871090bf
-size 764529
diff --git a/samples/datas/data/models/Sponza/glTF/4871783166746854860.jpg b/samples/datas/data/models/Sponza/glTF/4871783166746854860.jpg
deleted file mode 100644
index d1e0df9..0000000
--- a/samples/datas/data/models/Sponza/glTF/4871783166746854860.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:259b6659cb2681e06ef04becd49298d379f2f25b2cc468acf0c2ade4d190637c
-size 570081
diff --git a/samples/datas/data/models/Sponza/glTF/4910669866631290573.jpg b/samples/datas/data/models/Sponza/glTF/4910669866631290573.jpg
deleted file mode 100644
index cd11761..0000000
--- a/samples/datas/data/models/Sponza/glTF/4910669866631290573.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3af8848a1a952ad8cc83199bbda0c095f9ed136be839659aa668f72afac91508
-size 1034060
diff --git a/samples/datas/data/models/Sponza/glTF/4975155472559461469.jpg b/samples/datas/data/models/Sponza/glTF/4975155472559461469.jpg
deleted file mode 100644
index 43e93c0..0000000
--- a/samples/datas/data/models/Sponza/glTF/4975155472559461469.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:fbdb7bcced57a005b84b4c3bbf744bae6309804cca51dabd9237e03a72fbc505
-size 399027
diff --git a/samples/datas/data/models/Sponza/glTF/5061699253647017043.png b/samples/datas/data/models/Sponza/glTF/5061699253647017043.png
deleted file mode 100644
index 8b690c3..0000000
--- a/samples/datas/data/models/Sponza/glTF/5061699253647017043.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/Sponza/glTF/5792855332885324923.jpg b/samples/datas/data/models/Sponza/glTF/5792855332885324923.jpg
deleted file mode 100644
index cff7cf6..0000000
--- a/samples/datas/data/models/Sponza/glTF/5792855332885324923.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9330cf1d51c8f6924b6c9ce09f2dedb21a82e1c7406c37d49ce95beca40bb3be
-size 564801
diff --git a/samples/datas/data/models/Sponza/glTF/5823059166183034438.jpg b/samples/datas/data/models/Sponza/glTF/5823059166183034438.jpg
deleted file mode 100644
index d1c351c..0000000
--- a/samples/datas/data/models/Sponza/glTF/5823059166183034438.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:34b464edddbd2295b0ee23fa7a7a440a19456888c586acdc47032f841b302abd
-size 573157
diff --git a/samples/datas/data/models/Sponza/glTF/6047387724914829168.jpg b/samples/datas/data/models/Sponza/glTF/6047387724914829168.jpg
deleted file mode 100644
index f6e1fc5..0000000
--- a/samples/datas/data/models/Sponza/glTF/6047387724914829168.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c39c9f304c2605be791b4c0a58cd0f8eb20de2dd6a4a4af893c4eb112d158353
-size 518310
diff --git a/samples/datas/data/models/Sponza/glTF/6151467286084645207.jpg b/samples/datas/data/models/Sponza/glTF/6151467286084645207.jpg
deleted file mode 100644
index ba6158f..0000000
--- a/samples/datas/data/models/Sponza/glTF/6151467286084645207.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:170f6c637ebd71a101244eb4d80c3dcf7063caf89e42053d3114d8aeca755cdf
-size 643517
diff --git a/samples/datas/data/models/Sponza/glTF/6593109234861095314.jpg b/samples/datas/data/models/Sponza/glTF/6593109234861095314.jpg
deleted file mode 100644
index cd11761..0000000
--- a/samples/datas/data/models/Sponza/glTF/6593109234861095314.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3af8848a1a952ad8cc83199bbda0c095f9ed136be839659aa668f72afac91508
-size 1034060
diff --git a/samples/datas/data/models/Sponza/glTF/6667038893015345571.jpg b/samples/datas/data/models/Sponza/glTF/6667038893015345571.jpg
deleted file mode 100644
index 9d2c5f3..0000000
--- a/samples/datas/data/models/Sponza/glTF/6667038893015345571.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:58942b73c8f209ab9cc6ea174375adfde9c1875cbfe093f993086a0ab6570724
-size 698410
diff --git a/samples/datas/data/models/Sponza/glTF/6772804448157695701.jpg b/samples/datas/data/models/Sponza/glTF/6772804448157695701.jpg
deleted file mode 100644
index 51286b4..0000000
--- a/samples/datas/data/models/Sponza/glTF/6772804448157695701.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:1ea4f9bc86354d363ea8153df9b7593c3bd3da153c53b9624c1fd8a960cb3ebc
-size 599959
diff --git a/samples/datas/data/models/Sponza/glTF/7056944414013900257.jpg b/samples/datas/data/models/Sponza/glTF/7056944414013900257.jpg
deleted file mode 100644
index 35885a1..0000000
--- a/samples/datas/data/models/Sponza/glTF/7056944414013900257.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:231d919288db7c977fda3091549195c1bd5197e9e63c039e972da8764f5435c1
-size 844768
diff --git a/samples/datas/data/models/Sponza/glTF/715093869573992647.jpg b/samples/datas/data/models/Sponza/glTF/715093869573992647.jpg
deleted file mode 100644
index fc60f6d..0000000
--- a/samples/datas/data/models/Sponza/glTF/715093869573992647.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d81efcb42b3a044595ca984cb46d941b159064bddae9a43ed8d9582db68d6b47
-size 280745
diff --git a/samples/datas/data/models/Sponza/glTF/7268504077753552595.jpg b/samples/datas/data/models/Sponza/glTF/7268504077753552595.jpg
deleted file mode 100644
index 74e6d24..0000000
--- a/samples/datas/data/models/Sponza/glTF/7268504077753552595.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:430758549ba2189d94f06abeaae092bfc0a1d8c22afc56f5caf3f99c5ee7407c
-size 572245
diff --git a/samples/datas/data/models/Sponza/glTF/7441062115984513793.jpg b/samples/datas/data/models/Sponza/glTF/7441062115984513793.jpg
deleted file mode 100644
index 53c725d..0000000
--- a/samples/datas/data/models/Sponza/glTF/7441062115984513793.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9edc7c1c73661658cd8ed7733728002d45fecd17cb37a962fb654ff1d8c1933d
-size 665796
diff --git a/samples/datas/data/models/Sponza/glTF/755318871556304029.jpg b/samples/datas/data/models/Sponza/glTF/755318871556304029.jpg
deleted file mode 100644
index 149a0f1..0000000
--- a/samples/datas/data/models/Sponza/glTF/755318871556304029.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:9f849f0510ca0df66ba1cba2380a6a1b481444d9e64b68da6b2ce202b54d9cec
-size 302363
diff --git a/samples/datas/data/models/Sponza/glTF/759203620573749278.jpg b/samples/datas/data/models/Sponza/glTF/759203620573749278.jpg
deleted file mode 100644
index 4913251..0000000
--- a/samples/datas/data/models/Sponza/glTF/759203620573749278.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f296e43c0d4c92953d4899ea0c38e8af992ba471acc87feb10f08e29a94aaef6
-size 512035
diff --git a/samples/datas/data/models/Sponza/glTF/7645212358685992005.jpg b/samples/datas/data/models/Sponza/glTF/7645212358685992005.jpg
deleted file mode 100644
index af99619..0000000
--- a/samples/datas/data/models/Sponza/glTF/7645212358685992005.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:46ffc9123ee3ad94b2595843b4446fd67dbf5a2f79dc1e3b4e637f5ea4578630
-size 652476
diff --git a/samples/datas/data/models/Sponza/glTF/7815564343179553343.jpg b/samples/datas/data/models/Sponza/glTF/7815564343179553343.jpg
deleted file mode 100644
index 9825366..0000000
--- a/samples/datas/data/models/Sponza/glTF/7815564343179553343.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8ad0e8a9ca6de602225a527361bc718881de8741bc48927e27259a8803e7fed7
-size 623144
diff --git a/samples/datas/data/models/Sponza/glTF/8006627369776289000.png b/samples/datas/data/models/Sponza/glTF/8006627369776289000.png
deleted file mode 100644
index ba5f655..0000000
--- a/samples/datas/data/models/Sponza/glTF/8006627369776289000.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/Sponza/glTF/8051790464816141987.jpg b/samples/datas/data/models/Sponza/glTF/8051790464816141987.jpg
deleted file mode 100644
index 5c3770a..0000000
--- a/samples/datas/data/models/Sponza/glTF/8051790464816141987.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4f06c93f8e9f90be44a2e78847e57acec82bd793f58f7be7f86b088150730b88
-size 260119
diff --git a/samples/datas/data/models/Sponza/glTF/8114461559286000061.jpg b/samples/datas/data/models/Sponza/glTF/8114461559286000061.jpg
deleted file mode 100644
index cf4a888..0000000
--- a/samples/datas/data/models/Sponza/glTF/8114461559286000061.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:06c6480e207ce64f9e7c08df3f7f21638da7da43f77682657f4c823acd8c81a5
-size 193077
diff --git a/samples/datas/data/models/Sponza/glTF/8481240838833932244.jpg b/samples/datas/data/models/Sponza/glTF/8481240838833932244.jpg
deleted file mode 100644
index 4d53ec1..0000000
--- a/samples/datas/data/models/Sponza/glTF/8481240838833932244.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:1da7664b7b88ae58386a6e6b5eca2829537818061d704f002356d8fc483c1a28
-size 531156
diff --git a/samples/datas/data/models/Sponza/glTF/8503262930880235456.jpg b/samples/datas/data/models/Sponza/glTF/8503262930880235456.jpg
deleted file mode 100644
index 8976a20..0000000
--- a/samples/datas/data/models/Sponza/glTF/8503262930880235456.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c288a37ed8373d1132644873624b096a72ba81d03cda601e050a5de24ba13c39
-size 104626
diff --git a/samples/datas/data/models/Sponza/glTF/8747919177698443163.jpg b/samples/datas/data/models/Sponza/glTF/8747919177698443163.jpg
deleted file mode 100644
index dccdb78..0000000
--- a/samples/datas/data/models/Sponza/glTF/8747919177698443163.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8e90e94cadf80528a3df3496035d3c77900eba24d88b1c1d31c9dce77990fc44
-size 872255
diff --git a/samples/datas/data/models/Sponza/glTF/8750083169368950601.jpg b/samples/datas/data/models/Sponza/glTF/8750083169368950601.jpg
deleted file mode 100644
index 90aa719..0000000
--- a/samples/datas/data/models/Sponza/glTF/8750083169368950601.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:73a94a12fb0a9ab4c75e40996c9a2d49ac45ac18a8c8ae81d5ceb1c8ae52d6dc
-size 362437
diff --git a/samples/datas/data/models/Sponza/glTF/8773302468495022225.jpg b/samples/datas/data/models/Sponza/glTF/8773302468495022225.jpg
deleted file mode 100644
index d85686c..0000000
--- a/samples/datas/data/models/Sponza/glTF/8773302468495022225.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:dc5bf5f3091b548f1dfe40410b1aa1e2e55d82e2d77ba57dbd1f92955a0d8ff8
-size 413837
diff --git a/samples/datas/data/models/Sponza/glTF/8783994986360286082.jpg b/samples/datas/data/models/Sponza/glTF/8783994986360286082.jpg
deleted file mode 100644
index 52c8e41..0000000
--- a/samples/datas/data/models/Sponza/glTF/8783994986360286082.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:93d495e33d754c5723c910e322ac94108fc753b65af082a19be5252905aa741b
-size 388462
diff --git a/samples/datas/data/models/Sponza/glTF/9288698199695299068.jpg b/samples/datas/data/models/Sponza/glTF/9288698199695299068.jpg
deleted file mode 100644
index 833de50..0000000
--- a/samples/datas/data/models/Sponza/glTF/9288698199695299068.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7f55814430f289e89c7d675c3db925eee904fbc566ff83f4b49904de53138e98
-size 1044330
diff --git a/samples/datas/data/models/Sponza/glTF/9916269861720640319.jpg b/samples/datas/data/models/Sponza/glTF/9916269861720640319.jpg
deleted file mode 100644
index 59ec4fa..0000000
--- a/samples/datas/data/models/Sponza/glTF/9916269861720640319.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:81b21b9352f1fb9ccfeaf237f8547b985ddbf0cfd7ade7a4a8670b73a72b2cb5
-size 608687
diff --git a/samples/datas/data/models/Sponza/glTF/Sponza.bin b/samples/datas/data/models/Sponza/glTF/Sponza.bin
deleted file mode 100644
index 971accb..0000000
--- a/samples/datas/data/models/Sponza/glTF/Sponza.bin
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/Sponza/glTF/Sponza.gltf b/samples/datas/data/models/Sponza/glTF/Sponza.gltf
deleted file mode 100644
index 3168453..0000000
--- a/samples/datas/data/models/Sponza/glTF/Sponza.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e17c14edbc06b757dafcfed99f8815af9c5f5d9f9de3f0bc7740c37e68e0d829
-size 212504
diff --git a/samples/datas/data/models/Sponza/glTF/white.png b/samples/datas/data/models/Sponza/glTF/white.png
deleted file mode 100644
index 0851a35..0000000
--- a/samples/datas/data/models/Sponza/glTF/white.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/Sponza/screenshot/large.jpg b/samples/datas/data/models/Sponza/screenshot/large.jpg
deleted file mode 100644
index 50d6a09..0000000
--- a/samples/datas/data/models/Sponza/screenshot/large.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5c23f2064255e1dd6da53fb4f9b8da7d4808a17be722ee30670e2f21b64c3827
-size 885111
diff --git a/samples/datas/data/models/Sponza/screenshot/screenshot.jpg b/samples/datas/data/models/Sponza/screenshot/screenshot.jpg
deleted file mode 100644
index 458c089..0000000
--- a/samples/datas/data/models/Sponza/screenshot/screenshot.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3a9b3a8577c6b3b98aafd2c0b00c458b7cd311b52a0f2a341e6cc73e15b1275a
-size 31768
diff --git a/samples/datas/data/models/Untitled.png b/samples/datas/data/models/Untitled.png
deleted file mode 100644
index 8b6ada9..0000000
--- a/samples/datas/data/models/Untitled.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/agedplanks1-albedo.png b/samples/datas/data/models/agedplanks1-albedo.png
deleted file mode 100644
index f52a82a..0000000
--- a/samples/datas/data/models/agedplanks1-albedo.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/agedplanks1-normal4-ue.png b/samples/datas/data/models/agedplanks1-normal4-ue.png
deleted file mode 100644
index 185b6ac..0000000
--- a/samples/datas/data/models/agedplanks1-normal4-ue.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/chess.gltf b/samples/datas/data/models/chess.gltf
deleted file mode 100644
index 4f42cd5..0000000
--- a/samples/datas/data/models/chess.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a021b7609d4fbc590c4ffe495e3496cd2204f2c226f7f4d5c9421d4a3f8d2eb5
-size 3407650
diff --git a/samples/datas/data/models/cube.gltf b/samples/datas/data/models/cube.gltf
deleted file mode 100644
index 7d72524..0000000
--- a/samples/datas/data/models/cube.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:87aed37664ba8a792a79e0245c07ce34babcaa40abf94e469234e44cb8ecc9df
-size 3663
diff --git a/samples/datas/data/models/green-ceramic-tiles_basecolor.png b/samples/datas/data/models/green-ceramic-tiles_basecolor.png
deleted file mode 100644
index af3a519..0000000
--- a/samples/datas/data/models/green-ceramic-tiles_basecolor.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/green-ceramic-tiles_normal-dx.png b/samples/datas/data/models/green-ceramic-tiles_normal-dx.png
deleted file mode 100644
index be466d1..0000000
--- a/samples/datas/data/models/green-ceramic-tiles_normal-dx.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/icosphere.gltf b/samples/datas/data/models/icosphere.gltf
deleted file mode 100644
index ef72668..0000000
--- a/samples/datas/data/models/icosphere.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3720ae8e6ce9ceb1669396453ea1107575146494588b2e52463020e7ca9cf4d4
-size 34170
diff --git a/samples/datas/data/models/oxidized-copper-albedo.png b/samples/datas/data/models/oxidized-copper-albedo.png
deleted file mode 100644
index 42ceea7..0000000
--- a/samples/datas/data/models/oxidized-copper-albedo.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/oxidized-copper-normal-ue.png b/samples/datas/data/models/oxidized-copper-normal-ue.png
deleted file mode 100644
index 498e389..0000000
--- a/samples/datas/data/models/oxidized-copper-normal-ue.png
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/shadow.bin b/samples/datas/data/models/shadow.bin
deleted file mode 100644
index b332f19..0000000
--- a/samples/datas/data/models/shadow.bin
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/shadow.glb b/samples/datas/data/models/shadow.glb
deleted file mode 100644
index 63d5bf9..0000000
--- a/samples/datas/data/models/shadow.glb
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:cfb8aee60b56b163b91fabdf39c6956498d1cf3a3780db1a0c92b0671f4ccfe0
-size 33552
diff --git a/samples/datas/data/models/shadow.gltf b/samples/datas/data/models/shadow.gltf
deleted file mode 100644
index 62b6133..0000000
--- a/samples/datas/data/models/shadow.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a516145efb32792dbf6422ef2f6e5cd0907765584ee083a1f47cf6a94c503fb6
-size 13832
diff --git a/samples/datas/data/models/shadow2.gltf b/samples/datas/data/models/shadow2.gltf
deleted file mode 100644
index 82bf335..0000000
--- a/samples/datas/data/models/shadow2.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:4e2e77f34b0c623f58d2e07eed7a03100f9d09034cc6bfa4ec907105137ee714
-size 11207
diff --git a/samples/datas/data/models/untitled.bin b/samples/datas/data/models/untitled.bin
deleted file mode 100644
index 621d5e6..0000000
--- a/samples/datas/data/models/untitled.bin
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/models/untitled.glb b/samples/datas/data/models/untitled.glb
deleted file mode 100644
index 6644bde..0000000
--- a/samples/datas/data/models/untitled.glb
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a3af167e98ae6e39487b39bff0c9631e5fa246d9f97c8e1d8f7318edbe41d1eb
-size 2216
diff --git a/samples/datas/data/models/untitled.gltf b/samples/datas/data/models/untitled.gltf
deleted file mode 100644
index 31670a5..0000000
--- a/samples/datas/data/models/untitled.gltf
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ac5f07807d147c9adee8898cac57b977c5130df73847b0fc0adafbb8d495e505
-size 9717
diff --git a/samples/datas/data/textures/cubemap_yokohama_bc3_unorm.ktx b/samples/datas/data/textures/cubemap_yokohama_bc3_unorm.ktx
deleted file mode 100644
index b6de879..0000000
--- a/samples/datas/data/textures/cubemap_yokohama_bc3_unorm.ktx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:98353ab52af596027d924bef8110157c09b7a7a7f7c5e9db95586957af37616f
-size 8388908
diff --git a/samples/datas/data/textures/empty.ktx b/samples/datas/data/textures/empty.ktx
deleted file mode 100644
index b21a8ed..0000000
--- a/samples/datas/data/textures/empty.ktx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:05242a012e514766da53a265d378545b7b24cea9cd6bdc0616d1e79de5112379
-size 104
diff --git a/samples/datas/data/textures/gcanyon_cube.ktx b/samples/datas/data/textures/gcanyon_cube.ktx
deleted file mode 100644
index 9f266ef..0000000
--- a/samples/datas/data/textures/gcanyon_cube.ktx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c1fc35f4a7a690785f09a384538ccf1214c3dd7176ed061e41168ffd9fe59644
-size 67108956
diff --git a/samples/datas/data/textures/papermill.ktx b/samples/datas/data/textures/papermill.ktx
deleted file mode 100644
index 24589f3..0000000
--- a/samples/datas/data/textures/papermill.ktx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2ad269b9e81e8cb9489dba6a2c61f2063b46b450146e2344e6d6e1da2ce60626
-size 16777304
diff --git a/samples/datas/data/textures/pisa_cube.ktx b/samples/datas/data/textures/pisa_cube.ktx
deleted file mode 100644
index e0e0681..0000000
--- a/samples/datas/data/textures/pisa_cube.ktx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6f6044986602e11a40c6b32719e292678f2cbfae7313f1aa795bd1c31d1f4d51
-size 67108956
diff --git a/samples/datas/data/textures/rgba-reference.ktx b/samples/datas/data/textures/rgba-reference.ktx
deleted file mode 100755
index 1033d07..0000000
--- a/samples/datas/data/textures/rgba-reference.ktx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b9b54dafa5acbec7ce6d12bd8760002cfb0d297967e7be448ecfe924a1fd292a
-size 65604
diff --git a/samples/datas/data/textures/tex.astc b/samples/datas/data/textures/tex.astc
deleted file mode 100644
index 6756ffb..0000000
--- a/samples/datas/data/textures/tex.astc
+++ /dev/null
Binary files differ
diff --git a/samples/datas/data/textures/tex256.jpg b/samples/datas/data/textures/tex256.jpg
deleted file mode 100644
index b43c873..0000000
--- a/samples/datas/data/textures/tex256.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a202a6370f0262813145ba36ae5cc5c95743c8d5cbb64bc96356f3c052d85fcb
-size 24665
diff --git a/samples/datas/data/textures/texspace256.jpg b/samples/datas/data/textures/texspace256.jpg
deleted file mode 100644
index c05780e..0000000
--- a/samples/datas/data/textures/texspace256.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d40ba8850e16ffac67cd3ddba16d8ca78cd49b4a6a0e0ac2b02f168f64e64d50
-size 3952
diff --git a/samples/datas/data/textures/texture.jpg b/samples/datas/data/textures/texture.jpg
deleted file mode 100644
index b8c47a5..0000000
--- a/samples/datas/data/textures/texture.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2a18c0096711fde01b65a0b5913ddaec2679bc804c2ea85eb35eb89c2f405bf8
-size 324880
diff --git a/samples/datas/data/textures/texturearray_rocks_bc3_unorm.ktx b/samples/datas/data/textures/texturearray_rocks_bc3_unorm.ktx
deleted file mode 100644
index 817e511..0000000
--- a/samples/datas/data/textures/texturearray_rocks_bc3_unorm.ktx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a8f116fb09c606c305393b4f67669fd64f14f50568ce3f24529f8e5dab068ea5
-size 1747896
diff --git a/samples/datas/data/textures/uffizi_cube.ktx b/samples/datas/data/textures/uffizi_cube.ktx
deleted file mode 100644
index 56e6bc4..0000000
--- a/samples/datas/data/textures/uffizi_cube.ktx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a7ea222f182a2bc9012eb6b3af13bb32b72c7cc1219326757292142bc67246f3
-size 67108956
diff --git a/samples/datas/data/tiger.svg b/samples/datas/data/tiger.svg
deleted file mode 100644
index 67ba636..0000000
--- a/samples/datas/data/tiger.svg
+++ /dev/null
@@ -1,725 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg id="svg2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 900" version="1.1">
- <g id="g4" fill="none" transform="matrix(1.7656463,0,0,1.7656463,324.90716,255.00942)">
- <g id="g6" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path8" d="m-122.3,84.285s0.1,1.894-0.73,1.875c-0.82-0.019-17.27-48.094-37.8-45.851,0,0,17.78-7.353,38.53,43.976z"/>
- </g>
- <g id="g10" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path12" d="m-118.77,81.262s-0.55,1.816-1.32,1.517c-0.77-0.298,0.11-51.104-19.95-55.978,0,0,19.22-0.864,21.27,54.461z"/>
- </g>
- <g id="g14" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path16" d="m-91.284,123.59s1.636,0.96,1.166,1.64c-0.471,0.67-49.642-12.13-59.102,6.23,0,0,3.68-18.89,57.936-7.87z"/>
- </g>
- <g id="g18" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path20" d="m-94.093,133.8s1.856,0.4,1.622,1.19c-0.233,0.79-50.939,4.13-54.129,24.53,0,0-2.46-19.08,52.507-25.72z"/>
- </g>
- <g id="g22" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path24" d="m-98.304,128.28s1.778,0.66,1.432,1.41-50.998-3.34-57.128,16.37c0,0,0.35-19.24,55.696-17.78z"/>
- </g>
- <g id="g26" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path28" d="m-109.01,110.07s1.31,1.38,0.67,1.9-44.38-25.336-58.53-10.29c0,0,8.74-17.147,57.86,8.39z"/>
- </g>
- <g id="g30" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path32" d="m-116.55,114.26s1.45,1.22,0.88,1.81c-0.58,0.59-46.97-20.148-59.32-3.6,0,0,6.74-18.023,58.44,1.79z"/>
- </g>
- <g id="g34" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path36" d="m-119.15,118.34s1.6,1,1.11,1.67c-0.49,0.66-49.27-13.56-59.25,4.51,0,0,4.22-18.77,58.14-6.18z"/>
- </g>
- <g id="g38" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path40" d="m-108.42,118.95s1.12,1.53,0.42,1.97c-0.7,0.43-40.77-30.818-56.73-17.71,0,0,10.87-15.884,56.31,15.74z"/>
- </g>
- <g id="g42" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path44" d="m-128.2,90s0.6,1.8-0.2,2-29.4-41.8-48.6-34.2c0,0,15.2-11.8,48.8,32.2z"/>
- </g>
- <g id="g46" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path48" d="m-127.5,96.979s0.97,1.629,0.23,1.996c-0.74,0.368-37.72-34.476-54.83-22.914,0,0,12.3-14.8,54.6,20.918z"/>
- </g>
- <g id="g50" stroke-width="0.17200001" stroke="#000" fill="#FFF">
- <path id="path52" d="m-127.62,101.35s1.12,1.53,0.42,1.97c-0.7,0.43-40.77-30.818-56.73-17.713,0,0,10.87-15.881,56.31,15.743z"/>
- </g>
- <g id="g54" stroke="#000" fill="#FFF">
- <path id="path56" d="m-129.83,103.06c0.5,6.05,1.49,12.62,3.23,15.74,0,0-3.6,12.4,5.2,25.6,0,0-0.4,7.2,1.2,10.4,0,0,4,8.4,8.8,9.2,3.88,0.65,12.607,3.72,22.468,5.12,0,0,17.132,14.08,13.932,26.88,0,0-0.4,16.4-4,18,0,0,11.6-11.2,2,5.6l-4.4,18.8s25.6-21.6,10-3.2l-10,26s19.6-18.4,12.4-10l-3.2,8.8s43.2-27.2,12.4,2.4c0,0,8-3.6,12.4-0.8,0,0,6.8-1.2,6,0.4,0,0-20.8,10.4-24.4,28.8,0,0,8.4-10,5.2,0.8l0.4,11.6s4-21.6,3.6,16c0,0,19.2-18,7.6,2.8v16.8s15.2-16.4,8.8-3.6c0,0,10-8.8,6,6.4,0,0-0.8,10.4,3.6-0.8,0,0,16-30.6,10-4.4,0,0-0.8,19.2,4,4.4,0,0,0.4,10.4,9.6,17.6,0,0-1.2-50.8,11.6-14.8l4,16.4s2.8-9.2,2.4-14.4l8,8s15.2-22.8,12-9.6c0,0-7.6,16-6,20.8,0,0,16.8-34.8,18-36.4,0,0-2,42.4,8.8,6.4,0,0,5.6,12,2.8,16.4,0,0,8-8,7.2-11.2,0,0,4.6-8.2,7.4,5.4,0,0,1.8,9.4,3.4,6.2,0,0,4,24,5.2,1.2,0,0,1.6-13.6-5.6-25.2,0,0,0.8-3.2-2-7.2,0,0,13.6,21.6,6.4-7.2,0,0,11.201,8,12.401,8,0,0-13.601-23.2-4.801-18.4,0,0-5.2-10.4,12.801,1.6,0,0-16.001-16,1.6-6.4,0,0,7.999,6.4,0.4-3.6,0,0-14.401-16,7.599,2,0,0,11.6,16.4,12.4,19.2,0,0-10-29.2-14.4-32,0,0,8.4-36.4,49.6-20.8,0,0,6.8,17.2,11.2-1.2,0,0,12.8-6.4,24,21.2,0,0,4-13.6,3.2-16.4,0,0,6.8,1.2,6,0,0,0,13.2,4.4,14.4,3.6,0,0,6.8,6.8,7.2,3.2,0,0,9.2,2.8,7.2-0.8,0,0,8.8,15.6,9.2,19.2l2.4-14,2,2.8s1.6-7.6,0.8-8.8,20,6.8,24.8,27.6l2,8.4s6-14.8,4.4-18.8c0,0,5.2,0.8,5.6,5.2,0,0,4-23.2-0.8-29.2,0,0,4.4-0.8,5.6,2.8v-7.2s7.2,0.8,7.2-1.6c0,0,4.4-4,6.4,0.8,0,0-12.4-35.2,6-16,0,0,7.2,10.8,3.6-8s-7.6-20.4-2.8-20.8c0,0,0.8-3.6-1.2-5.2s1.2,0,1.2,0,4.8,4-0.4-18c0,0,6.4,1.6-5.6-27.6,0,0,2.8-2.4-1.2-10.8,0,0,8,4.4,10.8,2.8,0,0-0.4-1.6-3.6-5.6,0,0-21.6-54.8-1.2-32.8,0,0,11.85,13.55,5.45-9.25,0,0-9.11-24.009-8.33-28.305l-429.55,23.015z"/>
- </g>
- <g id="g58" stroke="#000" fill="#cc7226">
- <path id="path60" d="m299.72,80.245c0.62,0.181,2.83,1.305,4.08,2.955,0,0,6.8,10.8,1.6-7.6,0,0-9.2-28.8-0.4-17.6,0,0,6,7.2,2.8-6.4-3.86-16.427-6.4-22.8-6.4-22.8s11.6,4.8-15.2-34.8l8.8,3.6s-19.6-39.6-41.2-44.8l-8-6s38.4-38,25.6-74.8c0,0-6.8-5.2-16.4,4,0,0-6.4,4.8-12.4,3.2,0,0-30.8,1.2-32.8,1.2s-36.8-37.2-102.4-19.6c0,0-5.2,2-9.599,0.8,0,0-18.401-16-67.201,6.8,0,0-10,2-11.6,2s-4.4,0-12.4,6.4-8.4,7.2-10.4,8.8c0,0-16.4,11.2-21.2,12,0,0-11.6,6.4-16,16.4l-3.6,1.2s-1.6,7.2-2,8.4c0,0-4.8,3.6-5.6,9.2,0,0-8.8,6-8.4,10.4,0,0-1.6,5.2-2.4,10,0,0-7.2,4.8-6.4,7.6,0,0-7.6,14-6.4,20.8,0,0-6.4-0.4-9.2,2,0,0-0.8,4.8-2.4,5.2,0,0-2.8,1.2-0.4,5.2,0,0-1.6,2.8-2,4.4,0,0,0.8,2.8-3.6,8.4,0,0-6.4,18.8-4.4,24,0,0,0.4,4.8-2.4,6.4,0,0-3.6-0.4,4.8,11.6,0,0,0.8,1.2-2.4,3.6,0,0-17.2,3.6-19.6,20,0,0-13.6,14.8-13.6,20,0,2.305,0.27,5.452,0.97,10.06,0,0-0.57,8.34,27.03,9.14s402.72-31.355,402.72-31.355z"/>
- </g>
- <g id="g62" fill="#cc7226">
- <path id="path64" d="m-115.6,102.6c-25-39.4-10.6,17-10.6,17,8.8,34.4,138.4-3.2,138.4-3.2s168.8-30.4,180-34.4,106.4,2.4,106.4,2.4l-5.6-16.8c-64.8-46.4-84-23.2-97.6-27.2s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2-31.74-22.951-16.8,8.8c16,34-58.4,39.2-75.2,28s7.2,18.4,7.2,18.4c18.4,20-16,3.2-16,3.2-34.4-12.8-58.4,12.8-61.6,13.6s-8,4-8.8-2.4-8.31-23.101-40,3.2c-20,16.6-33.8-5.4-33.8-5.4l-2.8,11.6z"/>
- </g>
- <g id="g66" fill="#e87f3a">
- <path id="path68" d="m133.51,25.346c-6.4,0.8-31.77-22.939-16.8,8.8,16.6,35.2-58.4,39.2-75.2,28-16.801-11.2,7.2,18.4,7.2,18.4,18.4,20.004-16.001,3.2-16.001,3.2-34.4-12.8-58.4,12.8-61.6,13.6s-8,4.004-8.8-2.4c-0.8-6.4-8.179-22.934-40,3.2-21.236,17.344-34.729-4.109-34.729-4.109l-3.2,10.113c-25-39.804-9.93,18.51-9.93,18.51,8.81,34.4,139.06-4.51,139.06-4.51s168.8-30.404,180-34.404,105.53,2.327,105.53,2.327l-5.53-17.309c-64.8-46.4-83.2-22.618-96.8-26.618s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z"/>
- </g>
- <g id="g70" fill="#ea8c4d">
- <path id="path72" d="m134.82,27.091c-6.4,0.8-31.14-23.229-16.8,8.8,16.2,36.201-58.401,39.201-75.201,28.001s7.2,18.4,7.2,18.4c18.4,19.998-16,3.2-16,3.2-34.4-12.8-58.401,12.8-61.601,13.6s-8,3.998-8.8-2.4c-0.8-6.4-8.048-22.767-40,3.2-22.473,18.088-35.658-2.818-35.658-2.818l-3.6,8.616c-23.8-38.998-9.25,20.02-9.25,20.02,8.8,34.4,139.71-5.82,139.71-5.82s168.8-30.398,180-34.398,104.65,2.254,104.65,2.254l-5.45-17.818c-64.8-46.4-82.4-22.037-96-26.037s-11.2,5.6-14.4,6.401c-3.2,0.8-42.4-24.001-48.8-23.201z"/>
- </g>
- <g id="g74" fill="#ec9961">
- <path id="path76" d="m136.13,28.837c-6.4,0.8-31.13-23.232-16.8,8.8,16.8,37.556-58.936,38.845-75.202,28-16.8-11.2,7.2,18.4,7.2,18.4,18.4,20.003-16,3.2-16,3.2-34.4-12.8-58.4,12.803-61.6,13.603s-8,4-8.8-2.403c-0.8-6.4-7.917-22.598-40.001,3.203-23.709,18.83-36.587-1.53-36.587-1.53l-4,7.13c-21.8-36.803-8.58,21.52-8.58,21.52,8.8,34.4,140.37-7.12,140.37-7.12s168.8-30.403,180-34.403,103.78,2.182,103.78,2.182l-5.38-18.327c-64.8-46.401-81.6-21.455-95.2-25.455s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z"/>
- </g>
- <g id="g78" fill="#eea575">
- <path id="path80" d="m137.44,30.583c-6.4,0.8-30.63-23.454-16.8,8.8,16.8,39.2-58.403,39.2-75.203,28s7.2,18.4,7.2,18.4c18.4,19.997-16,3.2-16,3.2-34.4-12.8-58.4,12.797-61.6,13.597s-8,4-8.8-2.4c-0.8-6.397-7.785-22.428-40,3.2-24.946,19.58-37.507-0.23-37.507-0.23l-4.4,5.63c-19.8-34.798-7.91,23.04-7.91,23.04,8.8,34.4,141.02-8.44,141.02-8.44s168.8-30.397,180-34.397,102.91,2.109,102.91,2.109l-5.31-18.837c-64.8-46.4-80.8-20.872-94.4-24.872s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z"/>
- </g>
- <g id="g82" fill="#f1b288">
- <path id="path84" d="m138.75,32.328c-6.4,0.8-32.37-22.651-16.8,8.8,19.2,38.8-58.404,39.2-75.204,28s7.2,18.4,7.2,18.4c18.4,20.002-16,3.2-16,3.2-34.4-12.8-58.4,12.802-61.6,13.602s-8,4-8.8-2.4c-0.8-6.402-7.654-22.265-40,3.2-26.182,20.33-38.436,1.05-38.436,1.05l-4.8,4.15c-18-33.202-7.24,24.54-7.24,24.54,8.8,34.4,141.68-9.74,141.68-9.74s168.8-30.402,180-34.402,102.03,2.036,102.03,2.036l-5.23-19.345c-64.8-46.4-80-20.291-93.6-24.291s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z"/>
- </g>
- <g id="g86" fill="#f3bf9c">
- <path id="path88" d="m140.06,34.073c-6.4,0.8-32.75-22.46-16.8,8.8,20.4,40.001-58.405,39.201-75.205,28.001s7.2,18.4,7.2,18.4c18.4,19.996-16,3.2-16,3.2-34.4-12.8-58.4,12.796-61.6,13.596s-8,4-8.8-2.4c-0.8-6.396-7.523-22.092-40,3.2-27.419,21.08-39.365,2.35-39.365,2.35l-5.2,2.65c-16-30.196-6.56,26.06-6.56,26.06,8.8,34.4,142.32-11.06,142.32-11.06s168.8-30.396,180-34.396,101.16,1.963,101.16,1.963l-5.16-19.854c-64.8-46.4-79.2-19.709-92.8-23.709-13.6-4.001-11.2,5.6-14.4,6.4s-42.4-24.001-48.8-23.201z"/>
- </g>
- <g id="g90" fill="#f5ccb0">
- <path id="path92" d="m141.36,35.819c-6.4,0.8-33.84-21.875-16.8,8.8,22,39.6-58.396,39.2-75.196,28s7.2,18.4,7.2,18.4c18.4,20.001-16,3.2-16,3.2-34.4-12.8-58.4,12.801-61.6,13.601s-8,4-8.8-2.4c-0.8-6.401-7.391-21.928-40,3.2-28.655,21.82-40.294,3.64-40.294,3.64l-5.6,1.16c-14.4-28.401-5.89,27.56-5.89,27.56,8.8,34.4,142.98-12.36,142.98-12.36s168.8-30.401,180-34.401,100.3,1.891,100.3,1.891l-5.1-20.364c-64.8-46.4-78.4-19.127-92-23.127s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z"/>
- </g>
- <g id="g94" fill="#f8d8c4">
- <path id="path96" d="m142.67,37.565c-6.4,0.8-33.84-21.876-16.8,8.8,22,39.6-58.396,39.2-75.196,28s7.2,18.4,7.2,18.4c18.4,19.995-16,3.2-16,3.2-34.401-12.8-58.401,12.795-61.601,13.595s-8,4-8.8-2.4-7.259-21.755-40,3.2c-29.891,22.57-41.213,4.93-41.213,4.93l-6-0.33c-13.61-26.396-5.22,29.08-5.22,29.08,8.8,34.4,143.63-13.68,143.63-13.68s168.8-30.395,180-34.395,99.42,1.818,99.42,1.818l-5.01-20.873c-64.81-46.4-77.61-18.545-91.21-22.545s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z"/>
- </g>
- <g id="g98" fill="#fae5d7">
- <path id="path100" d="m143.98,39.31c-6.4,0.8-33.45-22.087-16.8,8.8,22,40.8-58.397,39.2-75.197,28s7.2,18.4,7.2,18.4c18.4,20-16,3.2-16,3.2-34.4-12.8-58.4,12.8-61.6,13.6-3.201,0.8-8.001,4-8.801-2.4s-7.128-21.592-40,3.2c-31.127,23.31-42.142,6.22-42.142,6.22l-6.4-1.82c-13-24-4.55,30.58-4.55,30.58,8.8,34.4,144.29-14.98,144.29-14.98s168.8-30.4,180-34.4,98.55,1.746,98.55,1.746l-4.95-21.382c-64.8-46.401-76.8-17.964-90.4-21.964s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z"/>
- </g>
- <g id="g102" fill="#fcf2eb">
- <path id="path104" d="m145.29,41.055c-6.4,0.8-32.37-22.644-16.8,8.8,21.2,42.801-58.398,39.201-75.198,28.001s7.2,18.4,7.2,18.4c18.4,20.004-16,3.2-16,3.2-34.4-12.8-58.4,12.804-61.6,13.604s-8,4-8.8-2.4-6.997-21.428-40,3.2c-32.365,24.05-43.072,7.5-43.072,7.5l-6.8-3.3c-12.8-23.204-3.87,32.09-3.87,32.09,8.8,34.4,144.94-16.29,144.94-16.29s168.8-30.4,180-34.404c11.2-4,97.67,1.674,97.67,1.674l-4.87-21.893c-64.8-46.4-76-17.381-89.6-21.381-13.6-4.001-11.2,5.6-14.4,6.4s-42.4-24.001-48.8-23.201z"/>
- </g>
- <g id="g106" fill="#FFF">
- <path id="path108" d="m-115.8,119.6c-12.8-22-3.2,33.6-3.2,33.6,8.8,34.4,145.6-17.6,145.6-17.6s168.8-30.4,180-34.4,96.8,1.6,96.8,1.6l-4.8-22.4c-64.8-46.4-75.2-16.8-88.8-20.8s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2-31.62-23.007-16.8,8.8c22.23,47.707-60.759,37.627-75.2,28-16.8-11.2,7.2,18.4,7.2,18.4,18.4,20-16,3.2-16,3.2-34.4-12.8-58.4,12.8-61.6,13.6s-8,4-8.8-2.4-6.865-21.256-40,3.2c-33.6,24.8-44,8.8-44,8.8l-7.2-4.8z"/>
- </g>
- <g id="g110" fill="#000">
- <path id="path112" d="m-74.2,149.6s-7.2,11.6,13.6,24.8c0,0,1.4,1.4-16.6-2.8,0,0-6.2-2-7.8-12.4,0,0-4.8-4.4-9.6-10s20.4,0.4,20.4,0.4z"/>
- </g>
- <g id="g114" fill="#CCC">
- <path id="path116" d="m65.8,102s17.698,26.82,17.1,31.6c-1.3,10.4-1.5,20,1.7,24,3.201,4,12.001,37.2,12.001,37.2s-0.4,1.2,11.999-36.8c0,0,11.6-16-8.4-34.4,0,0-35.2-28.8-34.4-21.6z"/>
- </g>
- <g id="g118" fill="#000">
- <path id="path120" d="m-54.2,176.4s11.2,7.2-3.2,38.4l6.4-2.4s-0.8,11.2-4,13.6l7.2-3.2s4.8,8,0.8,12.8c0,0,16.8,8,16,14.4,0,0,6.4-8,2.4-14.4s-11.2-2.4-10.4-20.8l-8.8,3.2s5.6-8.8,5.6-15.2l-8,2.4s15.469-26.58,4.8-28c-6-0.8-8.8-0.8-8.8-0.8z"/>
- </g>
- <g id="g122" fill="#CCC">
- <path id="path124" d="m-21.8,193.2s2.8-4.4,0-3.6-34,15.6-40,25.2c0,0,34.4-24.4,40-21.6z"/>
- </g>
- <g id="g126" fill="#CCC">
- <path id="path128" d="m-11.4,201.2s2.8-4.4,0-3.6-34,15.6-40,25.2c0,0,34.4-24.4,40-21.6z"/>
- </g>
- <g id="g130" fill="#CCC">
- <path id="path132" d="m1.8,186s2.8-4.4,0-3.6-34,15.6-40,25.2c0,0,34.4-24.4,40-21.6z"/>
- </g>
- <g id="g134" fill="#CCC">
- <path id="path136" d="m-21.4,229.6s0-6-2.8-5.2-38.8,18.4-44.8,28c0,0,42-25.6,47.6-22.8z"/>
- </g>
- <g id="g138" fill="#CCC">
- <path id="path140" d="m-20.2,218.8s1.2-4.8-1.6-4c-2,0-28.4,11.6-34.4,21.2,0,0,29.6-21.6,36-17.2z"/>
- </g>
- <g id="g142" fill="#CCC">
- <path id="path144" d="m-34.6,266.4-10,7.6s10.4-7.6,14-6.4c0,0-6.8,11.2-7.6,16.4,0,0,10.4-12.8,16-12.4,0,0,7.6,0.4,7.6,11.2,0,0,5.6-10.4,8.8-10,0,0,1.2,6.4,0,13.2,0,0,4-7.6,8-6,0,0,6.4-2,5.6,9.6,0,0,0,10.4-0.8,13.2,0,0,5.6-26.4,8-26.8,0,0,8-1.2,12.8,7.6,0,0-4-7.6,0.8-5.6,0,0,10.8,1.6,14,8.4,0,0-6.8-12-1.2-8.8l8,6.4s8.4,21.2,10.4,22.8c0,0-7.6-21.6-6-21.6,0,0-2-12,3.2,2.8,0,0-3.2-14,2.4-13.2s10,10.8,18.4,8.4c0,0,9.601,5.6,11.601-63.6l-124,46.8z"/>
- </g>
- <g id="g146" fill="#000">
- <path id="path148" d="m-29.8,173.6s14.8-6,54.8,0c0,0,7.2,0.4,14-8.4s33.6-16,40-14l9.601,6.4,0.8,1.2s12.399,10.4,12.799,18-14.399,55.6-24,71.6c-9.6,16-19.2,28.4-38.4,26,0,0-20.8-4-46.4,0,0,0-29.2-1.6-32-9.6s11.2-23.2,11.2-23.2,4.4-8.4,3.2-22.8-0.8-42.4-5.6-45.2z"/>
- </g>
- <g id="g150" fill="#e5668c">
- <path id="path152" d="M-7.8,175.6c8.4,18.4-21.2,83.6-21.2,83.6-2,1.6,12.66,7.65,22.8,5.2,10.946-2.64,51.2,1.6,51.2,1.6,23.6-15.6,36.4-60,36.4-60s10.401-24-7.2-27.2c-17.6-3.2-82-3.2-82-3.2z"/>
- </g>
- <g id="g154" fill="#b23259">
- <path id="path156" d="m-9.831,206.5c3.326-12.79,4.91-24.59,2.031-30.9,0,0,62.4,6.4,73.6-14.4,4.241-7.87,19.001,22.8,18.6,32.4,0,0-63,14.4-77.8,3.2l-16.431,9.7z"/>
- </g>
- <g id="g158" fill="#a5264c">
- <path id="path160" d="m-5.4,222.8s2,7.2-0.4,11.2c0,0-1.6,0.8-2.8,1.2,0,0,1.2,3.6,7.2,5.2,0,0,2,4.4,4.4,4.8s7.2,6,11.2,4.8,15.2-5.2,15.2-5.2,5.6-3.2,14.4,0.4c0,0,2.375-0.8,2.8-4.8,0.5-4.7,3.6-8.4,5.6-10.4s11.6-14.8,10.4-15.2-68,8-68,8z"/>
- </g>
- <g id="g162" stroke="#000" fill="#ff727f">
- <path id="path164" d="m-9.8,174.4s-2.8,22.4,0.4,30.8,2.4,10.4,1.6,14.4,3.6,14,9.2,20l12,1.6s15.2-3.6,24.4-0.8c0,0,8.994,1.34,12.4-13.6,0,0,4.8-6.4,12-9.2s14.4-44.4,10.4-52.4-18.4-12.4-34.4,3.2-18-1.2-48,6z"/>
- </g>
- <g id="g166" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path168" d="m-8.2,249.2s-0.8-2-5.2-2.4c0,0-22.4-3.6-30.8-16,0,0-6.8-5.6-2.4,6,0,0,10.4,20.4,17.2,23.2,0,0,16.4,4,21.2-10.8z"/>
- </g>
- <g id="g170" fill="#cc3f4c">
- <path id="path172" d="m71.742,185.23c0.659-7.91,2.612-16.52,0.858-20.03-6.446-12.89-23.419-7.5-34.4,3.2-16,15.6-18-1.2-48,6,0,0-1.745,13.96-0.905,23.98,0,0,37.305-11.58,38.105-5.98,0,0,1.6-3.2,10.8-3.2s31.942-1.17,33.542-3.97z"/>
- </g>
- <g id="g174" stroke-width="2" stroke="#a51926">
- <path id="path176" d="m28.6,175.2s4.8,4.8,1.2,14.4c0,0-14.4,16-12.4,30"/>
- </g>
- <g id="g178" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path180" d="m-19.4,260s-4.4-12.8,4.4-6l3.6,3.6c-1.2,1.6-6.8,5.6-8,2.4z"/>
- </g>
- <g id="g182" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path184" d="m-14.36,261.2s-3.52-10.24,3.52-4.8l2.88,2.88c-4.56,1.28,0,3.84-6.4,1.92z"/>
- </g>
- <g id="g186" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path188" d="m-9.56,261.2s-3.52-10.24,3.52-4.8l2.88,2.88c-3.36,1.28,0,3.84-6.4,1.92z"/>
- </g>
- <g id="g190" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path192" d="m-2.96,261.4s-3.52-10.24,3.52-4.8c0,0,4.383,2.33,2.881,2.88-2.961,1.08,0,3.84-6.401,1.92z"/>
- </g>
- <g id="g194" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path196" d="m3.52,261.32s-3.52-10.24,3.521-4.8l2.88,2.88c-0.96,1.28,0,3.84-6.401,1.92z"/>
- </g>
- <g id="g198" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path200" d="m10.2,262s-4.8-12.4,4.4-6l3.6,3.6c-1.2,1.6,0,4.8-8,2.4z"/>
- </g>
- <g id="g202" stroke-width="2" stroke="#a5264c">
- <path id="path204" d="m-18.2,244.8s13.2-2.8,19.2,0.4c0,0,6,1.2,7.2,0.8s4.4-0.8,4.4-0.8"/>
- </g>
- <g id="g206" stroke-width="2" stroke="#a5264c">
- <path id="path208" d="m15.8,253.6s12-13.6,24-9.2c7.016,2.57,6-0.8,6.8-3.6s1-7,6-10"/>
- </g>
- <g id="g210" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path212" d="m33,237.6s-4-10.8-6.8,2-6,16.4-7.6,19.2c0,0,0,5.2,8.4,4.8,0,0,10.8-0.4,11.2-3.2s-1.2-14.4-5.2-22.8z"/>
- </g>
- <g id="g214" stroke-width="2" stroke="#a5264c">
- <path id="path216" d="m47,244.8s3.6-2.4,6-1.2"/>
- </g>
- <g id="g218" stroke-width="2" stroke="#a5264c">
- <path id="path220" d="m53.5,228.4s2.9-4.9,7.7-5.7"/>
- </g>
- <g id="g222" fill="#b2b2b2">
- <path id="path224" d="m-25.8,265.2s18,3.2,22.4,1.6l0.4,2-20.8-1.2s-11.6-5.6-2-2.4z"/>
- </g>
- <g id="g226" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path228" d="m-11.8,172,19.6,0.8s7.2,30.8,3.6,38.4c0,0-1.2,2.8-4-2.8,0,0-18.4-32.8-21.6-34.8s1.2-1.6,2.4-1.6z"/>
- </g>
- <g id="g230" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path232" d="m-88.9,169.3s8.9,1.7,21.5,4.3c0,0,4.8,22.4,8,27.2s-0.4,4.8-4,2-18.4-16.8-20.4-21.2-5.1-12.3-5.1-12.3z"/>
- </g>
- <g id="g234" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path236" d="m-67.039,173.82s5.8,1.55,6.809,3.76c1.008,2.22-1.202,5.51-1.202,5.51s-1,3.31-2.202,1.15c-1.202-2.17-4.074-9.83-3.405-10.42z"/>
- </g>
- <g id="g238" fill="#000">
- <path id="path240" d="m-67,173.6s3.6,5.2,7.2,5.2,3.982-0.41,6.8,0.2c4.6,1,4.2-1,10.8,0.2,2.64,0.48,5.2-0.4,8,0.8s6,0.4,7.2-1.6,6-6.2,6-6.2-12.8,1.8-15.6,2.6c0,0-22.4,1.2-30.4-1.2z"/>
- </g>
- <g id="g242" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path244" d="m-22.4,173.8s-6.45,3.5-6.85,5.9,5.25,6.1,5.25,6.1,2.75,4.6,3.35,2.2-0.95-13.8-1.75-14.2z"/>
- </g>
- <g id="g246" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path248" d="m-59.885,179.26s7.007,11.19,7.224-0.02c0,0,0.557-1.26-1.203-1.28-6.075-0.07-4.554-4.18-6.021,1.3z"/>
- </g>
- <g id="g250" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path252" d="m-52.707,179.51s7.921,11.19,7.285-0.09c0,0,0.007-0.33-1.746-0.48-4.747-0.42-4.402-4.94-5.539,0.57z"/>
- </g>
- <g id="g254" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path256" d="m-45.494,179.52s7.96,10.63,7.291,0.96c0,0,0.119-1.23-1.535-1.53-3.892-0.71-4.103-3.95-5.756,0.57z"/>
- </g>
- <g id="g258" stroke-width="0.5" stroke="#000" fill="#FFC">
- <path id="path260" d="m-38.618,179.6s7.9,11.56,8.248,1.78c0,0,1.644-1.38-0.102-1.6-5.818-0.74-5.02-5.19-8.146-0.18z"/>
- </g>
- <g id="g262" fill="#e5e5b2">
- <path id="path264" d="m-74.792,183.13-7.658-1.53c-2.6-5-4.7-11.15-4.7-11.15s6.35,1,18.85,3.8c0,0,0.876,3.32,2.348,9.11l-8.84-0.23z"/>
- </g>
- <g id="g266" fill="#e5e5b2">
- <path id="path268" d="m-9.724,178.47c-1.666-2.51-2.983-4.26-3.633-4.67-3.013-1.88,1.13-1.51,2.259-1.51l18.454,0.76s0.524,2.24,1.208,5.63c0,0-10.088-2.01-18.288-0.21z"/>
- </g>
- <g id="g270" fill="#cc7226">
- <path id="path272" d="m43.88,40.321c27.721,3.96,53.241-31.68,55.001-41.361,1.759-9.68-8.36-21.56-8.36-21.56,1.32-3.08-3.52-17.16-8.8-26.4s-21.181-8.266-38.721-9.24c-15.84-0.88-34.32,22.44-35.64,24.2s4.84,40.041,6.16,45.761-1.32,32.12-1.32,32.12c34.24-9.1,3.96-7.48,31.68-3.52z"/>
- </g>
- <g id="g274" fill="#ea8e51">
- <path id="path276" d="m8.088-33.392c-1.296,1.728,4.752,39.313,6.048,44.929s-1.296,31.536-1.296,31.536c32.672-8.88,3.888-7.344,31.104-3.456,27.217,3.888,52.273-31.104,54.001-40.609,1.728-9.504-8.208-21.168-8.208-21.168,1.296-3.024-3.456-16.848-8.64-25.92s-20.795-8.115-38.017-9.072c-15.552-0.864-33.696,22.032-34.992,23.76z"/>
- </g>
- <g id="g278" fill="#efaa7c">
- <path id="path280" d="m8.816-32.744c-1.272,1.696,4.664,38.585,5.936,44.097s-1.272,30.952-1.272,30.952c31.404-9.16,3.816-7.208,30.528-3.392,26.713,3.816,51.305-30.528,53.001-39.857,1.696-9.328-8.056-20.776-8.056-20.776,1.272-2.968-3.392-16.536-8.48-25.44s-20.41-7.965-37.313-8.904c-15.264-0.848-33.072,21.624-34.344,23.32z"/>
- </g>
- <g id="g282" fill="#f4c6a8">
- <path id="path284" d="m9.544-32.096c-1.248,1.664,4.576,37.857,5.824,43.265s-1.248,30.368-1.248,30.368c29.436-9.04,3.744-7.072,29.952-3.328,26.209,3.744,50.337-29.952,52.001-39.104,1.664-9.153-7.904-20.385-7.904-20.385,1.248-2.912-3.328-16.224-8.32-24.96s-20.025-7.815-36.609-8.736c-14.976-0.832-32.448,21.216-33.696,22.88z"/>
- </g>
- <g id="g286" fill="#f9e2d3">
- <path id="path288" d="m10.272-31.448c-1.224,1.632,4.488,37.129,5.712,42.433s-1.224,29.784-1.224,29.784c27.868-8.92,3.672-6.936,29.376-3.264,25.705,3.672,49.369-29.376,51.001-38.353,1.632-8.976-7.752-19.992-7.752-19.992,1.224-2.856-3.264-15.912-8.16-24.48s-19.64-7.665-35.905-8.568c-14.688-0.816-31.824,20.808-33.048,22.44z"/>
- </g>
- <g id="g290" fill="#FFF">
- <path id="path292" d="M44.2,36.8c25.2,3.6,48.401-28.8,50.001-37.6s-7.6-19.6-7.6-19.6c1.2-2.8-3.201-15.6-8.001-24s-19.254-7.514-35.2-8.4c-14.4-0.8-31.2,20.4-32.4,22s4.4,36.4,5.6,41.6-1.2,29.2-1.2,29.2c25.5-8.6,3.6-6.8,28.8-3.2z"/>
- </g>
- <g id="g294" fill="#CCC">
- <path id="path296" d="m90.601,2.8s-27.801,7.6-39.401,6c0,0-15.8-6.6-24.6,15.2,0,0-3.6,7.2-5.6,9.2s69.601-30.4,69.601-30.4z"/>
- </g>
- <g id="g298" fill="#000">
- <path id="path300" d="m94.401,0.6s-29.001,12.2-39.001,11.8c0,0-16.4-4.6-24.8,10,0,0-8.4,9.2-11.6,10.8,0,0-0.4,1.6,6-2.4l10.4,5.2s14.8,9.6,24.4-6.4c0,0,4-11.2,4-13.2s21.2-7.6,22.801-8c1.6-0.4,8.2-4.6,7.8-7.8z"/>
- </g>
- <g id="g302" fill="#99cc32">
- <path id="path304" d="m47,36.514c-6.872,0-15.245-3.865-15.245-10.114,0-6.248,8.373-12.513,15.245-12.513,6.874,0,12.446,5.065,12.446,11.313,0,6.249-5.572,11.314-12.446,11.314z"/>
- </g>
- <g id="g306" fill="#659900">
- <path id="path308" d="m43.377,19.83c-4.846,0.722-9.935,2.225-9.863,2.009,1.54-4.619,7.901-7.952,13.486-7.952,4.296,0,8.084,1.978,10.32,4.988,0,0-5.316-0.33-13.943,0.955z"/>
- </g>
- <g id="g310" fill="#FFF">
- <path id="path312" d="m55.4,19.6s-4.4-3.2-4.4-1c0,0,3.6,4.4,4.4,1z"/>
- </g>
- <g id="g314" fill="#000">
- <path id="path316" d="m45.4,27.726c-2.499,0-4.525-2.026-4.525-4.526,0-2.499,2.026-4.525,4.525-4.525,2.5,0,4.526,2.026,4.526,4.525,0,2.5-2.026,4.526-4.526,4.526z"/>
- </g>
- <g id="g318" fill="#cc7226">
- <path id="path320" d="m-58.6,14.4s-3.2-21.2-0.8-25.6c0,0,10.8-10,10.4-13.6,0,0-0.4-18-1.6-18.8s-8.8-6.8-14.8-0.4c0,0-10.4,18-9.6,24.4v2s-7.6-0.4-9.2,1.6c0,0-1.2,5.2-2.4,5.6,0,0-2.8,2.4-0.8,5.2,0,0-2,2.4-1.6,6.4l7.6,4s2,14.4,12.8,19.6c4.836,2.329,8-4.4,10-10.4z"/>
- </g>
- <g id="g322" fill="#FFF">
- <path id="path324" d="m-59.6,12.56s-2.88-19.08-0.72-23.04c0,0,9.72-9,9.36-12.24,0,0-0.36-16.2-1.44-16.92s-7.92-6.12-13.32-0.36c0,0-9.36,16.2-8.64,21.96v1.8s-6.84-0.36-8.28,1.44c0,0-1.08,4.68-2.16,5.04,0,0-2.52,2.16-0.72,4.68,0,0-1.8,2.16-1.44,5.76l6.84,3.6s1.8,12.96,11.52,17.64c4.352,2.095,7.2-3.96,9-9.36z"/>
- </g>
- <g id="g326" fill="#eb955c">
- <path id="path328" d="m-51.05-42.61c-1.09-0.86-8.58-6.63-14.43-0.39,0,0-10.14,17.55-9.36,23.79v1.95s-7.41-0.39-8.97,1.56c0,0-1.17,5.07-2.34,5.46,0,0-2.73,2.34-0.78,5.07,0,0-1.95,2.34-1.56,6.24l7.41,3.9s1.95,14.04,12.48,19.11c4.714,2.27,7.8-4.29,9.75-10.14,0,0-3.12-20.67-0.78-24.96,0,0,10.53-9.75,10.14-13.26,0,0-0.39-17.55-1.56-18.33z"/>
- </g>
- <g id="g330" fill="#f2b892">
- <path id="path332" d="m-51.5-41.62c-0.98-0.92-8.36-6.46-14.06-0.38,0,0-9.88,17.1-9.12,23.18v1.9s-7.22-0.38-8.74,1.52c0,0-1.14,4.94-2.28,5.32,0,0-2.66,2.28-0.76,4.94,0,0-1.9,2.28-1.52,6.08l7.22,3.8s1.9,13.68,12.16,18.62c4.594,2.212,7.6-4.18,9.5-9.88,0,0-3.04-20.14-0.76-24.32,0,0,10.26-9.5,9.88-12.92,0,0-0.38-17.1-1.52-17.86z"/>
- </g>
- <g id="g334" fill="#f8dcc8">
- <path id="path336" d="m-51.95-40.63c-0.87-0.98-8.14-6.29-13.69-0.37,0,0-9.62,16.65-8.88,22.57v1.85s-7.03-0.37-8.51,1.48c0,0-1.11,4.81-2.22,5.18,0,0-2.59,2.22-0.74,4.81,0,0-1.85,2.22-1.48,5.92l7.03,3.7s1.85,13.32,11.84,18.13c4.473,2.154,7.4-4.07,9.25-9.62,0,0-2.96-19.61-0.74-23.68,0,0,9.99-9.25,9.62-12.58,0,0-0.37-16.65-1.48-17.39z"/>
- </g>
- <g id="g338" fill="#FFF">
- <path id="path340" d="m-59.6,12.46s-2.88-18.98-0.72-22.94c0,0,9.72-9,9.36-12.24,0,0-0.36-16.2-1.44-16.92-0.76-1.04-7.92-6.12-13.32-0.36,0,0-9.36,16.2-8.64,21.96v1.8s-6.84-0.36-8.28,1.44c0,0-1.08,4.68-2.16,5.04,0,0-2.52,2.16-0.72,4.68,0,0-1.8,2.16-1.44,5.76l6.84,3.6s1.8,12.96,11.52,17.64c4.352,2.095,7.2-4.06,9-9.46z"/>
- </g>
- <g id="g342" fill="#CCC">
- <path id="path344" d="m-62.7,6.2s-21.6-10.2-22.5-11c0,0,9.1,8.2,9.9,8.2s12.6,2.8,12.6,2.8z"/>
- </g>
- <g id="g346" fill="#000">
- <path id="path348" d="m-79.8,0s18.4,3.6,18.4,8c0,2.912-0.243,16.331-5.6,14.8-8.4-2.4-4.8-16.8-12.8-22.8z"/>
- </g>
- <g id="g350" fill="#99cc32">
- <path id="path352" d="m-71.4,3.8s8.978,1.474,10,4.2c0.6,1.6,1.263,9.908-4.2,11-4.552,0.911-6.782-9.31-5.8-15.2z"/>
- </g>
- <g id="g354" fill="#000">
- <path id="path356" d="m14.595,46.349c-0.497-1.742,0.814-1.611,2.605-2.149,2-0.6,14.2-4.4,15-7s14,1.8,14,1.8c1.8,0.8,6.2,3.4,6.2,3.4,4.8,1.2,11.4,1.6,11.4,1.6,2.4,1,5.8,3.8,5.8,3.8,14.6,10.2,27.001,3,27.001,3,19.999-6.6,13.999-23.8,13.999-23.8-3-9,0.2-12.4,0.2-12.4,0.2-3.8,7.4,2.6,7.4,2.6,2.6,4.2,3.4,9.2,3.4,9.2,8,11.2,4.6-6.6,4.6-6.6,0.2-1-2.6-4.6-2.6-5.8s-1.8-4.6-1.8-4.6c-3-3.4-0.6-10.4-0.6-10.4,1.8-13.8-0.4-12-0.4-12-1.2-1.8-10.4,8.2-10.4,8.2-2.2,3.4-8.2,5-8.2,5-2.799,1.8-6.199,0.4-6.199,0.4-2.6-0.4-8.2,6.6-8.2,6.6,2.8-0.2,5.2,4.2,7.6,4.4s4.2-2.4,5.799-3c1.6-0.6,4.4,5.2,4.4,5.2,0.4,2.6-5.2,7.4-5.2,7.4-0.4,4.6-1.999,3-1.999,3-3-0.6-4.2,3.2-5.2,7.8s-5.2,5-5.2,5c-1.6,7.4-2.801,4.4-2.801,4.4-0.2-5.6-6.2,0.2-6.2,0.2-1.2,2-5.8-0.2-5.8-0.2-6.8-2-4.4-4-4.4-4,1.8-2.2,13,0,13,0,2.2-1.6-5.8-5.6-5.8-5.6-0.6-1.8,0.4-6.2,0.4-6.2,1.2-3.2,8-8.8,8-8.8,9.401-1.2,6.601-2.8,6.601-2.8-6.2-5.2-12.001,2.4-12.001,2.4-2.2,6.2-19.6,21.2-19.6,21.2-4.8,3.4-2.2-3.4-6.2,0s-24.6-5.6-24.6-5.6c-11.562-1.193-14.294,14.549-17.823,11.429,0,0,5.418,8.52,3.818,2.92z"/>
- </g>
- <g id="g358" fill="#000">
- <path id="path360" d="m209.4-120s-25.6,8-28.4,26.8c0,0-2.4,22.8,18,40.4,0,0,0.4,6.4,2.4,9.6,0,0-1.6,4.8,17.2-2.8l27.2-8.4s6.4-2.4,11.6-11.2,20.4-27.6,16.8-52.8c0,0,1.2-11.2-4.8-11.6,0,0-8.4-1.6-15.6,6,0,0-6.8,3.2-9.2,2.8l-35.2,1.2z"/>
- </g>
- <g id="g362" fill="#000">
- <path id="path364" d="m264.02-120.99s2.1-8.93-2.74-4.09c0,0-7.04,5.72-14.52,5.72,0,0-14.52,2.2-18.92,15.4,0,0-3.96,26.84,3.96,32.56,0,0,4.84,7.48,11.88,0.88s22.54-36.83,20.34-50.47z"/>
- </g>
- <g id="g366" fill="#323232">
- <path id="path368" d="m263.65-120.63s2.09-8.75-2.66-3.99c0,0-6.92,5.61-14.26,5.61,0,0-14.26,2.16-18.58,15.12,0,0-3.89,26.354,3.89,31.97,0,0,4.75,7.344,11.66,0.864,6.92-6.48,22.11-36.184,19.95-49.574z"/>
- </g>
- <g id="g370" fill="#666">
- <path id="path372" d="m263.27-120.27s2.08-8.56-2.58-3.9c0,0-6.78,5.51-13.99,5.51,0,0-14,2.12-18.24,14.84,0,0-3.81,25.868,3.82,31.38,0,0,4.66,7.208,11.45,0.848,6.78-6.36,21.66-35.538,19.54-48.678z"/>
- </g>
- <g id="g374" fill="#999">
- <path id="path376" d="m262.9-119.92s2.07-8.37-2.51-3.79c0,0-6.65,5.41-13.73,5.41,0,0-13.72,2.08-17.88,14.56,0,0-3.75,25.372,3.74,30.78,0,0,4.58,7.072,11.23,0.832,6.66-6.24,21.23-34.892,19.15-47.792z"/>
- </g>
- <g id="g378" fill="#CCC">
- <path id="path380" d="m262.53-119.56s2.06-8.18-2.43-3.7c0,0-6.53,5.31-13.47,5.31,0,0-13.46,2.04-17.54,14.28,0,0-3.67,24.886,3.67,30.19,0,0,4.49,6.936,11.02,0.816,6.52-6.12,20.79-34.246,18.75-46.896z"/>
- </g>
- <g id="g382" fill="#FFF">
- <path id="path384" d="m262.15-119.2s2.05-8-2.35-3.6c0,0-6.4,5.2-13.2,5.2,0,0-13.2,2-17.2,14,0,0-3.6,24.4,3.6,29.6,0,0,4.4,6.8,10.8,0.8s20.35-33.6,18.35-46z"/>
- </g>
- <g id="g386" fill="#992600">
- <path id="path388" d="m50.6,84s-20.4-19.2-28.4-20c0,0-34.4-4-49.2,14,0,0,17.6-20.4,45.2-14.8,0,0-21.6-4.4-34-1.2l-26.4,14-2.8,4.8s4-14.8,22.4-20.8c0,0,22.8-4.8,33.6,0,0,0-21.6-6.8-31.6-4.8,0,0-30.4-2.4-43.2,24,0,0,4-14.4,18.8-21.6,0,0,13.6-8.8,34-6,0,0,14.4,3.2,19.6,5.6s4-0.4-4.4-5.2c0,0-5.6-10-19.6-9.6,0,0-42.8,3.6-53.2,15.6,0,0,13.6-11.2,24-14,0,0,22.4-8,30.8-7.2,0,0,24.8,1,32.4-3,0,0-11.2,5-8,8.2s10,10.8,10,12,24.2,23.3,27.8,27.7l2.2,2.3z"/>
- </g>
- <g id="g390" fill="#CCC">
- <path id="path392" d="m189,278s-15.5-36.5-28-46c0,0,26,16,29.5,34,0,0,0,10-1.5,12z"/>
- </g>
- <g id="g394" fill="#CCC">
- <path id="path396" d="m236,285.5s-26.5-55-45-79c0,0,43.5,37.5,48.5,64l0.5,5.5-3-2.5s-0.5,9-1,12z"/>
- </g>
- <g id="g398" fill="#CCC">
- <path id="path400" d="m292.5,237s-62.5-59.5-64-62c0,0,60.5,66,63.5,73.5,0,0-2-9,0.5-11.5z"/>
- </g>
- <g id="g402" fill="#CCC">
- <path id="path404" d="m104,280.5s19.5-52,38.5-29.5c0,0,15,10,14.5,13,0,0-4-6.5-22-6,0,0-19-3-31,22.5z"/>
- </g>
- <g id="g406" fill="#CCC">
- <path id="path408" d="m294.5,153s-45-28.5-52.5-30c-11.81-2.36,49.5,29,54.5,39.5,0,0,2-2.5-2-9.5z"/>
- </g>
- <g id="g410" fill="#000">
- <path id="path412" d="m143.8,259.6s20.4-2,27.2-8.8l4.4,3.6,17.6-38.4,3.6,5.2s14.4-14.8,13.6-22.8,12.8,6,12.8,6-0.8-11.6,6.4-4.8c0,0-2.4-15.6,6-7.6,0,0-10.54-30.16,12-4.4,5.6,6.4,1.2-0.4,1.2-0.4s-26-48-4.4-33.6c0,0,2-22.8,0.8-27.2s-3.2-26.8-8-32,0.4-6.8,6-1.6c0,0-11.2-24,2-12,0,0-3.6-15.2-8-18,0,0-5.6-17.2,9.6-6.4,0,0-4.4-12.4-7.6-15.6,0,0-11.6-27.6-4.4-22.8l4.4,3.6s-6.8-14-0.4-9.6,6.4,4,6.4,4-21.2-33.2-0.8-15.6c0,0-8.16-13.918-11.6-20.8,0,0-18.8-20.4-4.4-14l4.8,1.6s-8.8-10-16.8-11.6,2.4-8,8.8-6,22,9.6,22,9.6,12.8,18.8,16.8,19.2c0,0-20-7.6-14,0.4,0,0,14.4,14,7.2,13.6,0,0-6,7.2-1.2,16,0,0-18.46-18.391-3.6,7.2l6.8,16.4s-24.4-24.8-13.2-2.8c0,0,17.2,23.6,19.2,24s6.4,9.2,6.4,9.2l-4.4-2,5.2,8.8s-11.2-12-5.2,1.2l5.6,14.4s-20.4-22-6.8,7.6c0,0-16.4-5.2-7.6,12,0,0-1.6,16-1.2,21.2s1.6,33.6-2.8,41.6,6,27.2,8,31.2,5.6,14.8-3.2,5.6-4.4-3.6-2.4,5.2,8,24.4,7.2,30c0,0-1.2,1.2-4.4-2.4,0,0-14.8-22.8-13.2-8.4,0,0-1.2,8-4.4,16.8,0,0-3.2,10.8-3.2,2,0,0-3.2-16.8-6-9.2s-6.4,13.6-9.2,16-8-20.4-9.2-10c0,0-12-12.4-16.8,4l-11.6,16.4s-0.4-12.4-1.6-6.4c0,0-30,6-40.4,1.6z"/>
- </g>
- <g id="g414" fill="#000">
- <path id="path416" d="m109.4-97.2s-11.599-8-15.599-7.6,27.599-8.8,68.799,18.8c0,0,4.8,2.8,8.4,2.4,0,0,3.2,2.4,0.4,6,0,0-8.8,9.6,2.4,20.8,0,0,18.4,6.8,12.8-2,0,0,10.8,4,13.2,8s1.2,0,1.2,0l-12.4-12.4s-5.2-2-8-10.4-5.2-18.4-0.8-21.6c0,0-4,4.4-3.2,0.4s4.4-7.6,6-8,18-16.2,24.8-16.6c0,0-9.2,1.4-12.2,0.4s-29.6-12.4-35.6-13.6c0,0-16.8-6.6-4.8-4.6,0,0,35.8,3.8,54,17,0,0-7.2-8.4-25.6-15.4,0,0-22.2-12.6-57.4-7.6,0,0-17.8,3.2-25.6,5,0,0-2.599-0.6-3.199-1s-12.401-9.4-40.001-2.4c0,0-17,4.6-25.6,9.4,0,0-15.2,1.2-18.8,4.4,0,0-18.6,14.6-20.6,15.4s-13.4,8.4-14.2,8.8c0,0,24.6-6.6,27-9s19.8-5,22.2-3.6,10.8,0.8,1.2,1.4c0,0,75.6,14.8,76.4,16.8s4.8,0.8,4.8,0.8z"/>
- </g>
- <g id="g418" fill="#cc7226">
- <path id="path420" d="m180.8-106.4s-10.2-7.4-12.2-7.4-14.4-10.2-18.6-9.8-16.4-9.6-43.8-1.4c0,0-0.6-2,3-2.8,0,0,6.4-2.2,6.8-2.8,0,0,20.2-4.2,27.4-0.6,0,0,9.2,2.6,15.4,8.8,0,0,11.2,3.2,14.4,2.2,0,0,8.8,2.2,9.2,4,0,0,5.8,3,4,5.6,0,0,0.4,1.6-5.6,4.2z"/>
- </g>
- <g id="g422" fill="#cc7226">
- <path id="path424" d="m168.33-108.51c0.81,0.63,1.83,0.73,2.43,1.54,0.24,0.31-0.05,0.64-0.37,0.74-1.04,0.31-2.1-0.26-3.24,0.33-0.4,0.21-1.04,0.03-1.6-0.12-1.63-0.44-3.46-0.47-5.15,0.22-1.98-1.13-4.34-0.54-6.42-1.55-0.06-0.02-0.28,0.32-0.36,0.3-3.04-1.15-6.79-0.87-9.22-3.15-2.43-0.41-4.78-0.87-7.21-1.55-1.82-0.51-3.23-1.5-4.85-2.33-1.38-0.71-2.83-1.23-4.37-1.61-1.86-0.45-3.69-0.34-5.58-0.86-0.1-0.02-0.29,0.32-0.37,0.3-0.32-0.11-0.62-0.69-0.79-0.64-1.68,0.52-3.17-0.45-4.83-0.11-1.18-1.22-2.9-0.98-4.45-1.42-2.97-0.85-6.12,0.42-9.15-0.58,4.11-1.84,8.8-0.61,12.86-2.68,2.33-1.18,4.99-0.08,7.56-0.84,0.49-0.15,1.18-0.35,1.58,0.32,0.14-0.14,0.32-0.37,0.38-0.35,2.44,1.16,4.76,2.43,7.24,3.5,0.34,0.15,0.88-0.09,1.13,0.12,1.52,1.21,3.46,1.11,4.85,2.33,1.7-0.5,3.49-0.12,5.22-0.75,0.08-0.02,0.31,0.32,0.34,0.3,1.14-0.75,2.29-0.48,3.18-0.18,0.34,0.12,1,0.37,1.31,0.44,1.12,0.27,1.98,0.75,3.16,0.94,0.11,0.02,0.3-0.32,0.37-0.3,1.12,0.44,2.16,0.39,2.82,1.55,0.14-0.14,0.3-0.37,0.38-0.35,1.03,0.34,1.68,1.1,2.78,1.34,0.48,0.1,1.1,0.73,1.67,0.91,2.39,0.73,4.24,2.26,6.43,3.15,0.76,0.31,1.64,0.55,2.27,1.04z"/>
- </g>
- <g id="g426" fill="#cc7226">
- <path id="path428" d="m91.696-122.74c-2.518-1.72-4.886-2.83-7.328-4.62-0.181-0.13-0.541,0.04-0.743-0.08-1.007-0.61-1.895-1.19-2.877-1.89-0.539-0.38-1.36-0.37-1.868-0.63-2.544-1.29-5.173-1.85-7.68-3.04,0.682-0.64,1.804-0.39,2.4-1.2,0.195,0.28,0.433,0.56,0.786,0.37,1.678-0.9,3.528-1.05,5.204-0.96,1.704,0.09,3.424,0.39,5.199,0.67,0.307,0.04,0.506,0.56,0.829,0.66,2.228,0.66,4.617,0.14,6.736,0.98,1.591,0.63,3.161,1.45,4.4,2.72,0.252,0.26-0.073,0.57-0.353,0.76,0.388-0.11,0.661,0.1,0.772,0.41,0.084,0.24,0.084,0.54,0,0.78-0.112,0.31-0.391,0.41-0.765,0.46-1.407,0.19,0.365-1.19-0.335-0.74-1.273,0.82-0.527,2.22-1.272,3.49-0.28-0.19-0.51-0.41-0.4-0.8,0.234,0.52-0.368,0.81-0.536,1.13-0.385,0.72-1.284,2.14-2.169,1.53z"/>
- </g>
- <g id="g430" fill="#cc7226">
- <path id="path432" d="m59.198-115.39c-3.154-0.79-6.204-0.68-9.22-1.96-0.067-0.02-0.29,0.32-0.354,0.3-1.366-0.6-2.284-1.56-3.36-2.61-0.913-0.89-2.571-0.5-3.845-0.99-0.324-0.12-0.527-0.63-0.828-0.67-1.219-0.16-2.146-1.11-3.191-1.68,2.336-0.8,4.747-0.76,7.209-1.15,0.113-0.02,0.258,0.31,0.391,0.31,0.136,0,0.266-0.23,0.4-0.36,0.195,0.28,0.497,0.61,0.754,0.35,0.548-0.54,1.104-0.35,1.644-0.31,0.144,0.01,0.269,0.32,0.402,0.32,0.136,0,0.267-0.32,0.4-0.32,0.136,0,0.267,0.32,0.4,0.32,0.136,0,0.266-0.23,0.4-0.36,0.692,0.78,1.577,0.23,2.399,0.41,1.038,0.22,1.305,1.37,2.379,1.67,4.715,1.3,8.852,3.45,13.215,5.54,0.307,0.14,0.517,0.39,0.407,0.78,0.267,0,0.58-0.09,0.77,0.04,1.058,0.74,2.099,1.28,2.796,2.38,0.216,0.34-0.113,0.75-0.346,0.7-4.429-1-8.435-1.61-12.822-2.71z"/>
- </g>
- <g id="g434" fill="#cc7226">
- <path id="path436" d="m45.338-71.179c-1.592-1.219-2.176-3.25-3.304-5.042-0.214-0.34,0.06-0.654,0.377-0.743,0.56-0.159,1.103,0.319,1.512,0.521,1.745,0.862,3.28,2.104,5.277,2.243,1.99,2.234,6.25,2.619,6.257,6,0.001,0.859-1.427-0.059-1.857,0.8-2.451-1.003-4.84-0.9-7.22-2.367-0.617-0.381-0.287-0.834-1.042-1.412z"/>
- </g>
- <g id="g438" fill="#cc7226">
- <path id="path440" d="m17.8-123.76c0.135,0,7.166,0.24,7.149,0.35-0.045,0.31-7.775,1.36-8.139,1.19-0.164-0.08-7.676,2.35-7.81,2.22,0.268-0.14,8.534-3.76,8.8-3.76z"/>
- </g>
- <g id="g442" fill="#000">
- <path id="path444" d="m33.2-114s-14.8,1.8-19.2,3-23,8.8-26,10.8c0,0-13.4,5.4-30.4,25.4,0,0,7.6-3.4,9.8-6.2,0,0,13.6-12.6,13.4-10,0,0,12.2-8.6,11.6-6.4,0,0,24.4-11.2,22.4-8,0,0,21.6-4.6,20.6-2.6,0,0,18.8,4.4,16,4.6,0,0-5.8,1.2,0.6,4.8,0,0-3.4,4.4-8.8,0.4s-2.4-1.8-7.4-0.8c0,0-2.6,0.8-7.2-3.2,0,0-5.6-4.6-14.4-1,0,0-30.6,12.6-32.6,13.2,0,0-3.6,2.8-6,6.4,0,0-5.8,4.4-8.8,5.8,0,0-12.8,11.6-14,13,0,0-3.4,5.2-4.2,5.6,0,0,6.4-3.8,8.4-5.8,0,0,14-10,19.4-10.8,0,0,4.4-3,5.2-4.4,0,0,14.4-9.2,18.6-9.2,0,0,9.2,5.2,11.6-1.8,0,0,5.8-1.8,11.4-0.6,0,0,3.2-2.6,2.4-4.8,0,0,1.6-1.8,2.6,2,0,0,3.4,3.6,8.2,1.6,0,0,4-0.2,2,2.2,0,0-4.4,3.8-16.2,4,0,0-12.4,0.6-28.8,8.2,0,0-29.8,10.4-39,20.8,0,0-6.4,8.8-11.8,10,0,0-5.8,0.8-11.8,8.2,0,0,9.8-5.8,18.8-5.8,0,0,4-2.4,0.2,1.2,0,0-3.6,7.6-2,13,0,0-0.6,5.2-1.4,6.8,0,0-7.8,12.8-7.8,15.2s1.2,12.2,1.6,12.8-1-1.6,2.8,0.8,6.6,4,7.4,6.8-2-5.4-2.2-7.2-4.4-9-3.6-11.4c0,0,1,1,1.8,2.4,0,0-0.6-0.6,0-4.2,0,0,0.8-5.2,2.2-8.4s3.4-7,3.8-7.8,0.4-6.6,1.8-4l3.4,2.6s-2.8-2.6-0.6-4.8c0,0-1-5.6,0.8-8.2,0,0,7-8.4,8.6-9.4s0.2-0.6,0.2-0.6,6-4.2,0.2-2.6c0,0-4,1.6-7,1.6,0,0-7.6,2-3.6-2.2s14-9.6,17.8-9.4l0.8,1.6,11.2-2.4-1.2,0.8s-0.2-0.2,4-0.6,10,1,11.4-0.8,4.8-2.8,4.4-1.4-0.6,3.4-0.6,3.4,5-5.8,4.4-3.6-8.8,7.4-10.2,13.6l10.4-8.2,3.6-3s3.6,2.2,3.8,0.6,4.8-7.4,6-7.2,3.2-2.6,3,0,7.4,8,7.4,8,3.2-1.8,4.6-0.4,5.6-19.8,5.6-19.8l25-10.6,43.6-3.4-16.999-6.8-61.001-11.4z"/>
- </g>
- <g id="g446" stroke-width="2" stroke="#4c0000">
- <path id="path448" d="m51.4,85s-15-16.8-23.4-19.4c0,0-13.4-6.8-38,1"/>
- </g>
- <g id="g450" stroke-width="2" stroke="#4c0000">
- <path id="path452" d="m24.8,64.2s-25.2-8-40.6-3.8c0,0-18.4,2-26.8,15.8"/>
- </g>
- <g id="g454" stroke-width="2" stroke="#4c0000">
- <path id="path456" d="m21.2,63s-17-7.2-31.8-9.4c0,0-16.6-2.6-33.2,4.6,0,0-12.2,6-17.6,16.2"/>
- </g>
- <g id="g458" stroke-width="2" stroke="#4c0000">
- <path id="path460" d="m22.2,63.4s-15.4-11-16.4-12.4c0,0-7-11-20-11.4,0,0-21.4,0.8-38.6,8.8"/>
- </g>
- <g id="g462" fill="#000">
- <path id="path464" d="M20.895,54.407c1.542,1.463,28.505,30.393,28.505,30.393,35.2,36.6,7.2,2.4,7.2,2.4-7.6-4.8-16.8-23.6-16.8-23.6-1.2-2.8,14,7.2,14,7.2,4,0.8,17.6,20,17.6,20-6.8-2.4-2,4.8-2,4.8,2.8,2,23.201,17.6,23.201,17.6,3.6,4,7.599,5.6,7.599,5.6,14-5.2,7.6,8,7.6,8,2.4,6.8,8-4.8,8-4.8,11.2-16.8-5.2-14.4-5.2-14.4-30,2.8-36.8-13.2-36.8-13.2-2.4-2.4,6.4,0,6.4,0,8.401,2-7.2-12.4-7.2-12.4,2.4,0,11.6,6.8,11.6,6.8,10.401,9.2,12.401,7.2,12.401,7.2,17.999-8.8,28.399-1.2,28.399-1.2,2,1.6-3.6,8.4-2,13.6s6.4,17.6,6.4,17.6c-2.4,1.6-2,12.4-2,12.4,16.8,23.2,7.2,21.2,7.2,21.2-15.6-0.4-0.8,7.2-0.8,7.2,3.2,2,12,9.2,12,9.2-2.8-1.2-4.4,4-4.4,4,4.8,4,2,8.8,2,8.8-6,1.2-7.2,5.2-7.2,5.2,6.8,8-3.2,8.4-3.2,8.4,3.6,4.4-1.2,16.4-1.2,16.4-4.8,0-11.2,5.6-11.2,5.6,2.4,4.8-8,10.4-8,10.4-8.4,1.6-5.6,8.4-5.6,8.4-7.999,6-10.399,22-10.399,22-0.8,10.4-3.2,13.6,2,11.6,5.199-2,4.399-14.4,4.399-14.4-4.799-15.6,38-31.6,38-31.6,4-1.6,4.8-6.8,4.8-6.8,2,0.4,10.8,8,10.8,8,7.6,11.2,8,2,8,2,1.2-3.6-0.4-9.6-0.4-9.6,6-21.6-8-28-8-28-10-33.6,4-25.2,4-25.2,2.8,5.6,13.6,10.8,13.6,10.8l3.6-2.4c-1.6-4.8,6.8-10.8,6.8-10.8,2.8,6.4,8.8-1.6,8.8-1.6,3.6-24.4,16-10,16-10,4,1.2,5.2-5.6,5.2-5.6,3.6-10.4,0-24,0-24,3.6-0.4,13.2,5.6,13.2,5.6,2.8-3.6-6.4-20.4-2.4-18s8.4,4,8.4,4c0.8-2-9.2-14.4-9.2-14.4-4.4-2.8-9.6-23.2-9.6-23.2,7.2,3.6-2.8-11.6-2.8-11.6,0-3.2,6-14.4,6-14.4-0.8-6.8,0-6.4,0-6.4,2.8,1.2,10.8,2.8,4-3.6s0.8-11.2,0.8-11.2c4.4-2.8-9.2-2.4-9.2-2.4-5.2-4.4-4.8-8.4-4.8-8.4,8,2-6.4-12.4-8.8-16s7.2-8.8,7.2-8.8c13.2-3.6,1.6-6.8,1.6-6.8-19.6,0.4-8.8-10.4-8.8-10.4,6,0.4,4.4-2,4.4-2-5.2-1.2-14.8-7.6-14.8-7.6-4-3.6-0.4-2.8-0.4-2.8,16.8,1.2-12-10-12-10,8,0-10-10.4-10-10.4-2-1.6-5.2-9.2-5.2-9.2-6-5.2-10.8-12-10.8-12-0.4-4.4-5.2-9.2-5.2-9.2-11.6-13.6-17.2-13.2-17.2-13.2-14.8-3.6-20-2.8-20-2.8l-52.8,4.4c-26.4,12.8-18.6,33.8-18.6,33.8,6.4,8.4,15.6,4.6,15.6,4.6,4.6-6.2,16.2-4,16.2-4,20.401,3.2,17.801-0.4,17.801-0.4-2.4-4.6-18.601-10.8-18.801-11.4s-9-4-9-4c-3-1.2-7.4-10.4-7.4-10.4-3.2-3.4,12.6,2.4,12.6,2.4-1.2,1,6.2,5,6.2,5,17.401-1,28.001,9.8,28.001,9.8,10.799,16.6,10.999,8.4,10.999,8.4,2.8-9.4-9-30.6-9-30.6,0.4-2,8.6,4.6,8.6,4.6,1.4-2,2.2,3.8,2.2,3.8,0.2,2.4,4,10.4,4,10.4,2.8,13,6.4,5.6,6.4,5.6l4.6,9.4c1.4,2.6-4.6,10.2-4.6,10.2-0.2,2.8,0.6,2.6-5,10.2s-2.2,12-2.2,12c-1.4,6.6,7.4,6.2,7.4,6.2,2.6,2.2,6,2.2,6,2.2,1.8,2,4.2,1.4,4.2,1.4,1.6-3.8,7.8-1.8,7.8-1.8,1.4-2.4,9.6-2.8,9.6-2.8,1-2.6,1.4-4.2,4.8-4.8s-21.2-43.6-21.2-43.6c6.4-0.8-1.8-13.2-1.8-13.2-2.2-6.6,9.2,8,11.4,9.4s3.2,3.6,1.6,3.4-3.4,2-2,2.2,14.4,15.2,17.8,25.4,9.4,14.2,15.6,20.2,5.4,30.2,5.4,30.2c-0.4,8.8,5.6,19.4,5.6,19.4,2,3.8-2.2,22-2.2,22-2,2.2-0.6,3-0.6,3,1,1.2,7.8,14.4,7.8,14.4-1.8-0.2,1.8,3.4,1.8,3.4,5.2,6-1.2,3-1.2,3-6-1.6,1,8.2,1,8.2,1.2,1.8-7.8-2.8-7.8-2.8-9.2-0.6,2.4,6.6,2.4,6.6,8.6,7.2-2.8,2.8-2.8,2.8-4.6-1.8-1.4,5-1.4,5,3.2,1.6,20.4,8.6,20.4,8.6,0.4,3.8-2.6,8.8-2.6,8.8,0.4,4-1.8,7.4-1.8,7.4-1.2,8.2-1.8,9-1.8,9-4.2,0.2-11.6,14-11.6,14-1.8,2.6-12,14.6-12,14.6-2,7-20-0.2-20-0.2-6.6,3.4-4.6,0-4.6,0-0.4-2.2,4.4-8.2,4.4-8.2,7-2.6,4.4-13.4,4.4-13.4,4-1.4-7.2-4.2-7-5.4s6-2.6,6-2.6c8-2,3.6-4.4,3.6-4.4-0.6-4,2.4-9.6,2.4-9.6,11.6-0.8,0-17,0-17-10.8-7.6-11.8-13.4-11.8-13.4,12.6-8.2,4.4-20.6,4.6-24.2s1.4-25.2,1.4-25.2c-2-6.2-5-19.8-5-19.8,2.2-5.2,9.6-17.8,9.6-17.8,2.8-4.2,11.6-9,9.4-12s-10-1.2-10-1.2c-7.8-1.4-7.2,3.8-7.2,3.8-1.6,1-2.4,6-2.4,6-0.72,7.933-9.6,14.2-9.6,14.2-11.2,6.2-2,10.2-2,10.2,6,6.6-3.8,6.8-3.8,6.8-11-1.8-2.8,8.4-2.8,8.4,10.8,12.8,7.8,15.6,7.8,15.6-10.2,1,2.4,10.2,2.4,10.2s-0.8-2-0.6-0.2,3.2,6,4,8-3.2,2.2-3.2,2.2c0.6,9.6-14.8,5.4-14.8,5.4l-1.6,0.2c-1.6,0.2-12.8-0.6-18.6-2.8s-12.599-2.2-12.599-2.2-4,1.8-11.601,1.6c-7.6-0.2-15.6,2.6-15.6,2.6-4.4-0.4,4.2-4.8,4.4-4.6s5.8-5.4-2.2-4.8c-21.797,1.635-32.6-8.6-32.6-8.6-2-1.4-4.6-4.2-4.6-4.2-10-2,1.4,12.4,1.4,12.4,1.2,1.4-0.2,2.4-0.2,2.4-0.8-1.6-8.6-7-8.6-7-2.811-0.973-4.174-2.307-6.505-4.793z"/>
- </g>
- <g id="g466" fill="#4c0000">
- <path id="path468" d="m-3,42.8s11.6,5.6,14.2,8.4,16.6,14.2,16.6,14.2-5.4-2-8-3.8-13.4-10-13.4-10-3.8-6-9.4-8.8z"/>
- </g>
- <g id="g470" fill="#99cc32">
- <path id="path472" d="M-61.009,11.603c0.337-0.148-0.187-2.86-0.391-3.403-1.022-2.726-10-4.2-10-4.2-0.227,1.365-0.282,2.961-0.176,4.599,0,0,4.868,5.519,10.567,3.004z"/>
- </g>
- <g id="g474" fill="#659900">
- <path id="path476" d="M-61.009,11.403c-0.449,0.158-0.015-2.734-0.191-3.203-1.022-2.726-10.2-4.3-10.2-4.3-0.227,1.365-0.282,2.961-0.176,4.599,0,0,4.268,5.119,10.567,2.904z"/>
- </g>
- <g id="g478" fill="#000">
- <path id="path480" d="m-65.4,11.546c-0.625,0-1.131-1.14-1.131-2.546,0-1.405,0.506-2.545,1.131-2.545s1.132,1.14,1.132,2.545c0,1.406-0.507,2.546-1.132,2.546z"/>
- </g>
- <g id="g482" fill="#000">
- <path id="path484" d="M-65.4,9z"/>
- </g>
- <g id="g486" fill="#000">
- <path id="path488" d="m-111,109.6s-5.6,10,19.2,4c0,0,14-1.2,16.4-3.6,1.2,0.8,9.566,3.73,12.4,4.4,6.8,1.6,15.2-8.4,15.2-8.4s4.6-10.5,7.4-10.5-0.4,1.6-0.4,1.6-6.6,10.1-6.2,11.7c0,0-5.2,20-21.2,20.8,0,0-16.15,0.95-14.8,6.8,0,0,8.8-2.4,11.2,0,0,0,10.8-0.4,2.8,6l-6.8,11.6s0.14,3.92-10,0.4c-9.8-3.4-20.1-16.3-20.1-16.3s-15.95-14.55-5.1-28.5z"/>
- </g>
- <g id="g490" fill="#e59999">
- <path id="path492" d="m-112.2,113.6s-2,9.6,34.8-0.8l6.8,0.8c2.4,0.8,14.4,3.6,16.4,2.4,0,0-7.2,13.6-18.8,12,0,0-13.2,1.6-12.8,6.4,0,0,4,7.2,8.8,9.6,0,0,2.8,2.4,2.4,5.6s-3.2,4.8-5.2,5.6-5.2-2.4-6.8-2.4-10-6.4-14.4-11.2-12.8-16.8-12.4-19.6,1.2-8.4,1.2-8.4z"/>
- </g>
- <g id="g494" fill="#b26565">
- <path id="path496" d="m-109,131.05c2.6,3.95,5.8,8.15,8,10.55,4.4,4.8,12.8,11.2,14.4,11.2s4.8,3.2,6.8,2.4,4.8-2.4,5.2-5.6-2.4-5.6-2.4-5.6c-3.066-1.53-5.806-5.02-7.385-7.35,0,0,0.185,2.55-5.015,1.75s-10.4-3.6-12-6.8-4-5.6-2.4-2,4,7.2,5.6,7.6,1.2,1.6-1.2,1.2-5.2-0.8-9.6-6z"/>
- </g>
- <g id="g498" fill="#992600">
- <path id="path500" d="m-111.6,110s1.8-13.6,3-17.6c0,0-0.8-6.8,1.6-11s4.4-10.4,7.4-15.8,3.2-9.4,7.2-11,10-10.2,12.8-11.2,2.6-0.2,2.6-0.2,6.8-14.8,20.4-10.8c0,0-16.2-2.8-0.4-12.2,0,0-4.8,1.1-1.5-5.9,2.201-4.668,1.7,2.1-9.3,13.9,0,0-5,8.6-10.2,11.6s-17.2,10-18.4,13.8-4.4,9.6-6.4,11.2-4.8,5.8-5.2,9.2c0,0-1.2,4-2.6,5.2s-1.6,4.4-1.6,6.4-2,4.8-1.8,7.2c0,0,0.8,19,0.4,21l2-3.8z"/>
- </g>
- <g id="g502" fill="#FFF">
- <path id="path504" d="m-120.2,114.6s-2-1.4-6.4,4.6c0,0,7.3,33,7.3,34.4,0,0,1.1-2.1-0.2-9.3s-2.2-19.9-2.2-19.9l1.5-9.8z"/>
- </g>
- <g id="g506" fill="#992600">
- <path id="path508" d="m-98.6,54s-17.6,3.2-17.2,32.4l-0.8,24.8s-1.2-25.6-2.4-27.2,2.8-12.8-0.4-6.8c0,0-14,14-6,35.2,0,0,1.5,3.3-1.5-1.3,0,0-4.6-12.6-3.5-19,0,0,0.2-2.2,2.1-5,0,0,8.6-11.7,11.3-14,0,0,1.8-14.4,17.2-19.6,0,0,5.7-2.3,1.2,0.5z"/>
- </g>
- <g id="g510" fill="#000">
- <path id="path512" d="m40.8-12.2c0.66-0.354,0.651-1.324,1.231-1.497,1.149-0.344,1.313-1.411,1.831-2.195,0.873-1.319,1.066-2.852,1.648-4.343,0.272-0.7,0.299-1.655-0.014-2.315-1.174-2.481-1.876-4.93-3.318-7.356-0.268-0.45-0.53-1.244-0.731-1.842-0.463-1.384-1.72-2.375-2.58-3.695-0.288-0.441,0.237-1.366-0.479-1.45-0.897-0.105-2.346-0.685-2.579,0.341-0.588,2.587,0.423,5.11,1.391,7.552-0.782,0.692-0.448,1.613-0.296,2.38,0.71,3.606-0.488,6.958-1.249,10.432-0.023,0.104,0.319,0.302,0.291,0.364-1.222,2.686-2.674,5.131-4.493,7.512-0.758,0.992-1.63,1.908-2.127,2.971-0.368,0.787-0.776,1.753-0.526,2.741-3.435,2.78-5.685,6.625-8.296,10.471-0.462,0.68-0.171,1.889,0.38,2.158,0.813,0.398,1.769-0.626,2.239-1.472,0.389-0.698,0.742-1.348,1.233-1.991,0.133-0.175-0.046-0.594,0.089-0.715,2.633-2.347,4.302-5.283,6.755-7.651,1.95-0.329,3.487-1.327,5.235-2.34,0.308-0.179,0.832,0.07,1.122-0.125,1.753-1.177,1.751-3.213,1.857-5.123,0.05-0.884,0.246-2.201,1.386-2.812z"/>
- </g>
- <g id="g514" fill="#000">
- <path id="path516" d="m31.959-16.666c0.124-0.077-0.031-0.5,0.078-0.716,0.162-0.324,0.565-0.512,0.727-0.836,0.109-0.216-0.054-0.596,0.082-0.738,2.333-2.447,2.59-5.471,1.554-8.444,1.024-0.62,1.085-1.882,0.66-2.729-0.853-1.7-1.046-3.626-2.021-5.169-0.802-1.269-2.38-2.513-3.751-1.21-0.421,0.4-0.742,1.187-0.464,1.899,0.064,0.163,0.349,0.309,0.322,0.391-0.107,0.324-0.653,0.548-0.659,0.82-0.03,1.496-0.984,3.007-0.354,4.336,0.772,1.629,1.591,3.486,2.267,5.262-1.234,2.116-0.201,4.565-1.954,6.442-0.136,0.146-0.127,0.532-0.005,0.734,0.292,0.486,0.698,0.892,1.184,1.184,0.202,0.121,0.55,0.123,0.75-0.001,0.578-0.362,0.976-0.849,1.584-1.225z"/>
- </g>
- <g id="g518" fill="#000">
- <path id="path520" d="m94.771-26.977c1.389,1.792,1.679,4.587-0.37,5.977,0.55,3.309,3.901,1.33,5.999,0.8-0.11-0.388,0.12-0.732,0.4-0.737,1.06-0.015,1.74-1.047,2.8-0.863,0.44-1.557,2.07-2.259,2.72-3.639,1.72-3.695,1.13-7.968-1.45-11.214-0.2-0.254,0.01-0.771-0.11-1.133-0.76-2.211-2.82-2.526-4.76-3.214-1.176-3.875-1.837-7.906-3.599-11.6-1.614-0.25-2.312-1.989-3.649-2.709-1.333-0.719-1.901,0.86-1.86,1.906,0.007,0.205,0.459,0.429,0.289,0.794-0.076,0.164-0.336,0.275-0.336,0.409,0.001,0.135,0.222,0.266,0.356,0.4-0.918,0.82-2.341,1.297-2.636,2.442-0.954,3.71,1.619,6.835,3.287,10.036,0.591,1.135-0.145,2.406-0.905,3.614-0.438,0.695-0.33,1.822-0.054,2.678,0.752,2.331,2.343,4.07,3.878,6.053z"/>
- </g>
- <g id="g522" fill="#000">
- <path id="path524" d="m57.611-8.591c-1.487,1.851-4.899,4.42-1.982,6.348,0.194,0.129,0.564,0.133,0.737-0.001,2.021-1.565,4.024-2.468,6.46-3.05,0.124-0.029,0.398,0.438,0.767,0.277,1.613-0.703,3.623-0.645,4.807-1.983,3.767,0.224,7.332-0.892,10.723-2.2,1.161-0.448,2.431-1.007,3.632-1.509,1.376-0.576,2.58-1.504,3.692-2.645,0.133-0.136,0.487-0.046,0.754-0.046-0.04-0.863,0.922-0.99,1.169-1.612,0.092-0.232-0.058-0.628,0.075-0.73,2.138-1.63,3.058-3.648,1.889-6.025-0.285-0.578-0.534-1.196-1.1-1.672-1.085-0.911-2.187-0.057-3.234-0.361-0.159,0.628-0.888,0.456-1.274,0.654-0.859,0.439-2.192-0.146-3.051,0.292-1.362,0.695-2.603,0.864-4.025,1.241-0.312,0.082-1.09-0.014-1.25,0.613-0.134-0.134-0.282-0.368-0.388-0.346-1.908,0.396-3.168,0.61-4.469,2.302-0.103,0.133-0.545-0.046-0.704,0.089-0.957,0.808-1.362,2.042-2.463,2.714-0.201,0.123-0.553-0.045-0.747,0.084-0.646,0.431-1.013,1.072-1.655,1.519-0.329,0.229-0.729-0.096-0.697-0.352,0.245-1.947,0.898-3.734,0.323-5.61,2.077-2.52,4.594-4.469,6.4-7.2,0.015-2.166,0.707-4.312,0.594-6.389-0.01-0.193-0.298-0.926-0.424-1.273-0.312-0.854,0.594-1.92-0.25-2.644-1.404-1.203-2.696-0.327-3.52,1.106-1.838,0.39-3.904,1.083-5.482-0.151-1.007-0.787-1.585-1.693-2.384-2.749-0.985-1.302-0.65-2.738-0.58-4.302,0.006-0.128-0.309-0.264-0.309-0.398,0.001-0.135,0.221-0.266,0.355-0.4-0.706-0.626-0.981-1.684-2-2,0.305-1.092-0.371-1.976-1.242-2.278-1.995-0.691-3.672,1.221-5.564,1.294-0.514,0.019-0.981-1.019-1.63-1.344-0.432-0.216-1.136-0.249-1.498,0.017-0.688,0.504-1.277,0.618-2.035,0.823-1.617,0.436-2.895,1.53-4.375,2.385-1.485,0.857-2.44,2.294-3.52,3.614-0.941,1.152-1.077,3.566,0.343,4.066,1.843,0.65,3.147-2.053,5.113-1.727,0.312,0.051,0.518,0.362,0.408,0.75,0.389,0.109,0.607-0.12,0.8-0.4,0.858,1.019,2.022,1.356,2.96,2.229,0.97,0.904,2.716,0.486,3.731,1.483,1.529,1.502,0.97,4.183,2.909,5.488-0.586,1.313-1.193,2.59-1.528,4.017-0.282,1.206,0.712,2.403,1.923,2.312,1.258-0.094,1.52-0.853,2.005-1.929,0.267,0.267,0.736,0.564,0.695,0.78-0.457,2.387-1.484,4.38-1.942,6.811-0.059,0.317-0.364,0.519-0.753,0.409-0.468,4.149-4.52,6.543-7.065,9.708-0.403,0.502-0.407,1.751,0.002,2.154,1.403,1.387,3.363-0.159,5.063-0.662,0.213-1.206,1.072-2.148,2.404-2.092,0.256,0.01,0.491-0.532,0.815-0.662,0.348-0.138,0.85,0.086,1.136-0.112,1.729-1.195,3.137-2.301,4.875-3.49,0.192-0.131,0.536,0.028,0.752-0.08,0.325-0.162,0.512-0.549,0.835-0.734,0.348-0.2,0.59,0.09,0.783,0.37-0.646,0.349-0.65,1.306-1.232,1.508-0.775,0.268-1.336,0.781-2.01,1.228-0.292,0.193-0.951-0.055-1.055,0.124-0.598,1.028-1.782,1.466-2.492,2.349z"/>
- </g>
- <g id="g526" fill="#000">
- <path id="path528" d="m2.2-58s-9.238-2.872-20.4,22.8c0,0-2.4,5.2-4.8,7.2s-13.6,5.6-15.6,9.6l-10.4,16s14.8-16,18-18.4c0,0,8-8.4,4.8-1.6,0,0-14,10.8-12.8,20,0,0-5.6,14.4-6.4,16.4,0,0,16-32,18.4-33.2s3.6-1.2,2.4,2.4-1.6,20-4.4,22c0,0,8-20.4,7.2-23.6,0,0,3.2-3.6,5.6,1.6l-1.2,16,4.4,12s-2.4-11.2-0.8-26.8c0,0-2-10.4,2-4.8s13.6,11.6,13.6,16.4c0,0-5.2-17.6-14.4-22.4l-4,6-1.2-2s-3.6-0.8,0.8-7.6,4-7.6,4-7.6,6.4,7.2,8,7.2c0,0,13.2-7.6,14.4,16.8,0,0,6.8-14.4-2.4-21.2,0,0-14.8-2-13.6-7.2l7.2-12.4c3.6-5.2,2-2.4,2-2.4z"/>
- </g>
- <g id="g530" fill="#000">
- <path id="path532" d="m-17.8-41.6-16,5.2-7.2,9.6s17.2-10,21.2-11.2,2-3.6,2-3.6z"/>
- </g>
- <g id="g534" fill="#000">
- <path id="path536" d="m-57.8-35.2s-2,1.2-2.4,4-2.8,3.2-2,6,2.8,5.2,2.8,1.2,1.6-6,2.4-7.2,2.4-5.6-0.8-4z"/>
- </g>
- <g id="g538" fill="#000">
- <path id="path540" d="m-66.6,26s-8.4-4-11.6-7.6-2.748,1.566-7.6,1.2c-5.847-0.441-4.8-16.4-4.8-16.4l-4,7.6s-1.2,14.4,6.8,12c3.907-1.172,5.2,0.4,3.6,1.2s5.6,1.2,2.8,2.8,11.6-3.6,9.2,6.8l5.6-7.6z"/>
- </g>
- <g id="g542" fill="#000">
- <path id="path544" d="m-79.2,40.4s-15.4,4.4-19-5.2c0,0-4.8,2.4-2.6,5.4s3.4,3.4,3.4,3.4,5.4,1.2,4.8,2-3,4.2-3,4.2,10.2-6,16.4-9.8z"/>
- </g>
- <g id="g546" fill="#FFF">
- <path id="path548" d="m149.2,118.6c-0.43,2.14-2.1,2.94-4,3.6-1.92-0.96-4.51-4.06-6.4-2-0.47-0.48-1.25-0.54-1.6-1.2-0.46-0.9-0.19-1.94-0.53-2.74-0.55-1.28-1.25-2.64-1.07-4.06,1.81-0.71,2.4-2.62,1.93-4.38-0.07-0.26-0.5-0.45-0.3-0.8,0.19-0.33,0.5-0.55,0.77-0.82-0.13,0.14-0.28,0.37-0.39,0.35-0.61-0.11-0.49-0.75-0.36-1.13,0.59-1.75,2.6-2.01,3.95-0.82,0.26-0.56,0.77-0.37,1.2-0.4-0.05-0.58,0.36-1.11,0.56-1.53,0.52-1.09,2.14,0.01,2.94-0.6,1.08-0.83,2.14-1.52,3.22-0.92,1.81,1.01,3.52,2.22,4.72,3.97,0.57,0.83,0.81,2.11,0.75,3.07-0.04,0.65-1.42,0.29-1.76,1.22-0.65,1.75,1.19,2.27,1.94,3.61,0.2,0.35-0.06,0.65-0.38,0.75-0.41,0.13-1.19-0.06-1.06,0.39,0.98,3.19-1.78,3.87-4.13,4.44z"/>
- </g>
- <g id="g550" fill="#FFF">
- <path id="path552" d="m139.6,138.2c-0.01-1.74-1.61-3.49-0.4-5.2,0.14,0.14,0.27,0.36,0.4,0.36,0.14,0,0.27-0.22,0.4-0.36,1.5,2.22,5.15,3.14,5.01,5.99-0.03,0.45-1.11,1.37-0.21,2.01-1.81,1.35-1.87,3.72-2.8,5.6-1.24-0.28-2.45-0.65-3.6-1.2,0.35-1.48,0.24-3.17,1.06-4.49,0.43-0.7,0.14-1.78,0.14-2.71z"/>
- </g>
- <g id="g554" fill="#CCC">
- <path id="path556" d="m-26.6,129.2s-16.858,10.14-2.8-5.2c8.8-9.6,18.8-15.2,18.8-15.2s10.4-4.4,14-5.6,18.8-6.4,22-6.8,12.8-4.4,19.6-0.4,14.8,8.4,14.8,8.4-16.4-8.4-20-6-10.8,2-16.8,5.2c0,0-14.8,4.4-18,6.4s-13.6,13.6-15.2,12.8,0.4-1.2,1.6-4-0.8-4.4-8.8,2-9.2,8.4-9.2,8.4z"/>
- </g>
- <g id="g558" fill="#000">
- <path id="path560" d="m-19.195,123.23s1.41-13.04,9.888-11.37c0,0,8.226-4.17,10.948-6.14,0,0,8.139-1.7,9.449-2.32,18.479-8.698,33.198-4.179,33.745-5.299,0.546-1.119,20.171,5.999,23.78,10.079,0.391,0.45-10.231-5.59-19.929-7.48-8.273-1.617-29.875,0.24-40.781,5.78-2.973,1.51-11.918,7.29-14.449,7.18s-12.651,9.57-12.651,9.57z"/>
- </g>
- <g id="g562" fill="#CCC">
- <path id="path564" d="m-23,148.8s-15.2-2.4,1.6-4c0,0,18-2,22-7.2,0,0,13.6-9.2,16.4-9.6s32.8-7.6,33.2-10,6-2.4,7.6-1.6,0.8,2-2,2.8-34,17.2-40.4,18.4-18,8.8-22.8,10-15.6,1.2-15.6,1.2z"/>
- </g>
- <g id="g566" fill="#000">
- <path id="path568" d="m-3.48,141.4s-8.582-0.83,0.019-1.64c0,0,8.816-3.43,10.864-6.09,0,0,6.964-4.71,8.397-4.92,1.434-0.2,15.394-3.89,15.599-5.12s34.271-13.81,38.691-10.62c2.911,2.1-6.99,0.43-16.624,4.84-1.355,0.62-35.208,15.2-38.485,15.82-3.277,0.61-9.216,4.5-11.674,5.12-2.457,0.61-6.787,2.61-6.787,2.61z"/>
- </g>
- <g id="g570" fill="#000">
- <path id="path572" d="m-11.4,143.6s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g574" fill="#000">
- <path id="path576" d="m-18.6,145.2s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g578" fill="#000">
- <path id="path580" d="m-29,146.8s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g582" fill="#000">
- <path id="path584" d="m-36.6,147.6s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g586" fill="#000">
- <path id="path588" d="m1.8,108,3.2,1.6c-1.2,1.6-4.4,1.2-4.4,1.2l1.2-2.8z"/>
- </g>
- <g id="g590" fill="#000">
- <path id="path592" d="m-8.2,113.6s6.506-2.14,4,1.2c-1.2,1.6-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g594" fill="#000">
- <path id="path596" d="m-19.4,118.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g598" fill="#000">
- <path id="path600" d="m-27,124.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g602" fill="#000">
- <path id="path604" d="m-33.8,129.2s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g606" fill="#000">
- <path id="path608" d="m5.282,135.6s6.921-0.53,5.324,1.6c-1.597,2.12-4.792,1.06-4.792,1.06l-0.532-2.66z"/>
- </g>
- <g id="g610" fill="#000">
- <path id="path612" d="m15.682,130.8s6.921-0.53,5.324,1.6c-1.597,2.12-4.792,1.06-4.792,1.06l-0.532-2.66z"/>
- </g>
- <g id="g614" fill="#000">
- <path id="path616" d="m26.482,126.4s6.921-0.53,5.324,1.6c-1.597,2.12-4.792,1.06-4.792,1.06l-0.532-2.66z"/>
- </g>
- <g id="g618" fill="#000">
- <path id="path620" d="m36.882,121.6s6.921-0.53,5.324,1.6c-1.597,2.12-4.792,1.06-4.792,1.06l-0.532-2.66z"/>
- </g>
- <g id="g622" fill="#000">
- <path id="path624" d="m9.282,103.6s6.921-0.53,5.324,1.6c-1.597,2.12-5.592,1.86-5.592,1.86l0.268-3.46z"/>
- </g>
- <g id="g626" fill="#000">
- <path id="path628" d="m19.282,100.4s6.921-0.534,5.324,1.6c-1.597,2.12-5.992,1.86-5.992,1.86l0.668-3.46z"/>
- </g>
- <g id="g630" fill="#000">
- <path id="path632" d="m-3.4,140.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g634" fill="#992600">
- <path id="path636" d="m-76.6,41.2s-4.4,8.8-4.8,12c0,0,0.8-8.8,2-10.8s2.8-1.2,2.8-1.2z"/>
- </g>
- <g id="g638" fill="#992600">
- <path id="path640" d="m-95,55.2s-3.2,14.4-2.8,17.2c0,0-1.2-11.6-0.8-12.8s3.6-4.4,3.6-4.4z"/>
- </g>
- <g id="g642" fill="#CCC">
- <path id="path644" d="m-74.2-19.4-0.2,3.2-2.2,0.2s14.2,12.6,14.8,20.2c0,0,0.8-8.2-12.4-23.6z"/>
- </g>
- <g id="g646" fill="#000">
- <path id="path648" d="m-70.216-18.135c-0.431-0.416-0.212-1.161-0.62-1.421-0.809-0.516,1.298-0.573,1.07-1.289-0.383-1.206-0.196-1.227-0.318-2.503-0.057-0.598,0.531-2.138,0.916-2.578,1.446-1.652,0.122-4.584,1.762-6.135,0.304-0.289,0.68-0.841,0.965-1.259,0.659-0.963,1.843-1.451,2.793-2.279,0.318-0.276,0.117-1.103,0.686-1.011,0.714,0.115,1.955-0.015,1.91,0.826-0.113,2.12-1.442,3.84-2.722,5.508,0.451,0.704-0.007,1.339-0.291,1.896-1.335,2.62-1.146,5.461-1.32,8.301-0.005,0.085-0.312,0.163-0.304,0.216,0.353,2.335,0.937,4.534,1.816,6.763,0.366,0.93,0.837,1.825,0.987,2.752,0.111,0.686,0.214,1.519-0.194,2.224,2.035,2.89,0.726,5.541,1.895,9.072,0.207,0.625,1.899,2.539,1.436,2.378-2.513-0.871-2.625-1.269-2.802-2.022-0.146-0.623-0.476-2-0.713-2.602-0.064-0.164-0.235-2.048-0.313-2.17-1.513-2.382-0.155-2.206-1.525-4.564-1.428-0.68-2.394-1.784-3.517-2.946-0.198-0.204,0.945-0.928,0.764-1.141-1.092-1.289-2.245-2.056-1.909-3.549,0.155-0.69,0.292-1.747-0.452-2.467z"/>
- </g>
- <g id="g650" fill="#000">
- <path id="path652" d="m-73.8-16.4s0.4,6.8,2.8,8.4,1.2,0.8-2-0.4-2-2-2-2-2.8,0.4-0.4,2.4,6,4.4,4.4,4.4-9.2-4-9.2-6.8-1-6.9-1-6.9,1.1-0.8,5.9-0.7c0,0,1.4,0.7,1.5,1.6z"/>
- </g>
- <g id="g654" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path656" d="m-74.6,2.2s-8.52-2.791-27,0.6c0,0,9.031-2.078,27.8,0.2,10.3,1.25-0.8-0.8-0.8-0.8z"/>
- </g>
- <g id="g658" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path660" d="m-72.502,2.129s-8.246-3.518-26.951-1.737c0,0,9.178-1.289,27.679,2.603,10.154,2.136-0.728-0.866-0.728-0.866z"/>
- </g>
- <g id="g662" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path664" d="m-70.714,2.222s-7.962-4.121-26.747-3.736c0,0,9.248-0.604,27.409,4.654,9.966,2.885-0.662-0.918-0.662-0.918z"/>
- </g>
- <g id="g666" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path668" d="m-69.444,2.445s-6.824-4.307-23.698-5.405c0,0,8.339,0.17,24.22,6.279,8.716,3.353-0.522-0.874-0.522-0.874z"/>
- </g>
- <g id="g670" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path672" d="m45.84,12.961s-0.93,0.644-0.716-0.537c0.215-1.181,28.423-14.351,32.037-14.101,0,0-30.248,13.206-31.321,14.638z"/>
- </g>
- <g id="g674" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path676" d="m42.446,13.6s-0.876,0.715-0.755-0.479,27.208-16.539,30.83-16.573c0,0-29.117,15.541-30.075,17.052z"/>
- </g>
- <g id="g678" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path680" d="m39.16,14.975s-0.828,0.772-0.786-0.428c0.042-1.199,19.859-16.696,29.671-18.57,0,0-18.03,8.127-28.885,18.998z"/>
- </g>
- <g id="g682" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path684" d="m36.284,16.838s-0.745,0.694-0.707-0.385c0.038-1.08,17.872-15.027,26.703-16.713,0,0-16.226,7.314-25.996,17.098z"/>
- </g>
- <g id="g686" fill="#CCC">
- <path id="path688" d="m4.6,164.8s-15.2-2.4,1.6-4c0,0,18-2,22-7.2,0,0,13.6-9.2,16.4-9.6s19.2-4,19.6-6.4,6.4-4.8,8-4,1.6,10-1.2,10.8-21.6,8-28,9.2-18,8.8-22.8,10-15.6,1.2-15.6,1.2z"/>
- </g>
- <g id="g690" fill="#000">
- <path id="path692" d="m77.6,127.4s-3,1.6-4.2,4.2c0,0-6.4,10.6-20.6,13.8,0,0-23,9-30.8,11,0,0-13.4,5-20.8,4.2,0,0-7,0.2-0.8,1.8,0,0,20.2-2,23.6-3.8,0,0,15.6-5.2,18.6-7.8s21.2-7.6,23.4-9.6,12-10.4,11.6-13.8z"/>
- </g>
- <g id="g694" fill="#000">
- <path id="path696" d="m18.882,158.91s5.229-0.23,4.076,1.32-3.601,0.68-3.601,0.68l-0.475-2z"/>
- </g>
- <g id="g698" fill="#000">
- <path id="path700" d="m11.68,160.26s5.228-0.22,4.076,1.33c-1.153,1.55-3.601,0.67-3.601,0.67l-0.475-2z"/>
- </g>
- <g id="g702" fill="#000">
- <path id="path704" d="m1.251,161.51s5.229-0.23,4.076,1.32-3.601,0.68-3.601,0.68l-0.475-2z"/>
- </g>
- <g id="g706" fill="#000">
- <path id="path708" d="m-6.383,162.06s5.229-0.23,4.076,1.32-3.601,0.67-3.601,0.67l-0.475-1.99z"/>
- </g>
- <g id="g710" fill="#000">
- <path id="path712" d="m35.415,151.51s6.96-0.3,5.425,1.76c-1.534,2.07-4.793,0.9-4.793,0.9l-0.632-2.66z"/>
- </g>
- <g id="g714" fill="#000">
- <path id="path716" d="m45.73,147.09s5.959-3.3,5.425,1.76c-0.27,2.55-4.793,0.9-4.793,0.9l-0.632-2.66z"/>
- </g>
- <g id="g718" fill="#000">
- <path id="path720" d="m54.862,144.27s7.159-3.7,5.425,1.77c-0.778,2.44-4.794,0.9-4.794,0.9l-0.631-2.67z"/>
- </g>
- <g id="g722" fill="#000">
- <path id="path724" d="m64.376,139.45s4.359-4.9,5.425,1.76c0.406,2.54-4.793,0.9-4.793,0.9l-0.632-2.66z"/>
- </g>
- <g id="g726" fill="#000">
- <path id="path728" d="m26.834,156s5.228-0.23,4.076,1.32c-1.153,1.55-3.602,0.68-3.602,0.68l-0.474-2z"/>
- </g>
- <g id="g730" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path732" d="m62.434,34.603s-0.726,0.665-0.727-0.406c0-1.07,17.484-14.334,26.327-15.718,0,0-16.099,6.729-25.6,16.124z"/>
- </g>
- <g id="g734" fill="#000">
- <path id="path736" d="m65.4,98.4s22.001,22.4,31.201,26c0,0,9.199,11.2,5.199,37.2,0,0-3.199,7.6-6.399-13.2,0,0,3.2-25.2-8-9.2,0,0-8.401-9.9-2.001-9.6,0,0,3.201,2,3.601,0.4s-7.601-15.2-24.801-29.6,1.2-2,1.2-2z"/>
- </g>
- <g id="g738" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path740" d="m7,137.2s-0.2-1.8,1.6-1,96,7,127.6,31c0,0-45.199-23.2-129.2-30z"/>
- </g>
- <g id="g742" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path744" d="m17.4,132.8s-0.2-1.8,1.6-1,138.4-0.2,162,32.2c0,0-22-25.2-163.6-31.2z"/>
- </g>
- <g id="g746" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path748" d="m29,128.8s-0.2-1.8,1.6-1,175.2-12.2,198.8,20.2c0,0-9.6-25.6-200.4-19.2z"/>
- </g>
- <g id="g750" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path752" d="m39,124s-0.2-1.8,1.6-1,124-37.8,147.6-5.4c0,0-13.4-24.6-149.2,6.4z"/>
- </g>
- <g id="g754" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path756" d="m-19,146.8s-0.2-1.8,1.6-1,19.6,3,21.6,41.8c0,0-7.2-42-23.2-40.8z"/>
- </g>
- <g id="g758" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path760" d="m-27.8,148.4s-0.2-1.8,1.6-1,16-3.8,13.2,35c0,0,1.2-35.2-14.8-34z"/>
- </g>
- <g id="g762" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path764" d="m-35.8,148.8s-0.2-1.8,1.6-1,17.2,1.4,4.8,23.8c0,0,9.6-24-6.4-22.8z"/>
- </g>
- <g id="g766" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path768" d="m11.526,104.46s-0.444,2,1.105,0.79c16.068-12.628,48.51-71.53,104.2-77.164,0,0-38.312-12.11-105.3,76.374z"/>
- </g>
- <g id="g770" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path772" d="m22.726,102.66s-1.363-1.19,0.505-1.81c1.868-0.63,114.31-73.13,153.6-65.164,0,0-27.11-7.51-154.1,66.974z"/>
- </g>
- <g id="g774" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path776" d="m1.885,108.77s-0.509,1.6,1.202,0.62c8.975-5.12,12.59-62.331,56.167-63.586,0,0-32.411-14.714-57.369,62.966z"/>
- </g>
- <g id="g778" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path780" d="m-18.038,119.79s-1.077,1.29,0.876,1.03c10.246-1.33,31.651-42.598,76.09-37.519,0,0-31.966-14.346-76.966,36.489z"/>
- </g>
- <g id="g782" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path784" d="m-6.8,113.67s-0.811,1.47,1.058,0.84c9.799-3.27,22.883-47.885,67.471-51.432,0,0-34.126-7.943-68.529,50.592z"/>
- </g>
- <g id="g786" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path788" d="m-25.078,124.91s-0.873,1.04,0.709,0.84c8.299-1.08,25.637-34.51,61.633-30.396,0,0-25.893-11.62-62.342,29.556z"/>
- </g>
- <g id="g790" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path792" d="m-32.677,130.82s-1.005,1.05,0.586,0.93c4.168-0.31,34.806-33.39,53.274-17.89,0,0-12.015-18.721-53.86,16.96z"/>
- </g>
- <g id="g794" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path796" d="m36.855,98.898s-1.201-1.355,0.731-1.74c1.932-0.384,122.63-58.097,160.59-45.231,0,0-25.94-10.874-161.32,46.971z"/>
- </g>
- <g id="g798" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path800" d="m3.4,163.2s-0.2-1.8,1.6-1,17.2,1.4,4.8,23.8c0,0,9.6-24-6.4-22.8z"/>
- </g>
- <g id="g802" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path804" d="m13.8,161.6s-0.2-1.8,1.6-1,19.6,3,21.6,41.8c0,0-7.2-42-23.2-40.8z"/>
- </g>
- <g id="g806" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path808" d="m20.6,160s-0.2-1.8,1.6-1,26.4,4.2,50,36.6c0,0-35.6-36.8-51.6-35.6z"/>
- </g>
- <g id="g810" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path812" d="m28.225,157.97s-0.437-1.76,1.453-1.2c1.89,0.55,22.324-1.35,60.421,32.83,0,0-46.175-34.94-61.874-31.63z"/>
- </g>
- <g id="g814" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path816" d="m38.625,153.57s-0.437-1.76,1.453-1.2c1.89,0.55,36.724,5.05,88.422,40.03,0,0-74.176-42.14-89.875-38.83z"/>
- </g>
- <g id="g818" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path820" d="m-1.8,142s-0.2-1.8,1.6-1,55.2,3.4,85.6,30.2c0,0-34.901-24.77-87.2-29.2z"/>
- </g>
- <g id="g822" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path824" d="m-11.8,146s-0.2-1.8,1.6-1,26.4,4.2,50,36.6c0,0-35.6-36.8-51.6-35.6z"/>
- </g>
- <g id="g826" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path828" d="m49.503,148.96s-0.565-1.72,1.361-1.3c1.926,0.41,36.996,2.34,91.116,33.44,0,0-77.663-34.4-92.477-32.14z"/>
- </g>
- <g id="g830" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path832" d="m57.903,146.56s-0.565-1.72,1.361-1.3c1.926,0.41,36.996,2.34,91.116,33.44,0,0-77.063-34.8-92.477-32.14z"/>
- </g>
- <g id="g834" stroke-width="0.1" stroke="#000" fill="#FFF">
- <path id="path836" d="m67.503,141.56s-0.565-1.72,1.361-1.3c1.926,0.41,44.996,4.74,134.72,39.04,0,0-120.66-40.4-136.08-37.74z"/>
- </g>
- <g id="g838" fill="#000">
- <path id="path840" d="m-43.8,148.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g842" fill="#000">
- <path id="path844" d="m-13,162.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g846" fill="#000">
- <path id="path848" d="m-21.8,162s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z"/>
- </g>
- <g id="g850" fill="#000">
- <path id="path852" d="m-117.17,150.18s5.05,1.32,3.39,2.44-3.67-0.42-3.67-0.42l0.28-2.02z"/>
- </g>
- <g id="g854" fill="#000">
- <path id="path856" d="m-115.17,140.58s5.05,1.32,3.39,2.44-3.67-0.42-3.67-0.42l0.28-2.02z"/>
- </g>
- <g id="g858" fill="#000">
- <path id="path860" d="m-122.37,136.18s5.05,1.32,3.39,2.44-3.67-0.42-3.67-0.42l0.28-2.02z"/>
- </g>
- <g id="g862" fill="#CCC">
- <path id="path864" d="m-42.6,211.2-5.6,2c-2,0-13.2,3.6-18.8,13.6,0,0,12.4-9.6,24.4-15.6z"/>
- </g>
- <g id="g866" fill="#CCC">
- <path id="path868" d="m45.116,303.85c0.141,0.25,0.196,0.67,0.488,0.69,0.658,0.04,1.891,0.34,1.766-0.29-0.848-4.31-1.722-9.25-5.855-11.05-0.639-0.28-2.081,0.13-2.155,1.02-0.127,1.52-0.244,2.87,0.065,4.33,0.3,1.43,2.458,1.43,3.375,0.05,0.936,1.67,1.368,3.52,2.316,5.25z"/>
- </g>
- <g id="g870" fill="#CCC">
- <path id="path872" d="m34.038,308.58c0.748,1.41,0.621,3.27,2.036,3.84,0.74,0.29,2.59-0.68,2.172-1.76-0.802-2.06-1.19-4.3-2.579-6.11-0.2-0.26,0.04-0.79-0.12-1.12-0.594-1.22-1.739-1.96-3.147-1.63-1.115,2.2,0.033,4.33,1.555,6.04,0.136,0.15-0.03,0.53,0.083,0.74z"/>
- </g>
- <g id="g874" fill="#CCC">
- <path id="path876" d="m-5.564,303.39c-0.108-0.38-0.146-0.84,0.019-1.16,0.531-1.03,1.324-2.15,0.987-3.18-0.348-1.05-1.464-0.87-2.114-0.3-1.135,0.99-1.184,2.82-1.875,4.18-0.196,0.38-0.145,0.96-0.586,1.35-0.474,0.42-0.914,1.94-0.818,2.51,0.053,0.32-0.13,10.22,0.092,9.96,0.619-0.73,3.669-10.47,3.738-11.36,0.057-0.73,0.789-1.19,0.557-2z"/>
- </g>
- <g id="g878" fill="#CCC">
- <path id="path880" d="m-31.202,296.6c2.634-2.5,5.424-5.46,4.982-9.17-0.116-0.98-1.891-0.45-2.078,0.39-0.802,3.63-2.841,6.29-5.409,8.68-2.196,2.05-4.058,8.39-4.293,8.9,3.697-5.26,5.954-8,6.798-8.8z"/>
- </g>
- <g id="g882" fill="#CCC">
- <path id="path884" d="m-44.776,290.64c0.523-0.38,0.221-0.87,0.438-1.2,0.953-1.46,2.254-2.7,2.272-4.44,0.003-0.28-0.375-0.59-0.71-0.36-0.277,0.18-0.619,0.31-0.727,0.44-2.03,2.45-3.43,5.12-4.873,7.93-0.183,0.36-1.327,4.85-1.014,4.96,0.239,0.09,1.959-4.09,2.169-4.21,1.263-0.68,1.275-2.3,2.445-3.12z"/>
- </g>
- <g id="g886" fill="#CCC">
- <path id="path888" d="m-28.043,310.18c0.444-0.87,2.02-2.07,1.907-2.96-0.118-0.93,0.35-2.37-0.562-1.68-1.257,0.94-4.706,2.29-4.976,8.1-0.026,0.57,2.948-2.12,3.631-3.46z"/>
- </g>
- <g id="g890" fill="#CCC">
- <path id="path892" d="m-13.6,293c0.4-0.67,1.108-0.19,1.567-0.46,0.648-0.37,1.259-0.93,1.551-1.58,0.97-2.14,2.739-3.96,2.882-6.36-1.491-1.4-2.17,0.64-2.8,1.6-1.323-1.65-2.322,0.23-3.622,0.75-0.07,0.03-0.283-0.32-0.358-0.29-1.177,0.44-1.857,1.52-2.855,2.3-0.171,0.13-0.576-0.05-0.723,0.09-0.652,0.6-1.625,0.93-1.905,1.61-1.11,2.7-4.25,4.8-6.137,12.34,0.381,0.91,4.512-6.64,4.999-7.34,0.836-1.2,0.954,1.66,2.23,1,0.051-0.03,0.237,0.21,0.371,0.34,0.194-0.28,0.412-0.51,0.8-0.4,0-0.4-0.134-0.96,0.067-1.11,1.237-0.98,1.153-2.05,1.933-3.29,0.458,0.79,1.519,0.07,2,0.8z"/>
- </g>
- <g id="g894" fill="#CCC">
- <path id="path896" d="m46.2,347.4s7.4-20.4,3-31.6c0,0,11.4,21.6,6.8,32.8,0,0-0.4-10.4-4.4-15.4,0,0-4,12.8-5.4,14.2z"/>
- </g>
- <g id="g898" fill="#CCC">
- <path id="path900" d="m31.4,344.8s5.4-8.8-2.6-27.2c0,0-0.8,20.4-7.6,31.4,0,0,14.2-20.2,10.2-4.2z"/>
- </g>
- <g id="g902" fill="#CCC">
- <path id="path904" d="m21.4,342.8s-0.2-20,0.2-23c0,0-3.8,16.6-14,26.2,0,0,14.4-12,13.8-3.2z"/>
- </g>
- <g id="g906" fill="#CCC">
- <path id="path908" d="m11.8,310.8s6,13.6-4,32c0,0,6.4-12.2,1.6-19.2,0,0,2.6-3.4,2.4-12.8z"/>
- </g>
- <g id="g910" fill="#CCC">
- <path id="path912" d="m-7.4,342.4s-1-15.6,0.8-17.8c0,0,0.2-6.4-0.2-7.4,0,0,4-6.2,4.2,1.2,0,0,1.4,7.8,4.2,12.4,0,0,3.6,5.4,3.4,11.8,0,0-10-30.2-12.4-0.2z"/>
- </g>
- <g id="g914" fill="#CCC">
- <path id="path916" d="m-11,314.8s-6.6,10.8-8.4,29.8c0,0-1.4-6.2,2.4-20.6,0,0,4.2-15.4,6-9.2z"/>
- </g>
- <g id="g918" fill="#CCC">
- <path id="path920" d="m-32.8,334.6s5-5.4,6.4-10.4c0,0,3.6-15.8-2.8-7.2,0,0,0.2,8-8,15.4,0,0,4.8-2.4,4.4,2.2z"/>
- </g>
- <g id="g922" fill="#CCC">
- <path id="path924" d="m-38.6,329.6s3.4-17.4,4.2-18.2c0,0,1.8-3.4-1-0.2,0,0-8.8,19.2-12.8,25.8,0,0,8-9.2,9.6-7.4z"/>
- </g>
- <g id="g926" fill="#CCC">
- <path id="path928" d="m-44.4,313s11.6-22.4-10.2,3.4c0,0,11-9.8,10.2-3.4z"/>
- </g>
- <g id="g930" fill="#CCC">
- <path id="path932" d="m-59.8,298.4s4.8-18.8,7.4-18.6l1.6,1.6s-6,9.6-5.4,19.4c0,0-0.6-9.6-3.6-2.4z"/>
- </g>
- <g id="g934" fill="#CCC">
- <path id="path936" d="m270.5,287s-12-10-14.5-13.5c0,0,13.5,18.5,13.5,25.5,0,0,2.5-7.5,1-12z"/>
- </g>
- <g id="g938" fill="#CCC">
- <path id="path940" d="m276,265s-21-15-24.5-22.5c0,0,26.5,29.5,26.5,34,0,0,0.5-9-2-11.5z"/>
- </g>
- <g id="g942" fill="#CCC">
- <path id="path944" d="m293,111s-12-8-13.5-6c0,0,10.5,6.5,13,15,0,0-1.5-9,0.5-9z"/>
- </g>
- <g id="g946" fill="#CCC">
- <path id="path948" d="m301.5,191.5-17.5-12s19,17,19.5,21l-2-9z"/>
- </g>
- <g id="g950" stroke="#000">
- <path id="path952" d="m-89.25,169,22,4.75"/>
- </g>
- <g id="g954" stroke="#000">
- <path id="path956" d="m-39,331s-0.5-3.5-9.5,7"/>
- </g>
- <g id="g958" stroke="#000">
- <path id="path960" d="m-33.5,336s2-6.5-4.5-2"/>
- </g>
- <g id="g962" stroke="#000">
- <path id="path964" d="m20.5,344.5s1.5-11-10,2"/>
- </g>
- </g>
-</svg> \ No newline at end of file
diff --git a/samples/datas/datas.csproj b/samples/datas/datas.csproj
deleted file mode 100644
index 042e7bf..0000000
--- a/samples/datas/datas.csproj
+++ /dev/null
@@ -1,28 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <TargetFrameworks>net471;netstandard2.0</TargetFrameworks>
- <ProjectGuid>{0819E729-64D0-4D96-B7A7-FFDE86639977}</ProjectGuid>
- <OutputType>Exe</OutputType>
- </PropertyGroup>
-
- <ItemGroup>
- <Datas Include="data\**\*.*" />
- </ItemGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>$(SolutionDir)build\Debug\</OutputPath>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>$(SolutionDir)build\Release\</OutputPath>
- </PropertyGroup>
-
- <Target Name="Build" Condition="'@(Datas)'!=''">
- <Copy SourceFiles="@(Datas)" DestinationFiles="@(Datas-&gt;'$(OutputPath)data\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
- </Target>
-
-
- <Target Name="Clean">
- <RemoveDir Directories="$(OutputPath)\data\" />
- </Target>
-</Project>
diff --git a/samples/deferred/DebuDrawPipeline.cs b/samples/deferred/DebuDrawPipeline.cs
deleted file mode 100644
index fef2751..0000000
--- a/samples/deferred/DebuDrawPipeline.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL {
- public class DebugDrawPipeline : GraphicPipeline {
- public HostBuffer Vertices;
- uint vertexCount;
- uint vboLength = 100 * 6 * sizeof (float);
-
- public DebugDrawPipeline (Device dev, DescriptorSetLayout dsLayout, VkFormat colorFormat, VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1) :
- base (new RenderPass (dev, colorFormat), "Debug draw pipeline") {
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.LineList, samples);
- cfg.rasterizationState.lineWidth = 1.0f;
- cfg.RenderPass = RenderPass;
- cfg.Layout = new PipelineLayout(dev, dsLayout);
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex, (uint)Marshal.SizeOf<Matrix4x4> () * 2)
- );
- cfg.AddVertexBinding (0, 6 * sizeof(float));
- cfg.SetVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat);
-
- cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (true);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/debug.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/debug.frag.spv");
-
- layout = cfg.Layout;
-
- init (cfg);
-
- Vertices = new HostBuffer (dev, VkBufferUsageFlags.VertexBuffer, vboLength);
- Vertices.Map ();
- }
-
- public void AddLine (Vector3 start, Vector3 end, float r, float g, float b) {
- float[] data = {
- start.X, start.Y, start.Z,
- r, g, b,
- end.X, end.Y, end.Z,
- r, g, b
- };
- Vertices.Update (data, 12 * sizeof (float), vertexCount * 6 * sizeof (float));
- vertexCount+=2;
- }
-
- public void RecordDraw (CommandBuffer cmd, Framebuffer fb, Camera camera) {
- RenderPass.Begin (cmd, fb);
- const int ratio = 8;
- cmd.SetViewport (fb.Width/ratio, fb.Height/ratio, (ratio-1) * (int)fb.Width / ratio, (ratio-1) * (int)fb.Height / ratio);
- //cmd.SetViewport (200, 200,100,100,-10,10);//, 4 * (int)fb.Width / 5, 4 * (int)fb.Height / 5);
- cmd.SetScissor (fb.Width / ratio, fb.Height / ratio, (ratio-1) * (int)fb.Width / ratio, (ratio-1) * (int)fb.Height / ratio);
- //cmd.SetScissor (200, 200,100,100);
-
- Matrix4x4 ortho = Matrix4x4.CreateOrthographic (4, 4.0f / camera.AspectRatio,-1,1);
-
- cmd.PushConstant (layout, VkShaderStageFlags.Vertex, ortho);
-
- Bind (cmd);
-
- cmd.BindVertexBuffer (Vertices);
- cmd.Draw (vertexCount);
- RenderPass.End (cmd);
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- Vertices.Unmap ();
- Vertices.Dispose ();
- }
-
- base.Dispose (disposing);
- }
- }
-
-}
diff --git a/samples/deferred/DeferredPbrRenderer.cs b/samples/deferred/DeferredPbrRenderer.cs
deleted file mode 100644
index 3dc8520..0000000
--- a/samples/deferred/DeferredPbrRenderer.cs
+++ /dev/null
@@ -1,528 +0,0 @@
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using CVKL;
-using CVKL.glTF;
-using VK;
-
-namespace deferred {
- public class DeferredPbrRenderer : IDisposable {
- Device dev;
- Queue gQueue;
- public static int MAX_MATERIAL_COUNT = 4;
- public static VkSampleCountFlags NUM_SAMPLES = VkSampleCountFlags.SampleCount1;
- public static VkFormat HDR_FORMAT = VkFormat.R16g16b16a16Sfloat;
- public static VkFormat MRT_FORMAT = VkFormat.R32g32b32a32Sfloat;
- public static bool TEXTURE_ARRAY;
-
- public enum DebugView {
- none,
- color,
- normal,
- pos,
- occlusion,
- emissive,
- metallic,
- roughness,
- depth,
- prefill,
- irradiance,
- shadowMap
- }
- public DebugView currentDebugView = DebugView.none;
- public int lightNumDebug = 0;
- public int debugMip = 0;
- public int debugFace = 0;
-
- const float lightMoveSpeed = 0.1f;
- public float exposure = 2.0f;
- public float gamma = 1.2f;
-
- public struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 model;
- public Matrix4x4 view;
- public Vector4 camPos;
- public float prefilteredCubeMipLevels;
- public float scaleIBLAmbient;
- }
- public struct Light {
- public Vector4 position;
- public Vector4 color;
- public Matrix4x4 mvp;
- }
-
- public Matrices matrices = new Matrices {
- scaleIBLAmbient = 0.5f,
- };
- public Light[] lights = {
- new Light {
- position = new Vector4(2.5f,5.5f,2,0f),
- color = new Vector4(1,0.8f,0.8f,1)
- },
- /*new Light {
- position = new Vector4(-2.5f,5.5f,2,0f),
- color = new Vector4(0.8f,0.8f,1,1)
- }*/
- };
-
- Framebuffer frameBuffer;
- public Image gbColorRough, gbEmitMetal, gbN_AO, gbPos, hdrImgResolved, hdrImgMS;
-
- DescriptorPool descriptorPool;
- DescriptorSetLayout descLayoutMain, descLayoutTextures, descLayoutGBuff;
- DescriptorSet dsMain, dsGBuff;
-
- public PipelineCache pipelineCache;
- Pipeline gBuffPipeline, composePipeline, debugPipeline;
-
- public HostBuffer uboMatrices { get; private set; }
- public HostBuffer<Light> uboLights { get; private set; }
-
- RenderPass renderPass;
-
- public PbrModel model { get; private set; }
- public EnvironmentCube envCube;
- public ShadowMapRenderer shadowMapRenderer;
-
- public BoundingBox modelAABB;
-
- public VkSemaphore DrawComplete;
-
- const int SP_SKYBOX = 0;
- const int SP_MODELS = 1;
- const int SP_COMPOSE = 2;
- //const int SP_TONE_MAPPING = 3;
-
- string cubemapPath;
-
- uint width, height;
- public uint Width => width;
- public uint Height => height;
-
- public DeferredPbrRenderer (Queue gQueue, string cubemapPath, uint width, uint height, float nearPlane, float farPlane) {
- this.gQueue = gQueue;
- this.dev = gQueue.Dev;
- this.cubemapPath = cubemapPath;
- this.width = width;
- this.height = height;
-
- DrawComplete = dev.CreateSemaphore();
-
- pipelineCache = new PipelineCache (dev);
-
- descriptorPool = new DescriptorPool (dev, 5,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer, 3),
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler, 6),
- new VkDescriptorPoolSize (VkDescriptorType.InputAttachment, 5),
- new VkDescriptorPoolSize (VkDescriptorType.StorageImage, 4)
- );
-
- uboMatrices = new HostBuffer (dev, VkBufferUsageFlags.UniformBuffer, matrices, true);
- uboLights = new HostBuffer<Light> (dev, VkBufferUsageFlags.UniformBuffer, lights, true);
-
-#if WITH_SHADOWS
- shadowMapRenderer = new ShadowMapRenderer (gQueue, this);
-#endif
-
- init (nearPlane, farPlane);
- }
-
- void init_renderpass () {
- renderPass = new RenderPass (dev, NUM_SAMPLES);
-
- renderPass.AddAttachment (HDR_FORMAT, VkImageLayout.ColorAttachmentOptimal, VkSampleCountFlags.SampleCount1);//final outpout
- renderPass.AddAttachment (dev.GetSuitableDepthFormat (), VkImageLayout.DepthStencilAttachmentOptimal, NUM_SAMPLES);
- renderPass.AddAttachment (VkFormat.R8g8b8a8Unorm, VkImageLayout.ColorAttachmentOptimal, NUM_SAMPLES, VkAttachmentLoadOp.Clear, VkAttachmentStoreOp.DontCare);//GBuff0 (color + roughness) and final color before resolve
- renderPass.AddAttachment (VkFormat.R8g8b8a8Unorm, VkImageLayout.ColorAttachmentOptimal, NUM_SAMPLES, VkAttachmentLoadOp.Clear, VkAttachmentStoreOp.DontCare);//GBuff1 (emit + metal)
- renderPass.AddAttachment (MRT_FORMAT, VkImageLayout.ColorAttachmentOptimal, NUM_SAMPLES, VkAttachmentLoadOp.Clear, VkAttachmentStoreOp.DontCare);//GBuff2 (normals + AO)
- renderPass.AddAttachment (MRT_FORMAT, VkImageLayout.ColorAttachmentOptimal, NUM_SAMPLES, VkAttachmentLoadOp.Clear, VkAttachmentStoreOp.DontCare);//GBuff3 (Pos + depth)
- if (NUM_SAMPLES != VkSampleCountFlags.SampleCount1)
- renderPass.AddAttachment (HDR_FORMAT, VkImageLayout.ColorAttachmentOptimal, NUM_SAMPLES);//hdr color multisampled
-
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { depthStencil = new VkClearDepthStencilValue (1.0f, 0) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- if (NUM_SAMPLES != VkSampleCountFlags.SampleCount1)
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
-
- uint mainHdr = NUM_SAMPLES == VkSampleCountFlags.SampleCount1 ? 0u : 6u;
-
- SubPass[] subpass = { new SubPass (), new SubPass (), new SubPass ()};
- //skybox
- subpass[SP_SKYBOX].AddColorReference (mainHdr, VkImageLayout.ColorAttachmentOptimal);
- //models
- subpass[SP_MODELS].AddColorReference (new VkAttachmentReference (2, VkImageLayout.ColorAttachmentOptimal),
- new VkAttachmentReference (3, VkImageLayout.ColorAttachmentOptimal),
- new VkAttachmentReference (4, VkImageLayout.ColorAttachmentOptimal),
- new VkAttachmentReference (5, VkImageLayout.ColorAttachmentOptimal));
- subpass[SP_MODELS].SetDepthReference (1, VkImageLayout.DepthStencilAttachmentOptimal);
- subpass[SP_MODELS].AddPreservedReference (mainHdr);
-
- //compose
- subpass[SP_COMPOSE].AddColorReference (mainHdr, VkImageLayout.ColorAttachmentOptimal);
- subpass[SP_COMPOSE].AddInputReference (new VkAttachmentReference (2, VkImageLayout.ShaderReadOnlyOptimal),
- new VkAttachmentReference (3, VkImageLayout.ShaderReadOnlyOptimal),
- new VkAttachmentReference (4, VkImageLayout.ShaderReadOnlyOptimal),
- new VkAttachmentReference (5, VkImageLayout.ShaderReadOnlyOptimal));
- if (NUM_SAMPLES != VkSampleCountFlags.SampleCount1)
- subpass[SP_COMPOSE].AddResolveReference (0, VkImageLayout.ColorAttachmentOptimal);
- //tone mapping
- //subpass[SP_TONE_MAPPING].AddColorReference ((NUM_SAMPLES == VkSampleCountFlags.SampleCount1) ? 0u : 2u, VkImageLayout.ColorAttachmentOptimal);
- //subpass[SP_TONE_MAPPING].AddInputReference (new VkAttachmentReference (6, VkImageLayout.ShaderReadOnlyOptimal));
- //if (NUM_SAMPLES != VkSampleCountFlags.SampleCount1)
- //subpass[SP_TONE_MAPPING].AddResolveReference (0, VkImageLayout.ColorAttachmentOptimal);
-
- renderPass.AddSubpass (subpass);
-
- renderPass.AddDependency (Vk.SubpassExternal, SP_SKYBOX,
- VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.ColorAttachmentOutput,
- VkAccessFlags.MemoryRead, VkAccessFlags.ColorAttachmentRead | VkAccessFlags.ColorAttachmentWrite);
- renderPass.AddDependency (SP_SKYBOX, SP_MODELS,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader,
- VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.ShaderRead);
- renderPass.AddDependency (SP_MODELS, SP_COMPOSE,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader,
- VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.ShaderRead);
- //renderPass.AddDependency (SP_COMPOSE, Vk.SubpassExternal,
- //VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer,
- //VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.TransferRead);
- //renderPass.AddDependency (SP_COMPOSE, SP_COMPOSE,
- //VkPipelineStageFlags.Transfer, VkPipelineStageFlags.ComputeShader,
- //VkAccessFlags.TransferWrite, VkAccessFlags.ShaderRead);
- //renderPass.AddDependency (Vk.SubpassExternal, SP_TONE_MAPPING,
- // VkPipelineStageFlags.ComputeShader, VkPipelineStageFlags.FragmentShader,
- // VkAccessFlags.ShaderWrite, VkAccessFlags.ShaderRead);
- //renderPass.AddDependency (SP_SKYBOX, SP_TONE_MAPPING,
- //VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader,
- //VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.ShaderRead);
- renderPass.AddDependency (SP_COMPOSE, Vk.SubpassExternal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer,
- VkAccessFlags.ColorAttachmentRead | VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.TransferRead);
- //renderPass.AddDependency (SP_TONE_MAPPING, Vk.SubpassExternal,
- //VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.BottomOfPipe,
- //VkAccessFlags.ColorAttachmentRead | VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.MemoryRead);
- }
-
- void init (float nearPlane, float farPlane) {
- init_renderpass ();
-
- descLayoutMain = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, VkDescriptorType.UniformBuffer),//matrices and params
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (4, VkShaderStageFlags.Fragment, VkDescriptorType.UniformBuffer),//lights
- new VkDescriptorSetLayoutBinding (5, VkShaderStageFlags.Fragment, VkDescriptorType.UniformBuffer));//materials
-#if WITH_SHADOWS
- descLayoutMain.Bindings.Add (new VkDescriptorSetLayoutBinding (6, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
-#endif
-
- if (TEXTURE_ARRAY) {
- descLayoutMain.Bindings.Add (new VkDescriptorSetLayoutBinding (7, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));//texture array
- //descLayoutMain.Bindings.Add (new VkDescriptorSetLayoutBinding (8, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));//down sampled hdr
- } else {
- descLayoutTextures = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (4, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
- }
-
- descLayoutGBuff = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment),//color + roughness
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment),//emit + metal
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment),//normals + AO
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment));//Pos + depth
-
-
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, NUM_SAMPLES);
- cfg.rasterizationState.cullMode = VkCullModeFlags.Back;
- if (NUM_SAMPLES != VkSampleCountFlags.SampleCount1) {
- cfg.multisampleState.sampleShadingEnable = true;
- cfg.multisampleState.minSampleShading = 0.5f;
- }
- cfg.Cache = pipelineCache;
- if (TEXTURE_ARRAY)
- cfg.Layout = new PipelineLayout (dev, descLayoutMain, descLayoutGBuff);
- else
- cfg.Layout = new PipelineLayout (dev, descLayoutMain, descLayoutGBuff, descLayoutTextures);
-
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex, (uint)Marshal.SizeOf<Matrix4x4> ()),
- new VkPushConstantRange (VkShaderStageFlags.Fragment, sizeof (int), 64)
- );
- cfg.RenderPass = renderPass;
- cfg.SubpassIndex = SP_MODELS;
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- //cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
-
- cfg.AddVertex<PbrModelTexArray.Vertex> ();
-
- using (SpecializationInfo constants = new SpecializationInfo (
- new SpecializationConstant<float> (0, nearPlane),
- new SpecializationConstant<float> (1, farPlane),
- new SpecializationConstant<float> (2, MAX_MATERIAL_COUNT))) {
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#deferred.GBuffPbr.vert.spv");
- if (TEXTURE_ARRAY)
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.GBuffPbrTexArray.frag.spv", constants);
- else
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.GBuffPbr.frag.spv", constants);
-
- gBuffPipeline = new GraphicPipeline (cfg);
- }
- cfg.rasterizationState.cullMode = VkCullModeFlags.Front;
- //COMPOSE PIPELINE
- cfg.blendAttachments.Clear ();
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- cfg.ResetShadersAndVerticesInfos ();
- cfg.SubpassIndex = SP_COMPOSE;
- cfg.Layout = gBuffPipeline.Layout;
- cfg.depthStencilState.depthTestEnable = false;
- cfg.depthStencilState.depthWriteEnable = false;
- using (SpecializationInfo constants = new SpecializationInfo (
- new SpecializationConstant<uint> (0, (uint)lights.Length))) {
- cfg.AddShader (VkShaderStageFlags.Vertex, "#deferred.FullScreenQuad.vert.spv");
-#if WITH_SHADOWS
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.compose_with_shadows.frag.spv", constants);
-#else
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.compose.frag.spv", constants);
-#endif
- composePipeline = new GraphicPipeline (cfg);
- }
- //DEBUG DRAW use subpass of compose
- cfg.shaders[1] = new ShaderInfo (VkShaderStageFlags.Fragment, "#deferred.show_gbuff.frag.spv");
- cfg.SubpassIndex = SP_COMPOSE;
- debugPipeline = new GraphicPipeline (cfg);
- ////TONE MAPPING
- //cfg.shaders[1] = new ShaderInfo (VkShaderStageFlags.Fragment, "#deferred.tone_mapping.frag.spv");
- //cfg.SubpassIndex = SP_TONE_MAPPING;
- //toneMappingPipeline = new GraphicPipeline (cfg);
-
- dsMain = descriptorPool.Allocate (descLayoutMain);
- dsGBuff = descriptorPool.Allocate (descLayoutGBuff);
-
- envCube = new EnvironmentCube (cubemapPath, dsMain, gBuffPipeline.Layout, gQueue, renderPass);
-
- matrices.prefilteredCubeMipLevels = envCube.prefilterCube.CreateInfo.mipLevels;
-
- DescriptorSetWrites dsMainWrite = new DescriptorSetWrites (dsMain, descLayoutMain.Bindings.GetRange (0, 5).ToArray ());
- dsMainWrite.Write (dev,
- uboMatrices.Descriptor,
- envCube.irradianceCube.Descriptor,
- envCube.prefilterCube.Descriptor,
- envCube.lutBrdf.Descriptor,
- uboLights.Descriptor);
-
-#if WITH_SHADOWS
- dsMainWrite = new DescriptorSetWrites (dsMain, descLayoutMain.Bindings[6]);
- dsMainWrite.Write (dev, shadowMapRenderer.shadowMap.Descriptor);
-#endif
- }
-
-
- public void LoadModel (Queue transferQ, string path) {
- dev.WaitIdle ();
- model?.Dispose ();
-
- if (TEXTURE_ARRAY) {
- PbrModelTexArray mod = new PbrModelTexArray (transferQ, path);
- if (mod.texArray != null) {
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (dsMain, descLayoutMain.Bindings[5], descLayoutMain.Bindings[7]);
- uboUpdate.Write (dev, mod.materialUBO.Descriptor, mod.texArray.Descriptor);
- }
- model = mod;
- } else {
- model = new PbrModelSeparatedTextures (transferQ, path,
- descLayoutTextures,
- AttachmentType.Color,
- AttachmentType.PhysicalProps,
- AttachmentType.Normal,
- AttachmentType.AmbientOcclusion,
- AttachmentType.Emissive);
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (dsMain, descLayoutMain.Bindings[5]);
- uboUpdate.Write (dev, model.materialUBO.Descriptor);
- }
-
-
- modelAABB = model.DefaultScene.AABB;
- }
- public void buildCommandBuffers (CommandBuffer cmd) {
-
-
- renderPass.Begin (cmd, frameBuffer);
-
- cmd.SetViewport (frameBuffer.Width, frameBuffer.Height);
- cmd.SetScissor (frameBuffer.Width, frameBuffer.Height);
-
- cmd.BindDescriptorSet (gBuffPipeline.Layout, dsMain);
-
- envCube.RecordDraw (cmd);
-
- renderPass.BeginSubPass (cmd);
-
- if (model != null) {
- gBuffPipeline.Bind (cmd);
- model.Bind (cmd);
- model.DrawAll (cmd, gBuffPipeline.Layout);
- }
-
- renderPass.BeginSubPass (cmd);
-
- cmd.BindDescriptorSet (composePipeline.Layout, dsGBuff, 1);
-
- if (currentDebugView == DebugView.none)
- composePipeline.Bind (cmd);
- else {
- debugPipeline.Bind (cmd);
- uint debugValue = (uint)currentDebugView - 1;
- if (currentDebugView == DebugView.shadowMap)
- debugValue += (uint)((lightNumDebug << 8));
- else
- debugValue += (uint)((debugFace << 8) + (debugMip << 16));
- cmd.PushConstant (debugPipeline.Layout, VkShaderStageFlags.Fragment, debugValue, (uint)Marshal.SizeOf<Matrix4x4> ());
- }
-
- cmd.Draw (3, 1, 0, 0);
-
- //renderPass.BeginSubPass (cmd);
- //toneMappingPipeline.Bind (cmd);
- //cmd.Draw (3, 1, 0, 0);
-
- renderPass.End (cmd);
- }
-
- public void MoveLight (Vector4 dir) {
- lights[lightNumDebug].position += dir * lightMoveSpeed;
-#if WITH_SHADOWS
- shadowMapRenderer.updateShadowMap = true;
-#endif
- }
-
- #region update
- public void UpdateView (Camera camera) {
- camera.AspectRatio = (float)width / height;
-
- matrices.projection = camera.Projection;
- matrices.view = camera.View;
- matrices.model = camera.Model;
-
- matrices.camPos = new Vector4 (
- -camera.Position.Z * (float)Math.Sin (camera.Rotation.Y) * (float)Math.Cos (camera.Rotation.X),
- camera.Position.Z * (float)Math.Sin (camera.Rotation.X),
- camera.Position.Z * (float)Math.Cos (camera.Rotation.Y) * (float)Math.Cos (camera.Rotation.X),
- 0
- );
-
- uboMatrices.Update (matrices, (uint)Marshal.SizeOf<Matrices> ());
- }
-
- #endregion
-
-
- void createGBuff () {
- gbColorRough?.Dispose ();
- gbEmitMetal?.Dispose ();
- gbN_AO?.Dispose ();
- gbPos?.Dispose ();
- hdrImgResolved?.Dispose ();
- hdrImgMS?.Dispose ();
-
-
- hdrImgResolved = new Image (dev, HDR_FORMAT, VkImageUsageFlags.Sampled | VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransferSrc, VkMemoryPropertyFlags.DeviceLocal, width, height, VkImageType.Image2D, VkSampleCountFlags.SampleCount1);
- gbColorRough = new Image (dev, VkFormat.R8g8b8a8Unorm, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransientAttachment, VkMemoryPropertyFlags.DeviceLocal, width, height, VkImageType.Image2D, NUM_SAMPLES);
- gbEmitMetal = new Image (dev, VkFormat.R8g8b8a8Unorm, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransientAttachment, VkMemoryPropertyFlags.DeviceLocal, width, height, VkImageType.Image2D, NUM_SAMPLES);
- gbN_AO = new Image (dev, MRT_FORMAT, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransientAttachment, VkMemoryPropertyFlags.DeviceLocal, width, height, VkImageType.Image2D, NUM_SAMPLES);
- gbPos = new Image (dev, MRT_FORMAT, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransientAttachment, VkMemoryPropertyFlags.DeviceLocal, width, height, VkImageType.Image2D, NUM_SAMPLES);
- if (NUM_SAMPLES != VkSampleCountFlags.SampleCount1)
- hdrImgMS = new Image (dev, HDR_FORMAT, VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransientAttachment, VkMemoryPropertyFlags.DeviceLocal, width, height, VkImageType.Image2D, NUM_SAMPLES);
-
-
- gbColorRough.CreateView (); gbColorRough.CreateSampler ();
- gbColorRough.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- gbEmitMetal.CreateView (); gbEmitMetal.CreateSampler ();
- gbEmitMetal.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- gbN_AO.CreateView (); gbN_AO.CreateSampler ();
- gbN_AO.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- gbPos.CreateView (); gbPos.CreateSampler ();
- gbPos.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- hdrImgResolved.CreateView (); hdrImgResolved.CreateSampler ();
- hdrImgResolved.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- hdrImgMS?.CreateView ();
-
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descLayoutGBuff);
- uboUpdate.Write (dev, dsGBuff, gbColorRough.Descriptor,
- gbEmitMetal.Descriptor,
- gbN_AO.Descriptor,
- gbPos.Descriptor);
-
- gbColorRough.SetName ("GBuffColorRough");
- gbEmitMetal.SetName ("GBuffEmitMetal");
- gbN_AO.SetName ("GBuffN");
- gbPos.SetName ("GBuffPos");
- hdrImgResolved.SetName ("HDRimg resolved");
- hdrImgMS?.SetName ("HDRimg resolved");
- }
-
- public void Resize (uint width, uint height) {
- this.width = width;
- this.height = height;
-
- frameBuffer?.Dispose ();
- createGBuff ();
-
- frameBuffer = (NUM_SAMPLES == VkSampleCountFlags.SampleCount1) ?
- new Framebuffer (renderPass, width, height, new Image[] {
- hdrImgResolved, null, gbColorRough, gbEmitMetal, gbN_AO, gbPos}) :
- new Framebuffer (renderPass, width, height, new Image[] {
- hdrImgResolved, null, gbColorRough, gbEmitMetal, gbN_AO, gbPos, hdrImgMS});
- }
-
- public void Dispose () {
- dev.WaitIdle ();
-
- frameBuffer?.Dispose ();
-
- gbColorRough.Dispose ();
- gbEmitMetal.Dispose ();
- gbN_AO.Dispose ();
- gbPos.Dispose ();
- hdrImgMS?.Dispose ();
- hdrImgResolved.Dispose ();
-
- gBuffPipeline.Dispose ();
- composePipeline.Dispose ();
- //toneMappingPipeline.Dispose ();
- debugPipeline?.Dispose ();
-
- descLayoutMain.Dispose ();
- descLayoutTextures?.Dispose ();
- descLayoutGBuff.Dispose ();
-
- uboMatrices.Dispose ();
- uboLights.Dispose ();
- model.Dispose ();
- envCube.Dispose ();
-
-#if WITH_SHADOWS
- shadowMapRenderer.Dispose ();
-#endif
-
- descriptorPool.Dispose ();
-
- dev.DestroySemaphore (DrawComplete);
- }
- }
-}
diff --git a/samples/deferred/EnvironmentPipeline.cs b/samples/deferred/EnvironmentPipeline.cs
deleted file mode 100644
index 4e97a1c..0000000
--- a/samples/deferred/EnvironmentPipeline.cs
+++ /dev/null
@@ -1,318 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL {
- public class EnvironmentCube : GraphicPipeline {
-
- GPUBuffer vboSkybox;
-
- public Image cubemap { get; private set; }
- public Image lutBrdf { get; private set; }
- public Image irradianceCube { get; private set; }
- public Image prefilterCube { get; set; }
-
- public EnvironmentCube (string cubemapPath, DescriptorSet dsSkybox, PipelineLayout plLayout, Queue staggingQ, RenderPass renderPass, PipelineCache cache = null)
- : base (renderPass, cache, "EnvCube pipeline") {
-
- using (CommandPool cmdPool = new CommandPool (staggingQ.Dev, staggingQ.index)) {
-
- vboSkybox = new GPUBuffer<float> (staggingQ, cmdPool, VkBufferUsageFlags.VertexBuffer, box_vertices);
-
- cubemap = KTX.KTX.Load (staggingQ, cmdPool, cubemapPath,
- VkImageUsageFlags.Sampled, VkMemoryPropertyFlags.DeviceLocal, true);
- cubemap.CreateView (VkImageViewType.Cube, VkImageAspectFlags.Color);
- cubemap.CreateSampler (VkSamplerAddressMode.ClampToEdge);
- cubemap.SetName ("skybox Texture");
- cubemap.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, renderPass.Samples, false);
- cfg.RenderPass = renderPass;
- cfg.Layout = plLayout;
- cfg.AddVertexBinding (0, 3 * sizeof (float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat);
- cfg.AddShader (VkShaderStageFlags.Vertex, "#deferred.skybox.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.skybox.frag.spv");
- cfg.multisampleState.rasterizationSamples = Samples;
-
- layout = cfg.Layout;
-
- init (cfg);
-
- generateBRDFLUT (staggingQ, cmdPool);
- generateCubemaps (staggingQ, cmdPool);
- }
-
- }
-
- public void RecordDraw (CommandBuffer cmd) {
- Bind (cmd);
- cmd.BindVertexBuffer (vboSkybox);
- cmd.Draw (36);
- }
-
- #region skybox
-
- static float[] box_vertices = {
- 1.0f, 1.0f,-1.0f, // +X side
- 1.0f, 1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f,
- 1.0f,-1.0f,-1.0f,
- 1.0f, 1.0f,-1.0f,
-
- -1.0f,-1.0f,-1.0f, // +X side
- -1.0f,-1.0f, 1.0f,
- -1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f,-1.0f,
- -1.0f,-1.0f,-1.0f,
-
- -1.0f, 1.0f,-1.0f, // +Y side
- -1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f,-1.0f,
- 1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f,-1.0f,
-
- -1.0f,-1.0f,-1.0f, // -Y side
- 1.0f,-1.0f,-1.0f,
- 1.0f,-1.0f, 1.0f,
- -1.0f,-1.0f,-1.0f,
- 1.0f,-1.0f, 1.0f,
- -1.0f,-1.0f, 1.0f,
-
- -1.0f, 1.0f, 1.0f, // +Z side
- -1.0f,-1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
- -1.0f,-1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
-
- -1.0f,-1.0f,-1.0f, // -Z side
- 1.0f, 1.0f,-1.0f,
- 1.0f,-1.0f,-1.0f,
- -1.0f,-1.0f,-1.0f,
- -1.0f, 1.0f,-1.0f,
- 1.0f, 1.0f,-1.0f,
-
- };
- #endregion
-
- void generateBRDFLUT (Queue staggingQ, CommandPool cmdPool) {
- const VkFormat format = VkFormat.R16g16Sfloat;
- const int dim = 512;
-
- lutBrdf = new Image (Dev, format, VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.Sampled,
- VkMemoryPropertyFlags.DeviceLocal, dim, dim);
- lutBrdf.SetName ("lutBrdf");
-
- lutBrdf.CreateView ();
- lutBrdf.CreateSampler (VkSamplerAddressMode.ClampToEdge);
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1, false);
-
- cfg.Layout = new PipelineLayout (Dev, new DescriptorSetLayout (Dev));
- cfg.RenderPass = new RenderPass (Dev);
- cfg.RenderPass.AddAttachment (format, VkImageLayout.ShaderReadOnlyOptimal);
- cfg.RenderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0, 0, 0) });
- cfg.RenderPass.AddSubpass (new SubPass (VkImageLayout.ColorAttachmentOptimal));
- cfg.AddShader (VkShaderStageFlags.Vertex, "#deferred.genbrdflut.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.genbrdflut.frag.spv");
-
- using (GraphicPipeline pl = new GraphicPipeline (cfg)) {
- using (Framebuffer fb = new Framebuffer (cfg.RenderPass, dim, dim, lutBrdf)) {
- CommandBuffer cmd = cmdPool.AllocateCommandBuffer ();
- cmd.Start (VkCommandBufferUsageFlags.OneTimeSubmit);
- pl.RenderPass.Begin (cmd, fb);
- cmd.SetViewport (dim, dim);
- cmd.SetScissor (dim, dim);
- pl.Bind (cmd);
- cmd.Draw (3, 1, 0, 0);
- pl.RenderPass.End (cmd);
- cmd.End ();
-
- staggingQ.Submit (cmd);
- staggingQ.WaitIdle ();
-
- cmd.Free ();
- }
- }
- lutBrdf.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- }
-
- public enum CBTarget { IRRADIANCE = 0, PREFILTEREDENV = 1 };
-
- public Image generateCubeMap (Queue staggingQ, CommandPool cmdPool, CBTarget target) {
- const float deltaPhi = (2.0f * (float)Math.PI) / 180.0f;
- const float deltaTheta = (0.5f * (float)Math.PI) / 64.0f;
-
- VkFormat format = VkFormat.R32g32b32a32Sfloat;
- uint dim = 64;
-
- if (target == CBTarget.PREFILTEREDENV) {
- format = VkFormat.R16g16b16a16Sfloat;
- dim = 512;
- }
-
- uint numMips = (uint)Math.Floor (Math.Log (dim, 2)) + 1;
-
- Image imgFbOffscreen = new Image (Dev, format, VkImageUsageFlags.TransferSrc | VkImageUsageFlags.ColorAttachment,
- VkMemoryPropertyFlags.DeviceLocal, dim, dim);
- imgFbOffscreen.SetName ("offscreenfb");
- imgFbOffscreen.CreateView ();
-
- Image cmap = new Image (Dev, format, VkImageUsageFlags.TransferDst | VkImageUsageFlags.Sampled,
- VkMemoryPropertyFlags.DeviceLocal, dim, dim, VkImageType.Image2D, VkSampleCountFlags.SampleCount1, VkImageTiling.Optimal,
- numMips, 6, 1, VkImageCreateFlags.CubeCompatible);
- if (target == CBTarget.PREFILTEREDENV)
- cmap.SetName ("prefilterenvmap");
- else
- cmap.SetName ("irradianceCube");
- cmap.CreateView (VkImageViewType.Cube, VkImageAspectFlags.Color, 6, 0);
- cmap.CreateSampler (VkSamplerAddressMode.ClampToEdge);
-
- DescriptorPool dsPool = new DescriptorPool (Dev, 2, new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler));
-
- DescriptorSetLayout dsLayout = new DescriptorSetLayout (Dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
-
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1, false);
- cfg.Layout = new PipelineLayout (Dev, dsLayout);
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, (uint)Marshal.SizeOf<Matrix4x4> () + 8));
-
- cfg.RenderPass = new RenderPass (Dev);
- cfg.RenderPass.AddAttachment (format, VkImageLayout.ColorAttachmentOptimal);
- cfg.RenderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0, 0, 0) });
- cfg.RenderPass.AddSubpass (new SubPass (VkImageLayout.ColorAttachmentOptimal));
-
- cfg.AddVertexBinding (0, 3 * sizeof (float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#deferred.filtercube.vert.spv");
- if (target == CBTarget.PREFILTEREDENV)
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.prefilterenvmap.frag.spv");
- else
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.irradiancecube.frag.spv");
-
- Matrix4x4[] matrices = {
- // POSITIVE_X
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(180)) * Matrix4x4.CreateRotationY(Utils.DegreesToRadians(90)),
- // NEGATIVE_X
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(180)) * Matrix4x4.CreateRotationY(Utils.DegreesToRadians(-90)),
- // POSITIVE_Y
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(-90)),
- // NEGATIVE_Y
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(90)),
- // POSITIVE_Z
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(180)),
- // NEGATIVE_Z
- Matrix4x4.CreateRotationZ(Utils.DegreesToRadians(180))
- };
-
- VkImageSubresourceRange subRes = new VkImageSubresourceRange (VkImageAspectFlags.Color, 0, numMips, 0, 6);
-
- using (GraphicPipeline pl = new GraphicPipeline (cfg)) {
-
- DescriptorSet dset = dsPool.Allocate (dsLayout);
- DescriptorSetWrites dsUpdate = new DescriptorSetWrites (dsLayout);
- dsUpdate.Write (Dev, dset, cubemap.Descriptor);
- Dev.WaitIdle ();
-
- using (Framebuffer fb = new Framebuffer (pl.RenderPass, dim, dim, imgFbOffscreen)) {
- CommandBuffer cmd = cmdPool.AllocateCommandBuffer ();
- cmd.Start (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- cmap.SetLayout (cmd, VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal, subRes);
-
- float roughness = 0;
-
- cmd.SetScissor (dim, dim);
- cmd.SetViewport ((float)(dim), (float)dim);
-
- for (int m = 0; m < numMips; m++) {
- roughness = (float)m / ((float)numMips - 1f);
-
- for (int f = 0; f < 6; f++) {
- pl.RenderPass.Begin (cmd, fb);
-
- pl.Bind (cmd);
-
- float viewPortSize = (float)Math.Pow (0.5, m) * dim;
- cmd.SetViewport (viewPortSize, viewPortSize);
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment,
- matrices[f] * Matrix4x4.CreatePerspectiveFieldOfView (Utils.DegreesToRadians (90), 1f, 0.1f, 512f));
- if (target == CBTarget.IRRADIANCE) {
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, deltaPhi, (uint)Marshal.SizeOf<Matrix4x4> ());
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, deltaTheta, (uint)Marshal.SizeOf<Matrix4x4> () + 4);
- } else {
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, roughness, (uint)Marshal.SizeOf<Matrix4x4> ());
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, 64u, (uint)Marshal.SizeOf<Matrix4x4> () + 4);
- }
-
- cmd.BindDescriptorSet (pl.Layout, dset);
- cmd.BindVertexBuffer (vboSkybox);
- cmd.Draw (36);
-
- pl.RenderPass.End (cmd);
-
- imgFbOffscreen.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal);
-
- VkImageCopy region = new VkImageCopy ();
- region.srcSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, 1);
- region.dstSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, 1, (uint)m, (uint)f);
- region.extent = new VkExtent3D { width = (uint)viewPortSize, height = (uint)viewPortSize, depth = 1 };
-
- Vk.vkCmdCopyImage (cmd.Handle,
- imgFbOffscreen.Handle, VkImageLayout.TransferSrcOptimal,
- cmap.Handle, VkImageLayout.TransferDstOptimal,
- 1, region.Pin ());
- region.Unpin ();
-
- imgFbOffscreen.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferSrcOptimal, VkImageLayout.ColorAttachmentOptimal);
-
- }
- }
-
- cmap.SetLayout (cmd, VkImageLayout.TransferDstOptimal, VkImageLayout.ShaderReadOnlyOptimal, subRes);
-
- cmd.End ();
-
- staggingQ.Submit (cmd);
- staggingQ.WaitIdle ();
-
- cmd.Free ();
- }
- }
- cmap.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- dsLayout.Dispose ();
- imgFbOffscreen.Dispose ();
- dsPool.Dispose ();
-
- return cmap;
- }
-
- void generateCubemaps (Queue staggingQ, CommandPool cmdPool) {
- irradianceCube = generateCubeMap (staggingQ, cmdPool, CBTarget.IRRADIANCE);
- prefilterCube = generateCubeMap (staggingQ, cmdPool, CBTarget.PREFILTEREDENV);
- }
-
- protected override void Dispose (bool disposing) {
- vboSkybox.Dispose ();
- cubemap.Dispose ();
- lutBrdf.Dispose ();
- irradianceCube.Dispose ();
- prefilterCube.Dispose ();
-
- base.Dispose (disposing);
- }
- }
-
-}
diff --git a/samples/deferred/deferred.csproj b/samples/deferred/deferred.csproj
deleted file mode 100644
index 5a92526..0000000
--- a/samples/deferred/deferred.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
- <PropertyGroup>
- <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
-<!-- <EnableDefaultNoneItems>false</EnableDefaultNoneItems> -->
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DefineConstants>TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0;MEMORY_POOLS;WITH_SHADOWS;_WITH_VKVG</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugCrow|AnyCPU' ">
- <DefineConstants>TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0;MEMORY_POOLS;WITH_SHADOWS;_WITH_VKVG</DefineConstants>
- </PropertyGroup>
-
- <ItemGroup>
- <Compile Include="EnvironmentPipeline.cs;DeferredPbrRenderer.cs;shadowMapRenderer.cs" />
- </ItemGroup>
-
-
- <ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugCrow|AnyCPU' ">
- <Compile Include="../common/CrowWin.cs" />
- <Compile Include="main-crow.cs" />
- <EmbeddedResource Include="ui\**\*.*">
- <LogicalName>deferred.%(Filename)%(Extension)</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
-
- <ItemGroup Condition="$(Configuration) != 'DebugCrow' ">
- <Compile Include="main.cs" />
- </ItemGroup>
-
-
- <ItemGroup>
- <PackageReference Include="Crow.VK" Version="0.9.0-beta" />
- </ItemGroup>
-
- <ItemGroup>
- <Folder Include="shaders\" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\CVKL.Addons\gltfLoader\gltfLoader.csproj" />
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/samples/deferred/main-crow.cs b/samples/deferred/main-crow.cs
deleted file mode 100644
index 5c0e872..0000000
--- a/samples/deferred/main-crow.cs
+++ /dev/null
@@ -1,404 +0,0 @@
-using System;
-using System.Numerics;
-using Glfw;
-using VK;
-using CVKL;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace deferred {
- class Program : Crow.CrowWin {
- static void Main (string[] args) {
-#if DEBUG
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = false;
-#endif
- DeferredPbrRenderer.TEXTURE_ARRAY = true;
- DeferredPbrRenderer.NUM_SAMPLES = VkSampleCountFlags.SampleCount1;
- DeferredPbrRenderer.HDR_FORMAT = VkFormat.R32g32b32a32Sfloat;
- DeferredPbrRenderer.MRT_FORMAT = VkFormat.R16g16b16a16Sfloat;
-
- PbrModelTexArray.TEXTURE_DIM = 1024;
-
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- #region crow ui
- public Crow.Command CMDViewScenes, CMDViewEditor, CMDViewDebug, CMDViewMaterials;
- void init_crow_commands () {
- CMDViewScenes = new Crow.Command (new Action (() => loadWindow ("#deferred.main.crow", this))) { Caption = "Lighting", Icon = new Crow.SvgPicture ("#deferred.crow.svg"), CanExecute = true };
- CMDViewEditor = new Crow.Command (new Action (() => loadWindow ("#deferred.scenes.crow", this))) { Caption = "Scenes", Icon = new Crow.SvgPicture ("#deferred.crow.svg"), CanExecute = true };
- CMDViewDebug = new Crow.Command (new Action (() => loadWindow ("#deferred.debug.crow", this))) { Caption = "Debug", Icon = new Crow.SvgPicture ("#deferred.crow.svg"), CanExecute = true };
- CMDViewMaterials = new Crow.Command (new Action (() => loadWindow ("#deferred.materials.crow", this))) { Caption = "Materials", Icon = new Crow.SvgPicture ("#deferred.crow.svg"), CanExecute = true };
- }
-
- public DeferredPbrRenderer.DebugView CurrentDebugView {
- get { return renderer.currentDebugView; }
- set {
- if (value == renderer.currentDebugView)
- return;
- lock(crow.UpdateMutex)
- renderer.currentDebugView = value;
- rebuildBuffers = true;
- NotifyValueChanged ("CurrentDebugView", renderer.currentDebugView);
- }
- }
-
- public float Gamma {
- get { return renderer.matrices.gamma; }
- set {
- if (value == renderer.matrices.gamma)
- return;
- renderer.matrices.gamma = value;
- NotifyValueChanged ("Gamma", value);
- updateViewRequested = true;
- }
- }
- public float Exposure {
- get { return renderer.matrices.exposure; }
- set {
- if (value == renderer.matrices.exposure)
- return;
- renderer.matrices.exposure = value;
- NotifyValueChanged ("Exposure", value);
- updateViewRequested = true;
- }
- }
- public float LightStrength {
- get { return renderer.lights[renderer.lightNumDebug].color.X; }
- set {
- if (value == renderer.lights[renderer.lightNumDebug].color.X)
- return;
- renderer.lights[renderer.lightNumDebug].color = new Vector4(value);
- NotifyValueChanged ("LightStrength", value);
- renderer.uboLights.Update (renderer.lights);
- }
- }
- public List<DeferredPbrRenderer.Light> Lights => renderer.lights.ToList ();
- public List<Model.Scene> Scenes => renderer.model.Scenes;
- #endregion
-
- public override string[] EnabledDeviceExtensions => new string[] {
- Ext.D.VK_KHR_swapchain,
- Ext.D.VK_EXT_debug_marker
- };
-
- protected override void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures features) {
- base.configureEnabledFeatures (available_features, ref features);
-
- features.samplerAnisotropy = available_features.samplerAnisotropy;
- features.sampleRateShading = available_features.sampleRateShading;
- features.geometryShader = available_features.geometryShader;
- features.pipelineStatisticsQuery = true;
-
- if (available_features.textureCompressionETC2) {
- features.textureCompressionETC2 = true;
- Image.DefaultTextureFormat = VkFormat.Etc2R8g8b8a8UnormBlock;
- }else if (available_features.textureCompressionBC) {
- //features.textureCompressionBC = true;
- //Image.DefaultTextureFormat = VkFormat.Bc3UnormBlock;
- }
-
-
- }
-
- protected override void createQueues () {
- base.createQueues ();
- transferQ = new Queue (dev, VkQueueFlags.Transfer);
- }
-
- string[] cubemapPathes = {
- "../data/textures/papermill.ktx",
- "../data/textures/cubemap_yokohama_bc3_unorm.ktx",
- "../data/textures/gcanyon_cube.ktx",
- "../data/textures/pisa_cube.ktx",
- "../data/textures/uffizi_cube.ktx",
- };
- string[] modelPathes = {
- //"/mnt/devel/gts/vkChess.net/data/models/chess.glb",
- //"/home/jp/gltf/jaguar/scene.gltf",
- "../data/models/DamagedHelmet/glTF/DamagedHelmet.gltf",
- "../data/models/shadow.glb",
- "../data/models/Hubble.glb",
- "../data/models/MER_static.glb",
- "../data/models/ISS_stationary.glb",
- };
-
- int curModelIndex = 0;
- bool reloadModel;
- bool rebuildBuffers;
-
- Queue transferQ;
- DeferredPbrRenderer renderer;
- PipelineStatisticsQueryPool statPool;
- TimestampQueryPool timestampQPool;
- ulong[] results;
-
- DebugReport dbgRepport;
-
- Program () : base() {
-
- if (Instance.DEBUG_UTILS)
- dbgRepport = new DebugReport (instance,
- VkDebugReportFlagsEXT.ErrorEXT
- | VkDebugReportFlagsEXT.DebugEXT
- | VkDebugReportFlagsEXT.WarningEXT
- | VkDebugReportFlagsEXT.PerformanceWarningEXT
- );
-
- camera = new Camera (Utils.DegreesToRadians (45f), 1f, 0.1f, 16f);
- camera.SetPosition (0, 0, 2);
-
- renderer = new DeferredPbrRenderer (dev, swapChain, presentQueue, cubemapPathes[2], camera.NearPlane, camera.FarPlane);
- renderer.LoadModel (transferQ, modelPathes[curModelIndex]);
- camera.Model = Matrix4x4.CreateScale (1f / Math.Max (Math.Max (renderer.modelAABB.Width, renderer.modelAABB.Height), renderer.modelAABB.Depth));
-
- statPool = new PipelineStatisticsQueryPool (dev,
- VkQueryPipelineStatisticFlags.InputAssemblyVertices |
- VkQueryPipelineStatisticFlags.InputAssemblyPrimitives |
- VkQueryPipelineStatisticFlags.ClippingInvocations |
- VkQueryPipelineStatisticFlags.ClippingPrimitives |
- VkQueryPipelineStatisticFlags.FragmentShaderInvocations);
-
- timestampQPool = new TimestampQueryPool (dev);
-
- init_crow_commands ();
-
- crow.Load ("#deferred.menu.crow").DataSource = this;
-
- }
-
- protected override void recordDraw (CommandBuffer cmd, int imageIndex) {
- statPool.Begin (cmd);
- renderer.buildCommandBuffers (cmd, imageIndex);
- statPool.End (cmd);
- }
-
- public override void UpdateView () {
- renderer.UpdateView (camera);
- updateViewRequested = false;
-#if WITH_SHADOWS
- if (renderer.shadowMapRenderer.updateShadowMap)
- renderer.shadowMapRenderer.update_shadow_map (cmdPool);
-#endif
- }
-
- int frameCount = 0;
- public override void Update () {
- if (reloadModel) {
- renderer.LoadModel (transferQ, modelPathes[curModelIndex]);
- reloadModel = false;
- camera.Model = Matrix4x4.CreateScale (1f / Math.Max (Math.Max (renderer.modelAABB.Width, renderer.modelAABB.Height), renderer.modelAABB.Depth));
- updateViewRequested = true;
- rebuildBuffers = true;
-#if WITH_SHADOWS
- renderer.shadowMapRenderer.updateShadowMap = true;
-#endif
- }
-
- base.Update ();
-
- if (++frameCount > 20) {
- NotifyValueChanged ("fps", fps);
- frameCount = 0;
- }
-
- results = statPool.GetResults ();
- }
- protected override void OnResize () {
- renderer.Resize ();
- base.OnResize ();
- }
-
- #region Mouse and keyboard
- protected override void onMouseMove (double xPos, double yPos) {
- if (crow.ProcessMouseMove ((int)xPos, (int)yPos))
- return;
-
- double diffX = lastMouseX - xPos;
- double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- camera.Rotate ((float)-diffX, (float)-diffY);
- } else if (MouseButton[1]) {
- camera.SetZoom ((float)diffY);
- } else
- return;
-
- updateViewRequested = true;
- }
- protected override void onMouseButtonDown (Glfw.MouseButton button) {
- if (crow.ProcessMouseButtonDown ((Crow.MouseButton)button))
- return;
- base.onMouseButtonDown (button);
- }
- protected override void onMouseButtonUp (Glfw.MouseButton button) {
- if (crow.ProcessMouseButtonUp ((Crow.MouseButton)button))
- return;
- base.onMouseButtonUp (button);
- }
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- if (crow.ProcessKeyDown ((Crow.Key)key))
- return;
- switch (key) {
- case Key.F:
- if (modifiers.HasFlag (Modifier.Shift)) {
- renderer.debugFace--;
- if (renderer.debugFace < 0)
- renderer.debugFace = 5;
- } else {
- renderer.debugFace++;
- if (renderer.debugFace >= 5)
- renderer.debugFace = 0;
- }
- rebuildBuffers = true;
- break;
- case Key.M:
- if (modifiers.HasFlag (Modifier.Shift)) {
- renderer.debugMip--;
- if (renderer.debugMip < 0)
- renderer.debugMip = (int)renderer.envCube.prefilterCube.CreateInfo.mipLevels - 1;
- } else {
- renderer.debugMip++;
- if (renderer.debugMip >= renderer.envCube.prefilterCube.CreateInfo.mipLevels)
- renderer.debugMip = 0;
- }
- rebuildBuffers = true;
- break;
- case Key.L:
- if (modifiers.HasFlag (Modifier.Shift)) {
- renderer.lightNumDebug--;
- if (renderer.lightNumDebug < 0)
- renderer.lightNumDebug = (int)renderer.lights.Length - 1;
- } else {
- renderer.lightNumDebug++;
- if (renderer.lightNumDebug >= renderer.lights.Length)
- renderer.lightNumDebug = 0;
- }
- rebuildBuffers = true;
- break;
- case Key.Keypad0:
- case Key.Keypad1:
- case Key.Keypad2:
- case Key.Keypad3:
- case Key.Keypad4:
- case Key.Keypad5:
- case Key.Keypad6:
- case Key.Keypad7:
- case Key.Keypad8:
- case Key.Keypad9:
- renderer.currentDebugView = (DeferredPbrRenderer.DebugView)(int)key-320;
- rebuildBuffers = true;
- break;
- case Key.KeypadDivide:
- renderer.currentDebugView = DeferredPbrRenderer.DebugView.irradiance;
- rebuildBuffers = true;
- break;
- case Key.S:
- if (modifiers.HasFlag (Modifier.Control)) {
- renderer.pipelineCache.Save ();
- Console.WriteLine ($"Pipeline Cache saved.");
- } else {
- renderer.currentDebugView = DeferredPbrRenderer.DebugView.shadowMap;
- rebuildBuffers = true;
- }
- break;
- case Key.Up:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight(-Vector4.UnitZ);
- else
- camera.Move (0, 0, 1);
- break;
- case Key.Down:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (Vector4.UnitZ);
- else
- camera.Move (0, 0, -1);
- break;
- case Key.Left:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (-Vector4.UnitX);
- else
- camera.Move (1, 0, 0);
- break;
- case Key.Right:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (Vector4.UnitX);
- else
- camera.Move (-1, 0, 0);
- break;
- case Key.PageUp:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (Vector4.UnitY);
- else
- camera.Move (0, 1, 0);
- break;
- case Key.PageDown:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (-Vector4.UnitY);
- else
- camera.Move (0, -1, 0);
- break;
- case Key.F2:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.matrices.exposure -= 0.3f;
- else
- renderer.matrices.exposure += 0.3f;
- break;
- case Key.F3:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.matrices.gamma -= 0.1f;
- else
- renderer.matrices.gamma += 0.1f;
- break;
- case Key.F4:
- if (camera.Type == Camera.CamType.FirstPerson)
- camera.Type = Camera.CamType.LookAt;
- else
- camera.Type = Camera.CamType.FirstPerson;
- Console.WriteLine ($"camera type = {camera.Type}");
- break;
- case Key.KeypadAdd:
- curModelIndex++;
- if (curModelIndex >= modelPathes.Length)
- curModelIndex = 0;
- reloadModel = true;
- break;
- case Key.KeypadSubtract:
- curModelIndex--;
- if (curModelIndex < 0)
- curModelIndex = modelPathes.Length -1;
- reloadModel = true;
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- return;
- }
- updateViewRequested = true;
- }
- protected override void onKeyUp (Key key, int scanCode, Modifier modifiers) {
- if (crow.ProcessKeyUp ((Crow.Key)key))
- return;
- }
- protected override void onChar (CodePoint cp) {
- if (crow.ProcessKeyPress (cp.ToChar ()))
- return;
- }
- #endregion
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- renderer.Dispose ();
- statPool.Dispose ();
- timestampQPool.Dispose ();
- dbgRepport?.Dispose ();
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/deferred/main.cs b/samples/deferred/main.cs
deleted file mode 100644
index 9022d27..0000000
--- a/samples/deferred/main.cs
+++ /dev/null
@@ -1,551 +0,0 @@
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using CVKL;
-using CVKL.glTF;
-using Glfw;
-using VK;
-
-namespace deferred {
- class Deferred : VkWindow {
- static void Main (string[] args) {
-#if DEBUG
- //Instance.VALIDATION = true;
- //Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = false;
-#endif
- SwapChain.PREFERED_FORMAT = VkFormat.B8g8r8a8Srgb;
- DeferredPbrRenderer.TEXTURE_ARRAY = true;
- DeferredPbrRenderer.NUM_SAMPLES = VkSampleCountFlags.SampleCount1;
- DeferredPbrRenderer.HDR_FORMAT = VkFormat.R16g16b16a16Sfloat;
- DeferredPbrRenderer.MRT_FORMAT = VkFormat.R32g32b32a32Sfloat;
-
- PbrModelTexArray.TEXTURE_DIM = 1024;
-
- using (Deferred vke = new Deferred ()) {
- vke.Run ();
- }
- }
-
- public override string[] EnabledDeviceExtensions => new string[] {
- Ext.D.VK_KHR_swapchain,
- Ext.D.VK_EXT_debug_marker
- };
-
- protected override void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures enabled_features) {
- base.configureEnabledFeatures (available_features, ref enabled_features);
-
- enabled_features.samplerAnisotropy = available_features.samplerAnisotropy;
- enabled_features.sampleRateShading = available_features.sampleRateShading;
- enabled_features.geometryShader = available_features.geometryShader;
-
- enabled_features.textureCompressionBC = available_features.textureCompressionBC;
- }
-
- protected override void createQueues () {
- base.createQueues ();
- transferQ = new Queue (dev, VkQueueFlags.Transfer);
- computeQ = new Queue (dev, VkQueueFlags.Compute);
- }
- string[] cubemapPathes = {
- "../data/textures/papermill.ktx",
- "../data/textures/cubemap_yokohama_bc3_unorm.ktx",
- "../data/textures/gcanyon_cube.ktx",
- "../data/textures/pisa_cube.ktx",
- "../data/textures/uffizi_cube.ktx",
- };
- string[] modelPathes = {
- "../data/models/DamagedHelmet/glTF/DamagedHelmet.gltf",
- "../data/models/shadow.glb",
- "../data/models/Hubble.glb",
- "../data/models/MER_static.glb",
- "../data/models/ISS_stationary.glb",
- };
-
- int curModelIndex = 0;
- bool reloadModel;
- bool rebuildBuffers;
-
- Queue transferQ, computeQ;
- DeferredPbrRenderer renderer;
-
-
- GraphicPipeline plToneMap;
- Framebuffer[] frameBuffers;
- DescriptorPool descriptorPool;
- DescriptorSet descriptorSet;
-
-
-
- Deferred () : base("deferred") {
- camera = new Camera (Utils.DegreesToRadians (45f), 1f, 0.1f, 16f);
- camera.SetPosition (0, 0, 2);
-
- //renderer = new DeferredPbrRenderer (presentQueue, cubemapPathes[2], swapChain.Width, swapChain.Height, camera.NearPlane, camera.FarPlane);
- renderer = new DeferredPbrRenderer (presentQueue, cubemapPathes[2], swapChain.Width, swapChain.Height, camera.NearPlane, camera.FarPlane);
- renderer.LoadModel (transferQ, modelPathes[curModelIndex]);
- camera.Model = Matrix4x4.CreateScale (1f / Math.Max (Math.Max (renderer.modelAABB.Width, renderer.modelAABB.Height), renderer.modelAABB.Depth));
-
- init_final_pl ();
- }
-
- void init_final_pl() {
- descriptorPool = new DescriptorPool (dev, 3,
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler, 2),
- new VkDescriptorPoolSize (VkDescriptorType.StorageImage, 4)
- );
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, DeferredPbrRenderer.NUM_SAMPLES);
-
- cfg.Layout = new PipelineLayout (dev,
- new VkPushConstantRange (VkShaderStageFlags.Fragment, 2 * sizeof (float)),
- new DescriptorSetLayout (dev, 0,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- ));
-
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, DeferredPbrRenderer.NUM_SAMPLES);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#deferred.FullScreenQuad.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#deferred.tone_mapping.frag.spv");
-
- plToneMap = new GraphicPipeline (cfg);
-
- descriptorSet = descriptorPool.Allocate (cfg.Layout.DescriptorSetLayouts[0]);
-
- init_blur ();
- }
-
- ComputePipeline plBlur;
- DescriptorSetLayout dsLayoutBlur;
- DescriptorSet dsetBlurPing, dsetBlurPong;
- Image downSamp, downSamp2;
- CommandPool computeCmdPool;
-
- struct BlurPushCsts {
- public Vector2 texSize;
- public int dir;
- public float scale;
- public float strength;
- };
- BlurPushCsts pcBloom = new BlurPushCsts () { strength = 1.3f, scale = 0.4f };
-
- void init_blur () {
- computeCmdPool = new CommandPool (computeQ);
-
- blurComplete = dev.CreateSemaphore ();
-
- dsLayoutBlur = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Compute, VkDescriptorType.StorageImage),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Compute, VkDescriptorType.StorageImage)
- );
- plBlur = new ComputePipeline (
- new PipelineLayout (dev, new VkPushConstantRange (VkShaderStageFlags.Compute, (uint)Marshal.SizeOf<BlurPushCsts> ()), dsLayoutBlur),
- "#deferred.bloom.comp.spv");
-
- dsetBlurPing = descriptorPool.Allocate (dsLayoutBlur);
- dsetBlurPong = descriptorPool.Allocate (dsLayoutBlur);
- }
-
- void buildBlurCmd (CommandBuffer cmd) {
- renderer.hdrImgResolved.SetLayout (cmd, VkImageAspectFlags.Color,
- VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.TransferRead,
- VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer);
- downSamp.SetLayout (cmd, VkImageAspectFlags.Color,
- VkAccessFlags.ShaderRead, VkAccessFlags.TransferWrite,
- VkImageLayout.ShaderReadOnlyOptimal, VkImageLayout.TransferDstOptimal,
- VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.Transfer);
-
-
- renderer.hdrImgResolved.BlitTo (cmd, downSamp);
-
- renderer.hdrImgResolved.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferSrcOptimal, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.FragmentShader);
-
- downSamp2.SetLayout (cmd, VkImageAspectFlags.Color,
- 0, VkAccessFlags.MemoryWrite,
- VkImageLayout.Undefined, VkImageLayout.General,
- VkPipelineStageFlags.AllCommands, VkPipelineStageFlags.ComputeShader);
-
- downSamp.SetLayout (cmd, VkImageAspectFlags.Color,
- VkAccessFlags.TransferWrite, VkAccessFlags.MemoryRead,
- VkImageLayout.TransferDstOptimal, VkImageLayout.General,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.ComputeShader);
-
- plBlur.Bind (cmd);
-
- pcBloom.dir = 0;
- /*
- plBlur.BindDescriptorSet (cmd, dsetBlurPing);
- cmd.PushConstant (plBlur.Layout, VkShaderStageFlags.Compute, pcBloom);
- cmd.Dispatch (downSamp.Width / 16, downSamp.Height / 16);
-
- cmd.SetMemoryBarrier (VkPipelineStageFlags.ComputeShader, VkPipelineStageFlags.ComputeShader,
- VkAccessFlags.ShaderWrite, VkAccessFlags.ShaderRead);
-
- plBlur.BindDescriptorSet (cmd, dsetBlurPong);
- cmd.PushConstant (plBlur.Layout, VkShaderStageFlags.Compute, 1, (uint)Marshal.SizeOf<Vector2> ());
- cmd.Dispatch (downSamp.Width / 16, downSamp.Height / 16);
-
- downSamp.SetLayout (cmd, VkImageAspectFlags.Color,
- VkAccessFlags.MemoryWrite, VkAccessFlags.ShaderRead,
- VkImageLayout.General, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.ComputeShader, VkPipelineStageFlags.FragmentShader);*/
-
- downSamp.SetLayout (cmd, VkImageAspectFlags.Color,
- VkAccessFlags.TransferWrite, VkAccessFlags.ShaderRead,
- VkImageLayout.TransferDstOptimal, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.Transfer, VkPipelineStageFlags.FragmentShader);
-
- cmd.End ();
- }
-
-
- CommandBuffer cmdPbr;
- CommandBuffer cmdBlur;
- VkSemaphore blurComplete;
- const uint downSizing = 1;
- float finalDebug = -1.0f;
-
- void buildCommandBuffers () {
- //cmdPbr?.Free ();
- //cmdPbr = cmdPool.AllocateAndStart ();
- //renderer.buildCommandBuffers (cmdPbr);
- //cmdPbr.End ();
-
- //cmdBlur?.Free ();
- //cmdBlur = computeCmdPool.AllocateAndStart ();
- //buildBlurCmd (cmdBlur);
-
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
- cmds[i] = cmdPool.AllocateAndStart ();
-
- renderer.buildCommandBuffers (cmds[i]);
- //renderer.hdrImgResolved.SetLayout (cmds[i], VkImageAspectFlags.Color,
- //VkAccessFlags.TransferRead, VkAccessFlags.ShaderRead,
- //VkImageLayout.TransferSrcOptimal, VkImageLayout.ShaderReadOnlyOptimal,
- //VkPipelineStageFlags.Transfer, VkPipelineStageFlags.FragmentShader);
-
- plToneMap.RenderPass.Begin (cmds[i], frameBuffers[i]);
-
- cmds[i].SetViewport (frameBuffers[i].Width, frameBuffers[i].Height);
- cmds[i].SetScissor (frameBuffers[i].Width, frameBuffers[i].Height);
-
- plToneMap.Bind (cmds[i]);
- plToneMap.BindDescriptorSet (cmds[i], descriptorSet);
-
- cmds[i].PushConstant (plToneMap.Layout, VkShaderStageFlags.Fragment, 12, new float[] { renderer.exposure, renderer.gamma, finalDebug }, 0);
-
- cmds[i].Draw (3, 1, 0, 0);
-
- plToneMap.RenderPass.End (cmds[i]);
-
- renderer.hdrImgResolved.SetLayout (cmds[i], VkImageAspectFlags.Color,
- VkAccessFlags.ShaderRead, VkAccessFlags.ColorAttachmentWrite,
- VkImageLayout.ShaderReadOnlyOptimal, VkImageLayout.ColorAttachmentOptimal,
- VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.ColorAttachmentOutput);
-
- cmds[i].End ();
- }
- }
-
- public override void UpdateView () {
- renderer.UpdateView (camera);
- updateViewRequested = false;
-#if WITH_SHADOWS
- if (renderer.shadowMapRenderer.updateShadowMap)
- renderer.shadowMapRenderer.update_shadow_map (cmdPool);
-#endif
- }
-
- public override void Update () {
- if (reloadModel) {
- renderer.LoadModel (transferQ, modelPathes[curModelIndex]);
- reloadModel = false;
- camera.Model = Matrix4x4.CreateScale (1f / Math.Max (Math.Max (renderer.modelAABB.Width, renderer.modelAABB.Height), renderer.modelAABB.Depth));
- updateViewRequested = true;
- rebuildBuffers = true;
-#if WITH_SHADOWS
- renderer.shadowMapRenderer.updateShadowMap = true;
-#endif
- }
-
- if (rebuildBuffers) {
- buildCommandBuffers ();
- rebuildBuffers = false;
- }
-
- }
-
-
- protected override void render () {
- VkFence fence = dev.CreateFence();
- int idx = swapChain.GetNextImage (fence);
- if (idx < 0) {
- dev.DestroyFence (fence);
- OnResize ();
- return;
- }
-
- if (cmds[idx] == null)
- return;
-
- dev.WaitForFence (drawFences[idx]);
- dev.ResetFence (drawFences[idx]);
-
- presentQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx], drawFences[idx]);
- presentQueue.Present (swapChain, drawComplete[idx]);
- }
-
- protected override void OnResize () {
- base.OnResize ();
-
- dev.WaitIdle ();
-
- renderer.Resize (Width, Height);
-
- UpdateView ();
-
- downSamp?.Dispose ();
- downSamp2?.Dispose ();
- downSamp = new Image (dev, VkFormat.R16g16b16a16Sfloat, VkImageUsageFlags.TransferDst | VkImageUsageFlags.Storage | VkImageUsageFlags.Sampled,
- VkMemoryPropertyFlags.DeviceLocal, renderer.Width / downSizing, renderer.Height / downSizing, VkImageType.Image2D);
- downSamp2 = new Image (dev, VkFormat.R16g16b16a16Sfloat, VkImageUsageFlags.Storage,
- VkMemoryPropertyFlags.DeviceLocal, renderer.Width / downSizing, renderer.Height/ downSizing, VkImageType.Image2D);
- downSamp.CreateView (); downSamp.CreateSampler ();
- downSamp.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- downSamp2.CreateView (); downSamp2.CreateSampler ();
- downSamp2.Descriptor.imageLayout = VkImageLayout.General;
-
- downSamp.SetName ("HDRimgDownScaled");
- downSamp2.SetName ("HDRimgDownScaled2");
-
- pcBloom.texSize.X = downSamp.Width;
- pcBloom.texSize.Y = downSamp.Height;
-
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (plToneMap.RenderPass, swapChain.Width, swapChain.Height,
- (plToneMap.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- } : new Image[] {
- null,
- swapChain.images[i]
- });
- }
-
- DescriptorSetWrites dsUpdate = new DescriptorSetWrites (plToneMap.Layout.DescriptorSetLayouts[0]);
- dsUpdate.Write (dev, descriptorSet, renderer.hdrImgResolved.Descriptor, downSamp.Descriptor);
-
- dsUpdate = new DescriptorSetWrites (dsLayoutBlur);
- downSamp.Descriptor.imageLayout = VkImageLayout.General;
- dsUpdate.Write (dev, dsetBlurPong, downSamp2.Descriptor, downSamp.Descriptor);
- dsUpdate.Write (dev, dsetBlurPing, downSamp.Descriptor, downSamp2.Descriptor);
-
- buildCommandBuffers ();
-
- dev.WaitIdle ();
- }
-
- #region Mouse and keyboard
- protected override void onScroll (double xOffset, double yOffset) {
- }
- protected override void onMouseMove (double xPos, double yPos) {
- double diffX = lastMouseX - xPos;
- double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- camera.Rotate ((float)-diffX, (float)-diffY);
- } else if (MouseButton[1]) {
- camera.SetZoom ((float)diffY);
- } else
- return;
-
- updateViewRequested = true;
- }
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.F:
- if (modifiers.HasFlag (Modifier.Shift)) {
- renderer.debugFace--;
- if (renderer.debugFace < 0)
- renderer.debugFace = 5;
- } else {
- renderer.debugFace++;
- if (renderer.debugFace >= 5)
- renderer.debugFace = 0;
- }
- rebuildBuffers = true;
- break;
- case Key.M:
- if (modifiers.HasFlag (Modifier.Shift)) {
- renderer.debugMip--;
- if (renderer.debugMip < 0)
- renderer.debugMip = (int)renderer.envCube.prefilterCube.CreateInfo.mipLevels - 1;
- } else {
- renderer.debugMip++;
- if (renderer.debugMip >= renderer.envCube.prefilterCube.CreateInfo.mipLevels)
- renderer.debugMip = 0;
- }
- rebuildBuffers = true;
- break;
- case Key.L:
- if (modifiers.HasFlag (Modifier.Shift)) {
- renderer.lightNumDebug--;
- if (renderer.lightNumDebug < 0)
- renderer.lightNumDebug = (int)renderer.lights.Length - 1;
- } else {
- renderer.lightNumDebug++;
- if (renderer.lightNumDebug >= renderer.lights.Length)
- renderer.lightNumDebug = 0;
- }
- rebuildBuffers = true;
- break;
- case Key.Keypad0:
- case Key.Keypad1:
- case Key.Keypad2:
- case Key.Keypad3:
- case Key.Keypad4:
- case Key.Keypad5:
- case Key.Keypad6:
- case Key.Keypad7:
- case Key.Keypad8:
- case Key.Keypad9:
- renderer.currentDebugView = (DeferredPbrRenderer.DebugView)(int)key-320;
- rebuildBuffers = true;
- break;
- case Key.KeypadDivide:
- renderer.currentDebugView = DeferredPbrRenderer.DebugView.irradiance;
- rebuildBuffers = true;
- break;
- case Key.S:
- if (modifiers.HasFlag (Modifier.Control)) {
- renderer.pipelineCache.Save ();
- Console.WriteLine ($"Pipeline Cache saved.");
- } else {
- renderer.currentDebugView = DeferredPbrRenderer.DebugView.shadowMap;
- rebuildBuffers = true;
- }
- break;
- case Key.Up:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight(-Vector4.UnitZ);
- else
- camera.Move (0, 0, 1);
- break;
- case Key.Down:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (Vector4.UnitZ);
- else
- camera.Move (0, 0, -1);
- break;
- case Key.Left:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (-Vector4.UnitX);
- else
- camera.Move (1, 0, 0);
- break;
- case Key.Right:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (Vector4.UnitX);
- else
- camera.Move (-1, 0, 0);
- break;
- case Key.PageUp:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (Vector4.UnitY);
- else
- camera.Move (0, 1, 0);
- break;
- case Key.PageDown:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.MoveLight (-Vector4.UnitY);
- else
- camera.Move (0, -1, 0);
- break;
- case Key.F2:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.exposure -= 0.3f;
- else
- renderer.exposure += 0.3f;
- rebuildBuffers = true;
- break;
- case Key.F3:
- if (modifiers.HasFlag (Modifier.Shift))
- renderer.gamma -= 0.1f;
- else
- renderer.gamma += 0.1f;
- rebuildBuffers = true;
- break;
- case Key.D:
- finalDebug = -finalDebug;
- rebuildBuffers = true;
- break;
- case Key.B:
- if (modifiers.HasFlag (Modifier.Control)) {
- if (modifiers.HasFlag (Modifier.Shift))
- pcBloom.strength -= 0.1f;
- else
- pcBloom.strength += 0.1f;
- } else {
- if (modifiers.HasFlag (Modifier.Shift))
- pcBloom.scale *= 1.1f;
- else
- pcBloom.scale *= 0.9f;
- }
- Console.WriteLine ($"Bloom: scale = {pcBloom.scale}, strength = {pcBloom.strength}");
- rebuildBuffers = true;
- //if (camera.Type == Camera.CamType.FirstPerson)
- // camera.Type = Camera.CamType.LookAt;
- //else
- // camera.Type = Camera.CamType.FirstPerson;
- //Console.WriteLine ($"camera type = {camera.Type}");
- break;
- case Key.KeypadAdd:
- curModelIndex++;
- if (curModelIndex >= modelPathes.Length)
- curModelIndex = 0;
- reloadModel = true;
- break;
- case Key.KeypadSubtract:
- curModelIndex--;
- if (curModelIndex < 0)
- curModelIndex = modelPathes.Length -1;
- reloadModel = true;
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- return;
- }
- updateViewRequested = true;
- }
- #endregion
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- computeCmdPool.Dispose ();
- downSamp?.Dispose ();
- downSamp2?.Dispose ();
- if (frameBuffers != null)
- foreach (Framebuffer fb in frameBuffers)
- fb.Dispose ();
- renderer.Dispose ();
- plBlur.Dispose ();
- plToneMap.Dispose ();
- descriptorPool.Dispose ();
- }
- dev.DestroySemaphore (blurComplete);
- }
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/deferred/mainShadow.cs b/samples/deferred/mainShadow.cs
deleted file mode 100644
index 0bc3103..0000000
--- a/samples/deferred/mainShadow.cs
+++ /dev/null
@@ -1,415 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using Glfw;
-using VK;
-using CVKL;
-
-namespace deferredShadow {
- class Program : VkWindow{
- static void Main (string[] args) {
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1;
-
- public struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 view;
- public Matrix4x4 model;
- public Vector4 lightPos;
- public float gamma;
- public float exposure;
- }
-
- public Matrices matrices = new Matrices {
- lightPos = new Vector4 (1.0f, 0.0f, 0.0f, 1.0f),
- gamma = 1.0f,
- exposure = 2.0f,
- };
-
- const uint SHADOW_MAP_SIZE = 4096;
-
-#if DEBUG
- PipelineStatisticsQueryPool statPool;
- TimestampQueryPool timestampQPool;
- ulong[] results;
-#endif
-
- protected override void configureEnabledFeatures (ref VkPhysicalDeviceFeatures features) {
- base.configureEnabledFeatures (ref features);
-#if DEBUG
- features.pipelineStatisticsQuery = true;
-#endif
- }
-
- Program () : base(true) {
- //camera.Model = Matrix4x4.CreateRotationX (Utils.DegreesToRadians (-90)) * Matrix4x4.CreateRotationY (Utils.DegreesToRadians (180));
- //camera.SetRotation (-0.1f,-0.4f);
- camera.SetPosition (0, 0, -3);
-
- init ();
-
-#if DEBUG
- statPool = new PipelineStatisticsQueryPool (dev,
- VkQueryPipelineStatisticFlags.InputAssemblyVertices |
- VkQueryPipelineStatisticFlags.InputAssemblyPrimitives |
- VkQueryPipelineStatisticFlags.ClippingInvocations |
- VkQueryPipelineStatisticFlags.ClippingPrimitives |
- VkQueryPipelineStatisticFlags.FragmentShaderInvocations);
-
- timestampQPool = new TimestampQueryPool (dev);
-#endif
- }
-
- Framebuffer[] frameBuffers;
- Image gbColorRough, gbEmitMetal, gbN, gbPos;
-
- DescriptorPool descriptorPool;
- DescriptorSetLayout descLayoutMain, descLayoutModelTextures, descLayoutGBuff;
- DescriptorSet dsMain, dsGBuff;
-
- Pipeline gBuffPipeline, composePipeline;
-
- HostBuffer uboMats;
-
- RenderPass renderPass;
-
- Model model;
- EnvironmentCube envCube;
-
- DebugDrawPipeline debugDraw;
- Framebuffer[] debugFB;
-
- void init () {
- VkFormat depthFormat = dev.GetSuitableDepthFormat ();
- renderPass = new RenderPass (dev);
-
- renderPass.AddAttachment (swapChain.ColorFormat, VkImageLayout.ColorAttachmentOptimal, VkSampleCountFlags.SampleCount1);
- renderPass.AddAttachment (depthFormat, VkImageLayout.DepthStencilAttachmentOptimal, samples);
- renderPass.AddAttachment (VkFormat.R8g8b8a8Unorm, VkImageLayout.ColorAttachmentOptimal);
- renderPass.AddAttachment (VkFormat.R8g8b8a8Unorm, VkImageLayout.ColorAttachmentOptimal);
- renderPass.AddAttachment (VkFormat.R16g16b16a16Sfloat, VkImageLayout.ColorAttachmentOptimal);
- renderPass.AddAttachment (VkFormat.R16g16b16a16Sfloat, VkImageLayout.ColorAttachmentOptimal);
- //renderPass.AddAttachment (VkFormat.R16g16b16a16Sfloat, VkImageLayout.DepthStencilReadOnlyOptimal);
-
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { depthStencil = new VkClearDepthStencilValue (1.0f, 0) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
-
- SubPass[] subpass = { new SubPass (), new SubPass (), new SubPass() };
- subpass[0].AddColorReference ( new VkAttachmentReference (2, VkImageLayout.ColorAttachmentOptimal),
- new VkAttachmentReference (3, VkImageLayout.ColorAttachmentOptimal),
- new VkAttachmentReference (4, VkImageLayout.ColorAttachmentOptimal),
- new VkAttachmentReference (5, VkImageLayout.ColorAttachmentOptimal));
- subpass[0].SetDepthReference (1, VkImageLayout.DepthStencilAttachmentOptimal);
-
- subpass[1].AddColorReference (0, VkImageLayout.ColorAttachmentOptimal);
- subpass[1].AddInputReference ( new VkAttachmentReference (2, VkImageLayout.ShaderReadOnlyOptimal),
- new VkAttachmentReference (3, VkImageLayout.ShaderReadOnlyOptimal),
- new VkAttachmentReference (4, VkImageLayout.ShaderReadOnlyOptimal),
- new VkAttachmentReference (5, VkImageLayout.ShaderReadOnlyOptimal));
- renderPass.AddSubpass (subpass);
-
- renderPass.AddDependency (Vk.SubpassExternal, 0,
- VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.ColorAttachmentOutput,
- VkAccessFlags.MemoryRead, VkAccessFlags.ColorAttachmentRead | VkAccessFlags.ColorAttachmentWrite);
- renderPass.AddDependency (0, 1,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader,
- VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.ShaderRead);
- renderPass.AddDependency (1, Vk.SubpassExternal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.BottomOfPipe,
- VkAccessFlags.ColorAttachmentRead | VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.MemoryRead);
-
-
- descriptorPool = new DescriptorPool (dev, 3,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer, 2),
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler, 3),
- new VkDescriptorPoolSize (VkDescriptorType.InputAttachment, 4)
- );
-
- descLayoutMain = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, VkDescriptorType.UniformBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
-
- descLayoutModelTextures = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (4, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
-
- descLayoutGBuff = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment));
-
- dsMain = descriptorPool.Allocate (descLayoutMain);
- dsGBuff = descriptorPool.Allocate (descLayoutGBuff);
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, samples);
- cfg.Layout = new PipelineLayout (dev, descLayoutMain, descLayoutModelTextures, descLayoutGBuff);
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex, (uint)Marshal.SizeOf<Matrix4x4> ()),
- new VkPushConstantRange (VkShaderStageFlags.Fragment, (uint)Marshal.SizeOf<Model.PbrMaterial> (), 64)
- );
- cfg.RenderPass = renderPass;
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
-
- cfg.AddVertexBinding<Model.Vertex> (0);
- cfg.SetVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat, VkFormat.R32g32Sfloat);
- cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/pbrtest.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/GBuffPbr.frag.spv");
-
- gBuffPipeline = new GraphicPipeline (cfg);
- cfg.blendAttachments.Clear ();
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- cfg.ResetShadersAndVerticesInfos ();
- cfg.SubpassIndex = 1;
- cfg.Layout = gBuffPipeline.Layout;
- cfg.depthStencilState.depthTestEnable = false;
- cfg.depthStencilState.depthWriteEnable = false;
- cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/FullScreenQuad.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/pbrtest.frag.spv");
- composePipeline = new GraphicPipeline (cfg);
-
- envCube = new EnvironmentCube (presentQueue, renderPass);
-
- uboMats = new HostBuffer (dev, VkBufferUsageFlags.UniformBuffer, (ulong)Marshal.SizeOf<Matrices> () * 2);
- uboMats.Map ();//permanent map
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descLayoutMain);
- uboUpdate.Write (dev, dsMain, uboMats.Descriptor,
- envCube.lutBrdf.Descriptor,
- envCube.irradianceCube.Descriptor,
- envCube.prefilterCube.Descriptor);
- uboMats.Descriptor.offset = (ulong)Marshal.SizeOf<Matrices> ();
- envCube.WriteDesc (uboMats.Descriptor);
-#if DEBUG
- debugDraw = new DebugDrawPipeline (dev, descLayoutMain, swapChain.ColorFormat);
- debugDraw.AddLine (Vector3.Zero, new Vector3(matrices.lightPos.X,matrices.lightPos.Y,matrices.lightPos.Z)*3, 1, 1, 1);
- debugDraw.AddLine (Vector3.Zero, Vector3.UnitX, 1, 0, 0);
- debugDraw.AddLine (Vector3.Zero, Vector3.UnitY, 0, 1, 0);
- debugDraw.AddLine (Vector3.Zero, Vector3.UnitZ, 0, 0, 1);
-#endif
-
-
- model = new Model (presentQueue, "../data/models/DamagedHelmet/glTF/DamagedHelmet.gltf");
- //model = new Model (presentQueue, "../data/models/chess.gltf");
- //model = new Model (presentQueue, "../data/models/Sponza/glTF/Sponza.gltf");
- //model = new Model (dev, presentQueue, "../data/models/icosphere.gltf");
- //model = new Model (dev, presentQueue, cmdPool, "../data/models/cube.gltf");
- model.WriteMaterialsDescriptorSets (descLayoutModelTextures,
- VK.AttachmentType.Color,
- VK.AttachmentType.Normal,
- VK.AttachmentType.AmbientOcclusion,
- VK.AttachmentType.PhysicalProps,
- VK.AttachmentType.Emissive);
- }
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
- cmds[i] = cmdPool.AllocateCommandBuffer ();
- cmds[i].Start ();
-
-#if DEBUG
- statPool.Begin (cmds[i]);
- recordDraw (cmds[i], frameBuffers[i]);
- statPool.End (cmds[i]);
-
- debugDraw.RecordDraw (cmds[i], debugFB[i], camera);
-#else
- recordDraw (cmds[i], frameBuffers[i]);
-#endif
-
- cmds[i].End ();
- }
- }
- void recordDraw (CommandBuffer cmd, Framebuffer fb) {
- renderPass.Begin (cmd, fb);
-
- cmd.SetViewport (fb.Width, fb.Height);
- cmd.SetScissor (fb.Width, fb.Height);
-
- cmd.BindDescriptorSet (gBuffPipeline.Layout, dsMain);
- gBuffPipeline.Bind (cmd);
- model.Bind (cmd);
- model.DrawAll (cmd, gBuffPipeline.Layout);
-
- renderPass.BeginSubPass (cmd);
-
- cmd.BindDescriptorSet (composePipeline.Layout, dsGBuff, 2);
- composePipeline.Bind (cmd);
-
- cmd.Draw (3, 1, 0, 0);
-
- renderPass.End (cmd);
- }
-
-#region update
- void updateMatrices () {
- camera.AspectRatio = (float)swapChain.Width / swapChain.Height;
-
- matrices.projection = camera.Projection;
- matrices.view = camera.View;
- matrices.model = camera.Model;
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> ());
- matrices.view *= Matrix4x4.CreateTranslation (-matrices.view.Translation);
- matrices.model = Matrix4x4.Identity;
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> (), (uint)Marshal.SizeOf<Matrices> ());
- }
-
- public override void UpdateView () {
- updateMatrices ();
- updateViewRequested = false;
- }
- public override void Update () {
-#if DEBUG
- results = statPool.GetResults ();
-#endif
- }
-#endregion
-
-
-
- void createGBuff () {
- gbColorRough?.Dispose ();
- gbEmitMetal?.Dispose ();
- gbN?.Dispose ();
- gbPos?.Dispose ();
-
- gbColorRough = new Image (dev, VkFormat.R8g8b8a8Unorm, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment, VkMemoryPropertyFlags.DeviceLocal, swapChain.Width, swapChain.Height);
- gbEmitMetal = new Image (dev, VkFormat.R8g8b8a8Unorm, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment, VkMemoryPropertyFlags.DeviceLocal, swapChain.Width, swapChain.Height);
- gbN = new Image (dev, VkFormat.R16g16b16a16Sfloat, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment, VkMemoryPropertyFlags.DeviceLocal, swapChain.Width, swapChain.Height);
- gbPos = new Image (dev, VkFormat.R16g16b16a16Sfloat, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment, VkMemoryPropertyFlags.DeviceLocal, swapChain.Width, swapChain.Height);
-
- gbColorRough.CreateView ();
- gbColorRough.CreateSampler ();
- gbEmitMetal.CreateView ();
- gbEmitMetal.CreateSampler ();
- gbN.CreateView ();
- gbN.CreateSampler ();
- gbPos.CreateView ();
- gbPos.CreateSampler ();
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descLayoutGBuff);
- uboUpdate.Write (dev, dsGBuff, gbColorRough.Descriptor,
- gbEmitMetal.Descriptor,
- gbN.Descriptor,
- gbPos.Descriptor);
- gbColorRough.SetName ("GBuffColorRough");
- gbEmitMetal.SetName ("GBuffEmitMetal");
- gbN.SetName ("GBuffN");
- gbPos.SetName ("GBuffPos");
- }
-
- protected override void OnResize () {
- updateMatrices ();
-
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-#if DEBUG
- if (debugFB != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- debugFB[i]?.Dispose ();
-#endif
-
- createGBuff ();
-
- frameBuffers = new Framebuffer[swapChain.ImageCount];
- debugFB = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (renderPass, swapChain.Width, swapChain.Height, new Image[] {
- swapChain.images[i], null, gbColorRough, gbEmitMetal, gbN, gbPos});
-#if DEBUG
- debugFB[i] = new Framebuffer (debugDraw.RenderPass, swapChain.Width, swapChain.Height,(debugDraw.Samples == VkSampleCountFlags.SampleCount1)
- ? new Image[] { swapChain.images[i] } : new Image[] { null, swapChain.images[i] });
- debugFB[i].SetName ("main FB " + i);
-#endif
- }
-
- buildCommandBuffers ();
- }
-
-
- #region Mouse and keyboard
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.F1:
- if (modifiers.HasFlag (Modifier.Shift))
- matrices.exposure -= 0.3f;
- else
- matrices.exposure += 0.3f;
- break;
- case Key.F2:
- if (modifiers.HasFlag (Modifier.Shift))
- matrices.gamma -= 0.1f;
- else
- matrices.gamma += 0.1f;
- break;
- case Key.F3:
- if (camera.Type == Camera.CamType.FirstPerson)
- camera.Type = Camera.CamType.LookAt;
- else
- camera.Type = Camera.CamType.FirstPerson;
- Console.WriteLine ($"camera type = {camera.Type}");
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- return;
- }
- updateViewRequested = true;
- }
-#endregion
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- gbColorRough.Dispose ();
- gbEmitMetal.Dispose ();
- gbN.Dispose ();
- gbPos.Dispose ();
-
- gBuffPipeline.Dispose ();
- composePipeline.Dispose ();
-
- descLayoutMain.Dispose ();
- descLayoutModelTextures.Dispose ();
- descLayoutGBuff.Dispose ();
-
- uboMats.Dispose ();
- model.Dispose ();
- envCube.Dispose ();
-
- descriptorPool.Dispose ();
-#if DEBUG
- debugDraw.Dispose ();
- timestampQPool?.Dispose ();
- statPool?.Dispose ();
-#endif
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/deferred/mainWithDebugDrawer.cs b/samples/deferred/mainWithDebugDrawer.cs
deleted file mode 100644
index f95ed0a..0000000
--- a/samples/deferred/mainWithDebugDrawer.cs
+++ /dev/null
@@ -1,412 +0,0 @@
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using Glfw;
-using VK;
-using CVKL;
-
-namespace deferredDebug {
- class Program : VkWindow{
- static void Main (string[] args) {
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1;
-
- public struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 view;
- public Matrix4x4 model;
- public Vector4 lightPos;
- public float gamma;
- public float exposure;
- }
-
- public Matrices matrices = new Matrices {
- lightPos = new Vector4 (1.0f, 0, 0, 1.0f),
- gamma = 1.0f,
- exposure = 2.0f,
- };
-
-#if DEBUG
- PipelineStatisticsQueryPool statPool;
- TimestampQueryPool timestampQPool;
- ulong[] results;
-#endif
-
- protected override void configureEnabledFeatures (ref VkPhysicalDeviceFeatures features) {
- base.configureEnabledFeatures (ref features);
-#if DEBUG
- features.pipelineStatisticsQuery = true;
-#endif
- }
-
- Program () : base(true) {
- camera.Model = Matrix4x4.CreateRotationX (Utils.DegreesToRadians (-90)) * Matrix4x4.CreateRotationY (Utils.DegreesToRadians (180));
- camera.SetRotation (-0.1f,-0.4f);
- camera.SetPosition (0, 0, -3);
-
- init ();
-
-#if DEBUG
- statPool = new PipelineStatisticsQueryPool (dev,
- VkQueryPipelineStatisticFlags.InputAssemblyVertices |
- VkQueryPipelineStatisticFlags.InputAssemblyPrimitives |
- VkQueryPipelineStatisticFlags.ClippingInvocations |
- VkQueryPipelineStatisticFlags.ClippingPrimitives |
- VkQueryPipelineStatisticFlags.FragmentShaderInvocations);
-
- timestampQPool = new TimestampQueryPool (dev);
-#endif
- }
-
- Framebuffer[] frameBuffers;
- Image gbColorRough, gbEmitMetal, gbN, gbPos;
-
- DescriptorPool descriptorPool;
- DescriptorSetLayout descLayoutMain, descLayoutModelTextures, descLayoutGBuff;
- DescriptorSet dsMain, dsGBuff;
-
- Pipeline gBuffPipeline, composePipeline;
-
- HostBuffer uboMats;
-
- RenderPass renderPass;
-
- Model model;
- EnvironmentCube envCube;
-
- DebugDrawPipeline debugDraw;
- Framebuffer[] debugFB;
-
- void init () {
- renderPass = new RenderPass (dev);
- renderPass.AddAttachment (swapChain.ColorFormat, VkImageLayout.ColorAttachmentOptimal, VkSampleCountFlags.SampleCount1);
- renderPass.AddAttachment (dev.GetSuitableDepthFormat(), VkImageLayout.DepthStencilAttachmentOptimal, samples);
- renderPass.AddAttachment (VkFormat.R8g8b8a8Unorm, VkImageLayout.ColorAttachmentOptimal);
- renderPass.AddAttachment (VkFormat.R8g8b8a8Unorm, VkImageLayout.ColorAttachmentOptimal);
- renderPass.AddAttachment (VkFormat.R16g16b16a16Sfloat, VkImageLayout.ColorAttachmentOptimal);
- renderPass.AddAttachment (VkFormat.R16g16b16a16Sfloat, VkImageLayout.ColorAttachmentOptimal);
-
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { depthStencil = new VkClearDepthStencilValue (1.0f, 0) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
- renderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0.0f, 0.0f, 0.0f) });
-
- SubPass[] subpass = { new SubPass (), new SubPass () };
- subpass[0].AddColorReference ( new VkAttachmentReference (2, VkImageLayout.ColorAttachmentOptimal),
- new VkAttachmentReference (3, VkImageLayout.ColorAttachmentOptimal),
- new VkAttachmentReference (4, VkImageLayout.ColorAttachmentOptimal),
- new VkAttachmentReference (5, VkImageLayout.ColorAttachmentOptimal));
- subpass[0].SetDepthReference (1, VkImageLayout.DepthStencilAttachmentOptimal);
-
- subpass[1].AddColorReference (0, VkImageLayout.ColorAttachmentOptimal);
- subpass[1].AddInputReference ( new VkAttachmentReference (2, VkImageLayout.ShaderReadOnlyOptimal),
- new VkAttachmentReference (3, VkImageLayout.ShaderReadOnlyOptimal),
- new VkAttachmentReference (4, VkImageLayout.ShaderReadOnlyOptimal),
- new VkAttachmentReference (5, VkImageLayout.ShaderReadOnlyOptimal));
- renderPass.AddSubpass (subpass);
-
- renderPass.AddDependency (Vk.SubpassExternal, 0,
- VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.ColorAttachmentOutput,
- VkAccessFlags.MemoryRead, VkAccessFlags.ColorAttachmentRead | VkAccessFlags.ColorAttachmentWrite);
- renderPass.AddDependency (0, 1,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader,
- VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.ShaderRead);
- renderPass.AddDependency (1, Vk.SubpassExternal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.BottomOfPipe,
- VkAccessFlags.ColorAttachmentRead | VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.MemoryRead);
-
-
- descriptorPool = new DescriptorPool (dev, 3,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer, 2),
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler, 3),
- new VkDescriptorPoolSize (VkDescriptorType.InputAttachment, 4)
- );
-
- descLayoutMain = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, VkDescriptorType.UniformBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
-
- descLayoutModelTextures = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (4, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
-
- descLayoutGBuff = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.InputAttachment));
-
- dsMain = descriptorPool.Allocate (descLayoutMain);
- dsGBuff = descriptorPool.Allocate (descLayoutGBuff);
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, samples);
- cfg.Layout = new PipelineLayout (dev, descLayoutMain, descLayoutModelTextures, descLayoutGBuff);
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex, (uint)Marshal.SizeOf<Matrix4x4> ()),
- new VkPushConstantRange (VkShaderStageFlags.Fragment, sizeof(int), 64)
- );
- cfg.RenderPass = renderPass;
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
-
- cfg.AddVertexBinding<Model.Vertex> (0);
- cfg.SetVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat, VkFormat.R32g32Sfloat);
- cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/pbrtest.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/GBuffPbr.frag.spv");
-
- gBuffPipeline = new GraphicPipeline (cfg);
- cfg.blendAttachments.Clear ();
- cfg.blendAttachments.Add (new VkPipelineColorBlendAttachmentState (false));
- cfg.ResetShadersAndVerticesInfos ();
- cfg.SubpassIndex = 1;
- cfg.Layout = gBuffPipeline.Layout;
- cfg.depthStencilState.depthTestEnable = false;
- cfg.depthStencilState.depthWriteEnable = false;
- cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/FullScreenQuad.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/pbrtest.frag.spv");
- composePipeline = new GraphicPipeline (cfg);
-
- envCube = new EnvironmentCube (presentQueue, renderPass);
-
- uboMats = new HostBuffer (dev, VkBufferUsageFlags.UniformBuffer, (ulong)Marshal.SizeOf<Matrices> () * 2);
- uboMats.Map ();//permanent map
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descLayoutMain);
- uboUpdate.Write (dev, dsMain, uboMats.Descriptor,
- envCube.lutBrdf.Descriptor,
- envCube.irradianceCube.Descriptor,
- envCube.prefilterCube.Descriptor);
- uboMats.Descriptor.offset = (ulong)Marshal.SizeOf<Matrices> ();
- envCube.WriteDesc (uboMats.Descriptor);
-#if DEBUG
- debugDraw = new DebugDrawPipeline (dev, descLayoutMain, swapChain.ColorFormat);
- debugDraw.AddLine (Vector3.Zero, new Vector3(matrices.lightPos.X,matrices.lightPos.Y,matrices.lightPos.Z)*3, 1, 1, 1);
- debugDraw.AddLine (Vector3.Zero, Vector3.UnitX, 1, 0, 0);
- debugDraw.AddLine (Vector3.Zero, Vector3.UnitY, 0, 1, 0);
- debugDraw.AddLine (Vector3.Zero, Vector3.UnitZ, 0, 0, 1);
-#endif
-
-
- model = new Model (presentQueue, "../data/models/DamagedHelmet/glTF/DamagedHelmet.gltf");
- //model = new Model (presentQueue, "../data/models/chess.gltf");
- //model = new Model (presentQueue, "../data/models/Sponza/glTF/Sponza.gltf");
- //model = new Model (dev, presentQueue, "../data/models/icosphere.gltf");
- //model = new Model (dev, presentQueue, cmdPool, "../data/models/cube.gltf");
- model.WriteMaterialsDescriptorSets (descLayoutModelTextures,
- VK.AttachmentType.Color,
- VK.AttachmentType.Normal,
- VK.AttachmentType.AmbientOcclusion,
- VK.AttachmentType.PhysicalProps,
- VK.AttachmentType.Emissive);
- }
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
- cmds[i] = cmdPool.AllocateCommandBuffer ();
- cmds[i].Start ();
-
-#if DEBUG
- statPool.Begin (cmds[i]);
- recordDraw (cmds[i], frameBuffers[i]);
- statPool.End (cmds[i]);
-
- debugDraw.RecordDraw (cmds[i], debugFB[i], camera);
-#else
- recordDraw (cmds[i], frameBuffers[i]);
-#endif
-
- cmds[i].End ();
- }
- }
- void recordDraw (CommandBuffer cmd, Framebuffer fb) {
- renderPass.Begin (cmd, fb);
-
- cmd.SetViewport (fb.Width, fb.Height);
- cmd.SetScissor (fb.Width, fb.Height);
-
- cmd.BindDescriptorSet (gBuffPipeline.Layout, dsMain);
- gBuffPipeline.Bind (cmd);
- model.Bind (cmd);
- model.DrawAll (cmd, gBuffPipeline.Layout);
-
- renderPass.BeginSubPass (cmd);
-
- cmd.BindDescriptorSet (composePipeline.Layout, dsGBuff, 2);
- composePipeline.Bind (cmd);
-
- cmd.Draw (3, 1, 0, 0);
-
- renderPass.End (cmd);
- }
-
-#region update
- void updateMatrices () {
- camera.AspectRatio = (float)swapChain.Width / swapChain.Height;
-
- matrices.projection = camera.Projection;
- matrices.view = camera.View;
- matrices.model = camera.Model;
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> ());
- matrices.view *= Matrix4x4.CreateTranslation (-matrices.view.Translation);
- matrices.model = Matrix4x4.Identity;
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> (), (uint)Marshal.SizeOf<Matrices> ());
- }
-
- public override void UpdateView () {
- updateMatrices ();
- updateViewRequested = false;
- }
- public override void Update () {
-#if DEBUG
- results = statPool.GetResults ();
-#endif
- }
-#endregion
-
-
-
- void createGBuff () {
- gbColorRough?.Dispose ();
- gbEmitMetal?.Dispose ();
- gbN?.Dispose ();
- gbPos?.Dispose ();
-
- gbColorRough = new Image (dev, VkFormat.R8g8b8a8Unorm, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment, VkMemoryPropertyFlags.DeviceLocal, swapChain.Width, swapChain.Height);
- gbEmitMetal = new Image (dev, VkFormat.R8g8b8a8Unorm, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment, VkMemoryPropertyFlags.DeviceLocal, swapChain.Width, swapChain.Height);
- gbN = new Image (dev, VkFormat.R16g16b16a16Sfloat, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment, VkMemoryPropertyFlags.DeviceLocal, swapChain.Width, swapChain.Height);
- gbPos = new Image (dev, VkFormat.R16g16b16a16Sfloat, VkImageUsageFlags.InputAttachment | VkImageUsageFlags.ColorAttachment, VkMemoryPropertyFlags.DeviceLocal, swapChain.Width, swapChain.Height);
-
- gbColorRough.CreateView ();
- gbColorRough.CreateSampler ();
- gbEmitMetal.CreateView ();
- gbEmitMetal.CreateSampler ();
- gbN.CreateView ();
- gbN.CreateSampler ();
- gbPos.CreateView ();
- gbPos.CreateSampler ();
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descLayoutGBuff);
- uboUpdate.Write (dev, dsGBuff, gbColorRough.Descriptor,
- gbEmitMetal.Descriptor,
- gbN.Descriptor,
- gbPos.Descriptor);
- gbColorRough.SetName ("GBuffColorRough");
- gbEmitMetal.SetName ("GBuffEmitMetal");
- gbN.SetName ("GBuffN");
- gbPos.SetName ("GBuffPos");
- }
-
- protected override void OnResize () {
- updateMatrices ();
-
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-#if DEBUG
- if (debugFB != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- debugFB[i]?.Dispose ();
-#endif
-
- createGBuff ();
-
- frameBuffers = new Framebuffer[swapChain.ImageCount];
- debugFB = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (renderPass, swapChain.Width, swapChain.Height, new Image[] {
- swapChain.images[i], null, gbColorRough, gbEmitMetal, gbN, gbPos});
-#if DEBUG
- debugFB[i] = new Framebuffer (debugDraw.RenderPass, swapChain.Width, swapChain.Height,(debugDraw.Samples == VkSampleCountFlags.SampleCount1)
- ? new Image[] { swapChain.images[i] } : new Image[] { null, swapChain.images[i] });
- debugFB[i].SetName ("main FB " + i);
-#endif
- }
-
- buildCommandBuffers ();
- }
-
-
- #region Mouse and keyboard
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.F1:
- if (modifiers.HasFlag (Modifier.Shift))
- matrices.exposure -= 0.3f;
- else
- matrices.exposure += 0.3f;
- break;
- case Key.F2:
- if (modifiers.HasFlag (Modifier.Shift))
- matrices.gamma -= 0.1f;
- else
- matrices.gamma += 0.1f;
- break;
- case Key.F3:
- if (camera.Type == Camera.CamType.FirstPerson)
- camera.Type = Camera.CamType.LookAt;
- else
- camera.Type = Camera.CamType.FirstPerson;
- Console.WriteLine ($"camera type = {camera.Type}");
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- return;
- }
- updateViewRequested = true;
- }
-#endregion
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- gbColorRough.Dispose ();
- gbEmitMetal.Dispose ();
- gbN.Dispose ();
- gbPos.Dispose ();
-
- gBuffPipeline.Dispose ();
- composePipeline.Dispose ();
-
- descLayoutMain.Dispose ();
- descLayoutModelTextures.Dispose ();
- descLayoutGBuff.Dispose ();
-
- uboMats.Dispose ();
- model.Dispose ();
- envCube.Dispose ();
-
- descriptorPool.Dispose ();
-#if DEBUG
- foreach (Framebuffer fb in debugFB)
- fb.Dispose ();
-
- debugDraw.Dispose ();
- timestampQPool?.Dispose ();
- statPool?.Dispose ();
-#endif
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/deferred/modelWithVkvgStats.cs b/samples/deferred/modelWithVkvgStats.cs
deleted file mode 100644
index f4ea123..0000000
--- a/samples/deferred/modelWithVkvgStats.cs
+++ /dev/null
@@ -1,359 +0,0 @@
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using Glfw;
-using CVKL;
-using VK;
-using static CVKL.Camera;
-
-namespace modelWithVkvgStats {
- class Program : VkWindow {
-
- PipelineStatisticsQueryPool statPool;
- TimestampQueryPool timestampQPool;
-
- ulong[] results;
-
- protected override void configureEnabledFeatures (ref VkPhysicalDeviceFeatures features) {
- base.configureEnabledFeatures (ref features);
- features.pipelineStatisticsQuery = true;
- }
- public struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 view;
- public Matrix4x4 model;
- public Vector4 lightPos;
- public float gamma;
- public float exposure;
- }
-
- public Matrices matrices = new Matrices {
- lightPos = new Vector4 (0.0f, 0.0f, -2.0f, 1.0f),
- gamma = 1.0f,
- exposure = 2.0f,
- };
-
- HostBuffer uboMats;
-
- DescriptorPool descriptorPool;
- DescriptorSetLayout descLayoutMatrix;
- DescriptorSetLayout descLayoutTextures;
- DescriptorSet dsMats;
-
- GraphicPipeline pipeline;
- GraphicPipeline uiPipeline;
- Framebuffer[] frameBuffers;
-
- Model model;
-
- vkvg.Device vkvgDev;
- vkvg.Surface vkvgSurf;
- Image vkvgImage;
-
- void vkvgDraw () {
-
- using (vkvg.Context ctx = new vkvg.Context (vkvgSurf)) {
- ctx.Operator = vkvg.Operator.Clear;
- ctx.Paint ();
- ctx.Operator = vkvg.Operator.Over;
-
- ctx.LineWidth = 1;
- ctx.SetSource (0.1, 0.1, 0.1, 0.3);
- ctx.Rectangle (5.5, 5.5, 400, 250);
- ctx.FillPreserve ();
- ctx.Flush ();
- ctx.SetSource (0.8, 0.8, 0.8);
- ctx.Stroke ();
-
- ctx.FontFace = "mono";
- ctx.FontSize = 10;
- int x = 16;
- int y = 40, dy = 16;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"fps: {fps,5} "));
- ctx.MoveTo (x + 200, y - 0.5);
- ctx.Rectangle (x + 200, y - 8.5, 0.1 * fps, 10);
- ctx.SetSource (0.1, 0.9, 0.1);
- ctx.Fill ();
- ctx.SetSource (0.8, 0.8, 0.8);
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"Exposure:{matrices.exposure,5} "));
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"Gamma: {matrices.gamma,5} "));
- if (results == null)
- return;
-
- y += dy*2;
- ctx.MoveTo (x, y);
- ctx.ShowText ("Pipeline Statistics");
- ctx.MoveTo (x-2, 2.5+y);
- ctx.LineTo (x+160, 2.5+y);
- ctx.Stroke ();
- y += 4;
- x += 20;
-
- for (int i = 0; i < statPool.RequestedStats.Length; i++) {
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"{statPool.RequestedStats[i].ToString(),-30} :{results[i],12:0,0} "));
- }
-
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"{"Elapsed microsecond",-20} :{timestampQPool.ElapsedMiliseconds:0.0000} "));
- }
- }
-
- Program () : base () {
- vkvgDev = new vkvg.Device (instance.Handle, phy.Handle, dev.VkDev.Handle, presentQueue.qFamIndex,
- vkvg.SampleCount.Sample_4, presentQueue.index);
-
- camera.Type = CamType.FirstPerson;
- camera.Model = Matrix4x4.CreateScale (0.05f) * Matrix4x4.CreateRotationX((float)Math.PI);
- //Camera.SetRotation (-0.1f,-0.4f);
- camera.SetPosition (0, 2, -3);
-
- init ();
-
- model = new Model (presentQueue, "../data/models/Sponza/glTF/Sponza.gltf");
- model.WriteMaterialsDescriptorSets (descLayoutTextures,
- VK.AttachmentType.Color,
- VK.AttachmentType.Normal,
- VK.AttachmentType.AmbientOcclusion,
- VK.AttachmentType.PhysicalProps,
- VK.AttachmentType.Emissive);
- }
-
- void init (VkSampleCountFlags samples = VkSampleCountFlags.SampleCount4) {
- descriptorPool = new DescriptorPool (dev, 2,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer),
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler)
- );
-
- descLayoutMatrix = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex|VkShaderStageFlags.Fragment, VkDescriptorType.UniformBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
-
- descLayoutTextures = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (4, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
-
- dsMats = descriptorPool.Allocate (descLayoutMatrix);
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, samples);
-
- cfg.Layout = new PipelineLayout (dev, descLayoutMatrix, descLayoutTextures);
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex, (uint)Marshal.SizeOf<Matrix4x4> ()),
- new VkPushConstantRange (VkShaderStageFlags.Fragment, (uint)Marshal.SizeOf<Model.PbrMaterial> (), 64)
- );
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), samples);
-
- cfg.AddVertexBinding<Model.Vertex> (0);
- cfg.SetVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat, VkFormat.R32g32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/pbrtest.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/pbrtest.frag.spv");
-
- pipeline = new GraphicPipeline (cfg);
-
- cfg.ResetShadersAndVerticesInfos ();
- cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/FullScreenQuad.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/simpletexture.frag.spv");
-
- cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (true);
-
- uiPipeline = new GraphicPipeline (cfg);
-
- uboMats = new HostBuffer (dev, VkBufferUsageFlags.UniformBuffer, (ulong)Marshal.SizeOf<Matrices>());
- uboMats.Map ();//permanent map
-
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (dsMats, descLayoutMatrix.Bindings[0]);
- uboUpdate.Write (dev, uboMats.Descriptor);
-
- cfg.Layout.SetName ("Main Pipeline layout");
- uboMats.SetName ("uboMats");
- descriptorPool.SetName ("main pool");
- descLayoutTextures.SetName ("descLayoutTextures");
-
- statPool = new PipelineStatisticsQueryPool (dev,
- VkQueryPipelineStatisticFlags.InputAssemblyVertices |
- VkQueryPipelineStatisticFlags.InputAssemblyPrimitives |
- VkQueryPipelineStatisticFlags.ClippingInvocations |
- VkQueryPipelineStatisticFlags.ClippingPrimitives |
- VkQueryPipelineStatisticFlags.FragmentShaderInvocations);
-
- timestampQPool = new TimestampQueryPool (dev);
-
- }
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
-
- cmds[i] = cmdPool.AllocateCommandBuffer ();
- cmds[i].Start ();
-
- statPool.Begin (cmds[i]);
- cmds[i].BeginRegion ("draw" + i, 0.5f, 1f, 0f);
- cmds[i].Handle.SetDebugMarkerName (dev, "cmd Draw" + i);
- recordDraw (cmds[i], frameBuffers[i]);
- cmds[i].EndRegion ();
- statPool.End (cmds[i]);
- cmds[i].End ();
- }
- }
- void recordDraw (CommandBuffer cmd, Framebuffer fb) {
- cmd.BeginRegion ("models", 0.5f, 1f, 0f);
- pipeline.RenderPass.Begin (cmd, fb);
-
- cmd.SetViewport (fb.Width, fb.Height);
- cmd.SetScissor (fb.Width, fb.Height);
-
- cmd.BindDescriptorSet (pipeline.Layout, dsMats);
- pipeline.Bind (cmd);
- model.Bind (cmd);
- model.DrawAll (cmd, pipeline.Layout);
-
- cmd.EndRegion ();
- cmd.BeginRegion ("vkvg", 0.5f, 1f, 0f);
- uiPipeline.Bind (cmd);
-
- timestampQPool.Start (cmd);
-
- vkvgImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ColorAttachmentOptimal, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader);
-
- cmd.Draw (3, 1, 0, 0);
-
- vkvgImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ShaderReadOnlyOptimal, VkImageLayout.ColorAttachmentOptimal,
- VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.BottomOfPipe);
-
- timestampQPool.End (cmd);
-
- pipeline.RenderPass.End (cmd);
- cmd.EndRegion ();
- }
-
- #region update
- void updateMatrices () {
-
- camera.AspectRatio = (float)swapChain.Width / swapChain.Height;
-
- matrices.projection = camera.Projection;
- matrices.view = camera.View;
- matrices.model = camera.Model;
- uboMats.Update (matrices, (uint)Marshal.SizeOf<Matrices> ());
- }
-
- public override void UpdateView () {
- updateMatrices ();
- updateViewRequested = false;
- }
- public override void Update () {
- results = statPool.GetResults ();
- vkvgDraw ();
- }
- #endregion
-
- #region mouse and keyboard
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.F1:
- if (modifiers.HasFlag (Modifier.Shift))
- matrices.exposure -= 0.3f;
- else
- matrices.exposure += 0.3f;
- break;
- case Key.F2:
- if (modifiers.HasFlag (Modifier.Shift))
- matrices.gamma -= 0.1f;
- else
- matrices.gamma += 0.1f;
- break;
- case Key.F3:
- if (camera.Type == CamType.FirstPerson)
- camera.Type = CamType.LookAt;
- else
- camera.Type = CamType.FirstPerson;
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- return;
- }
- updateViewRequested = true;
- }
- #endregion
-
- protected override void OnResize () {
-
- vkvgImage?.Dispose ();
- vkvgSurf?.Dispose ();
- vkvgSurf = new vkvg.Surface (vkvgDev, (int)swapChain.Width, (int)swapChain.Height);
- vkvgImage = new Image (dev, new VkImage ((ulong)vkvgSurf.VkImage.ToInt64 ()), VkFormat.B8g8r8a8Unorm,
- VkImageUsageFlags.ColorAttachment, (uint)vkvgSurf.Width, (uint)vkvgSurf.Height);
- vkvgImage.CreateView (VkImageViewType.ImageView2D, VkImageAspectFlags.Color);
- vkvgImage.CreateSampler (VkFilter.Nearest,VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder);
-
- vkvgImage.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (dsMats, descLayoutMatrix.Bindings[1]);
- uboUpdate.Write (dev, vkvgImage.Descriptor);
-
- updateMatrices ();
-
- if (frameBuffers!=null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (pipeline.RenderPass, swapChain.Width, swapChain.Height,
- (pipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- null
- } : new Image[] {
- null,
- null,
- swapChain.images[i]
- });
- frameBuffers[i].SetName ("main FB " + i);
-
- }
-
- buildCommandBuffers ();
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
- model.Dispose ();
- pipeline.Dispose ();
- descLayoutMatrix.Dispose ();
- descLayoutTextures.Dispose ();
- descriptorPool.Dispose ();
-
- uboMats.Dispose ();
-
- vkvgSurf?.Dispose ();
- vkvgDev.Dispose ();
-
- timestampQPool.Dispose ();
- statPool.Dispose ();
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/deferred/shaders/FullScreenQuad.vert b/samples/deferred/shaders/FullScreenQuad.vert
deleted file mode 100644
index 826720b..0000000
--- a/samples/deferred/shaders/FullScreenQuad.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-#version 450
-
-layout (location = 0) out vec2 outUV;
-
-void main()
-{
- outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
- gl_Position = vec4(outUV * 2.0f + -1.0f, 0.0f, 1.0f);
- //gl_Position = vec4(outUV -1.0f, 0.0f, 1.0f);
-}
diff --git a/samples/deferred/shaders/GBuffPbr.frag b/samples/deferred/shaders/GBuffPbr.frag
deleted file mode 100644
index ca398e6..0000000
--- a/samples/deferred/shaders/GBuffPbr.frag
+++ /dev/null
@@ -1,212 +0,0 @@
-#version 450
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-#define MANUAL_SRGB 0
-#define DEBUG 0
-
-layout (constant_id = 0) const float NEAR_PLANE = 0.1f;
-layout (constant_id = 1) const float FAR_PLANE = 256.0f;
-layout (constant_id = 2) const int MAT_COUNT = 1;
-
-struct Material {
- vec4 baseColorFactor;
- vec4 emissiveFactor;
- vec4 diffuseFactor;
- vec4 specularFactor;
- float workflow;
- uint tex0;
- uint tex1;
- float metallicFactor;
- float roughnessFactor;
- float alphaMask;
- float alphaMaskCutoff;
- int pad0;
-};
-const float M_PI = 3.141592653589793;
-const float c_MinRoughness = 0.04;
-
-const float PBR_WORKFLOW_METALLIC_ROUGHNESS = 1.0;
-const float PBR_WORKFLOW_SPECULAR_GLOSINESS = 2.0f;
-
-const uint MAP_COLOR = 0x1;
-const uint MAP_NORMAL = 0x2;
-const uint MAP_AO = 0x4;
-const uint MAP_METAL = 0x8;
-const uint MAP_ROUGHNESS = 0x10;
-const uint MAP_METALROUGHNESS = 0x20;
-const uint MAP_EMISSIVE = 0x40;
-
-layout (location = 0) in vec3 inWorldPos;
-layout (location = 1) in vec3 inNormal;
-layout (location = 2) in vec2 inUV0;
-layout (location = 3) in vec2 inUV1;
-
-
-layout (set = 0, binding = 5) uniform UBOMaterials {
- Material materials[MAT_COUNT];
-};
-
-// Material bindings
-layout (set = 2, binding = 0) uniform sampler2D colorMap;
-layout (set = 2, binding = 1) uniform sampler2D physicalDescriptorMap;
-layout (set = 2, binding = 2) uniform sampler2D normalMap;
-layout (set = 2, binding = 3) uniform sampler2D aoMap;
-layout (set = 2, binding = 4) uniform sampler2D emissiveMap;
-
-
-layout (push_constant) uniform PushCsts {
- layout(offset = 64)
- int materialIdx;
-};
-
-
-layout (location = 0) out vec4 outColorRough;
-layout (location = 1) out vec4 outEmitMetal;
-layout (location = 2) out vec4 outN_AO;
-layout (location = 3) out vec4 outPos;
-
-vec4 SRGBtoLINEAR(vec4 srgbIn)
-{
- #ifdef MANUAL_SRGB
- #ifdef SRGB_FAST_APPROXIMATION
- vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
- #else //SRGB_FAST_APPROXIMATION
- vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
- vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
- #endif //SRGB_FAST_APPROXIMATION
- return vec4(linOut,srgbIn.w);;
- #else //MANUAL_SRGB
- return srgbIn;
- #endif //MANUAL_SRGB
-}
-
-// Find the normal for this fragment, pulling either from a predefined normal map
-// or from the interpolated mesh normal and tangent attributes.
-vec3 getNormal()
-{
- vec3 tangentNormal;
- // Perturb normal, see http://www.thetenthplanet.de/archives/1180
- if ((materials[materialIdx].tex0 & MAP_NORMAL) == MAP_NORMAL)
- tangentNormal = texture(normalMap, inUV0).xyz * 2.0 - 1.0;
- else if ((materials[materialIdx].tex1 & MAP_NORMAL) == MAP_NORMAL)
- tangentNormal = texture(normalMap, inUV1).xyz * 2.0 - 1.0;
- else
- return normalize(inNormal);
-
- vec3 q1 = dFdx(inWorldPos);
- vec3 q2 = dFdy(inWorldPos);
- vec2 st1 = dFdx(inUV0);
- vec2 st2 = dFdy(inUV0);
-
- vec3 N = normalize(inNormal);
- vec3 T = normalize(q1 * st2.t - q2 * st1.t);
- vec3 B = -normalize(cross(N, T));
- mat3 TBN = mat3(T, B, N);
-
- return normalize(TBN * tangentNormal);
-}
-
-// Gets metallic factor from specular glossiness workflow inputs
-float convertMetallic(vec3 diffuse, vec3 specular, float maxSpecular) {
- float perceivedDiffuse = sqrt(0.299 * diffuse.r * diffuse.r + 0.587 * diffuse.g * diffuse.g + 0.114 * diffuse.b * diffuse.b);
- float perceivedSpecular = sqrt(0.299 * specular.r * specular.r + 0.587 * specular.g * specular.g + 0.114 * specular.b * specular.b);
- if (perceivedSpecular < c_MinRoughness) {
- return 0.0;
- }
- float a = c_MinRoughness;
- float b = perceivedDiffuse * (1.0 - maxSpecular) / (1.0 - c_MinRoughness) + perceivedSpecular - 2.0 * c_MinRoughness;
- float c = c_MinRoughness - perceivedSpecular;
- float D = max(b * b - 4.0 * a * c, 0.0);
- return clamp((-b + sqrt(D)) / (2.0 * a), 0.0, 1.0);
-}
-
-float linearDepth(float depth)
-{
- float z = depth * 2.0f - 1.0f;
- return (2.0f * NEAR_PLANE * FAR_PLANE) / (FAR_PLANE + NEAR_PLANE - z * (FAR_PLANE - NEAR_PLANE));
-}
-
-void main()
-{
- float perceptualRoughness;
- float metallic;
- vec4 baseColor;
- vec3 emissive = vec3(0);
-
- baseColor = materials[materialIdx].baseColorFactor;
-
- if (materials[materialIdx].workflow == PBR_WORKFLOW_METALLIC_ROUGHNESS) {
- perceptualRoughness = materials[materialIdx].roughnessFactor;
- metallic = materials[materialIdx].metallicFactor;
- // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
- // This layout intentionally reserves the 'r' channel for (optional) occlusion map data
- if ((materials[materialIdx].tex0 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS){
- perceptualRoughness *= texture(physicalDescriptorMap, inUV0).g;
- metallic *= texture(physicalDescriptorMap, inUV0).b;
- }else if ((materials[materialIdx].tex1 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS){
- perceptualRoughness *= texture(physicalDescriptorMap, inUV1).g;
- metallic *= texture(physicalDescriptorMap, inUV1).b;
- }
- perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
- metallic = clamp(metallic, 0.0, 1.0);
-
- // The albedo may be defined from a base texture or a flat color
- if ((materials[materialIdx].tex0 & MAP_COLOR) == MAP_COLOR)
- baseColor *= SRGBtoLINEAR(texture(colorMap, inUV0));
- else if ((materials[materialIdx].tex1 & MAP_COLOR) == MAP_COLOR)
- baseColor *= SRGBtoLINEAR(texture(colorMap, inUV1));
- }
-
- if (materials[materialIdx].alphaMask == 1.0f) {
- if (baseColor.a < materials[materialIdx].alphaMaskCutoff)
- discard;
- }
-
- if (materials[materialIdx].workflow == PBR_WORKFLOW_SPECULAR_GLOSINESS) {
- // Values from specular glossiness workflow are converted to metallic roughness
- if ((materials[materialIdx].tex0 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- perceptualRoughness = 1.0 - texture(physicalDescriptorMap, inUV0).a;
- else if ((materials[materialIdx].tex1 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- perceptualRoughness = 1.0 - texture(physicalDescriptorMap, inUV1).a;
- else
- perceptualRoughness = 0.0;
-
- const float epsilon = 1e-6;
-
- vec4 diffuse = SRGBtoLINEAR(texture(colorMap, inUV0));
- vec3 specular = SRGBtoLINEAR(texture(physicalDescriptorMap, inUV0)).rgb;
-
- float maxSpecular = max(max(specular.r, specular.g), specular.b);
-
- // Convert metallic value from specular glossiness inputs
- metallic = convertMetallic(diffuse.rgb, specular, maxSpecular);
-
- vec3 baseColorDiffusePart = diffuse.rgb * ((1.0 - maxSpecular) / (1 - c_MinRoughness) / max(1 - metallic, epsilon)) * materials[materialIdx].diffuseFactor.rgb;
- vec3 baseColorSpecularPart = specular - (vec3(c_MinRoughness) * (1 - metallic) * (1 / max(metallic, epsilon))) * materials[materialIdx].specularFactor.rgb;
- baseColor = vec4(mix(baseColorDiffusePart, baseColorSpecularPart, metallic * metallic), diffuse.a);
-
- }
-
- const float u_OcclusionStrength = 1.0f;
- const float u_EmissiveFactor = 1.0f;
- float ao = 1.0f;
-
- if ((materials[materialIdx].tex0 & MAP_EMISSIVE) == MAP_EMISSIVE)
- emissive = SRGBtoLINEAR(texture(emissiveMap, inUV0)).rgb * u_EmissiveFactor;
- else if ((materials[materialIdx].tex1 & MAP_EMISSIVE) == MAP_EMISSIVE)
- emissive = SRGBtoLINEAR(texture(emissiveMap, inUV1)).rgb * u_EmissiveFactor;
-
- if ((materials[materialIdx].tex0 & MAP_AO) == MAP_AO)
- ao = texture(aoMap, inUV0).r;
- else if ((materials[materialIdx].tex1 & MAP_AO) == MAP_AO)
- ao = texture(aoMap, inUV1).r;
-
- vec3 n = getNormal();
- vec3 p = inWorldPos;
-
- outColorRough = vec4 (baseColor.rgb, perceptualRoughness);
- outEmitMetal = vec4 (emissive, metallic);
- outN_AO = vec4 (n, ao);
- outPos = vec4 (p, linearDepth(gl_FragCoord.z));
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/GBuffPbr.vert b/samples/deferred/shaders/GBuffPbr.vert
deleted file mode 100644
index 7cafe49..0000000
--- a/samples/deferred/shaders/GBuffPbr.vert
+++ /dev/null
@@ -1,37 +0,0 @@
-#version 450
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec3 inNormal;
-layout (location = 2) in vec2 inUV0;
-layout (location = 3) in vec2 inUV1;
-
-layout (set = 0, binding = 0) uniform UBO {
- mat4 projection;
- mat4 model;
- mat4 view;
-} ubo;
-
-layout(push_constant) uniform PushConsts {
- mat4 model;
-} pc;
-
-layout (location = 0) out vec3 outWorldPos;
-layout (location = 1) out vec3 outNormal;
-layout (location = 2) out vec2 outUV0;
-layout (location = 3) out vec2 outUV1;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-void main()
-{
- vec4 locPos = ubo.model * pc.model * vec4(inPos, 1.0);
- outNormal = normalize(transpose(inverse(mat3(ubo.model * pc.model))) * inNormal);
-
- outWorldPos = locPos.xyz;
- outUV0 = inUV0;
- outUV1 = inUV1;
- gl_Position = ubo.projection * ubo.view * vec4(outWorldPos, 1.0);
-}
diff --git a/samples/deferred/shaders/GBuffPbrTexArray.frag b/samples/deferred/shaders/GBuffPbrTexArray.frag
deleted file mode 100644
index dee3471..0000000
--- a/samples/deferred/shaders/GBuffPbrTexArray.frag
+++ /dev/null
@@ -1,211 +0,0 @@
-#version 450
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-#define MANUAL_SRGB 0
-#define DEBUG 0
-
-layout (constant_id = 0) const float NEAR_PLANE = 0.1f;
-layout (constant_id = 1) const float FAR_PLANE = 256.0f;
-layout (constant_id = 2) const int MAT_COUNT = 1;
-
-struct Material {
- vec4 baseColorFactor;
- vec4 emissiveFactor;
- vec4 diffuseFactor;
- vec4 specularFactor;
-
- float workflow;
- uint tex0;
- uint tex1;
- int baseColorTex;
-
- int physicalDescTex;
- int normalTex;
- int occlusionTex;
- int emissiveTex;
-
- float metallicFactor;
- float roughnessFactor;
- float alphaMask;
- float alphaMaskCutoff;
-};
-const float M_PI = 3.141592653589793;
-const float c_MinRoughness = 0.04;
-
-const float PBR_WORKFLOW_METALLIC_ROUGHNESS = 1.0;
-const float PBR_WORKFLOW_SPECULAR_GLOSINESS = 2.0f;
-
-const uint MAP_COLOR = 0x1;
-const uint MAP_NORMAL = 0x2;
-const uint MAP_AO = 0x4;
-const uint MAP_METAL = 0x8;
-const uint MAP_ROUGHNESS = 0x10;
-const uint MAP_METALROUGHNESS = 0x20;
-const uint MAP_EMISSIVE = 0x40;
-
-layout (location = 0) in vec3 inWorldPos;
-layout (location = 1) in vec3 inNormal;
-layout (location = 2) in vec2 inUV0;
-layout (location = 3) in vec2 inUV1;
-
-layout (set = 0, binding = 5) uniform UBOMaterials {
- Material materials[MAT_COUNT];
-};
-layout (set = 0, binding = 7) uniform sampler2DArray texArray;
-
-layout (push_constant) uniform PushCsts {
- layout(offset = 64)
- int materialIdx;
-};
-
-
-layout (location = 0) out vec4 outColorRough;
-layout (location = 1) out vec4 outEmitMetal;
-layout (location = 2) out vec4 outN_AO;
-layout (location = 3) out vec4 outPos;
-
-vec4 SRGBtoLINEAR(vec4 srgbIn)
-{
- #ifdef MANUAL_SRGB
- #ifdef SRGB_FAST_APPROXIMATION
- vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
- #else //SRGB_FAST_APPROXIMATION
- vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
- vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
- #endif //SRGB_FAST_APPROXIMATION
- return vec4(linOut,srgbIn.w);;
- #else //MANUAL_SRGB
- return srgbIn;
- #endif //MANUAL_SRGB
-}
-
-// Find the normal for this fragment, pulling either from a predefined normal map
-// or from the interpolated mesh normal and tangent attributes.
-vec3 getNormal()
-{
- vec3 tangentNormal;
- // Perturb normal, see http://www.thetenthplanet.de/archives/1180
- if ((materials[materialIdx].tex0 & MAP_NORMAL) == MAP_NORMAL)
- tangentNormal = texture(texArray, vec3(inUV0, materials[materialIdx].normalTex)).xyz * 2.0 - 1.0;
- else if ((materials[materialIdx].tex1 & MAP_NORMAL) == MAP_NORMAL)
- tangentNormal = texture(texArray, vec3(inUV1, materials[materialIdx].normalTex)).xyz * 2.0 - 1.0;
- else
- return normalize(inNormal);
-
- vec3 q1 = dFdx(inWorldPos);
- vec3 q2 = dFdy(inWorldPos);
- vec2 st1 = dFdx(inUV0);
- vec2 st2 = dFdy(inUV0);
-
- vec3 N = normalize(inNormal);
- vec3 T = normalize(q1 * st2.t - q2 * st1.t);
- vec3 B = -normalize(cross(N, T));
- mat3 TBN = mat3(T, B, N);
-
- return normalize(TBN * tangentNormal);
-}
-
-// Gets metallic factor from specular glossiness workflow inputs
-float convertMetallic(vec3 diffuse, vec3 specular, float maxSpecular) {
- float perceivedDiffuse = sqrt(0.299 * diffuse.r * diffuse.r + 0.587 * diffuse.g * diffuse.g + 0.114 * diffuse.b * diffuse.b);
- float perceivedSpecular = sqrt(0.299 * specular.r * specular.r + 0.587 * specular.g * specular.g + 0.114 * specular.b * specular.b);
- if (perceivedSpecular < c_MinRoughness) {
- return 0.0;
- }
- float a = c_MinRoughness;
- float b = perceivedDiffuse * (1.0 - maxSpecular) / (1.0 - c_MinRoughness) + perceivedSpecular - 2.0 * c_MinRoughness;
- float c = c_MinRoughness - perceivedSpecular;
- float D = max(b * b - 4.0 * a * c, 0.0);
- return clamp((-b + sqrt(D)) / (2.0 * a), 0.0, 1.0);
-}
-
-float linearDepth(float depth)
-{
- float z = depth * 2.0f - 1.0f;
- return (2.0f * NEAR_PLANE * FAR_PLANE) / (FAR_PLANE + NEAR_PLANE - z * (FAR_PLANE - NEAR_PLANE));
-}
-
-void main()
-{
- float perceptualRoughness;
- float metallic;
- vec4 baseColor;
- vec3 emissive = vec3(0);
-
- baseColor = materials[materialIdx].baseColorFactor;
-
- if (materials[materialIdx].workflow == PBR_WORKFLOW_METALLIC_ROUGHNESS) {
- perceptualRoughness = materials[materialIdx].roughnessFactor;
- metallic = materials[materialIdx].metallicFactor;
- // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
- // This layout intentionally reserves the 'r' channel for (optional) occlusion map data
- if ((materials[materialIdx].tex0 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS){
- perceptualRoughness *= texture(texArray, vec3(inUV0, materials[materialIdx].physicalDescTex)).g;
- metallic *= texture(texArray, vec3(inUV0, materials[materialIdx].physicalDescTex)).b;
- }else if ((materials[materialIdx].tex1 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS){
- perceptualRoughness *= texture(texArray, vec3(inUV1, materials[materialIdx].physicalDescTex)).g;
- metallic *= texture(texArray, vec3(inUV1, materials[materialIdx].physicalDescTex)).b;
- }
- perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
- metallic = clamp(metallic, 0.0, 1.0);
-
- // The albedo may be defined from a base texture or a flat color
- if ((materials[materialIdx].tex0 & MAP_COLOR) == MAP_COLOR)
- baseColor *= SRGBtoLINEAR(texture(texArray, vec3(inUV0, materials[materialIdx].baseColorTex)));
- else if ((materials[materialIdx].tex1 & MAP_COLOR) == MAP_COLOR)
- baseColor *= SRGBtoLINEAR(texture(texArray, vec3(inUV1, materials[materialIdx].baseColorTex)));
- }
-
- if (materials[materialIdx].alphaMask == 1.0f) {
- if (baseColor.a < materials[materialIdx].alphaMaskCutoff)
- discard;
- }
-
- if (materials[materialIdx].workflow == PBR_WORKFLOW_SPECULAR_GLOSINESS) {
- // Values from specular glossiness workflow are converted to metallic roughness
- if ((materials[materialIdx].tex0 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- perceptualRoughness = 1.0 - texture(texArray, vec3(inUV0, materials[materialIdx].physicalDescTex)).a;
- else if ((materials[materialIdx].tex1 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- perceptualRoughness = 1.0 - texture(texArray, vec3(inUV1, materials[materialIdx].physicalDescTex)).a;
- else
- perceptualRoughness = 0.0;
-
- const float epsilon = 1e-6;
-
- vec4 diffuse = SRGBtoLINEAR(texture(texArray, vec3(inUV0, materials[materialIdx].baseColorTex)));
- vec3 specular = SRGBtoLINEAR(texture(texArray, vec3(inUV0, materials[materialIdx].physicalDescTex))).rgb;
-
- float maxSpecular = max(max(specular.r, specular.g), specular.b);
-
- // Convert metallic value from specular glossiness inputs
- metallic = convertMetallic(diffuse.rgb, specular, maxSpecular);
-
- vec3 baseColorDiffusePart = diffuse.rgb * ((1.0 - maxSpecular) / (1 - c_MinRoughness) / max(1 - metallic, epsilon)) * materials[materialIdx].diffuseFactor.rgb;
- vec3 baseColorSpecularPart = specular - (vec3(c_MinRoughness) * (1 - metallic) * (1 / max(metallic, epsilon))) * materials[materialIdx].specularFactor.rgb;
- baseColor = vec4(mix(baseColorDiffusePart, baseColorSpecularPart, metallic * metallic), diffuse.a);
-
- }
-
- const float u_OcclusionStrength = 1.0f;
- const float u_EmissiveFactor = 1.0f;
- float ao = 1.0f;
-
- if ((materials[materialIdx].tex0 & MAP_EMISSIVE) == MAP_EMISSIVE)
- emissive = SRGBtoLINEAR(texture(texArray, vec3(inUV0, materials[materialIdx].emissiveTex))).rgb * u_EmissiveFactor;
- else if ((materials[materialIdx].tex1 & MAP_EMISSIVE) == MAP_EMISSIVE)
- emissive = SRGBtoLINEAR(texture(texArray, vec3(inUV1, materials[materialIdx].emissiveTex))).rgb * u_EmissiveFactor;
-
- if ((materials[materialIdx].tex0 & MAP_AO) == MAP_AO)
- ao = texture(texArray, vec3(inUV0, materials[materialIdx].occlusionTex)).r;
- else if ((materials[materialIdx].tex1 & MAP_AO) == MAP_AO)
- ao = texture(texArray, vec3(inUV1, materials[materialIdx].occlusionTex)).r;
-
- vec3 n = getNormal();
- vec3 p = inWorldPos;
-
- outColorRough = vec4 (baseColor.rgb, perceptualRoughness);
- outEmitMetal = vec4 (emissive, metallic);
- outN_AO = vec4 (n, ao);
- outPos = vec4 (p, linearDepth(gl_FragCoord.z));
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/bloom.comp b/samples/deferred/shaders/bloom.comp
deleted file mode 100644
index e2b1318..0000000
--- a/samples/deferred/shaders/bloom.comp
+++ /dev/null
@@ -1,60 +0,0 @@
-#version 450
-
-layout (local_size_x = 16, local_size_y = 16) in;
-layout (binding = 0, rgba16f) uniform readonly image2D inputImage;
-layout (binding = 1, rgba16f) uniform image2D resultImage;
-
-layout(push_constant) uniform PushConsts {
- vec2 texSize;
- int dir;
- float scale;
- float strength;
-} pc;
-
-void main(void)
-{
- // From the OpenGL Super bible
- const float weights[] = float[](0.0024499299678342,
- 0.0043538453346397,
- 0.0073599963704157,
- 0.0118349786570722,
- 0.0181026699707781,
- 0.0263392293891488,
- 0.0364543006660986,
- 0.0479932050577658,
- 0.0601029809166942,
- 0.0715974486241365,
- 0.0811305381519717,
- 0.0874493212267511,
- 0.0896631113333857,
- 0.0874493212267511,
- 0.0811305381519717,
- 0.0715974486241365,
- 0.0601029809166942,
- 0.0479932050577658,
- 0.0364543006660986,
- 0.0263392293891488,
- 0.0181026699707781,
- 0.0118349786570722,
- 0.0073599963704157,
- 0.0043538453346397,
- 0.0024499299678342);
-
-
- float ar = 1.0;
- vec4 color = vec4(0.0);
-
- // Aspect ratio for vertical blur pass
- if (pc.dir == 1)
- ar = pc.texSize.y / pc.texSize.x;
-
- vec2 P = gl_GlobalInvocationID.yx - vec2(0, (weights.length() >> 1) * ar * pc.scale);
-
- for (int i = 0; i < weights.length(); i++)
- {
- vec2 dv = vec2(0.0, i * pc.scale) * ar;
- color += imageLoad (inputImage, ivec2(P + dv)) * weights[i] * pc.strength;
- }
-
- imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), color);
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/bloom.frag b/samples/deferred/shaders/bloom.frag
deleted file mode 100644
index c3bf402..0000000
--- a/samples/deferred/shaders/bloom.frag
+++ /dev/null
@@ -1,63 +0,0 @@
-#version 450
-
-layout (binding = 0) uniform sampler2D samplerColor0;
-layout (binding = 1) uniform sampler2D samplerColor1;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outColor;
-
-layout (constant_id = 0) const int dir = 0;
-
-void main(void)
-{
- // From the OpenGL Super bible
- const float weights[] = float[](0.0024499299678342,
- 0.0043538453346397,
- 0.0073599963704157,
- 0.0118349786570722,
- 0.0181026699707781,
- 0.0263392293891488,
- 0.0364543006660986,
- 0.0479932050577658,
- 0.0601029809166942,
- 0.0715974486241365,
- 0.0811305381519717,
- 0.0874493212267511,
- 0.0896631113333857,
- 0.0874493212267511,
- 0.0811305381519717,
- 0.0715974486241365,
- 0.0601029809166942,
- 0.0479932050577658,
- 0.0364543006660986,
- 0.0263392293891488,
- 0.0181026699707781,
- 0.0118349786570722,
- 0.0073599963704157,
- 0.0043538453346397,
- 0.0024499299678342);
-
-
- const float blurScale = 0.003;
- const float blurStrength = 1.0;
-
- float ar = 1.0;
- // Aspect ratio for vertical blur pass
- if (dir == 1)
- {
- vec2 ts = textureSize(samplerColor1, 0);
- ar = ts.y / ts.x;
- }
-
- vec2 P = inUV.yx - vec2(0, (weights.length() >> 1) * ar * blurScale);
-
- vec4 color = vec4(0.0);
- for (int i = 0; i < weights.length(); i++)
- {
- vec2 dv = vec2(0.0, i * blurScale) * ar;
- color += texture(samplerColor1, P + dv) * weights[i] * blurStrength;
- }
-
- outColor = color;
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/compose.frag b/samples/deferred/shaders/compose.frag
deleted file mode 100644
index 81312bd..0000000
--- a/samples/deferred/shaders/compose.frag
+++ /dev/null
@@ -1,230 +0,0 @@
-#version 450
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (set = 0, binding = 0) uniform UBO {
- mat4 projection;
- mat4 model;
- mat4 view;
- vec4 camPos;
- float exposure;
- float gamma;
- float prefilteredCubeMipLevels;
- float scaleIBLAmbient;
-} ubo;
-
-layout (constant_id = 0) const uint NUM_LIGHTS = 1;
-
-struct Light {
- vec4 position;
- vec4 color;
- mat4 mvp;
-};
-
-layout (set = 0, binding = 4) uniform UBOLights {
- Light lights[NUM_LIGHTS];
-};
-
-const float M_PI = 3.141592653589793;
-const float c_MinRoughness = 0.04;
-
-layout (input_attachment_index = 0, set = 1, binding = 0) uniform subpassInputMS samplerColorRough;
-layout (input_attachment_index = 1, set = 1, binding = 1) uniform subpassInputMS samplerEmitMetal;
-layout (input_attachment_index = 2, set = 1, binding = 2) uniform subpassInputMS samplerN_AO;
-layout (input_attachment_index = 3, set = 1, binding = 3) uniform subpassInputMS samplerPos;
-
-layout (set = 0, binding = 1) uniform samplerCube samplerIrradiance;
-layout (set = 0, binding = 2) uniform samplerCube prefilteredMap;
-layout (set = 0, binding = 3) uniform sampler2D samplerBRDFLUT;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outColor;
-
-// Encapsulate the various inputs used by the various functions in the shading equation
-// We store values in this struct to simplify the integration of alternative implementations
-// of the shading terms, outlined in the Readme.MD Appendix.
-struct PBRInfo
-{
- float NdotL; // cos angle between normal and light direction
- float NdotV; // cos angle between normal and view direction
- float NdotH; // cos angle between normal and half vector
- float LdotH; // cos angle between light direction and half vector
- float VdotH; // cos angle between view direction and half vector
- float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)
- float metalness; // metallic value at the surface
- vec3 reflectance0; // full reflectance color (normal incidence angle)
- vec3 reflectance90; // reflectance color at grazing angle
- float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])
- vec3 diffuseColor; // color contribution from diffuse lighting
- vec3 specularColor; // color contribution from specular lighting
-};
-
-// Calculation of the lighting contribution from an optional Image Based Light source.
-// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
-// See our README.md on Environment Maps [3] for additional discussion.
-vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)
-{
- float lod = (pbrInputs.perceptualRoughness * ubo.prefilteredCubeMipLevels);
- // retrieve a scale and bias to F0. See [1], Figure 3
- vec3 brdf = (texture(samplerBRDFLUT, vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
- vec3 diffuseLight = texture(samplerIrradiance, reflection).rgb;
-
- vec3 specularLight = textureLod(prefilteredMap, reflection, lod).rgb;
-
- vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
- vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
-
- // For presentation, this allows us to disable IBL terms
- // For presentation, this allows us to disable IBL terms
- diffuse *= ubo.scaleIBLAmbient;
- specular *= ubo.scaleIBLAmbient;
-
- return diffuse + specular;
-}
-
-// Basic Lambertian diffuse
-// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
-// See also [1], Equation 1
-vec3 diffuse(PBRInfo pbrInputs)
-{
- return pbrInputs.diffuseColor / M_PI;
-}
-
-// The following equation models the Fresnel reflectance term of the spec equation (aka F())
-// Implementation of fresnel from [4], Equation 15
-vec3 specularReflection(PBRInfo pbrInputs)
-{
- return pbrInputs.reflectance0 + (pbrInputs.reflectance90 - pbrInputs.reflectance0) * pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
-}
-
-// This calculates the specular geometric attenuation (aka G()),
-// where rougher material will reflect less light back to the viewer.
-// This implementation is based on [1] Equation 4, and we adopt their modifications to
-// alphaRoughness as input as originally proposed in [2].
-float geometricOcclusion(PBRInfo pbrInputs)
-{
- float NdotL = pbrInputs.NdotL;
- float NdotV = pbrInputs.NdotV;
- float r = pbrInputs.alphaRoughness;
-
- float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
- float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
- return attenuationL * attenuationV;
-}
-
-// The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())
-// Implementation from "Average Irregularity Representation of a Roughened Surface for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz
-// Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.
-float microfacetDistribution(PBRInfo pbrInputs)
-{
- float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
- float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
- return roughnessSq / (M_PI * f * f);
-}
-
-// Gets metallic factor from specular glossiness workflow inputs
-float convertMetallic(vec3 diffuse, vec3 specular, float maxSpecular) {
- float perceivedDiffuse = sqrt(0.299 * diffuse.r * diffuse.r + 0.587 * diffuse.g * diffuse.g + 0.114 * diffuse.b * diffuse.b);
- float perceivedSpecular = sqrt(0.299 * specular.r * specular.r + 0.587 * specular.g * specular.g + 0.114 * specular.b * specular.b);
- if (perceivedSpecular < c_MinRoughness) {
- return 0.0;
- }
- float a = c_MinRoughness;
- float b = perceivedDiffuse * (1.0 - maxSpecular) / (1.0 - c_MinRoughness) + perceivedSpecular - 2.0 * c_MinRoughness;
- float c = c_MinRoughness - perceivedSpecular;
- float D = max(b * b - 4.0 * a * c, 0.0);
- return clamp((-b + sqrt(D)) / (2.0 * a), 0.0, 1.0);
-}
-
-void main()
-{
- if (subpassLoad(samplerPos, gl_SampleID).a == 1.0f)
- discard;
-
- float perceptualRoughness = subpassLoad(samplerColorRough, gl_SampleID).a;
- float metallic = subpassLoad(samplerEmitMetal, gl_SampleID).a;
- vec3 diffuseColor;
- vec4 baseColor = vec4(subpassLoad(samplerColorRough, gl_SampleID).rgb, 1);
- vec3 emissive = subpassLoad (samplerEmitMetal, gl_SampleID).rgb;
-
- vec3 f0 = vec3(0.04);
-
- diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
- diffuseColor *= 1.0 - metallic;
-
- float alphaRoughness = perceptualRoughness * perceptualRoughness;
-
- vec3 specularColor = mix(f0, baseColor.rgb, metallic);
-
- // Compute reflectance.
- float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
-
- // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.
- // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.
- float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
- vec3 specularEnvironmentR0 = specularColor.rgb;
- vec3 specularEnvironmentR90 = vec3(1.0) * reflectance90;
-
- vec3 n = subpassLoad(samplerN_AO, gl_SampleID).rgb;
- vec3 pos = subpassLoad(samplerPos, gl_SampleID).rgb;
- vec3 v = normalize(ubo.camPos.xyz - pos); // Vector from surface point to camera
-
- vec3 colors = vec3(0);
- vec3 lightTarget = vec3(0);
-
- for (int i=0; i<NUM_LIGHTS; i++) {
-
- vec3 l = normalize(lights[i].position.xyz-pos); // Vector from surface point to light
- vec3 h = normalize(l+v); // Half vector between both l and v
- vec3 reflection = -normalize(reflect(v, n));
- reflection.y *= -1.0f;
-
- float NdotL = clamp(dot(n, l), 0.001, 1.0);
- float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
- float NdotH = clamp(dot(n, h), 0.0, 1.0);
- float LdotH = clamp(dot(l, h), 0.0, 1.0);
- float VdotH = clamp(dot(v, h), 0.0, 1.0);
-
- PBRInfo pbrInputs = PBRInfo(
- NdotL,
- NdotV,
- NdotH,
- LdotH,
- VdotH,
- perceptualRoughness,
- metallic,
- specularEnvironmentR0,
- specularEnvironmentR90,
- alphaRoughness,
- diffuseColor,
- specularColor
- );
-
- // Calculate the shading terms for the microfacet specular shading model
- vec3 F = specularReflection(pbrInputs);
- float G = geometricOcclusion(pbrInputs);
- float D = microfacetDistribution(pbrInputs);
-
- // Calculation of analytical lighting contribution
- vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
- vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
- // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
- vec3 color = NdotL * lights[i].color.rgb * (diffuseContrib + specContrib);
- // Calculate lighting contribution from image based lighting source (IBL)
- colors += (color + getIBLContribution(pbrInputs, n, reflection));
-
-
- }
- colors /= NUM_LIGHTS;
-
-
- const float u_OcclusionStrength = 1.0f;
- const float u_EmissiveFactor = 1.0f;
-
- //AO is in the alpha channel of the normalAttachment
- colors = mix(colors, colors * subpassLoad(samplerN_AO, gl_SampleID).a, u_OcclusionStrength);
- colors += emissive;
-
- outColor = vec4(colors, baseColor.a);
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/compose_with_shadows.frag b/samples/deferred/shaders/compose_with_shadows.frag
deleted file mode 100644
index 4247393..0000000
--- a/samples/deferred/shaders/compose_with_shadows.frag
+++ /dev/null
@@ -1,277 +0,0 @@
-#version 450
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (set = 0, binding = 0) uniform UBO {
- mat4 projection;
- mat4 model;
- mat4 view;
- vec4 camPos;
- float prefilteredCubeMipLevels;
- float scaleIBLAmbient;
-} ubo;
-
-layout (constant_id = 0) const uint NUM_LIGHTS = 1;
-
-struct Light {
- vec4 position;
- vec4 color;
- mat4 mvp;
-};
-
-layout (set = 0, binding = 4) uniform UBOLights {
- Light lights[NUM_LIGHTS];
-};
-
-const float M_PI = 3.141592653589793;
-const float c_MinRoughness = 0.04;
-#define SHADOW_FACTOR 0.15
-
-layout (input_attachment_index = 0, set = 1, binding = 0) uniform subpassInputMS samplerColorRough;
-layout (input_attachment_index = 1, set = 1, binding = 1) uniform subpassInputMS samplerEmitMetal;
-layout (input_attachment_index = 2, set = 1, binding = 2) uniform subpassInputMS samplerN_AO;
-layout (input_attachment_index = 3, set = 1, binding = 3) uniform subpassInputMS samplerPos;
-
-layout (set = 0, binding = 1) uniform samplerCube samplerIrradiance;
-layout (set = 0, binding = 2) uniform samplerCube prefilteredMap;
-layout (set = 0, binding = 3) uniform sampler2D samplerBRDFLUT;
-layout (set = 0, binding = 6) uniform sampler2DArray samplerShadowMap;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outColor;
-
-// Encapsulate the various inputs used by the various functions in the shading equation
-// We store values in this struct to simplify the integration of alternative implementations
-// of the shading terms, outlined in the Readme.MD Appendix.
-struct PBRInfo
-{
- float NdotL; // cos angle between normal and light direction
- float NdotV; // cos angle between normal and view direction
- float NdotH; // cos angle between normal and half vector
- float LdotH; // cos angle between light direction and half vector
- float VdotH; // cos angle between view direction and half vector
- float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)
- float metalness; // metallic value at the surface
- vec3 reflectance0; // full reflectance color (normal incidence angle)
- vec3 reflectance90; // reflectance color at grazing angle
- float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])
- vec3 diffuseColor; // color contribution from diffuse lighting
- vec3 specularColor; // color contribution from specular lighting
-};
-
-// Calculation of the lighting contribution from an optional Image Based Light source.
-// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
-// See our README.md on Environment Maps [3] for additional discussion.
-vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)
-{
- float lod = (pbrInputs.perceptualRoughness * ubo.prefilteredCubeMipLevels);
- // retrieve a scale and bias to F0. See [1], Figure 3
- vec3 brdf = (texture(samplerBRDFLUT, vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
- vec3 diffuseLight = texture(samplerIrradiance, reflection).rgb;
-
- vec3 specularLight = textureLod(prefilteredMap, reflection, lod).rgb;
-
- vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
- vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
-
- // For presentation, this allows us to disable IBL terms
- // For presentation, this allows us to disable IBL terms
- diffuse *= ubo.scaleIBLAmbient;
- specular *= ubo.scaleIBLAmbient;
-
- return diffuse + specular;
-}
-
-// Basic Lambertian diffuse
-// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
-// See also [1], Equation 1
-vec3 diffuse(PBRInfo pbrInputs)
-{
- return pbrInputs.diffuseColor / M_PI;
-}
-
-// The following equation models the Fresnel reflectance term of the spec equation (aka F())
-// Implementation of fresnel from [4], Equation 15
-vec3 specularReflection(PBRInfo pbrInputs)
-{
- return pbrInputs.reflectance0 + (pbrInputs.reflectance90 - pbrInputs.reflectance0) * pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
-}
-
-// This calculates the specular geometric attenuation (aka G()),
-// where rougher material will reflect less light back to the viewer.
-// This implementation is based on [1] Equation 4, and we adopt their modifications to
-// alphaRoughness as input as originally proposed in [2].
-float geometricOcclusion(PBRInfo pbrInputs)
-{
- float NdotL = pbrInputs.NdotL;
- float NdotV = pbrInputs.NdotV;
- float r = pbrInputs.alphaRoughness;
-
- float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
- float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
- return attenuationL * attenuationV;
-}
-
-// The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())
-// Implementation from "Average Irregularity Representation of a Roughened Surface for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz
-// Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.
-float microfacetDistribution(PBRInfo pbrInputs)
-{
- float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
- float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
- return roughnessSq / (M_PI * f * f);
-}
-
-// Gets metallic factor from specular glossiness workflow inputs
-float convertMetallic(vec3 diffuse, vec3 specular, float maxSpecular) {
- float perceivedDiffuse = sqrt(0.299 * diffuse.r * diffuse.r + 0.587 * diffuse.g * diffuse.g + 0.114 * diffuse.b * diffuse.b);
- float perceivedSpecular = sqrt(0.299 * specular.r * specular.r + 0.587 * specular.g * specular.g + 0.114 * specular.b * specular.b);
- if (perceivedSpecular < c_MinRoughness) {
- return 0.0;
- }
- float a = c_MinRoughness;
- float b = perceivedDiffuse * (1.0 - maxSpecular) / (1.0 - c_MinRoughness) + perceivedSpecular - 2.0 * c_MinRoughness;
- float c = c_MinRoughness - perceivedSpecular;
- float D = max(b * b - 4.0 * a * c, 0.0);
- return clamp((-b + sqrt(D)) / (2.0 * a), 0.0, 1.0);
-}
-
-float textureProj(vec4 P, float layer, vec2 offset)
-{
- float shadow = 1.0;
- vec4 shadowCoord = P / P.w;
- shadowCoord.st = shadowCoord.st * 0.5 + 0.5;
-
- if (shadowCoord.z > -1.0 && shadowCoord.z < 1.0)
- {
- float dist = texture(samplerShadowMap, vec3(shadowCoord.st + offset, layer)).r;
- if (shadowCoord.w > 0.0 && dist < shadowCoord.z)
- shadow = SHADOW_FACTOR;
- }else
- shadow = 0.05f;//for debug view out of light proj
-
- return shadow;
-}
-
-float filterPCF(vec4 sc, float layer)
-{
- ivec2 texDim = textureSize(samplerShadowMap, 0).xy;
- float scale = 1.5;
- float dx = scale * 1.0 / float(texDim.x);
- float dy = scale * 1.0 / float(texDim.y);
-
- float shadowFactor = 0.0;
- int count = 0;
- int range = 1;
-
- for (int x = -range; x <= range; x++)
- {
- for (int y = -range; y <= range; y++)
- {
- shadowFactor += textureProj(sc, layer, vec2(dx*x, dy*y));
- count++;
- }
-
- }
- return shadowFactor / count;
-}
-
-void main()
-{
- if (subpassLoad(samplerPos, gl_SampleID).a == 1.0f)
- discard;
-
- float perceptualRoughness = subpassLoad(samplerColorRough, gl_SampleID).a;
- float metallic = subpassLoad(samplerEmitMetal, gl_SampleID).a;
- vec3 diffuseColor;
- vec4 baseColor = vec4(subpassLoad(samplerColorRough, gl_SampleID).rgb, 1);
- vec3 emissive = subpassLoad (samplerEmitMetal, gl_SampleID).rgb;
-
- vec3 f0 = vec3(0.04);
-
- diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
- diffuseColor *= 1.0 - metallic;
-
- float alphaRoughness = perceptualRoughness * perceptualRoughness;
-
- vec3 specularColor = mix(f0, baseColor.rgb, metallic);
-
- // Compute reflectance.
- float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
-
- // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.
- // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.
- float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
- vec3 specularEnvironmentR0 = specularColor.rgb;
- vec3 specularEnvironmentR90 = vec3(1.0) * reflectance90;
-
- vec3 n = subpassLoad(samplerN_AO, gl_SampleID).rgb;
- vec3 pos = subpassLoad(samplerPos, gl_SampleID).rgb;
- vec3 v = normalize(ubo.camPos.xyz - pos); // Vector from surface point to camera
-
- vec3 colors = vec3(0);
- vec3 lightTarget = vec3(0);
-
- for (int i=0; i<NUM_LIGHTS; i++) {
-
- vec3 l = normalize(lights[i].position.xyz-pos); // Vector from surface point to light
- vec3 h = normalize(l+v); // Half vector between both l and v
- vec3 reflection = -normalize(reflect(v, n));
- reflection.y *= -1.0f;
-
- float NdotL = clamp(dot(n, l), 0.001, 1.0);
- float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
- float NdotH = clamp(dot(n, h), 0.0, 1.0);
- float LdotH = clamp(dot(l, h), 0.0, 1.0);
- float VdotH = clamp(dot(v, h), 0.0, 1.0);
-
- PBRInfo pbrInputs = PBRInfo(
- NdotL,
- NdotV,
- NdotH,
- LdotH,
- VdotH,
- perceptualRoughness,
- metallic,
- specularEnvironmentR0,
- specularEnvironmentR90,
- alphaRoughness,
- diffuseColor,
- specularColor
- );
-
- // Calculate the shading terms for the microfacet specular shading model
- vec3 F = specularReflection(pbrInputs);
- float G = geometricOcclusion(pbrInputs);
- float D = microfacetDistribution(pbrInputs);
-
- // Calculation of analytical lighting contribution
- vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
- vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
- // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
- vec3 color = NdotL * lights[i].color.rgb * (diffuseContrib + specContrib);
-
- #if SHADOW
- vec4 shadowClip = lights[i].mvp * vec4(pos, 1);
- float shadowFactor = filterPCF(shadowClip, i);
- // Calculate lighting contribution from image based lighting source (IBL)
- colors += shadowFactor * (color + getIBLContribution(pbrInputs, n, reflection));
- #else
- colors += color + getIBLContribution(pbrInputs, n, reflection);
- #endif
-
-
- }
- colors /= NUM_LIGHTS;
-
-
- const float u_OcclusionStrength = 1.0f;
- const float u_EmissiveFactor = 3.0f;
-
- //AO is in the alpha channel of the normalAttachment
- colors = mix(colors, colors * subpassLoad(samplerN_AO, gl_SampleID).a, u_OcclusionStrength);
- colors += emissive * u_EmissiveFactor;
-
- outColor = vec4(colors, baseColor.a);
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/debug.frag b/samples/deferred/shaders/debug.frag
deleted file mode 100644
index fd419ff..0000000
--- a/samples/deferred/shaders/debug.frag
+++ /dev/null
@@ -1,12 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inColor;
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = vec4(inColor, 1.0);
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/debug.vert b/samples/deferred/shaders/debug.vert
deleted file mode 100644
index 180e58e..0000000
--- a/samples/deferred/shaders/debug.vert
+++ /dev/null
@@ -1,34 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec3 inColor;
-
-layout (location = 0) out vec3 outColor;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projectionMatrix;
- mat4 viewMatrix;
- mat4 modelMatrix;
- float gamma;
- float exposure;
-} ubo;
-
-layout(push_constant) uniform PushConsts {
- mat4 projectionMatrix;
-} pc;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-void main()
-{
- outColor = inColor;
-
- gl_Position = pc.projectionMatrix * vec4 ((ubo.viewMatrix * vec4(inPos.xyz, 0.0)).xyz, 1);
-}
diff --git a/samples/deferred/shaders/emissive.frag b/samples/deferred/shaders/emissive.frag
deleted file mode 100644
index 2efe331..0000000
--- a/samples/deferred/shaders/emissive.frag
+++ /dev/null
@@ -1,25 +0,0 @@
-#version 450
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (input_attachment_index = 0, set = 2, binding = 0) uniform subpassInputMS samplerColorRough;
-layout (input_attachment_index = 1, set = 2, binding = 1) uniform subpassInputMS samplerEmitMetal;
-layout (input_attachment_index = 2, set = 2, binding = 2) uniform subpassInputMS samplerN_AO;
-layout (input_attachment_index = 3, set = 2, binding = 3) uniform subpassInputMS samplerPos;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outColor;
-
-const float offset[5] = float[](0.0, 1.0, 2.0, 3.0, 4.0);
-const float weight[5] = float[](0.2270270270, 0.1945945946, 0.1216216216,
- 0.0540540541, 0.0162162162);
-
-void main()
-{
- if (subpassLoad(samplerPos, gl_SampleID).a == 1.0f)
- discard;
- vec3 emissive = subpassLoad (samplerEmitMetal, gl_SampleID).rgb;
-
- outColor = vec4(emissive, 1);
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/filtercube.vert b/samples/deferred/shaders/filtercube.vert
deleted file mode 100644
index 1226e28..0000000
--- a/samples/deferred/shaders/filtercube.vert
+++ /dev/null
@@ -1,19 +0,0 @@
-#version 450
-
-layout (location = 0) in vec3 inPos;
-
-layout(push_constant) uniform PushConsts {
- layout (offset = 0) mat4 mvp;
-} pushConsts;
-
-layout (location = 0) out vec3 outUVW;
-
-out gl_PerVertex {
- vec4 gl_Position;
-};
-
-void main()
-{
- outUVW = inPos;
- gl_Position = pushConsts.mvp * vec4(inPos.xyz, 1.0);
-}
diff --git a/samples/deferred/shaders/genbrdflut.frag b/samples/deferred/shaders/genbrdflut.frag
deleted file mode 100644
index b6290dd..0000000
--- a/samples/deferred/shaders/genbrdflut.frag
+++ /dev/null
@@ -1,90 +0,0 @@
-#version 450
-
-layout (location = 0) in vec2 inUV;
-layout (location = 0) out vec4 outColor;
-layout (constant_id = 0) const uint NUM_SAMPLES = 1024u;
-
-const float PI = 3.1415926536;
-
-// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
-float random(vec2 co)
-{
- float a = 12.9898;
- float b = 78.233;
- float c = 43758.5453;
- float dt= dot(co.xy ,vec2(a,b));
- float sn= mod(dt,3.14);
- return fract(sin(sn) * c);
-}
-
-vec2 hammersley2d(uint i, uint N)
-{
- // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
- uint bits = (i << 16u) | (i >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- float rdi = float(bits) * 2.3283064365386963e-10;
- return vec2(float(i) /float(N), rdi);
-}
-
-// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
-vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
-{
- // Maps a 2D point to a hemisphere with spread based on roughness
- float alpha = roughness * roughness;
- float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
- float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
- float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
- vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
-
- // Tangent space
- vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangentX = normalize(cross(up, normal));
- vec3 tangentY = normalize(cross(normal, tangentX));
-
- // Convert to world Space
- return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
-}
-
-// Geometric Shadowing function
-float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness)
-{
- float k = (roughness * roughness) / 2.0;
- float GL = dotNL / (dotNL * (1.0 - k) + k);
- float GV = dotNV / (dotNV * (1.0 - k) + k);
- return GL * GV;
-}
-
-vec2 BRDF(float NoV, float roughness)
-{
- // Normal always points along z-axis for the 2D lookup
- const vec3 N = vec3(0.0, 0.0, 1.0);
- vec3 V = vec3(sqrt(1.0 - NoV*NoV), 0.0, NoV);
-
- vec2 LUT = vec2(0.0);
- for(uint i = 0u; i < NUM_SAMPLES; i++) {
- vec2 Xi = hammersley2d(i, NUM_SAMPLES);
- vec3 H = importanceSample_GGX(Xi, roughness, N);
- vec3 L = 2.0 * dot(V, H) * H - V;
-
- float dotNL = max(dot(N, L), 0.0);
- float dotNV = max(dot(N, V), 0.0);
- float dotVH = max(dot(V, H), 0.0);
- float dotNH = max(dot(H, N), 0.0);
-
- if (dotNL > 0.0) {
- float G = G_SchlicksmithGGX(dotNL, dotNV, roughness);
- float G_Vis = (G * dotVH) / (dotNH * dotNV);
- float Fc = pow(1.0 - dotVH, 5.0);
- LUT += vec2((1.0 - Fc) * G_Vis, Fc * G_Vis);
- }
- }
- return LUT / float(NUM_SAMPLES);
-}
-
-void main()
-{
- outColor = vec4(BRDF(inUV.s, 1.0-inUV.t), 0.0, 1.0);
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/genbrdflut.vert b/samples/deferred/shaders/genbrdflut.vert
deleted file mode 100644
index f3dd233..0000000
--- a/samples/deferred/shaders/genbrdflut.vert
+++ /dev/null
@@ -1,9 +0,0 @@
-#version 450
-
-layout (location = 0) out vec2 outUV;
-
-void main()
-{
- outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
- gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f);
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/irradiancecube.frag b/samples/deferred/shaders/irradiancecube.frag
deleted file mode 100644
index 340d679..0000000
--- a/samples/deferred/shaders/irradiancecube.frag
+++ /dev/null
@@ -1,37 +0,0 @@
-// Generates an irradiance cube from an environment map using convolution
-
-#version 450
-
-layout (location = 0) in vec3 inPos;
-layout (location = 0) out vec4 outColor;
-layout (binding = 0) uniform samplerCube samplerEnv;
-
-layout(push_constant) uniform PushConsts {
- layout (offset = 64) float deltaPhi;
- layout (offset = 68) float deltaTheta;
-} consts;
-
-#define PI 3.1415926535897932384626433832795
-
-void main()
-{
- vec3 N = normalize(inPos);
- vec3 up = vec3(0.0, 1.0, 0.0);
- vec3 right = normalize(cross(up, N));
- up = cross(N, right);
-
- const float TWO_PI = PI * 2.0;
- const float HALF_PI = PI * 0.5;
-
- vec3 color = vec3(0.0);
- uint sampleCount = 0u;
- for (float phi = 0.0; phi < TWO_PI; phi += consts.deltaPhi) {
- for (float theta = 0.0; theta < HALF_PI; theta += consts.deltaTheta) {
- vec3 tempVec = cos(phi) * right + sin(phi) * up;
- vec3 sampleVector = cos(theta) * N + sin(theta) * tempVec;
- color += texture(samplerEnv, sampleVector).rgb * cos(theta) * sin(theta);
- sampleCount++;
- }
- }
- outColor = vec4(PI * color / float(sampleCount), 1.0);//texture(samplerEnv, inPos).rgba;
-}
diff --git a/samples/deferred/shaders/prefilterenvmap.frag b/samples/deferred/shaders/prefilterenvmap.frag
deleted file mode 100644
index ae1212e..0000000
--- a/samples/deferred/shaders/prefilterenvmap.frag
+++ /dev/null
@@ -1,105 +0,0 @@
-#version 450
-
-layout (location = 0) in vec3 inPos;
-layout (location = 0) out vec4 outColor;
-
-layout (binding = 0) uniform samplerCube samplerEnv;
-
-layout(push_constant) uniform PushConsts {
- layout (offset = 64) float roughness;
- layout (offset = 68) uint numSamples;
-} consts;
-
-const float PI = 3.1415926536;
-
-// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
-float random(vec2 co)
-{
- float a = 12.9898;
- float b = 78.233;
- float c = 43758.5453;
- float dt= dot(co.xy ,vec2(a,b));
- float sn= mod(dt,3.14);
- return fract(sin(sn) * c);
-}
-
-vec2 hammersley2d(uint i, uint N)
-{
- // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
- uint bits = (i << 16u) | (i >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- float rdi = float(bits) * 2.3283064365386963e-10;
- return vec2(float(i) /float(N), rdi);
-}
-
-// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
-vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
-{
- // Maps a 2D point to a hemisphere with spread based on roughness
- float alpha = roughness * roughness;
- float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
- float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
- float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
- vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
-
- // Tangent space
- vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangentX = normalize(cross(up, normal));
- vec3 tangentY = normalize(cross(normal, tangentX));
-
- // Convert to world Space
- return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
-}
-
-// Normal Distribution function
-float D_GGX(float dotNH, float roughness)
-{
- float alpha = roughness * roughness;
- float alpha2 = alpha * alpha;
- float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0;
- return (alpha2)/(PI * denom*denom);
-}
-
-vec3 prefilterEnvMap(vec3 R, float roughness)
-{
- vec3 N = R;
- vec3 V = R;
- vec3 color = vec3(0.0);
- float totalWeight = 0.0;
- float envMapDim = float(textureSize(samplerEnv, 0).s);
- for(uint i = 0u; i < consts.numSamples; i++) {
- vec2 Xi = hammersley2d(i, consts.numSamples);
- vec3 H = importanceSample_GGX(Xi, roughness, N);
- vec3 L = 2.0 * dot(V, H) * H - V;
- float dotNL = clamp(dot(N, L), 0.0, 1.0);
- if(dotNL > 0.0) {
- // Filtering based on https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/
-
- float dotNH = clamp(dot(N, H), 0.0, 1.0);
- float dotVH = clamp(dot(V, H), 0.0, 1.0);
-
- // Probability Distribution Function
- float pdf = D_GGX(dotNH, roughness) * dotNH / (4.0 * dotVH) + 0.0001;
- // Slid angle of current smple
- float omegaS = 1.0 / (float(consts.numSamples) * pdf);
- // Solid angle of 1 pixel across all cube faces
- float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim);
- // Biased (+1.0) mip level for better result
- float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f);
- color += textureLod(samplerEnv, L, mipLevel).rgb * dotNL;
- totalWeight += dotNL;
-
- }
- }
- return (color / totalWeight);
-}
-
-
-void main()
-{
- vec3 N = normalize(inPos);
- outColor = vec4(prefilterEnvMap(N, consts.roughness), 1.0);
-}
diff --git a/samples/deferred/shaders/shadow.geom b/samples/deferred/shaders/shadow.geom
deleted file mode 100644
index 9fd322c..0000000
--- a/samples/deferred/shaders/shadow.geom
+++ /dev/null
@@ -1,34 +0,0 @@
-#version 420
-
-#define NUM_LIGHTS 2
-
-layout (triangles, invocations = NUM_LIGHTS) in;
-layout (triangle_strip, max_vertices = 3) out;
-
-struct Light {
- vec4 position;
- vec4 color;
- mat4 mvp;
-};
-layout (set = 0, binding = 0) uniform UBO {
- mat4 projection;
- mat4 model;
- mat4 view;
-};
-layout (set = 0, binding = 1) uniform UBOLights {
- Light lights[NUM_LIGHTS];
-};
-
-//layout (location = 0) in int inInstanceIndex[];
-
-
-void main()
-{
- for (int i = 0; i < gl_in.length(); i++)
- {
- gl_Layer = gl_InvocationID;
- gl_Position = lights[gl_InvocationID].mvp * model * gl_in[i].gl_Position;
- EmitVertex();
- }
- EndPrimitive();
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/shadow.vert b/samples/deferred/shaders/shadow.vert
deleted file mode 100644
index b0bd6c0..0000000
--- a/samples/deferred/shaders/shadow.vert
+++ /dev/null
@@ -1,12 +0,0 @@
-#version 450
-
-layout (location = 0) in vec3 inPos;
-
-layout(push_constant) uniform PushConsts {
- mat4 model;
-} pc;
-
-void main()
-{
- gl_Position = pc.model * vec4(inPos,1);
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/show_gbuff.frag b/samples/deferred/shaders/show_gbuff.frag
deleted file mode 100644
index 7859e36..0000000
--- a/samples/deferred/shaders/show_gbuff.frag
+++ /dev/null
@@ -1,92 +0,0 @@
-#version 450
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (input_attachment_index = 0, set = 1, binding = 0) uniform subpassInputMS samplerColorRough;
-layout (input_attachment_index = 1, set = 1, binding = 1) uniform subpassInputMS samplerEmitMetal;
-layout (input_attachment_index = 2, set = 1, binding = 2) uniform subpassInputMS samplerN_AO;
-layout (input_attachment_index = 3, set = 1, binding = 3) uniform subpassInputMS samplerPos;
-
-layout (set = 0, binding = 1) uniform samplerCube samplerIrradiance;
-layout (set = 0, binding = 2) uniform samplerCube prefilteredMap;
-layout (set = 0, binding = 3) uniform sampler2D samplerBRDFLUT;
-layout (set = 0, binding = 6) uniform sampler2DArray samplerShadowMap;
-
-layout (push_constant) uniform PushCsts {
- layout(offset = 64)
- int imgIdx;
-};
-
-layout (location = 0) in vec2 inUV;
-layout (location = 0) out vec4 outColor;
-
-const uint color = 0;
-const uint normal = 1;
-const uint pos = 2;
-const uint occlusion = 3;
-const uint emissive = 4;
-const uint metallic = 5;
-const uint roughness = 6;
-const uint depth = 7;
-const uint prefill = 8;
-const uint irradiance = 9;
-const uint shadowMap = 10;
-
-vec4 sampleCubeMap (samplerCube sc, uint face, uint lod) {
- vec2 uv = 2.0 * inUV - vec2(1.0);
- switch (face) {
- case 0:
- return vec4 (textureLod (sc, vec3(1, uv.t, uv.s), lod).rgb, 1);
- case 1:
- return vec4 (textureLod (sc, vec3(-1, uv.t, uv.s), lod).rgb, 1);
- case 2:
- return vec4 (textureLod (sc, vec3(uv.s, 1, -uv.t), lod).rgb, 1);
- case 3:
- return vec4 (textureLod (sc, vec3(uv.s, -1, uv.t), lod).rgb, 1);
- case 4:
- return vec4 (textureLod (sc, vec3(uv, 1), lod).rgb, 1);
- case 5:
- return vec4 (textureLod (sc, vec3(-uv.s, uv.t, -1), lod).rgb, 1);
- }
-}
-
-void main()
-{
- uint imgNum = bitfieldExtract (imgIdx, 0, 8);
- switch (imgNum) {
- case color:
- outColor = vec4(subpassLoad(samplerColorRough, gl_SampleID).rgb, 1);
- break;
- case normal:
- outColor = vec4(subpassLoad(samplerN_AO, gl_SampleID).rgb, 1);
- break;
- case pos:
- outColor = vec4(subpassLoad(samplerPos, gl_SampleID).rgb, 1);
- break;
- case occlusion:
- outColor = vec4(subpassLoad(samplerN_AO, gl_SampleID).aaa, 1);
- break;
- case emissive:
- outColor = vec4(subpassLoad(samplerEmitMetal, gl_SampleID).rgb, 1);
- break;
- case metallic:
- outColor = vec4(subpassLoad(samplerEmitMetal, gl_SampleID).aaa, 1);
- break;
- case roughness:
- outColor = vec4(subpassLoad(samplerColorRough, gl_SampleID).aaa, 1);
- break;
- case depth:
- outColor = vec4(subpassLoad(samplerPos, gl_SampleID).aaa, 1);
- break;
- case shadowMap:
- vec3 d = texture(samplerShadowMap, vec3(inUV, bitfieldExtract (imgIdx, 8, 8))).rrr;
- outColor = vec4(d*d*d, 1);
- break;
- default:
- if (imgNum == prefill)
- outColor = sampleCubeMap (prefilteredMap, bitfieldExtract (imgIdx, 8, 8), bitfieldExtract (imgIdx, 16, 8));
- else if (imgNum == irradiance)
- outColor = sampleCubeMap (samplerIrradiance, bitfieldExtract (imgIdx, 8, 8), bitfieldExtract (imgIdx, 16, 8));
- break;
- }
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/simpletexture.frag b/samples/deferred/shaders/simpletexture.frag
deleted file mode 100644
index a081876..0000000
--- a/samples/deferred/shaders/simpletexture.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (set = 0, binding = 0) uniform sampler2D samplerColor;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = texture(samplerColor, inUV);
-}
diff --git a/samples/deferred/shaders/skybox.frag b/samples/deferred/shaders/skybox.frag
deleted file mode 100644
index e505ef1..0000000
--- a/samples/deferred/shaders/skybox.frag
+++ /dev/null
@@ -1,12 +0,0 @@
-#version 450
-
-layout (binding = 2) uniform samplerCube samplerEnv;
-
-layout (set = 0, location = 0) in vec3 inUVW;
-
-layout (set = 0, location = 0) out vec4 outColor;
-
-void main()
-{
- outColor = vec4(textureLod(samplerEnv, inUVW, 1.5).rgb, 1.0);
-} \ No newline at end of file
diff --git a/samples/deferred/shaders/skybox.vert b/samples/deferred/shaders/skybox.vert
deleted file mode 100644
index 22e285e..0000000
--- a/samples/deferred/shaders/skybox.vert
+++ /dev/null
@@ -1,27 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projection;
- mat4 model;
- mat4 view;
-} ubo;
-
-layout (location = 0) out vec3 outUVW;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-void main()
-{
- outUVW = inPos;
- outUVW.y = -outUVW.y;
- gl_Position = ubo.projection * mat4(mat3(ubo.view)) * vec4(inPos, 1.0);
-}
diff --git a/samples/deferred/shaders/tone_mapping.frag b/samples/deferred/shaders/tone_mapping.frag
deleted file mode 100644
index 6a1a8d4..0000000
--- a/samples/deferred/shaders/tone_mapping.frag
+++ /dev/null
@@ -1,70 +0,0 @@
-#version 450
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout(push_constant) uniform PushConsts {
- float exposure;
- float gamma;
- float debug;
-} pc;
-
-layout (set = 0, binding = 0) uniform sampler2D samplerHDR;
-layout (set = 0, binding = 1) uniform sampler2D bloom;
-
-layout (location = 0) in vec2 inUV;
-layout (location = 0) out vec4 outColor;
-
-vec3 Uncharted2Tonemap(vec3 color)
-{
- const float A = 0.15;
- const float B = 0.50;
- const float C = 0.10;
- const float D = 0.20;
- const float E = 0.02;
- const float F = 0.30;
- const float W = 11.2;
- return ((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F;
-}
-
-vec3 tonemap(vec3 color)
-{
- vec3 outcol = Uncharted2Tonemap(color.rgb * pc.exposure);
- outcol = outcol * (1.0f / Uncharted2Tonemap(vec3(11.2f)));
- return pow(outcol, vec3(1.0f / pc.gamma));
-}
-
-vec3 SRGBtoLINEAR(vec3 srgbIn)
-{
- #ifdef MANUAL_SRGB
- #ifdef SRGB_FAST_APPROXIMATION
- return pow(srgbIn.xyz,vec3(2.2));
- #else //SRGB_FAST_APPROXIMATION
- vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
- return linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
- #endif //SRGB_FAST_APPROXIMATION
- #else //MANUAL_SRGB
- return srgbIn;
- #endif //MANUAL_SRGB
-}
-
-void main()
-{
- if (pc.debug < 0.0f) {
- //vec4 hdrColor = texelFetch (samplerHDR, ivec2(inUV), gl_SampleID);
- vec4 hdrColor = texture (samplerHDR, inUV);
- //vec4 c = texture (bloom, inUV);
- //float lum = (0.299*c.r + 0.587*c.g + 0.114*c.b);
- //if (lum>1.0)
- // hdrColor.rgb += c.rgb * 0.05;
- outColor = vec4(SRGBtoLINEAR(tonemap(hdrColor.rgb)), hdrColor.a);
- }else
- outColor = texture (bloom, inUV);
-
-
- /*
- outColor = vec4(SRGBtoLINEAR(tonemap(hdrColor.rgb)), hdrColor.a);;*/
-
-/* vec3 mapped = vec3(1.0) - exp(-hdrColor.rgb * pc.exposure);
- mapped = pow(mapped, vec3(1.0 / pc.gamma));
- outColor = vec4(mapped, hdrColor.a);*/
-} \ No newline at end of file
diff --git a/samples/deferred/shadowMapRenderer.cs b/samples/deferred/shadowMapRenderer.cs
deleted file mode 100644
index a4684ec..0000000
--- a/samples/deferred/shadowMapRenderer.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-/*shadow mapping greatly inspired from:
-* Vulkan Example - Deferred shading with shadows from multiple light sources using geometry shader instancing
-* Copyright (C) 2016 by Sascha Willems - www.saschawillems.de
-* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-*/
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using CVKL;
-using CVKL.glTF;
-using VK;
-using static deferred.DeferredPbrRenderer;
-
-namespace deferred {
- public class ShadowMapRenderer : IDisposable {
- Device dev;
- Queue gQueue;
-
- public static uint SHADOWMAP_SIZE = 4096;
- public static VkFormat SHADOWMAP_FORMAT = VkFormat.D32SfloatS8Uint;
- public static VkSampleCountFlags SHADOWMAP_NUM_SAMPLES = VkSampleCountFlags.SampleCount1;
- public bool updateShadowMap = true;
-
- public float depthBiasConstant = 1.5f;
- public float depthBiasSlope = 1.75f;
- float lightFOV = Utils.DegreesToRadians (60);
- float lightFarPlane;
-
-
-
- RenderPass shadowPass;
- Framebuffer fbShadowMap;
- public Image shadowMap { get; private set; }
- Pipeline shadowPipeline;
- DescriptorPool descriptorPool;
- DescriptorSetLayout descLayoutShadow;
- DescriptorSet dsShadow;
- DeferredPbrRenderer renderer;
-
- public ShadowMapRenderer (Queue gQueue, DeferredPbrRenderer renderer, float farPlane = 16f) {
- this.lightFarPlane = farPlane;
- this.gQueue = gQueue;
- this.dev = gQueue.Dev;
- this.renderer = renderer;
-
- descriptorPool = new DescriptorPool (dev, 1,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer, 2)
- );
-
- init ();
- }
-
- void init () {
-
- //Shadow map renderpass
- shadowPass = new RenderPass (dev, VkSampleCountFlags.SampleCount1);
- shadowPass.AddAttachment (SHADOWMAP_FORMAT, VkImageLayout.DepthStencilReadOnlyOptimal, SHADOWMAP_NUM_SAMPLES);
- shadowPass.ClearValues.Add (new VkClearValue { depthStencil = new VkClearDepthStencilValue (1.0f, 0) });
-
- SubPass subpass0 = new SubPass ();
- subpass0.SetDepthReference (0);
- shadowPass.AddSubpass (subpass0);
-
- shadowPass.AddDependency (Vk.SubpassExternal, 0,
- VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.EarlyFragmentTests,
- VkAccessFlags.ShaderRead, VkAccessFlags.DepthStencilAttachmentWrite);
- shadowPass.AddDependency (0, Vk.SubpassExternal,
- VkPipelineStageFlags.LateFragmentTests, VkPipelineStageFlags.FragmentShader,
- VkAccessFlags.DepthStencilAttachmentWrite, VkAccessFlags.ShaderRead);
-
- descLayoutShadow = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Geometry, VkDescriptorType.UniformBuffer),//matrices
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Geometry, VkDescriptorType.UniformBuffer));//lights
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList);
- cfg.rasterizationState.cullMode = VkCullModeFlags.Back;
- cfg.rasterizationState.depthBiasEnable = true;
- cfg.dynamicStates.Add (VkDynamicState.DepthBias);
-
- cfg.RenderPass = shadowPass;
-
- cfg.Layout = new PipelineLayout (dev, descLayoutShadow);
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex|VkShaderStageFlags.Geometry, (uint)Marshal.SizeOf<Matrix4x4> ())
- );
-
- cfg.AddVertexBinding<PbrModel.Vertex> (0);
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#deferred.shadow.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Geometry, "#deferred.shadow.geom.spv");
-
- shadowPipeline = new GraphicPipeline (cfg);
-
- //shadow map image
- shadowMap = new Image (dev, SHADOWMAP_FORMAT, VkImageUsageFlags.DepthStencilAttachment | VkImageUsageFlags.Sampled, VkMemoryPropertyFlags.DeviceLocal, SHADOWMAP_SIZE, SHADOWMAP_SIZE,
- VkImageType.Image2D, SHADOWMAP_NUM_SAMPLES, VkImageTiling.Optimal, 1, (uint)renderer.lights.Length);
- shadowMap.CreateView (VkImageViewType.ImageView2DArray, VkImageAspectFlags.Depth, shadowMap.CreateInfo.arrayLayers);
- shadowMap.CreateSampler (VkSamplerAddressMode.ClampToBorder);
- shadowMap.Descriptor.imageLayout = VkImageLayout.DepthStencilReadOnlyOptimal;
-
- fbShadowMap = new Framebuffer (shadowPass, SHADOWMAP_SIZE, SHADOWMAP_SIZE, (uint)renderer.lights.Length);
- fbShadowMap.attachments.Add (shadowMap);
- fbShadowMap.Activate ();
-
- dsShadow = descriptorPool.Allocate (descLayoutShadow);
-
- DescriptorSetWrites dsWrite = new DescriptorSetWrites (dsShadow, descLayoutShadow);
- dsWrite.Write (dev, renderer.uboMatrices.Descriptor, renderer.uboLights.Descriptor);
- }
-
- public void update_light_matrices () {
- Matrix4x4 proj = Matrix4x4.CreatePerspectiveFieldOfView (lightFOV, 1, 0.1f, lightFarPlane);
- for (int i = 0; i < renderer.lights.Length; i++) {
- Matrix4x4 view = Matrix4x4.CreateLookAt (renderer.lights[i].position.ToVector3 (), Vector3.Zero, Vector3.UnitY);
- renderer.lights[i].mvp = view * proj;
- }
- renderer.uboLights.Update (renderer.lights);
- dev.WaitIdle ();
- }
-
- public void update_shadow_map (CommandPool cmdPool) {
- update_light_matrices ();
-
- CommandBuffer cmd = cmdPool.AllocateAndStart ();
-
- shadowPass.Begin (cmd, fbShadowMap);
-
- cmd.SetViewport (SHADOWMAP_SIZE, SHADOWMAP_SIZE);
- cmd.SetScissor (SHADOWMAP_SIZE, SHADOWMAP_SIZE);
-
- cmd.BindDescriptorSet (shadowPipeline.Layout, dsShadow);
-
- Vk.vkCmdSetDepthBias (cmd.Handle, depthBiasConstant, 0.0f, depthBiasSlope);
-
- shadowPipeline.Bind (cmd);
-
- if (renderer.model != null) {
- renderer.model.Bind (cmd);
- renderer.model.DrawAll (cmd, shadowPipeline.Layout, true);
- }
-
- shadowPass.End (cmd);
-
- gQueue.EndSubmitAndWait (cmd);
- updateShadowMap = false;
- }
-
-
- public void Dispose () {
- shadowPipeline?.Dispose ();
- fbShadowMap?.Dispose ();
- shadowMap?.Dispose ();
- descriptorPool?.Dispose ();
- }
- }
-}
diff --git a/samples/deferred/ui/debug.crow b/samples/deferred/ui/debug.crow
deleted file mode 100644
index 4d78bf1..0000000
--- a/samples/deferred/ui/debug.crow
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<Window Caption="Debug" Icon="#deferred.crow.svg" Left="10" Top="100" Width="40%" Height="50%">
- <VerticalStack Spacing="1" Margin="10" CacheEnabled="true">
- <HorizontalStack Height="Fit">
- <Label Text="Fps:" Width="80"/>
- <Label Text="{fps}" Width="Stretched" TextAlignment="Center"/>
- </HorizontalStack>
- <Expandable Caption="Debug Views">
- <EnumSelector Left="20" EnumValue="{²CurrentDebugView}" Width="50%"/>
- </Expandable>
- </VerticalStack>
-</Window>
-
diff --git a/samples/deferred/ui/deferred.style b/samples/deferred/ui/deferred.style
deleted file mode 100644
index c21ffb6..0000000
--- a/samples/deferred/ui/deferred.style
+++ /dev/null
@@ -1,61 +0,0 @@
-icon {
- Width="14";
- Height="14";
-}
-MemberViewLabel {
- Margin="1";
- Height="Fit";
- Width="50%";
- Background="White";
-}
-MemberViewHStack {
- Focusable="true";
- Height="Fit";
- Spacing="1";
- MouseEnter="{Background=SteelBlue}";
- MouseLeave="{Background=Transparent}";
-}
-
-IcoBut {
- Template = "#Crow.Coding.ui.IcoBut.template";
- MinimumSize = "10,10";
- Width = "8";
- Height = "14";
- Background = "White";
-}
-
-WinSchema {
- Template="#Crow.Coding.ui.DockWindows.WinSchemaItem.template";
- Focusable = "true";
- MinimumSize="150,50";
- Width = "Fit";
- Height = "Fit";
-}
-TabItem {
- AllowDrag="false";
- Background="Jet";
-}
-TreeItemBorder {
- CornerRadius="2";
- Margin="0";
- Focusable="true";
- Height="Fit";
- Width="Stretched";
- Foreground="Transparent";
- MouseEnter="{Foreground=DimGrey}";
- MouseLeave="{Foreground=Transparent}";
-}
-TreeIcon {
- Margin="0";
- Width="14";
- Height="14";
-}
-NormalizedFloat {
- Minimum="0.0";
- Maximum="1.0";
- SmallIncrement="0.01";
- LargeIncrement="0.1";
- Decimals="2";
- Width="60";
- Foreground="Black";
-}
diff --git a/samples/deferred/ui/images/crow.svg b/samples/deferred/ui/images/crow.svg
deleted file mode 100644
index c621130..0000000
--- a/samples/deferred/ui/images/crow.svg
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- height="35.987217"
- width="51.116982"
- version="1.1"
- id="svg2">
- <metadata
- id="metadata8">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs6" />
- <path
- id="path2818"
- d="m 36.232985,35.977162 c -0.02345,-0.0094 -0.04263,-0.04436 -0.04263,-0.07772 0,-0.03337 -0.04543,-0.117846 -0.100965,-0.187724 -0.05553,-0.06987 -0.10986,-0.152552 -0.120738,-0.183728 -0.04888,-0.140096 -0.547064,-0.441575 -0.740404,-0.448061 -0.01333,-6.73e-4 -0.0417,0.06441 -0.06301,0.144127 -0.0213,0.07971 -0.05448,0.164118 -0.0737,0.187567 -0.06807,0.08303 -0.2351,0.04596 -0.448164,-0.09947 -0.114492,-0.07815 -0.231452,-0.140793 -0.259915,-0.139198 -0.103032,0.0057 -0.22753,-0.0647 -0.284401,-0.160973 -0.105659,-0.178872 -0.451937,-0.41031 -0.613884,-0.41031 -0.11287,0 -0.378547,-0.121442 -0.488394,-0.223239 -0.06283,-0.05824 -0.129597,-0.08369 -0.219515,-0.08369 -0.191898,0 -0.291236,-0.05025 -0.332315,-0.168082 -0.02007,-0.05761 -0.05795,-0.104746 -0.08415,-0.104746 -0.02621,0 -0.07371,-0.02879 -0.105549,-0.06398 -0.03185,-0.03519 -0.108169,-0.07213 -0.169604,-0.08211 -0.219849,-0.03568 -0.937873,-0.414299 -0.993727,-0.524009 -0.01875,-0.03685 -0.103161,-0.143806 -0.187567,-0.237705 -0.189643,-0.210956 -0.537045,-0.371869 -0.741262,-0.343338 -0.710425,0.09925 -0.737631,0.100685 -1.030367,0.05449 -0.337983,-0.05334 -0.630446,-0.05889 -1.115893,-0.02117 -0.331487,0.02576 -0.347801,0.02387 -0.368967,-0.04283 -0.01219,-0.03838 0.0026,-0.154623 0.03266,-0.258318 0.03015,-0.103694 0.04455,-0.205124 0.03202,-0.225402 -0.04471,-0.07234 -0.314032,-0.0065 -0.532991,0.130268 -0.165667,0.103489 -0.230973,0.169125 -0.288563,0.290041 -0.07126,0.149603 -0.19268,0.232754 -0.339892,0.232754 -0.09327,0 -0.01149,-0.448641 0.108895,-0.597398 0.0301,-0.03719 0.045,-0.04843 0.03312,-0.02499 -0.01262,0.02492 3.4e-5,0.04263 0.03051,0.04263 0.03229,0 0.04463,-0.01945 0.03247,-0.05115 -0.0108,-0.02813 -0.0027,-0.05115 0.01813,-0.05115 0.02077,0 0.03776,-0.02034 0.03776,-0.04521 0,-0.05853 0.151433,-0.201223 0.181571,-0.171088 0.01268,0.01268 0.02305,0.003 0.02305,-0.02158 0,-0.05501 0.190827,-0.241992 0.218611,-0.214209 0.01107,0.01107 0.02012,0.0013 0.02012,-0.02169 0,-0.02299 0.01358,-0.03341 0.03018,-0.02314 0.0166,0.01026 0.07415,0.0046 0.127887,-0.01261 0.05374,-0.01721 0.185946,-0.03746 0.293797,-0.04502 0.154262,-0.01082 0.196092,-0.0032 0.196092,0.03533 0,0.03062 0.02017,0.04134 0.05362,0.02851 0.02949,-0.01132 0.08321,-0.0048 0.119365,0.01461 0.04469,0.02391 0.06573,0.02399 0.06573,0 0,-0.0546 0.166343,-0.02716 0.19016,0.03136 0.01696,0.04168 0.02726,0.03685 0.05065,-0.02383 0.03017,-0.0782 0.05209,-0.07969 0.33327,-0.02256 0.04625,0.0094 0.07104,0.0023 0.05918,-0.01685 -0.01918,-0.03103 0.105189,-0.09308 0.158609,-0.07913 0.01351,0.0035 0.0409,-0.02412 0.06088,-0.06145 0.01998,-0.03733 0.06279,-0.06787 0.09513,-0.06787 0.03235,0 0.07872,-0.0319 0.103074,-0.07089 0.03874,-0.06204 0.03597,-0.07306 -0.02225,-0.08828 -0.04068,-0.01065 -0.07465,-0.05808 -0.08746,-0.122132 -0.01151,-0.0576 -0.03098,-0.0947 -0.04325,-0.08243 -0.02243,0.02243 -0.09396,-0.07925 -0.134223,-0.190818 -0.01192,-0.03303 -0.05709,-0.06895 -0.100386,-0.07981 -0.0433,-0.01087 -0.08702,-0.04139 -0.09717,-0.06783 -0.01015,-0.02644 -0.03811,-0.04866 -0.06215,-0.04937 -0.02403,-6.72e-4 -0.09734,-0.06977 -0.162897,-0.153463 -0.06556,-0.08369 -0.141017,-0.152171 -0.167679,-0.152171 -0.02665,0 -0.03909,-0.0094 -0.02762,-0.02084 0.02949,-0.02949 -0.161533,-0.183774 -0.227545,-0.183774 -0.03567,0 -0.05475,-0.02971 -0.05475,-0.08526 0,-0.04689 -0.01667,-0.08526 -0.03705,-0.08526 -0.02039,0 -0.132932,-0.09206 -0.250118,-0.204591 -0.117184,-0.112527 -0.225744,-0.193097 -0.241239,-0.179042 -0.0155,0.01404 -0.01813,0.008 -0.0059,-0.01351 0.02148,-0.0376 -0.06692,-0.09775 -0.12476,-0.08487 -0.01546,0.0034 -0.01943,-0.0078 -0.0088,-0.02496 0.01062,-0.01717 -0.02277,-0.05853 -0.0742,-0.09191 -0.05142,-0.03337 -0.113546,-0.08877 -0.138053,-0.123093 -0.02451,-0.03432 -0.06672,-0.0624 -0.09378,-0.0624 -0.02707,0 -0.04922,-0.01355 -0.04922,-0.03012 0,-0.0438 -0.778285,-0.624964 -0.930964,-0.695162 -0.0729,-0.03352 -0.164401,-0.05081 -0.209278,-0.03955 -0.05655,0.01418 -0.102151,-0.0031 -0.15683,-0.05944 -0.0424,-0.0437 -0.06447,-0.05739 -0.04905,-0.03043 0.01542,0.02698 -0.03574,-0.0023 -0.113694,-0.06486 -0.140423,-0.112848 -0.199258,-0.210672 -0.162485,-0.270173 0.01048,-0.01696 -0.0034,-0.03946 -0.03092,-0.05001 -0.03157,-0.0121 -0.04839,-0.06147 -0.04566,-0.133995 0.0046,-0.123415 -0.115972,-0.333547 -0.242202,-0.421962 -0.03969,-0.0278 -0.06324,-0.06494 -0.05237,-0.08255 0.01089,-0.01761 -0.0042,-0.04121 -0.03354,-0.05247 -0.02932,-0.01125 -0.05331,-0.04833 -0.05331,-0.0824 0,-0.03407 -0.03837,-0.107533 -0.08526,-0.163263 -0.07704,-0.09156 -0.08519,-0.130424 -0.08459,-0.403332 0.0011,-0.467434 0.102818,-0.951299 0.346875,-1.649081 0.133708,-0.382291 0.234679,-0.776483 0.280602,-1.095504 0.01999,-0.138863 0.01188,-0.170521 -0.06808,-0.265547 -0.09126,-0.108463 -0.277674,-0.207699 -0.390138,-0.207699 -0.03326,0 -0.167911,-0.04572 -0.299229,-0.101598 -0.334854,-0.142493 -0.698295,-0.199641 -1.524701,-0.239741 -0.393891,-0.01911 -0.856189,-0.05756 -1.027322,-0.08543 -0.171134,-0.02796 -0.404168,-0.05076 -0.517855,-0.05076 -0.113686,0 -0.249901,-0.01718 -0.302703,-0.03821 -0.0528,-0.02101 -0.22913,-0.0397 -0.391836,-0.04152 -0.16271,-0.0018 -0.288412,-0.01532 -0.27934,-0.03 0.0091,-0.01468 -0.01127,-0.02647 -0.0452,-0.02621 -0.03393,2.24e-4 -0.315468,-0.0481 -0.625641,-0.107494 l -0.563945,-0.107977 -0.33979,0.10758 c -0.186882,0.05917 -0.349511,0.107539 -0.361388,0.107494 -0.04086,-1.36e-4 -0.05638,-0.13324 -0.01741,-0.149221 0.02145,-0.0088 -0.0023,-0.01721 -0.05276,-0.01869 -0.05047,-0.0015 -0.100161,0.01089 -0.110412,0.02747 -0.03208,0.05191 -0.458126,0.118498 -0.505769,0.07904 -0.02811,-0.02328 -0.09385,-0.0242 -0.195783,-0.0028 -0.08441,0.01777 -0.280073,0.0495 -0.434816,0.07054 -0.154743,0.02104 -0.281352,0.05283 -0.281352,0.07068 0,0.01786 -0.02302,0.02362 -0.05115,0.01281 -0.02814,-0.0108 -0.05123,-0.0086 -0.05131,0.0049 0,0.01348 -0.05615,0.02741 -0.124603,0.03097 -0.06845,0.0036 -0.1336,0.01891 -0.144786,0.0341 -0.02606,0.03542 -0.139983,0.04146 -0.796184,0.04221 -0.297591,4.49e-4 -0.537126,0.01439 -0.537126,0.0315 0,0.01698 -0.134282,0.03143 -0.298403,0.0321 -0.369505,0.0015 -0.539084,0.01992 -0.844055,0.09164 -0.131298,0.03088 -0.373004,0.06513 -0.537126,0.0761 -0.164122,0.01097 -0.298404,0.03207 -0.298404,0.04687 0,0.01481 -0.05371,0.0182 -0.119361,0.0076 -0.08039,-0.01304 -0.119361,-0.0061 -0.119361,0.02122 0,0.02232 -0.01443,0.03166 -0.03208,0.02075 -0.03408,-0.02106 -0.587009,0.111706 -0.615884,0.147893 -0.0094,0.01176 -0.04775,0.02527 -0.08526,0.03003 -0.319552,0.04061 -0.388045,0.05571 -0.371812,0.08197 0.01026,0.01661 -0.02466,0.02725 -0.07759,0.02367 -0.107275,-0.0073 -0.331986,0.114563 -0.292219,0.15843 0.014,0.01544 0.0067,0.01729 -0.01626,0.0041 -0.03986,-0.0229 -0.410541,0.170723 -0.776766,0.405746 -0.09378,0.06018 -0.400713,0.229852 -0.682064,0.377042 -0.8431486,0.441091 -1.5106691,0.786933 -1.9438848,1.00712 -0.331279,0.168378 -0.7656083,0.411685 -1.2106655,0.678201 -0.1208071,0.07234 -0.7235464,0.348753 -1.0060453,0.461358 -0.1688108,0.06729 -0.3529682,0.143067 -0.4092389,0.168389 -0.3782305,0.170213 -0.4488005,0.204855 -0.4944967,0.24276 -0.1118065,0.09275 -0.7795227,0.48269 -0.974639,0.569184 -0.1140235,0.05055 -0.3212008,0.108223 -0.4603938,0.12817 -0.2794774,0.04005 -0.6793677,0.03386 -0.6793677,-0.01051 0,-0.01562 -0.014897,-0.01916 -0.033103,-0.0079 -0.018206,0.01125 -0.04289,-0.01852 -0.054852,-0.0662 -0.011962,-0.04766 -0.028767,-0.08665 -0.037344,-0.08665 -0.027842,0 -0.1640932,0.0777 -0.1816285,0.103583 -0.024028,0.03546 -0.2704515,0.135139 -0.3340901,0.135139 -0.040327,0 -0.033244,-0.02142 0.029742,-0.08996 l 0.082677,-0.08996 -0.1534646,0.02493 c -0.084405,0.01371 -0.2762361,0.02752 -0.4262904,0.0307 -0.1617809,0.0034 -0.3133657,0.02625 -0.3724277,0.0561 -0.076685,0.03876 -0.1028397,0.04063 -0.113677,0.0081 -0.00774,-0.02322 -0.050258,-0.04223 -0.09448,-0.04223 -0.044221,0 -0.090781,-0.0168 -0.1034652,-0.03732 -0.012684,-0.02052 -0.05963,-0.03032 -0.1043224,-0.02178 -0.044694,0.0085 -0.0812605,0.0028 -0.0812605,-0.01277 0,-0.01557 -0.0226251,-0.01963 -0.0502787,-0.009 -0.0276536,0.01062 -0.0747891,-0.0052 -0.10474605,-0.03517 -0.0299569,-0.02996 -0.0836695,-0.05446 -0.11936206,-0.05446 -0.0755134,0 -0.16300798,-0.155442 -0.14396948,-0.255775 0.0216458,-0.114071 0.0858903,-0.269677 0.13551736,-0.328235 0.0258287,-0.03048 0.0424846,-0.07582 0.0370134,-0.100762 -0.005471,-0.02494 0.0126179,-0.04604 0.0401989,-0.04689 0.0275816,-8.75e-4 0.0695576,-0.03992 0.0932812,-0.08681 0.0237239,-0.04689 0.0433594,-0.07187 0.0436366,-0.05551 2.7333e-4,0.01638 0.0233532,0.0108 0.0512819,-0.01239 0.0279281,-0.02318 0.0409047,-0.05812 0.0288344,-0.07765 -0.0120695,-0.01954 -0.00597,-0.02563 0.013563,-0.01355 0.03826,0.02364 0.1334119,-0.06902 0.102556,-0.09987 -0.010234,-0.01023 -0.081291,0.01337 -0.15790503,0.05246 -0.19132318,0.0976 -0.53029094,0.131726 -0.60948002,0.06135 -0.040574,-0.03605 -0.10602968,-0.04828 -0.20760549,-0.03876 L 0,26.723956 0.13129745,26.603285 c 0.20194096,-0.185598 1.15569925,-0.834706 1.22646285,-0.834706 0.017944,0 1.0011722,-0.593762 1.1596288,-0.700289 l 0.1062908,-0.07146 -0.097498,-0.04316 c -0.075194,-0.03329 -0.09082,-0.05618 -0.068306,-0.100101 0.016056,-0.03132 0.038207,-0.148677 0.049225,-0.2608 0.013936,-0.141813 0.038705,-0.216631 0.081377,-0.245814 0.1348325,-0.09221 0.317117,-0.268214 0.317117,-0.306188 0,-0.04333 -0.2144179,0.01817 -0.8473768,0.243035 -0.1940842,0.06895 -0.3609084,0.117337 -0.3707213,0.107524 -0.030038,-0.03004 0.1889381,-0.28351 0.3932649,-0.455219 0.1064018,-0.08942 0.2148835,-0.182797 0.2410706,-0.207519 0.134978,-0.127412 0.6824316,-0.46318 1.0116807,-0.620491 0.2054297,-0.09815 0.4118743,-0.205241 0.4587663,-0.237974 0.046892,-0.03274 0.2270451,-0.133333 0.40034,-0.223546 0.1732947,-0.09022 0.3093674,-0.169742 0.3023838,-0.176726 -0.00698,-0.007 -0.1087422,0.01965 -0.226129,0.0592 -0.1501313,0.05057 -0.2241353,0.06119 -0.249524,0.0358 -0.025388,-0.02539 -0.024637,-0.03609 0.00253,-0.03609 0.021244,0 0.048451,-0.03096 0.060459,-0.06879 0.019185,-0.06045 0.1680893,-0.221549 0.4635947,-0.501568 0.048755,-0.0462 0.1428871,-0.117089 0.2091823,-0.157532 0.2161395,-0.131856 0.3951126,-0.257621 0.4169899,-0.29302 0.022754,-0.03682 1.0610754,-0.562441 1.1881729,-0.601483 0.04125,-0.01267 0.1911105,-0.08059 0.3330257,-0.150923 0.1419153,-0.07034 0.2933966,-0.139111 0.3366242,-0.152832 0.043226,-0.01372 0.1463559,-0.07271 0.2291753,-0.131083 0.1199707,-0.08456 0.1625792,-0.09864 0.2096072,-0.06927 0.047284,0.02953 0.1538875,-0.0087 0.5358933,-0.192258 0.2622766,-0.126017 0.5689448,-0.264972 0.6814862,-0.308789 0.1125401,-0.04382 0.2249981,-0.09985 0.2499076,-0.124513 0.081951,-0.08115 0.1773194,-0.116582 0.3449729,-0.128175 0.1131113,-0.0078 0.1886589,-0.03475 0.2391522,-0.08524 0.040595,-0.0406 0.1438461,-0.118225 0.2294472,-0.172512 0.1733184,-0.109916 0.2284002,-0.176259 0.2623733,-0.316014 0.01334,-0.05486 0.06939,-0.123095 0.132975,-0.161862 0.06158,-0.03755 0.08742,-0.0685 0.05876,-0.07038 -0.08661,-0.0057 0.555593,-0.16351 0.673539,-0.16552 0.06836,-0.0011 0.110835,-0.01922 0.110835,-0.0471 0,-0.02486 0.03789,-0.08081 0.08421,-0.124319 0.09656,-0.09071 0.08465,-0.1374 -0.03506,-0.1374 -0.139172,0 -0.09502,-0.04884 0.164003,-0.181411 0.306614,-0.156928 0.449342,-0.161093 0.841624,-0.02456 0.28366,0.09873 0.288206,0.09917 0.345032,0.03364 0.03167,-0.03652 0.06838,-0.06639 0.08158,-0.06639 0.02544,0 0.444123,-0.288445 0.530711,-0.36562 0.02814,-0.02508 0.1816,-0.14031 0.341033,-0.256071 0.159432,-0.115763 0.427996,-0.311618 0.596806,-0.435234 0.324997,-0.237988 0.519973,-0.363211 0.852581,-0.547569 0.112541,-0.06238 0.272663,-0.181743 0.355823,-0.265252 l 0.151204,-0.151834 -0.279091,0.01616 c -0.295876,0.01713 -0.322422,0.0016 -0.24494,-0.143172 0.05332,-0.09963 0.736112,-0.634181 1.100461,-0.86154 0.05926,-0.03698 0.08714,-0.07645 0.07227,-0.102311 -0.01332,-0.02315 -0.01159,-0.03067 0.0038,-0.01669 0.01542,0.01398 0.07543,-0.01065 0.133354,-0.05471 0.219267,-0.166827 1.171023,-0.727058 1.367134,-0.804733 0.258942,-0.102562 0.861798,-0.404573 0.886111,-0.443911 0.0101,-0.01634 0.121786,-0.06366 0.248193,-0.105146 0.287589,-0.09439 0.30873,-0.106826 0.229061,-0.134772 -0.06732,-0.02362 -0.07326,-0.02127 0.880461,-0.347551 0.239998,-0.08211 0.429331,-0.156371 0.420748,-0.165033 -0.0086,-0.0087 0.03161,-0.01751 0.08933,-0.01966 0.05771,-0.0022 0.121598,-0.02517 0.141958,-0.05115 0.02171,-0.0277 0.120634,-0.05234 0.239187,-0.05957 0.210669,-0.01285 0.602989,-0.173276 0.928324,-0.379597 0.08567,-0.05433 0.264945,-0.123611 0.398397,-0.153965 0.133453,-0.03035 0.2584,-0.06637 0.277662,-0.08004 0.01927,-0.01367 0.09641,-0.04558 0.171433,-0.07092 0.07503,-0.02534 0.173013,-0.07458 0.217746,-0.109424 0.04473,-0.03484 0.09298,-0.06335 0.107228,-0.06335 0.01425,0 0.07348,-0.04445 0.131636,-0.09877 0.113963,-0.106457 0.351444,-0.240935 0.463279,-0.26234 0.038,-0.0073 0.08445,-0.03321 0.10321,-0.05764 0.01875,-0.02443 0.09498,-0.08983 0.169391,-0.145337 0.194156,-0.144837 0.214536,-0.162058 0.478569,-0.404414 0.251516,-0.230862 0.606848,-0.516232 1.227718,-0.98599 0.344093,-0.2603468 0.589539,-0.4332454 1.258562,-0.886573 0.133088,-0.09018 0.449157,-0.2640469 0.702374,-0.3863728 0.253216,-0.1223245 0.529451,-0.2557186 0.613857,-0.2964302 0.08441,-0.04071 0.158614,-0.085626 0.16491,-0.099811 0.0063,-0.014184 0.02548,-0.017112 0.04263,-0.00653 0.01716,0.010605 0.0312,0.00558 0.0312,-0.011156 0,-0.016741 0.02005,-0.030435 0.04455,-0.030435 0.0245,0 0.158784,-0.058252 0.298402,-0.129445 0.139619,-0.071195 0.430335,-0.1978034 0.646038,-0.2813523 0.215704,-0.083549 0.491939,-0.1954213 0.613858,-0.2486049 0.121921,-0.053185 0.306077,-0.1321049 0.40924,-0.1753788 0.103162,-0.043273 0.29828,-0.1359289 0.433601,-0.2058975 0.135324,-0.069969 0.361685,-0.1753594 0.503025,-0.2342005 0.141344,-0.058844 0.256987,-0.118339 0.256987,-0.1322199 0,-0.013882 0.01945,-0.02524 0.04319,-0.02524 0.02377,0 0.303834,-0.1227275 0.622385,-0.2727296 0.318551,-0.1500017 0.675102,-0.3078947 0.792333,-0.3508747 0.117228,-0.042978 0.213145,-0.092292 0.213145,-0.1095837 0,-0.017291 0.01918,-0.027759 0.04263,-0.02326 0.06969,0.013374 0.594379,-0.1884232 0.639435,-0.2459351 0.0094,-0.011971 0.04007,-0.021527 0.06821,-0.021238 0.121558,0.00127 0.660662,-0.1945862 0.918837,-0.3337747 0.241294,-0.1300895 0.587545,-0.3830342 0.701059,-0.5121391 0.01875,-0.021333 0.06131,-0.048999 0.09456,-0.061479 0.03325,-0.012481 0.07001,-0.047591 0.08169,-0.078024 0.02692,-0.070138 0.174568,-0.219039 0.217202,-0.219039 0.01774,0 0.05143,-0.030691 0.07486,-0.068207 0.02342,-0.037513 0.06448,-0.068206 0.09123,-0.068206 0.02675,0 0.03887,-0.00976 0.02696,-0.021682 -0.01192,-0.011924 0.05783,-0.09633 0.155007,-0.1875678 0.09718,-0.091238 0.161929,-0.1668596 0.143886,-0.168049 -0.01803,-0.00118 0.0028,-0.016405 0.04612,-0.033815 0.04747,-0.019039 0.06915,-0.047456 0.05441,-0.071314 -0.01348,-0.021822 -0.0098,-0.030553 0.0083,-0.019409 0.01801,0.011138 0.09144,-0.040204 0.163151,-0.1140923 0.0717,-0.073888 0.117738,-0.1343421 0.10229,-0.1343421 -0.01546,0 0.02072,-0.036015 0.08038,-0.080032 0.05967,-0.044017 0.09718,-0.091336 0.08336,-0.105152 -0.01383,-0.013815 -0.0095,-0.020006 0.0097,-0.013752 0.04939,0.01615 0.223702,-0.1274928 0.194271,-0.1600887 -0.01342,-0.014875 -0.0072,-0.017247 0.01376,-0.00527 0.06096,0.034779 0.607999,-0.4589859 0.563584,-0.5087016 -0.0121,-0.013544 -0.0039,-0.014234 0.01831,-0.00155 0.02248,0.012885 0.06394,-0.010665 0.09378,-0.053276 0.02942,-0.042001 0.05349,-0.064232 0.05349,-0.049403 0,0.035425 0.155483,-0.078134 0.314002,-0.2293306 0.06954,-0.066327 0.191209,-0.1634486 0.270384,-0.2158258 l 0.143933,-0.095226 -0.09461,-0.017052 c -0.09208,-0.016595 -0.08962,-0.020213 0.09234,-0.1351948 0.102836,-0.064979 0.180276,-0.1355869 0.172099,-0.1569075 -0.0082,-0.021322 0.03576,-0.063723 0.09766,-0.094226 l 0.112534,-0.055461 -0.110835,-7.738e-4 c -0.121681,-8.545e-4 -0.148951,-0.052289 -0.04518,-0.085223 0.03611,-0.011461 0.177308,-0.1287936 0.313783,-0.260741 0.136473,-0.1319475 0.294923,-0.2638643 0.352116,-0.2931487 0.05718,-0.029285 0.112307,-0.066044 0.122484,-0.081687 0.01017,-0.015643 0.08691,-0.0653452 0.170517,-0.1104495 0.08361,-0.0451035 0.148684,-0.0976873 0.144617,-0.11685267 -0.0041,-0.0191645 0.0331,-0.0450046 0.08257,-0.0574227 0.04948,-0.0124174 0.127764,-0.0523182 0.173974,-0.0886698 0.04622,-0.0363507 0.110775,-0.0660921 0.143466,-0.0660921 0.08441,0 0.311151,-0.09789 0.391757,-0.16912543 0.07224,-0.0638419 0.511584,-0.24011339 0.598463,-0.24011339 0.02826,0 0.08528,-0.0237481 0.126716,-0.0527741 0.137291,-0.09616158 0.661132,-0.14352007 1.525634,-0.1379271367 0.792642,0.005129127 0.827085,0.008206607 1.091305,0.0975625367 0.150053,0.050747 0.291903,0.09246343 0.315215,0.09270283 0.09396,9.6895e-4 0.976611,0.42511458 1.100071,0.52862744 0.02811,0.02359 0.159498,0.0947176 0.291932,0.15806233 0.235834,0.11281152 0.25372,0.12719829 0.25372,0.20412699 0,0.023291 0.03271,0.029587 0.08526,0.016402 0.05003,-0.012556 0.08526,-0.00673 0.08526,0.014086 0,0.019516 0.04219,0.054229 0.09378,0.077137 0.05158,0.022909 0.123537,0.06862 0.159895,0.1015785 0.03637,0.032959 0.08624,0.059926 0.110835,0.059926 0.02459,0 0.04471,0.012883 0.04471,0.028629 0,0.037801 0.156041,0.1077839 0.240323,0.1077839 0.03664,0 0.0666,0.015347 0.0666,0.034103 0,0.050098 0.102113,0.041678 0.103394,-0.00853 4.52e-4,-0.025512 0.01972,-0.01804 0.04753,0.018611 0.03352,0.044207 0.07116,0.055035 0.135327,0.038932 0.05776,-0.014496 0.08889,-0.00837 0.08889,0.017504 0,0.021897 0.01498,0.030556 0.0333,0.019242 0.0461,-0.028494 0.444224,0.057046 0.423279,0.090944 -0.0093,0.015101 0.01841,0.027008 0.06163,0.02646 0.09589,-0.00121 0.512136,0.096881 0.42817,0.100902 -0.03285,0.00157 -0.05968,0.016565 -0.05968,0.033318 0,0.03259 0.410853,0.1157062 0.437957,0.0886 0.0089,-0.00889 0.03294,-0.00257 0.0534,0.014024 0.06789,0.055028 0.736829,0.2457834 0.776319,0.2213777 0.02148,-0.013281 0.02951,-0.00894 0.01796,0.00974 -0.01146,0.018537 0.130919,0.1054296 0.316393,0.1930939 0.185473,0.087664 0.472547,0.2615323 0.637942,0.3863739 0.1654,0.1248417 0.319902,0.2270363 0.343352,0.2270984 0.02346,6.81e-5 0.03547,0.00725 0.02675,0.015975 -0.0087,0.00872 0.03686,0.077444 0.101278,0.1527108 0.06442,0.075267 0.110018,0.148369 0.101315,0.162449 -0.0087,0.014079 0.0071,0.034399 0.03515,0.045154 0.02802,0.010755 0.0512,8.546e-4 0.05148,-0.022004 4.51e-4,-0.032265 0.0064,-0.032371 0.02662,-4.693e-4 0.01435,0.022595 0.02243,0.1068802 0.01796,0.1872996 -0.0057,0.1024476 0.0013,0.1309839 0.024,0.09533 0.02653,-0.041988 0.03272,-0.038959 0.03537,0.017319 0.0018,0.037513 0.01096,0.049024 0.0204,0.025578 0.0094,-0.023446 0.02802,-0.042629 0.04119,-0.042629 0.03781,0 0.03799,0.1327189 0,0.1560674 -0.02003,0.012395 -0.01119,0.037667 0.0217,0.061689 0.03979,0.029097 0.04904,0.067036 0.03244,0.1331389 -0.01277,0.050846 -0.03781,0.092447 -0.05563,0.092447 -0.01783,0 -0.02058,-0.019183 -0.0061,-0.042629 0.01444,-0.023446 -0.01394,-0.016324 -0.06312,0.015829 -0.08648,0.056549 -0.219373,0.09752 -0.342779,0.1056776 -0.0328,0.00217 -0.05968,0.015832 -0.05968,0.030358 0,0.014528 -0.03452,0.026195 -0.07673,0.025926 -0.04219,-2.688e-4 -0.12277,0.00591 -0.17904,0.013737 -0.971882,0.1351175 -1.779858,0.2316536 -2.0803,0.2485518 -0.206324,0.011606 -0.393648,0.035672 -0.416267,0.053482 -0.02261,0.017814 -0.05578,0.023341 -0.07366,0.012286 -0.05845,-0.036117 -0.137867,0.016695 -0.115393,0.076729 0.01854,0.049502 0.01385,0.050803 -0.03628,0.010053 -0.03979,-0.032383 -0.05754,-0.034549 -0.05754,-0.00703 0,0.021875 -0.01918,0.037283 -0.04264,0.034238 -0.113695,-0.014764 -0.168405,0.00487 -0.149657,0.0537 0.02179,0.056803 -0.03027,0.070789 -0.06349,0.017051 -0.01159,-0.018757 -0.0547,-0.032889 -0.0958,-0.031409 -0.04111,0.00149 -0.0564,0.010143 -0.03402,0.019253 0.02238,0.00911 0.03199,0.039256 0.02134,0.066986 -0.01674,0.043659 -0.02757,0.043 -0.0805,-0.00493 -0.04614,-0.041755 -0.07725,-0.046733 -0.126687,-0.020273 -0.03605,0.019289 -0.100448,0.02594 -0.143132,0.014777 -0.06857,-0.017931 -0.07496,-0.010784 -0.05491,0.061432 0.02026,0.072941 0.01773,0.075587 -0.02355,0.024614 -0.043,-0.053101 -0.05392,-0.052267 -0.155229,0.011876 -0.05993,0.037942 -0.108954,0.096734 -0.108954,0.1306499 0,0.044877 -0.01859,0.056808 -0.0682,0.04383 -0.0459,-0.012002 -0.06821,-0.00104 -0.06821,0.033502 0,0.031463 -0.04526,0.059826 -0.11689,0.073265 -0.0945,0.017728 -0.121158,0.041367 -0.139184,0.1234405 -0.02175,0.099065 -0.131379,0.1912377 -0.208964,0.1757021 -0.0213,-0.00429 -0.04769,0.015535 -0.05861,0.044002 -0.01092,0.028466 -0.0342,0.051758 -0.05175,0.051758 -0.03502,0 -0.139325,0.089285 -0.496709,0.4251098 -0.130107,0.1222664 -0.264395,0.2311337 -0.298403,0.241927 -0.03401,0.010793 -0.0623,0.045447 -0.06289,0.077007 -6.73e-4,0.031562 -0.0658,0.1065697 -0.144939,0.1666874 -0.270923,0.2058155 -0.531097,0.4853767 -0.510157,0.5481845 0.0076,0.022891 -0.0026,0.041625 -0.02258,0.041625 -0.02005,0 -0.05384,0.069059 -0.0751,0.1534642 -0.02126,0.084405 -0.05168,0.153465 -0.06763,0.153465 -0.01593,0 -0.02014,0.023019 -0.0093,0.051153 0.0108,0.028133 0.0056,0.051153 -0.01149,0.051153 -0.01712,0 -0.03115,0.034533 -0.03119,0.076733 0,0.1328989 -0.05393,0.4006339 -0.07758,0.3860182 -0.02005,-0.012388 -0.02725,0.1344432 -0.04256,0.8672752 -0.002,0.1031621 -0.01694,0.1959073 -0.03288,0.2061001 -0.03087,0.019749 -0.0581,0.1355871 -0.06226,0.2648322 -0.0013,0.043314 -0.0177,0.069369 -0.03625,0.057909 -0.01933,-0.011951 -0.02505,0.00175 -0.0134,0.03209 0.01118,0.029109 0.0038,0.052929 -0.01638,0.052929 -0.02017,0 -0.02725,0.024567 -0.01573,0.054598 0.01151,0.030024 0.004,0.065088 -0.01676,0.077907 -0.02074,0.012818 -0.04479,0.099111 -0.05345,0.1917602 -0.0087,0.092648 -0.03066,0.1734248 -0.0489,0.1795037 -0.01824,0.00606 -0.02536,0.040824 -0.01584,0.077209 0.01077,0.041208 -0.0034,0.074092 -0.03753,0.087197 -0.03015,0.01157 -0.04634,0.03478 -0.03596,0.05157 0.01038,0.0168 0.005,0.03053 -0.01205,0.03053 -0.017,0 -0.03228,0.04742 -0.03393,0.105393 -0.0051,0.179718 -0.117438,0.644115 -0.15081,0.623489 -0.01741,-0.01076 -0.02813,0.0011 -0.02381,0.02649 0.0043,0.02533 -0.0024,0.08442 -0.01478,0.131309 -0.01244,0.04689 -0.02923,0.154317 -0.03733,0.238722 -0.03648,0.380211 -0.166541,0.813049 -0.262056,0.87208 -0.01658,0.01025 -0.03014,0.06376 -0.03014,0.118927 0,0.05516 -0.01494,0.100297 -0.03323,0.100297 -0.04322,0 -0.145532,0.197792 -0.122006,0.23586 0.01,0.01608 -0.0048,0.04821 -0.0327,0.07138 -0.02793,0.02318 -0.05078,0.06201 -0.05078,0.08628 0,0.02428 -0.01521,0.04926 -0.03381,0.05551 -0.01859,0.0063 -0.03965,0.06171 -0.0468,0.123232 -0.0071,0.06153 -0.03801,0.139504 -0.06858,0.173284 -0.03057,0.03378 -0.04532,0.07168 -0.03278,0.08423 0.01255,0.01254 0.0024,0.02281 -0.02266,0.02281 -0.02501,0 -0.03585,0.0096 -0.0241,0.02137 0.0306,0.0306 -0.07344,0.220798 -0.170284,0.311282 -0.04526,0.04228 -0.07383,0.09055 -0.06351,0.107262 0.01033,0.01671 -0.0042,0.03918 -0.03219,0.04993 -0.02803,0.01075 -0.05096,0.05164 -0.05096,0.09084 0,0.03921 -0.01459,0.06228 -0.03239,0.05127 -0.03561,-0.022 -0.113081,0.09788 -0.08282,0.128147 0.01035,0.01034 -0.02074,0.04474 -0.06911,0.07642 -0.04835,0.03169 -0.08004,0.07036 -0.0704,0.08595 0.01898,0.03069 -0.114371,0.168819 -0.162961,0.168819 -0.01633,0 -0.02025,0.01524 -0.0088,0.03387 0.01151,0.01863 -0.03329,0.0897 -0.09956,0.157928 -0.06627,0.06823 -0.110938,0.139503 -0.09927,0.158378 0.01168,0.01887 -0.01552,0.06424 -0.06042,0.100806 -0.0449,0.03656 -0.05862,0.05631 -0.03048,0.04387 0.02814,-0.01243 0.01662,0.0079 -0.02558,0.04514 -0.0422,0.03726 -0.07673,0.08078 -0.07673,0.09671 0,0.01593 -0.03129,0.0485 -0.06953,0.07238 -0.03825,0.02388 -0.06135,0.05666 -0.05135,0.07284 0.01,0.01618 -0.0057,0.03859 -0.03494,0.0498 -0.02921,0.01121 -0.04333,0.03622 -0.03137,0.05557 0.01196,0.01935 0.0028,0.03097 -0.02039,0.02582 -0.02317,-0.0052 -0.05348,0.02899 -0.06734,0.07589 -0.01387,0.04689 -0.02673,0.07265 -0.0286,0.05724 -0.0047,-0.0388 -0.105707,0.06596 -0.105707,0.109636 0,0.01944 -0.03113,0.05199 -0.06916,0.07235 -0.03805,0.02035 -0.06111,0.05004 -0.05127,0.06597 0.0099,0.01593 -0.03193,0.07271 -0.09283,0.126176 -0.0609,0.05347 -0.118399,0.112566 -0.127777,0.131323 -0.0094,0.01876 -0.0255,0.03129 -0.03584,0.02784 -0.01033,-0.0034 -0.03831,0.02502 -0.0622,0.06325 -0.03566,0.0571 -0.03535,0.06485 0.0018,0.0434 0.05754,-0.03329 -0.100394,0.1488 -0.202424,0.233387 -0.04238,0.03514 -0.06834,0.078 -0.05767,0.09525 0.01067,0.01725 -0.0028,0.03137 -0.02973,0.03137 -0.05121,0 -0.198718,0.175689 -0.238939,0.28459 -0.01279,0.0346 -0.05386,0.07092 -0.09128,0.08071 -0.03742,0.0098 -0.06803,0.03258 -0.06803,0.05064 0,0.01807 -0.09548,0.127541 -0.212171,0.243271 -0.116693,0.115729 -0.208771,0.221926 -0.204617,0.235994 0.0042,0.01407 -0.0136,0.02558 -0.03946,0.02558 -0.0419,0 -0.36223,0.342153 -0.36223,0.386912 0,0.01812 -0.168333,0.207786 -0.434598,0.489667 -0.0797,0.08438 -0.134927,0.169585 -0.122716,0.189342 0.01221,0.01976 0.0063,0.02606 -0.01324,0.01401 -0.01949,-0.01205 -0.148957,0.09803 -0.287676,0.244627 -0.138717,0.146595 -0.276317,0.280693 -0.305775,0.297993 -0.113761,0.06682 -0.575254,0.510672 -0.575254,0.553274 0,0.0247 -0.01457,0.0359 -0.03239,0.0249 -0.01781,-0.01102 -0.04944,0.01184 -0.07028,0.05078 -0.02084,0.03893 -0.07624,0.08538 -0.123127,0.103201 -0.04688,0.01782 -0.07681,0.04604 -0.06651,0.06271 0.01031,0.01667 0,0.04609 -0.02352,0.06537 -0.04179,0.03468 -0.06108,0.04086 -0.127513,0.04086 -0.01875,0 -0.03027,0.01782 -0.02558,0.03961 0.0047,0.02178 -0.02216,0.04864 -0.05968,0.05968 -0.09596,0.02823 -0.460392,0.278998 -0.460392,0.316789 0,0.01721 -0.01255,0.02353 -0.02789,0.01405 -0.01535,-0.0095 -0.06906,0.02093 -0.119362,0.06757 -0.05031,0.04665 -0.09193,0.07268 -0.09251,0.05785 -6.72e-4,-0.01482 -0.01667,-6.8e-5 -0.0358,0.03272 -0.01911,0.03282 -0.06469,0.05968 -0.101275,0.05968 -0.03659,0 -0.09465,0.02686 -0.129032,0.05968 -0.03439,0.03282 -0.08427,0.06436 -0.110835,0.07008 -0.02657,0.0057 -0.06461,0.03156 -0.08453,0.05742 -0.01992,0.02586 -0.07746,0.05738 -0.127885,0.07003 -0.05042,0.01265 -0.09168,0.03925 -0.09168,0.0591 0,0.01985 -0.0097,0.02636 -0.02162,0.01447 -0.04327,-0.04327 -0.532043,0.244878 -0.72163,0.425432 -0.107024,0.101924 -0.294339,0.269485 -0.416257,0.372357 -0.351072,0.296226 -0.477445,0.419441 -0.477445,0.465526 0,0.02358 -0.01248,0.03903 -0.02774,0.03434 -0.03696,-0.01136 -0.401163,0.357536 -0.389174,0.394188 0.0052,0.01575 -0.0044,0.02012 -0.0213,0.0097 -0.01687,-0.01042 -0.120842,0.08723 -0.231043,0.217028 -0.110194,0.129794 -0.21571,0.237324 -0.234468,0.238955 -0.01875,0.0015 -0.139775,0.102333 -0.268924,0.223779 -0.129156,0.121446 -0.242179,0.220809 -0.251161,0.220809 -0.02537,0 -0.405851,0.275683 -0.572008,0.414454 -0.08205,0.06852 -0.314931,0.239897 -0.51753,0.380842 -0.387603,0.269655 -0.569368,0.44102 -0.766137,0.7223 -0.153643,0.219636 -0.36955,0.618807 -0.36955,0.683236 0,0.02749 -0.01176,0.04998 -0.02616,0.04998 -0.03167,0 -0.156417,0.321733 -0.224782,0.579755 -0.02733,0.103161 -0.05974,0.38707 -0.07201,0.63091 -0.01228,0.243838 -0.0367,0.457921 -0.0543,0.47574 -0.01759,0.01781 -0.03199,0.148686 -0.03199,0.290814 0,0.176685 -0.01649,0.281962 -0.05214,0.332861 -0.06265,0.08945 -0.03628,0.229636 0.05526,0.293757 0.03494,0.02447 0.273134,0.242804 0.529317,0.485172 0.256175,0.242373 0.479046,0.445791 0.495268,0.452042 0.01622,0.0063 0.02949,0.03311 0.02949,0.05968 0,0.02657 0.01297,0.04831 0.02881,0.04831 0.01584,0 0.103231,0.07579 0.194197,0.168432 0.09096,0.09264 0.17544,0.16222 0.187725,0.154627 0.01228,-0.0076 0.05524,0.02404 0.09546,0.07029 0.04022,0.04625 0.08856,0.0841 0.107445,0.0841 0.01889,0 0.03433,0.02302 0.03433,0.05115 0,0.02814 0.02393,0.05115 0.05316,0.05115 0.02924,0 0.04403,0.01481 0.03285,0.03288 -0.01118,0.01808 0.0378,0.07056 0.108823,0.116611 0.146636,0.09507 0.410528,0.327953 0.371622,0.327953 -0.01411,0 -0.0027,0.02302 0.02548,0.05115 0.02813,0.02814 0.07527,0.05115 0.104743,0.05115 0.02948,0 0.04976,0.01918 0.04506,0.04263 -0.0047,0.02344 0.01067,0.03879 0.0341,0.0341 0.02345,-0.0047 0.03879,0.01066 0.0341,0.0341 -0.0047,0.02344 0.01067,0.03879 0.03411,0.0341 0.02345,-0.0047 0.04263,0.0068 0.04263,0.02558 0,0.01875 0.01151,0.03167 0.02558,0.02869 0.01407,-0.003 0.05372,0.0068 0.08812,0.0218 0.04921,0.02142 0.05285,0.03336 0.01705,0.05605 -0.03107,0.0197 -0.01515,0.029 0.05031,0.02936 0.05269,4.48e-4 0.08814,0.01291 0.07878,0.02806 -0.0094,0.01515 0.01658,0.05262 0.05767,0.08326 0.211981,0.158129 0.321478,0.232868 0.398667,0.272128 0.115603,0.05878 0.204537,0.136366 0.205017,0.178823 6.73e-4,0.01926 0.06544,0.06496 0.144938,0.101519 0.141447,0.06505 0.340091,0.238163 0.308982,0.269278 -0.02718,0.02718 0.06833,0.153699 0.127777,0.169241 0.06948,0.01817 0.188265,0.276674 0.320871,0.69827 0.08404,0.267179 0.118475,0.330863 0.220688,0.408197 0.06662,0.0504 0.147197,0.124217 0.17907,0.164057 0.09286,0.116054 0.407185,0.314295 0.561941,0.354407 0.212211,0.05501 0.317944,0.197997 0.317944,0.42998 0,0.177064 0.0046,0.186422 0.114315,0.232258 0.06286,0.02626 0.181802,0.05857 0.2643,0.07179 0.08249,0.01322 0.264143,0.05332 0.403658,0.08911 0.139516,0.0358 0.327111,0.06508 0.416878,0.06508 0.191088,0 0.623427,0.160645 0.804959,0.299105 0.06647,0.0507 0.148841,0.153773 0.183033,0.229045 0.08345,0.183693 0.08156,0.232392 -0.0079,0.203999 -0.0628,-0.01994 -0.06843,-0.01289 -0.04589,0.05738 0.06069,0.189278 0.08178,0.333911 0.08254,0.566071 l 8.75e-4,0.247251 -0.10231,0 c -0.141004,0 -0.224605,-0.0965 -0.270173,-0.311862 -0.02207,-0.104268 -0.09225,-0.260923 -0.163567,-0.365089 -0.119313,-0.174261 -0.130354,-0.181565 -0.24619,-0.162767 -0.149842,0.02432 -0.206755,0.09784 -0.206755,0.267096 l 0,0.130514 -0.144938,-0.0091 c -0.128781,-0.0081 -0.143506,-0.0015 -0.132061,0.05907 0.02757,0.146015 0.01951,0.403542 -0.01289,0.41185 -0.01875,0.0048 -0.05329,0.0011 -0.07673,-0.0083 z m -4.19369,-3.988246 c 0.03255,-0.03255 -0.11857,-0.219098 -0.220265,-0.271924 -0.05026,-0.0261 -0.100619,-0.07448 -0.111934,-0.107508 -0.01132,-0.03303 -0.08846,-0.113161 -0.171444,-0.178065 -0.08298,-0.06491 -0.144604,-0.124279 -0.136937,-0.131946 0.01826,-0.01826 -0.252842,-0.244541 -0.292968,-0.244541 -0.01698,0 -0.03088,-0.02302 -0.03088,-0.05116 0,-0.02813 -0.01918,-0.04732 -0.04263,-0.04263 -0.02345,0.0047 -0.03879,-0.01067 -0.03411,-0.0341 0.0047,-0.02344 -0.0145,-0.04263 -0.04263,-0.04263 -0.02814,0 -0.05115,-0.02165 -0.05115,-0.04811 0,-0.02646 -0.09552,-0.13005 -0.212251,-0.230198 -0.116736,-0.100146 -0.253339,-0.224289 -0.30356,-0.27587 -0.05022,-0.05158 -0.09883,-0.09379 -0.108026,-0.09379 -0.0092,0 -0.09926,-0.08057 -0.200152,-0.17904 -0.186476,-0.182007 -0.359788,-0.332507 -0.382912,-0.332507 -0.007,0 -0.08682,-0.06799 -0.177335,-0.151102 -0.09051,-0.08311 -0.17673,-0.143589 -0.191592,-0.1344 -0.01486,0.0092 -0.02702,0.0024 -0.02702,-0.01528 0,-0.04201 -0.511787,-0.42675 -0.567681,-0.42675 -0.02375,0 -0.03553,-0.01237 -0.02619,-0.02747 0.02194,-0.03549 -0.281469,-0.225376 -0.403641,-0.252609 -0.05158,-0.01149 -0.09378,-0.03557 -0.09378,-0.05349 0,-0.019 -0.02956,-0.01678 -0.07091,0.0054 -0.06793,0.03636 -0.064,0.04498 0.09378,0.205769 0.09058,0.0923 0.183871,0.167842 0.207322,0.167869 0.02344,2.7e-5 0.04263,0.01302 0.04263,0.02885 0,0.01584 0.117144,0.14245 0.26033,0.281352 0.143178,0.138902 0.292804,0.289504 0.332507,0.334665 0.125042,0.142265 0.487691,0.495555 0.560957,0.546484 0.03864,0.02686 0.06096,0.06523 0.04957,0.08526 -0.01138,0.02003 -0.0087,0.02557 0.0061,0.0123 0.0147,-0.01326 0.07471,0.01169 0.133356,0.05543 0.05864,0.04375 0.165259,0.106726 0.236917,0.139967 0.0936,0.04341 0.117608,0.06848 0.08526,0.08899 -0.03381,0.02144 -0.02966,0.02869 0.01667,0.02908 0.03393,4.48e-4 0.05331,0.01409 0.04306,0.03066 -0.01667,0.02698 0.14951,0.115529 0.236282,0.125904 0.01875,0.0023 0.05419,0.0064 0.07875,0.0093 0.02455,0.0029 0.03515,0.02054 0.02356,0.0393 -0.01161,0.01875 0.0036,0.0341 0.0339,0.0341 0.03023,0 0.111436,0.03837 0.180445,0.08526 0.06901,0.04689 0.10272,0.08549 0.07492,0.08578 -0.04424,6.72e-4 -0.04417,0.0046 6.73e-4,0.03333 0.02814,0.01803 0.0764,0.02496 0.107242,0.01537 0.05882,-0.01828 0.141637,0.04693 0.20138,0.15856 0.01945,0.03632 0.09688,0.104889 0.17209,0.152367 0.10982,0.06933 0.132322,0.100292 0.114247,0.157236 -0.01432,0.04508 -0.0096,0.06294 0.01288,0.04903 0.01947,-0.01203 0.04436,-0.0074 0.05532,0.01035 0.01095,0.01772 -0.01483,0.0389 -0.05733,0.04706 -0.06684,0.01286 -0.06461,0.01548 0.01656,0.01949 0.07775,0.0038 0.09378,0.02023 0.09378,0.09574 0,0.149781 0.08859,0.215831 0.289483,0.215831 0.09713,0 0.186006,-0.0094 0.197504,-0.02091 z m -3.916702,-3.351519 c 0.01031,-0.01667 -0.03866,-0.07277 -0.108823,-0.124668 -0.162544,-0.12024 -0.245198,-0.220673 -0.246159,-0.299097 -0.0011,-0.08664 -0.139045,-0.398508 -0.176318,-0.398508 -0.01692,0 -0.04534,-0.03837 -0.06316,-0.08526 -0.01784,-0.04689 -0.04766,-0.08526 -0.06629,-0.08526 -0.01864,0 -0.02504,-0.02302 -0.01425,-0.05115 0.0108,-0.02813 0.0057,-0.05115 -0.01129,-0.05115 -0.04968,0 -0.120395,0.399496 -0.08306,0.469258 0.01779,0.03321 0.143661,0.159902 0.279747,0.281536 0.13608,0.121632 0.279425,0.254059 0.318537,0.294281 0.07702,0.0792 0.141411,0.09803 0.17108,0.05003 z m -0.771004,-2.50443 c -0.0043,-0.02202 0.0183,-0.08917 0.05025,-0.149197 0.03194,-0.06003 0.05808,-0.149179 0.05808,-0.198109 0,-0.05436 0.01416,-0.08021 0.0364,-0.06647 0.03025,0.01869 0.09496,-0.116002 0.0709,-0.147575 -0.004,-0.0054 0.01613,-0.03331 0.04495,-0.06211 0.02881,-0.02881 0.05237,-0.08874 0.05237,-0.133183 0,-0.04445 0.01414,-0.08955 0.03142,-0.100225 0.01728,-0.01069 0.05839,-0.09215 0.09136,-0.181054 0.03297,-0.08891 0.08744,-0.201739 0.12104,-0.250748 0.0336,-0.04901 0.05132,-0.09889 0.03937,-0.110837 -0.01194,-0.01194 -0.0038,-0.02173 0.01806,-0.02173 0.02189,0 0.03955,-0.02686 0.03927,-0.05968 -6.73e-4,-0.05155 -0.0055,-0.05271 -0.03706,-0.0085 -0.03005,0.04207 -0.03367,0.03904 -0.02039,-0.01705 0.0089,-0.03751 0.02822,-0.09773 0.04298,-0.13381 0.02151,-0.05253 0.01548,-0.06124 -0.03023,-0.0437 -0.07092,0.02721 -0.07416,-0.02222 -0.0059,-0.09045 0.02814,-0.02813 0.05065,-0.07911 0.05002,-0.113272 -8.75e-4,-0.05383 -0.01019,-0.05124 -0.06906,0.01945 -0.03736,0.04486 -0.07781,0.07168 -0.08988,0.0596 -0.01208,-0.01207 -0.05363,0.0049 -0.09234,0.0378 -0.06688,0.05679 -0.06809,0.05679 -0.02417,0 0.02827,-0.0365 0.03201,-0.05968 0.0096,-0.05968 -0.02012,0 -0.04886,0.01918 -0.06386,0.04263 -0.01501,0.02344 -0.057,0.06565 -0.09334,0.09379 -0.06006,0.0465 -0.06403,0.04573 -0.0437,-0.0085 0.0123,-0.03282 0.0081,-0.05969 -0.0093,-0.05969 -0.01746,0 -0.04841,0.06522 -0.06882,0.144939 -0.02042,0.07972 -0.04562,0.167959 -0.05602,0.196096 -0.04849,0.131129 -0.111834,0.499144 -0.09503,0.552109 0.01033,0.03255 0.0018,0.09092 -0.01898,0.129723 -0.04485,0.08379 -0.0079,0.827525 0.03967,0.798134 0.01662,-0.01026 0.02669,-0.0367 0.02239,-0.05873 z m 0.415265,-1.487433 c 0,-0.01986 0.01535,-0.03611 0.0341,-0.03611 0.01875,0 0.03411,0.0068 0.03411,0.01503 0,0.0083 -0.01535,0.02453 -0.03411,0.03611 -0.01875,0.01158 -0.0341,0.0048 -0.0341,-0.01503 z m 0.06821,-0.102309 c 0,-0.01985 0.01535,-0.03611 0.0341,-0.03611 0.01875,0 0.0341,0.0068 0.0341,0.01503 0,0.0083 -0.01535,0.02452 -0.0341,0.03611 -0.01875,0.01158 -0.0341,0.0048 -0.0341,-0.01503 z M 50.350048,2.911456 c -0.04024,-0.04024 -0.0851,-0.060404 -0.09969,-0.044811 -0.01458,0.015594 -0.0073,0.035235 0.01633,0.043647 0.02355,0.00841 0.03614,0.026146 0.02793,0.039407 -0.0082,0.013261 0.01737,0.026543 0.05685,0.029515 l 0.07175,0.0054 -0.07316,-0.073163 z M 28.551232,31.653751 c 0,-0.0083 0.01534,-0.02453 0.0341,-0.03611 0.01875,-0.01158 0.0341,-0.0048 0.0341,0.01503 0,0.01987 -0.01534,0.03611 -0.0341,0.03611 -0.01875,0 -0.0341,-0.0067 -0.0341,-0.01503 z M 47.469354,1.6014697 c 0.0231,-0.00934 0.06912,-0.00991 0.102307,-0.00127 0.03317,0.00865 0.01431,0.016289 -0.04196,0.016985 -0.05627,6.93e-4 -0.08342,-0.00638 -0.06032,-0.015721 z"
- style="fill:#000000" />
-</svg>
diff --git a/samples/deferred/ui/main.crow b/samples/deferred/ui/main.crow
deleted file mode 100644
index 14e6082..0000000
--- a/samples/deferred/ui/main.crow
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<Window Caption="Lighting" Icon="#deferred.crow.svg" Left="10" Top="100" Width="40%" Height="40%" CornerRadius="10">
- <VerticalStack Spacing="1" Margin="10" CacheEnabled="true">
- <HorizontalStack Height="Fit" >
- <Label Text="Exposure:" Width="80"/>
- <Slider Height="10" Value="{²Exposure}" Maximum="10.0" SmallIncrement="0.1" LargeIncrement="1.0"/>
- <Label Text="{Exposure}" Width="40" TextAlignment="Right" />
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Text="Gamma:" Width="80" />
- <Slider Height="10" Value="{²Gamma}" Maximum="10.0" SmallIncrement="0.1" LargeIncrement="1.0"/>
- <Label Text="{Gamma}" Width="40" TextAlignment="Right" />
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Text="Light Strength:" Width="100" />
- <Slider Height="10" Value="{²LightStrength}" Maximum="50.0" SmallIncrement="0.1" LargeIncrement="5.0"/>
- <Label Text="{LightStrength}" Width="40" TextAlignment="Right" />
- </HorizontalStack>
- <ListBox Name="dv" Data="{Lights}" Width="Stretched" Height="Fit">
- <ItemTemplate>
- <Border Height="Fit">
- <VerticalStack>
- <HorizontalStack>
- <Label Text="Position" Width="50"/>
- <Label Text="{position}"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Text="Color" Width="50"/>
- <Label Text="{color}"/>
- </HorizontalStack>
- </VerticalStack>
- </Border>
- </ItemTemplate>
- </ListBox>
- </VerticalStack>
-</Window>
-
diff --git a/samples/deferred/ui/materials.crow b/samples/deferred/ui/materials.crow
deleted file mode 100644
index b4c5432..0000000
--- a/samples/deferred/ui/materials.crow
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<Window Icon="#deferred.crow.svg" Left="10" Top="100" Width="40%" Height="40%" CornerRadius="10">
- <VerticalStack>
- <ListBox Data="{Materials}">
- <ItemTemplate DataType="PbrMaterial">
- <VerticalStack>
- <ColorPicker Width="260" Height="Fit"/>
- <HorizontalStack>
- <Label Width="Stretched" Text="Metallic Factor"/>
- <Spinner Style="NormalizedFloat" Value="{²metallicFactor}"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Width="Stretched" Text="Roughness Factor"/>
- <Spinner Style="NormalizedFloat" Value="{²roughnessFactor}"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Width="Stretched" Text="Alpha Mask"/>
- <Spinner Style="NormalizedFloat" Value="{²alphaMask}"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Width="Stretched" Text="Alpha Mask Cutoff"/>
- <Spinner Style="NormalizedFloat" Value="{²alphaMaskCutoff}"/>
- </HorizontalStack>
- </VerticalStack>
- </ItemTemplate>
- </ListBox>
- <Button Caption="Apply" MouseClick="onApplyMaterialChanges"/>
- </VerticalStack>
-</Window>
-
diff --git a/samples/deferred/ui/menu.crow b/samples/deferred/ui/menu.crow
deleted file mode 100644
index 1cc36be..0000000
--- a/samples/deferred/ui/menu.crow
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<Menu>
- <MenuItem Caption="View" Fit="true" PopWidth="150">
- <MenuItem Command="{CMDViewScenes}"/>
- <MenuItem Command="{CMDViewDebug}"/>
- <MenuItem Command="{CMDViewEditor}"/>
- <MenuItem Command="{CMDViewMaterials}"/>
- </MenuItem>
-</Menu> \ No newline at end of file
diff --git a/samples/deferred/ui/sceneItem.crow b/samples/deferred/ui/sceneItem.crow
deleted file mode 100644
index ecb3a53..0000000
--- a/samples/deferred/ui/sceneItem.crow
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<VerticalStack>
- <Border Style="TreeItemBorder" MouseDoubleClick="./onClickForExpand">
- <HorizontalStack Spacing="5">
- <Image Margin="1" Width="10" Height="10" Focusable="true" MouseDown="./onClickForExpand"
- Path="{./Image}"
- Visible="{./IsExpandable}"
- SvgSub="{./IsExpanded}"
- MouseEnter="{Background=LightGrey}"
- MouseLeave="{Background=Transparent}"/>
- <Image Style="TreeIcon"
- Path="#Crow.Icons.folder.svg" SvgSub="{./IsExpanded}"/>
- <Label Text="{./Caption}"/>
- </HorizontalStack>
- </Border>
- <Container Name="Content" Visible="false"/>
-</VerticalStack>
-
diff --git a/samples/deferred/ui/scenes.crow b/samples/deferred/ui/scenes.crow
deleted file mode 100644
index b7f1b4f..0000000
--- a/samples/deferred/ui/scenes.crow
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<Window Caption="Scenes" Icon="#deferred.crow.svg" Left="10" Top="100" Width="40%" Height="80%" CornerRadius="10">
- <TreeView Data="{Scenes}" Width="Stretched">
- <ItemTemplate DataType="Scene" Data="GetNodes">
- <Expandable Caption="{Name}" Template="#deferred.sceneItem.crow" IsExpanded="{²IsExpanded}">
- <HorizontalStack Height="Fit">
- <Widget Width="8" Height="10"/>
- <VerticalStack Height="Fit" Name="ItemsContainer"/>
- </HorizontalStack>
- </Expandable>
- </ItemTemplate>
- <ItemTemplate DataType="Node" Data="Children">
- <Expandable Caption="Node" IsExpanded="{²IsExpanded}">
- <Template>
- <VerticalStack>
- <Border Style="TreeItemBorder" MouseDoubleClick="./onClickForExpand">
- <HorizontalStack Spacing="5">
- <Image Margin="1" Width="10" Height="10" Focusable="true" MouseDown="./onClickForExpand"
- Path="{./Image}"
- Visible="{./IsExpandable}"
- SvgSub="{./IsExpanded}"
- MouseEnter="{Background=LightGrey}"
- MouseLeave="{Background=Transparent}"/>
- <Image Style="TreeIcon"
- Path="#Crow.Icons.folder.svg" SvgSub="{./IsExpanded}"/>
- <Label Text="{./Caption}"/>
- <Label DataSource="{Mesh}" Text="{Name}"/>
- </HorizontalStack>
- </Border>
- <Container Name="Content" Visible="false"/>
- </VerticalStack>
- </Template>>
- <HorizontalStack Height="Fit">
- <Widget Width="8" Height="10"/>
- <VerticalStack Height="Fit" Name="ItemsContainer"/>
- </HorizontalStack>
- </Expandable>
- </ItemTemplate>
- </TreeView>
-</Window>
-
diff --git a/samples/deferred/ui/testImage.crow b/samples/deferred/ui/testImage.crow
deleted file mode 100644
index c245e14..0000000
--- a/samples/deferred/ui/testImage.crow
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0"?>
-<EnumSelector Height="300" EnumValue="{²CurrentDebugView}"/>
-
diff --git a/samples/pbr/EnvironmentPipeline.cs b/samples/pbr/EnvironmentPipeline.cs
deleted file mode 100644
index b259863..0000000
--- a/samples/pbr/EnvironmentPipeline.cs
+++ /dev/null
@@ -1,354 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL {
- class EnvironmentCube : GraphicPipeline {
-
- GPUBuffer vboSkybox;
-
- public Image cubemap { get; private set; }
- public Image lutBrdf { get; private set; }
- public Image irradianceCube { get; private set; }
- public Image prefilterCube { get; set; }
-
- public Image debugImg;
- public int debugMip = -1;
- public int debugFace = 0;
-
- public EnvironmentCube (DescriptorSet dsSkybox, PipelineLayout plLayout, Queue staggingQ, RenderPass renderPass, PipelineCache pipelineCache = null)
- : base (renderPass, pipelineCache, "EnvCube pipeline") {
-
- using (CommandPool cmdPool = new CommandPool (staggingQ.Dev, staggingQ.index)) {
-
- vboSkybox = new GPUBuffer<float> (staggingQ, cmdPool, VkBufferUsageFlags.VertexBuffer, box_vertices);
-
- cubemap = KTX.KTX.Load (staggingQ, cmdPool, cubemapPathes[2],
- VkImageUsageFlags.Sampled, VkMemoryPropertyFlags.DeviceLocal, true);
- cubemap.CreateView (VkImageViewType.Cube, VkImageAspectFlags.Color, 6);
- cubemap.CreateSampler (VkSamplerAddressMode.ClampToEdge);
- cubemap.SetName ("skybox Texture");
- cubemap.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, renderPass.Samples, false);
- cfg.RenderPass = renderPass;
- cfg.Layout = plLayout;
- cfg.AddVertexBinding (0, 3 * sizeof (float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat);
- cfg.AddShader (VkShaderStageFlags.Vertex, "#pbr.skybox.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#pbr.skybox.frag.spv");
- cfg.multisampleState.rasterizationSamples = Samples;
-
- layout = cfg.Layout;
-
- init (cfg);
-
- generateBRDFLUT (staggingQ, cmdPool);
- generateCubemaps (staggingQ, cmdPool);
- }
-
- }
-
- //public void WriteDesc (VkDescriptorBufferInfo matrixDesc) {
- // DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descLayoutMain);
- // uboUpdate.Write (Dev, dsSkybox, matrixDesc, cubemap.Descriptor);
- //}
-
- public void RecordDraw (CommandBuffer cmd) {
- Bind (cmd);
- cmd.BindVertexBuffer (vboSkybox);
- cmd.Draw (36);
- }
-
- #region skybox
- public List<string> cubemapPathes = new List<string>() {
- "../data/textures/papermill.ktx",
- "../data/textures/cubemap_yokohama_bc3_unorm.ktx",
- "../data/textures/gcanyon_cube.ktx",
- "../data/textures/pisa_cube.ktx",
- "../data/textures/uffizi_cube.ktx",
- };
- static float[] box_vertices = {
- 1.0f, 1.0f,-1.0f, // +X side
- 1.0f, 1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f,
- 1.0f,-1.0f,-1.0f,
- 1.0f, 1.0f,-1.0f,
-
- -1.0f,-1.0f,-1.0f, // +X side
- -1.0f,-1.0f, 1.0f,
- -1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f,-1.0f,
- -1.0f,-1.0f,-1.0f,
-
- -1.0f, 1.0f,-1.0f, // +Y side
- -1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
- -1.0f, 1.0f,-1.0f,
- 1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f,-1.0f,
-
- -1.0f,-1.0f,-1.0f, // -Y side
- 1.0f,-1.0f,-1.0f,
- 1.0f,-1.0f, 1.0f,
- -1.0f,-1.0f,-1.0f,
- 1.0f,-1.0f, 1.0f,
- -1.0f,-1.0f, 1.0f,
-
- -1.0f, 1.0f, 1.0f, // +Z side
- -1.0f,-1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
- -1.0f,-1.0f, 1.0f,
- 1.0f,-1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f,
-
- -1.0f,-1.0f,-1.0f, // -Z side
- 1.0f, 1.0f,-1.0f,
- 1.0f,-1.0f,-1.0f,
- -1.0f,-1.0f,-1.0f,
- -1.0f, 1.0f,-1.0f,
- 1.0f, 1.0f,-1.0f,
-
- };
- #endregion
-
- void generateBRDFLUT (Queue staggingQ, CommandPool cmdPool) {
- const VkFormat format = VkFormat.R16g16Sfloat;
- const int dim = 512;
-
- lutBrdf = new Image (Dev, format, VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.Sampled,
- VkMemoryPropertyFlags.DeviceLocal, dim, dim);
- lutBrdf.SetName ("lutBrdf");
-
- lutBrdf.CreateView ();
- lutBrdf.CreateSampler (VkSamplerAddressMode.ClampToEdge);
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1, false);
-
- cfg.Layout = new PipelineLayout (Dev, new DescriptorSetLayout (Dev));
- cfg.RenderPass = new RenderPass (Dev);
- cfg.RenderPass.AddAttachment (format, VkImageLayout.ShaderReadOnlyOptimal);
- cfg.RenderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0, 0, 0) });
- cfg.RenderPass.AddSubpass (new SubPass (VkImageLayout.ColorAttachmentOptimal));
- cfg.AddShader (VkShaderStageFlags.Vertex, "#pbr.genbrdflut.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#pbr.genbrdflut.frag.spv");
-
- using (GraphicPipeline pl = new GraphicPipeline (cfg)) {
- using (Framebuffer fb = new Framebuffer (cfg.RenderPass, dim, dim, lutBrdf)) {
- CommandBuffer cmd = cmdPool.AllocateCommandBuffer ();
- cmd.Start (VkCommandBufferUsageFlags.OneTimeSubmit);
- pl.RenderPass.Begin (cmd, fb);
- cmd.SetViewport (dim, dim);
- cmd.SetScissor (dim, dim);
- pl.Bind (cmd);
- cmd.Draw (3, 1, 0, 0);
- pl.RenderPass.End (cmd);
- cmd.End ();
-
- staggingQ.Submit (cmd);
- staggingQ.WaitIdle ();
-
- cmd.Free ();
- }
- }
- lutBrdf.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- }
-
- public enum CBTarget { IRRADIANCE = 0, PREFILTEREDENV = 1 };
-
- public Image generateCubeMap (Queue staggingQ, CommandPool cmdPool, CBTarget target) {
- const float deltaPhi = (2.0f * (float)Math.PI) / 180.0f;
- const float deltaTheta = (0.5f * (float)Math.PI) / 64.0f;
-
- VkFormat format = VkFormat.R32g32b32a32Sfloat;
- uint dim = 64;
-
- if (target == CBTarget.PREFILTEREDENV) {
- format = VkFormat.R16g16b16a16Sfloat;
- dim = 512;
- }
-
- uint numMips = (uint)Math.Floor (Math.Log (dim, 2)) + 1;
-
- Image imgFbOffscreen = new Image (Dev, format, VkImageUsageFlags.TransferSrc | VkImageUsageFlags.ColorAttachment,
- VkMemoryPropertyFlags.DeviceLocal, dim, dim);
- imgFbOffscreen.SetName ("offscreenfb");
- imgFbOffscreen.CreateView ();
-
- Image cmap = new Image (Dev, format, VkImageUsageFlags.TransferDst | VkImageUsageFlags.Sampled,
- VkMemoryPropertyFlags.DeviceLocal, dim, dim, VkImageType.Image2D, VkSampleCountFlags.SampleCount1, VkImageTiling.Optimal,
- numMips, 6, 1, VkImageCreateFlags.CubeCompatible);
- if (target == CBTarget.PREFILTEREDENV)
- cmap.SetName ("prefilterenvmap");
- else
- cmap.SetName ("irradianceCube");
- cmap.CreateView (VkImageViewType.Cube, VkImageAspectFlags.Color, 6);
- cmap.CreateSampler (VkSamplerAddressMode.ClampToEdge);
-
- DescriptorPool dsPool = new DescriptorPool (Dev, 2, new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler));
-
- DescriptorSetLayout dsLayout = new DescriptorSetLayout (Dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
-
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, VkSampleCountFlags.SampleCount1, false);
-
- cfg.Layout = new PipelineLayout (Dev, dsLayout);
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, (uint)Marshal.SizeOf<Matrix4x4> () + 8));
-
- cfg.RenderPass = new RenderPass (Dev);
- cfg.RenderPass.AddAttachment (format, VkImageLayout.ColorAttachmentOptimal);
- cfg.RenderPass.ClearValues.Add (new VkClearValue { color = new VkClearColorValue (0, 0, 0) });
- cfg.RenderPass.AddSubpass (new SubPass (VkImageLayout.ColorAttachmentOptimal));
-
- cfg.AddVertexBinding (0, 3 * sizeof (float));
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#pbr.filtercube.vert.spv");
- if (target == CBTarget.PREFILTEREDENV)
- cfg.AddShader (VkShaderStageFlags.Fragment, "#pbr.prefilterenvmap.frag.spv");
- else
- cfg.AddShader (VkShaderStageFlags.Fragment, "#pbr.irradiancecube.frag.spv");
-
- Matrix4x4[] matrices = {
- // POSITIVE_X
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(180)) * Matrix4x4.CreateRotationY(Utils.DegreesToRadians(90)),
- // NEGATIVE_X
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(180)) * Matrix4x4.CreateRotationY(Utils.DegreesToRadians(-90)),
- // POSITIVE_Y
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(-90)),
- // NEGATIVE_Y
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(90)),
- // POSITIVE_Z
- Matrix4x4.CreateRotationX(Utils.DegreesToRadians(180)),
- // NEGATIVE_Z
- Matrix4x4.CreateRotationZ(Utils.DegreesToRadians(180))
- };
-
- VkImageSubresourceRange subRes = new VkImageSubresourceRange (VkImageAspectFlags.Color, 0, numMips, 0, 6);
-
- using (GraphicPipeline pl = new GraphicPipeline (cfg)) {
- DescriptorSet dset = dsPool.Allocate (dsLayout);
- DescriptorSetWrites dsUpdate = new DescriptorSetWrites (dsLayout);
- dsUpdate.Write (Dev, dset, cubemap.Descriptor);
-
- using (Framebuffer fb = new Framebuffer (pl.RenderPass, dim, dim, imgFbOffscreen)) {
- CommandBuffer cmd = cmdPool.AllocateCommandBuffer ();
- cmd.Start (VkCommandBufferUsageFlags.OneTimeSubmit);
-
- cmap.SetLayout (cmd, VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal, subRes);
-
- float roughness = 0;
-
- cmd.SetScissor (dim, dim);
- cmd.SetViewport ((float)(dim), (float)dim);
-
- for (int m = 0; m < numMips; m++) {
- roughness = (float)m / ((float)numMips - 1f);
-
- for (int f = 0; f < 6; f++) {
- pl.RenderPass.Begin (cmd, fb);
-
- pl.Bind (cmd);
-
- float viewPortSize = (float)Math.Pow (0.5, m) * dim;
- cmd.SetViewport (viewPortSize, viewPortSize);
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment,
- matrices[f] * Matrix4x4.CreatePerspectiveFieldOfView (Utils.DegreesToRadians (90), 1f, 0.1f, 512f));
- if (target == CBTarget.IRRADIANCE) {
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, deltaPhi, (uint)Marshal.SizeOf<Matrix4x4> ());
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, deltaTheta, (uint)Marshal.SizeOf<Matrix4x4> () + 4);
- } else {
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, roughness, (uint)Marshal.SizeOf<Matrix4x4> ());
- cmd.PushConstant (pl.Layout, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, 32u, (uint)Marshal.SizeOf<Matrix4x4> () + 4);
- }
-
- cmd.BindDescriptorSet (pl.Layout, dset);
- cmd.BindVertexBuffer (vboSkybox);
- cmd.Draw (36);
-
- pl.RenderPass.End (cmd);
-
- imgFbOffscreen.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal);
-
- VkImageCopy region = new VkImageCopy ();
- region.srcSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, 1);
- region.dstSubresource = new VkImageSubresourceLayers (VkImageAspectFlags.Color, 1, (uint)m, (uint)f);
- region.extent = new VkExtent3D { width = (uint)viewPortSize, height = (uint)viewPortSize, depth = 1 };
-
- Vk.vkCmdCopyImage (cmd.Handle,
- imgFbOffscreen.Handle, VkImageLayout.TransferSrcOptimal,
- cmap.Handle, VkImageLayout.TransferDstOptimal,
- 1, region.Pin ());
- region.Unpin ();
-
- //debug img
- if (target == CBTarget.PREFILTEREDENV && m == debugMip && f == debugFace) {
- debugImg?.Dispose ();
- debugImg = new Image (Dev, VkFormat.R16g16b16a16Sfloat, VkImageUsageFlags.Sampled | VkImageUsageFlags.TransferDst, VkMemoryPropertyFlags.DeviceLocal,
- (uint)viewPortSize, (uint)viewPortSize);
- debugImg.CreateView ();
- debugImg.CreateSampler ();
- region.dstSubresource.baseArrayLayer = 0;
- region.dstSubresource.mipLevel = 0;
- debugImg.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal);
- Vk.vkCmdCopyImage (cmd.Handle,
- imgFbOffscreen.Handle, VkImageLayout.TransferSrcOptimal,
- debugImg.Handle, VkImageLayout.TransferDstOptimal,
- 1, region.Pin ());
- debugImg.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferDstOptimal, VkImageLayout.ShaderReadOnlyOptimal);
- region.Unpin ();
- }
-
- imgFbOffscreen.SetLayout (cmd, VkImageAspectFlags.Color,
- VkImageLayout.TransferSrcOptimal, VkImageLayout.ColorAttachmentOptimal);
-
- }
- }
-
- cmap.SetLayout (cmd, VkImageLayout.TransferDstOptimal, VkImageLayout.ShaderReadOnlyOptimal, subRes);
-
- cmd.End ();
-
- staggingQ.Submit (cmd);
- staggingQ.WaitIdle ();
-
- cmd.Free ();
- }
- }
- cmap.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-
- dsLayout.Dispose ();
- imgFbOffscreen.Dispose ();
- dsPool.Dispose ();
-
- return cmap;
- }
-
- void generateCubemaps (Queue staggingQ, CommandPool cmdPool) {
- irradianceCube = generateCubeMap (staggingQ, cmdPool, CBTarget.IRRADIANCE);
- prefilterCube = generateCubeMap (staggingQ, cmdPool, CBTarget.PREFILTEREDENV);
- }
-
- protected override void Dispose (bool disposing) {
- vboSkybox.Dispose ();
- cubemap.Dispose ();
- lutBrdf.Dispose ();
- irradianceCube.Dispose ();
- prefilterCube.Dispose ();
-
- debugImg?.Dispose ();
-
- base.Dispose (disposing);
- }
- }
-
-}
diff --git a/samples/pbr/PbrModel.cs b/samples/pbr/PbrModel.cs
deleted file mode 100644
index a48fe11..0000000
--- a/samples/pbr/PbrModel.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using System.Numerics;
-using System.Runtime.InteropServices;
-
-using VK;
-
-namespace CVKL {
- using CVKL.glTF;
-
-
- //TODO:stride in buffer views?
- public class PbrModel2 : PbrModelSeparatedTextures {
- public PbrModel2 (Queue transferQ, string path, DescriptorSetLayout layout, params AttachmentType[] attachments)
- : base (transferQ, path, layout, attachments) {}
-
- //TODO:destset for binding must be variable
- //TODO: ADD REFAULT MAT IF NO MAT DEFINED
- public override void RenderNode (CommandBuffer cmd, PipelineLayout pipelineLayout, Node node, Matrix4x4 currentTransform, bool shadowPass = false) {
- Matrix4x4 localMat = node.localMatrix * currentTransform;
-
- cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Vertex, localMat);
-
- if (node.Mesh != null) {
- foreach (Primitive p in node.Mesh.Primitives) {
- cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Fragment, (int)p.material, (uint)Marshal.SizeOf<Matrix4x4> ());
- if (descriptorSets[p.material] != null)
- cmd.BindDescriptorSet (pipelineLayout, descriptorSets[p.material], 1);
- cmd.DrawIndexed (p.indexCount, 1, p.indexBase, p.vertexBase, 0);
- }
- }
- if (node.Children == null)
- return;
- foreach (Node child in node.Children)
- RenderNode (cmd, pipelineLayout, child, localMat);
- }
- }
-}
diff --git a/samples/pbr/PbrPipeline.cs b/samples/pbr/PbrPipeline.cs
deleted file mode 100644
index 37e2d36..0000000
--- a/samples/pbr/PbrPipeline.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using VK;
-
-namespace CVKL {
- class PBRPipeline : GraphicPipeline {
-
- public struct Matrices {
- public Matrix4x4 projection;
- public Matrix4x4 model;
- public Matrix4x4 view;
- public Vector4 camPos;
- public Vector4 lightDir;
- public float exposure;
- public float gamma;
- public float prefilteredCubeMipLevels;
- public float scaleIBLAmbient;
- public float debugViewInputs;
- public float debugViewEquation;
- }
-
- public Matrices matrices = new Matrices {
- lightDir = Vector4.Normalize (new Vector4 (0.7f, 0.6f, 0.2f, 0.0f)),
- gamma = 2.2f,
- exposure = 4.5f,
- scaleIBLAmbient = 1f,
- debugViewInputs = 0,
- debugViewEquation = 0
- };
-
- public HostBuffer uboMats;
-
- DescriptorPool descriptorPool;
-
- DescriptorSetLayout descLayoutMain;
- DescriptorSetLayout descLayoutTextures;
- public DescriptorSet dsMain;
-
- public PbrModel2 model;
- public EnvironmentCube envCube;
-
- public PBRPipeline (Queue staggingQ, RenderPass renderPass, PipelineCache pipelineCache = null) :
- base (renderPass, pipelineCache, "pbr pipeline") {
-
- descriptorPool = new DescriptorPool (Dev, 2,
- new VkDescriptorPoolSize (VkDescriptorType.UniformBuffer, 2),
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler, 9)
- );
-
- descLayoutMain = new DescriptorSetLayout (Dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Vertex | VkShaderStageFlags.Fragment, VkDescriptorType.UniformBuffer),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (4, VkShaderStageFlags.Fragment, VkDescriptorType.UniformBuffer),
- new VkDescriptorSetLayoutBinding (5, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));//ui image
-
- descLayoutTextures = new DescriptorSetLayout (Dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (1, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (2, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (3, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler),
- new VkDescriptorSetLayoutBinding (4, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, renderPass.Samples);
- cfg.Layout = new PipelineLayout (Dev, descLayoutMain, descLayoutTextures);
- cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Vertex, (uint)Marshal.SizeOf<Matrix4x4> ()),
- new VkPushConstantRange (VkShaderStageFlags.Fragment, sizeof(int), 64)
- );
- cfg.RenderPass = renderPass;
- cfg.AddVertexBinding<PbrModel2.Vertex> (0);
- cfg.AddVertexAttributes (0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat, VkFormat.R32g32Sfloat, VkFormat.R32g32Sfloat);
-
- cfg.AddShader (VkShaderStageFlags.Vertex, "#pbr.pbr.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#pbr.pbr_khr.frag.spv");
-
- layout = cfg.Layout;
-
- init (cfg);
-
- dsMain = descriptorPool.Allocate (descLayoutMain);
-
- envCube = new EnvironmentCube (dsMain, layout, staggingQ, RenderPass);
-
- matrices.prefilteredCubeMipLevels = envCube.prefilterCube.CreateInfo.mipLevels;
- uboMats = new HostBuffer (Dev, VkBufferUsageFlags.UniformBuffer, matrices, true);
-
- string[] modelPathes = {
- "../data/models/DamagedHelmet/glTF/DamagedHelmet.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/Avocado/glTF/Avocado.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/BarramundiFish/glTF/BarramundiFish.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/BoomBoxWithAxes/glTF/BoomBoxWithAxes.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/Box/glTF/Box.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/EnvironmentTest/glTF/EnvironmentTest.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/MetalRoughSpheres/glTF/MetalRoughSpheres.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/OrientationTest/glTF/OrientationTest.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/Buggy/glTF/Buggy.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/2CylinderEngine/glTF-Embedded/2CylinderEngine.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/FlightHelmet/glTF/FlightHelmet.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/GearboxAssy/glTF/GearboxAssy.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/Lantern/glTF/Lantern.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/SciFiHelmet/glTF/SciFiHelmet.gltf",
- "/mnt/devel/vulkan/glTF-Sample-Models-master/2.0/Sponza/glTF/Sponza.gltf",
- "/mnt/devel/vkChess/data/chess.gltf"
- };
-
-
- model = new PbrModel2 (staggingQ, modelPathes[0], descLayoutTextures,
- AttachmentType.Color,
- AttachmentType.PhysicalProps,
- AttachmentType.Normal,
- AttachmentType.AmbientOcclusion,
- AttachmentType.Emissive);
- //model = new Model (Dev, presentQueue, "../data/models/icosphere.gltf");
- //model = new Model (Dev, presentQueue, cmdPool, "../data/models/cube.gltf");
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (descLayoutMain.Bindings.GetRange(0,5).ToArray());
- uboUpdate.Write (Dev, dsMain,
- uboMats.Descriptor,
- envCube.irradianceCube.Descriptor,
- envCube.prefilterCube.Descriptor,
- envCube.lutBrdf.Descriptor,
- model.materialUBO.Descriptor);
- }
-
- public void RecordDraw (CommandBuffer cmd) {
- cmd.BindDescriptorSet (Layout, dsMain);
- envCube.RecordDraw (cmd);
- drawModel (cmd);
- }
- void drawModel (CommandBuffer cmd) {
- Bind (cmd);
- model.Bind (cmd);
- model.DrawAll (cmd, Layout);
-
- }
-
- protected override void Dispose (bool disposing) {
- model.Dispose ();
- envCube.Dispose ();
-
- descLayoutMain.Dispose ();
- descLayoutTextures.Dispose ();
- descriptorPool.Dispose ();
-
- uboMats.Dispose ();
-
- base.Dispose (disposing);
- }
- }
-
-}
diff --git a/samples/pbr/main.cs b/samples/pbr/main.cs
deleted file mode 100644
index 19064ab..0000000
--- a/samples/pbr/main.cs
+++ /dev/null
@@ -1,432 +0,0 @@
-/* Forward pbr sample inspire from https://github.com/SaschaWillems/Vulkan-glTF-PBR
- *
- * Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
- *
- * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
- */
-
-using System;
-using System.Numerics;
-using System.Runtime.InteropServices;
-using Glfw;
-using VK;
-using CVKL;
-
-namespace pbrSample {
- class Program : VkWindow{
-
- static void Main (string[] args) {
-#if DEBUG
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = false;
-#endif
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
- protected override void configureEnabledFeatures (VkPhysicalDeviceFeatures available_features, ref VkPhysicalDeviceFeatures enabled_features) {
- base.configureEnabledFeatures (available_features, ref enabled_features);
-#if PIPELINE_STATS
- features.pipelineStatisticsQuery = true;
-#endif
- enabled_features.samplerAnisotropy = available_features.samplerAnisotropy;
- }
-
- VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1;
-
- Framebuffer[] frameBuffers;
- PBRPipeline pbrPipeline;
-
- enum DebugView {
- none,
- color,
- normal,
- occlusion,
- emissive,
- metallic,
- roughness
- }
-
- DebugView currentDebugView = DebugView.none;
-
-#if PIPELINE_STATS
- PipelineStatisticsQueryPool statPool;
- TimestampQueryPool timestampQPool;
- ulong[] results;
-#endif
- bool queryUpdatePrefilCube, showDebugImg;
-
-#if WITH_VKVG
- //DescriptorSet dsDebugImg;
- //void initDebugImg () {
- // dsDebugImg = descriptorPool.Allocate (descLayoutMain);
- // pbrPipeline.envCube.debugImg.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- // DescriptorSetWrites uboUpdate = new DescriptorSetWrites (dsDebugImg, descLayoutMain);
- // uboUpdate.Write (dev, pbrPipeline.envCube.debugImg.Descriptor);
- //}
-
- VkvgPipeline.VkvgPipeline vkvgPipeline;
-
- void vkvgDraw () {
- using (vkvg.Context ctx = vkvgPipeline.CreateContext ()) {
- ctx.Operator = vkvg.Operator.Clear;
- ctx.Paint ();
- ctx.Operator = vkvg.Operator.Over;
-
- ctx.LineWidth = 1;
- ctx.SetSource (0.1, 0.1, 0.1, 0.8);
- ctx.Rectangle (5.5, 5.5, 320, 300);
- ctx.FillPreserve ();
- ctx.Flush ();
- ctx.SetSource (0.8, 0.8, 0.8);
- ctx.Stroke ();
-
- ctx.FontFace = "mono";
- ctx.FontSize = 8;
- int x = 16;
- int y = 40, dy = 16;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"fps: {fps,5} "));
- ctx.MoveTo (x + 200, y - 0.5);
- ctx.Rectangle (x + 200, y - 8.5, 0.1 * fps, 10);
- ctx.SetSource (0.1, 0.9, 0.1);
- ctx.Fill ();
- ctx.SetSource (0.8, 0.8, 0.8);
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"Exposure:{pbrPipeline.matrices.exposure,5} "));
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"Gamma: {pbrPipeline.matrices.gamma,5} "));
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"Light pos: {lightPos.ToString()} "));
-
-#if PIPELINE_STATS
- if (results == null)
- return;
-
- y += dy*2;
- ctx.MoveTo (x, y);
- ctx.ShowText ("Pipeline Statistics");
- ctx.MoveTo (x-2, 4.5+y);
- ctx.LineTo (x+160, 4.5+y);
- ctx.Stroke ();
- y += 4;
- x += 20;
-
- for (int i = 0; i < statPool.RequestedStats.Length; i++) {
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"{statPool.RequestedStats[i].ToString(),-30} :{results[i],12:0,0} "));
- }
- /*y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"{"Elapsed microsecond",-20} :{timestampQPool.ElapsedMiliseconds:0.0000} "));*/
-#endif
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"{"Debug draw (numpad 0->6)",-30} : {currentDebugView.ToString ()} "));
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"{"Debug Prefil Face: (f)",-30} : {pbrPipeline.envCube.debugFace.ToString ()} "));
- y += dy;
- ctx.MoveTo (x, y);
- ctx.ShowText (string.Format ($"{"Debug Prefil Mip: (m)",-30} : {pbrPipeline.envCube.debugMip.ToString ()} "));
-
- vkvgPipeline.DrawResources (ctx, (int)Width, (int)Height);
- }
- }
-#endif
-
-
- Vector4 lightPos = new Vector4 (1, 0, 0, 0);
- BoundingBox modelAABB;
-
- Program () : base() {
-
- //UpdateFrequency = 20;
-
- camera.SetPosition (0, 0, 5);
-
-
- pbrPipeline = new PBRPipeline(presentQueue,
- new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), samples));
-
-
-
- modelAABB = pbrPipeline.model.DefaultScene.AABB;
-
- //camera.Model = Matrix4x4.CreateScale (1f/ Math.Max (Math.Max (modelAABB.max.X, modelAABB.max.Y), modelAABB.max.Z));
-
-#if PIPELINE_STATS
- statPool = new PipelineStatisticsQueryPool (dev,
- VkQueryPipelineStatisticFlags.InputAssemblyVertices |
- VkQueryPipelineStatisticFlags.InputAssemblyPrimitives |
- VkQueryPipelineStatisticFlags.ClippingInvocations |
- VkQueryPipelineStatisticFlags.ClippingPrimitives |
- VkQueryPipelineStatisticFlags.FragmentShaderInvocations);
-
- timestampQPool = new TimestampQueryPool (dev);
-#endif
-
-#if WITH_VKVG
- vkvgPipeline = new VkvgPipeline.VkvgPipeline (instance, dev, presentQueue, pbrPipeline);
-#endif
- }
-
- bool rebuildBuffers;
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
- cmds[i] = cmdPool.AllocateAndStart ();
-#if PIPELINE_STATS
- statPool.Begin (cmds[i]);
- recordDraw (cmds[i], frameBuffers[i]);
- statPool.End (cmds[i]);
-#else
- recordDraw (cmds[i], frameBuffers[i]);
-#endif
-
- cmds[i].End ();
- }
- }
- void recordDraw (CommandBuffer cmd, Framebuffer fb) {
- pbrPipeline.RenderPass.Begin (cmd, fb);
-
- cmd.SetViewport (fb.Width, fb.Height);
- cmd.SetScissor (fb.Width, fb.Height);
-
- pbrPipeline.RecordDraw (cmd);
-
-#if WITH_VKVG
- vkvgPipeline.RecordDraw (cmd);
-#endif
- pbrPipeline.RenderPass.End (cmd);
- }
-
-
-#region update
- public override void UpdateView () {
- camera.AspectRatio = (float)swapChain.Width / swapChain.Height;
-
- pbrPipeline.matrices.lightDir = lightPos;
- pbrPipeline.matrices.projection = camera.Projection;
- pbrPipeline.matrices.view = camera.View;
- pbrPipeline.matrices.model = camera.Model;
-
-
- pbrPipeline.matrices.camPos = new Vector4 (
- -camera.Position.Z * (float)Math.Sin (camera.Rotation.Y) * (float)Math.Cos (camera.Rotation.X),
- camera.Position.Z * (float)Math.Sin (camera.Rotation.X),
- camera.Position.Z * (float)Math.Cos (camera.Rotation.Y) * (float)Math.Cos (camera.Rotation.X),
- 0
- );
- pbrPipeline.matrices.debugViewInputs = (float)currentDebugView;
-
- pbrPipeline.uboMats.Update (pbrPipeline.matrices, (uint)Marshal.SizeOf<PBRPipeline.Matrices> ());
-
- updateViewRequested = false;
- }
-
- public override void Update () {
-#if PIPELINE_STATS
- results = statPool.GetResults ();
-#endif
- if (rebuildBuffers) {
- buildCommandBuffers ();
- rebuildBuffers = false;
- }
-#if WITH_VKVG
- vkvgDraw ();
-#endif
- }
-#endregion
-
-
- protected override void OnResize () {
- base.OnResize ();
-
- dev.WaitIdle ();
-#if WITH_VKVG
- vkvgPipeline.Resize ((int)swapChain.Width, (int)swapChain.Height,
- new DescriptorSetWrites (pbrPipeline.dsMain, pbrPipeline.Layout.DescriptorSetLayouts[0].Bindings[5]));
-#endif
-
- UpdateView ();
-
- if (frameBuffers != null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (pbrPipeline.RenderPass, swapChain.Width, swapChain.Height,
- (pbrPipeline.RenderPass.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- null
- } : new Image[] {
- null,
- null,
- swapChain.images[i]
- });
- }
-
- buildCommandBuffers ();
- dev.WaitIdle ();
- }
-
- #region Mouse and keyboard
- protected override void onMouseMove (double xPos, double yPos) {
- double diffX = lastMouseX - xPos;
- double diffY = lastMouseY - yPos;
- if (MouseButton[0]) {
- camera.Rotate ((float)-diffX, (float)-diffY);
- } else if (MouseButton[1]) {
- camera.SetZoom ((float)diffY);
- } else
- return;
-
- updateViewRequested = true;
- }
-
- protected override void onKeyDown (Key key, int scanCode, Modifier modifiers) {
- switch (key) {
- case Key.F:
- if (modifiers.HasFlag (Modifier.Shift)) {
- pbrPipeline.envCube.debugFace --;
- if (pbrPipeline.envCube.debugFace < 0)
- pbrPipeline.envCube.debugFace = 5;
- } else {
- pbrPipeline.envCube.debugFace ++;
- if (pbrPipeline.envCube.debugFace > 5)
- pbrPipeline.envCube.debugFace = 0;
- }
- queryUpdatePrefilCube = updateViewRequested = true;
- break;
- case Key.M:
- if (modifiers.HasFlag (Modifier.Shift)) {
- pbrPipeline.envCube.debugMip --;
- if (pbrPipeline.envCube.debugMip < 0)
- pbrPipeline.envCube.debugMip = (int)pbrPipeline.envCube.prefilterCube.CreateInfo.mipLevels - 1;
- } else {
- pbrPipeline.envCube.debugMip ++;
- if (pbrPipeline.envCube.debugMip > pbrPipeline.envCube.prefilterCube.CreateInfo.mipLevels)
- pbrPipeline.envCube.debugMip = 0;
- }
- queryUpdatePrefilCube = updateViewRequested = true;
- break;
- case Key.P:
- showDebugImg = !showDebugImg;
- queryUpdatePrefilCube = updateViewRequested = true;
- break;
- case Key.Keypad0:
- currentDebugView = DebugView.none;
- break;
- case Key.Keypad1:
- currentDebugView = DebugView.color;
- break;
- case Key.Keypad2:
- currentDebugView = DebugView.normal;
- break;
- case Key.Keypad3:
- currentDebugView = DebugView.occlusion;
- break;
- case Key.Keypad4:
- currentDebugView = DebugView.emissive;
- break;
- case Key.Keypad5:
- currentDebugView = DebugView.metallic;
- break;
- case Key.Keypad6:
- currentDebugView = DebugView.roughness;
- break;
- case Key.Up:
- if (modifiers.HasFlag (Modifier.Shift))
- lightPos -= Vector4.UnitZ;
- else
- camera.Move (0, 0, 1);
- break;
- case Key.Down:
- if (modifiers.HasFlag (Modifier.Shift))
- lightPos += Vector4.UnitZ;
- else
- camera.Move (0, 0, -1);
- break;
- case Key.Left:
- if (modifiers.HasFlag (Modifier.Shift))
- lightPos -= Vector4.UnitX;
- else
- camera.Move (1, 0, 0);
- break;
- case Key.Right:
- if (modifiers.HasFlag (Modifier.Shift))
- lightPos += Vector4.UnitX;
- else
- camera.Move (-1, 0, 0);
- break;
- case Key.PageUp:
- if (modifiers.HasFlag (Modifier.Shift))
- lightPos += Vector4.UnitY;
- else
- camera.Move (0, 1, 0);
- break;
- case Key.PageDown:
- if (modifiers.HasFlag (Modifier.Shift))
- lightPos -= Vector4.UnitY;
- else
- camera.Move (0, -1, 0);
- break;
- case Key.F2:
- if (modifiers.HasFlag (Modifier.Shift))
- pbrPipeline.matrices.exposure -= 0.3f;
- else
- pbrPipeline.matrices.exposure += 0.3f;
- break;
- case Key.F3:
- if (modifiers.HasFlag (Modifier.Shift))
- pbrPipeline.matrices.gamma -= 0.1f;
- else
- pbrPipeline.matrices.gamma += 0.1f;
- break;
- case Key.F4:
- if (camera.Type == Camera.CamType.FirstPerson)
- camera.Type = Camera.CamType.LookAt;
- else
- camera.Type = Camera.CamType.FirstPerson;
- Console.WriteLine ($"camera type = {camera.Type}");
- break;
- default:
- base.onKeyDown (key, scanCode, modifiers);
- return;
- }
- updateViewRequested = true;
- }
- #endregion
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- pbrPipeline.Dispose ();
-#if WITH_VKVG
- vkvgPipeline.Dispose ();
-#endif
-
-#if PIPELINE_STATS
- timestampQPool?.Dispose ();
- statPool?.Dispose ();
-#endif
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/pbr/pbr.csproj b/samples/pbr/pbr.csproj
deleted file mode 100644
index c8eff12..0000000
--- a/samples/pbr/pbr.csproj
+++ /dev/null
@@ -1,24 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
- <PropertyGroup>
- <EnableDefaultNoneItems>false</EnableDefaultNoneItems>
- </PropertyGroup>
-
- <ItemGroup>
- <GLSLShader Update="shaders/simpletexture.frag">
- <LogicalName>CVKL.simpletexture.frag.spv</LogicalName>
- </GLSLShader>
- </ItemGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\..\CVKL.Addons\gltfLoader\gltfLoader.csproj" />
- <ProjectReference Include="..\..\CVKL.Addons\VkvgPipeline\VkvgPipeline.csproj" />
- </ItemGroup>
-
- <ItemGroup>
- <EmbeddedResource Include="ui\**\*.*">
- <LogicalName>deferred.%(Filename)%(Extension)</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
-
-</Project>
diff --git a/samples/pbr/screenshot.png b/samples/pbr/screenshot.png
deleted file mode 100644
index 5662cb5..0000000
--- a/samples/pbr/screenshot.png
+++ /dev/null
Binary files differ
diff --git a/samples/pbr/shaders/FullScreenQuad.vert b/samples/pbr/shaders/FullScreenQuad.vert
deleted file mode 100644
index 826720b..0000000
--- a/samples/pbr/shaders/FullScreenQuad.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-#version 450
-
-layout (location = 0) out vec2 outUV;
-
-void main()
-{
- outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
- gl_Position = vec4(outUV * 2.0f + -1.0f, 0.0f, 1.0f);
- //gl_Position = vec4(outUV -1.0f, 0.0f, 1.0f);
-}
diff --git a/samples/pbr/shaders/filtercube.vert b/samples/pbr/shaders/filtercube.vert
deleted file mode 100644
index 34adf73..0000000
--- a/samples/pbr/shaders/filtercube.vert
+++ /dev/null
@@ -1,20 +0,0 @@
-#version 450
-
-layout (location = 0) in vec3 inPos;
-
-layout(push_constant) uniform PushConsts {
- layout (offset = 0) mat4 mvp;
-} pushConsts;
-
-layout (location = 0) out vec3 outUVW;
-
-out gl_PerVertex {
- vec4 gl_Position;
-};
-
-void main()
-{
- outUVW = inPos;
- //outUVW.y = -outUVW.y;
- gl_Position = pushConsts.mvp * vec4(inPos.xyz, 1.0);
-}
diff --git a/samples/pbr/shaders/genbrdflut.frag b/samples/pbr/shaders/genbrdflut.frag
deleted file mode 100644
index b6290dd..0000000
--- a/samples/pbr/shaders/genbrdflut.frag
+++ /dev/null
@@ -1,90 +0,0 @@
-#version 450
-
-layout (location = 0) in vec2 inUV;
-layout (location = 0) out vec4 outColor;
-layout (constant_id = 0) const uint NUM_SAMPLES = 1024u;
-
-const float PI = 3.1415926536;
-
-// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
-float random(vec2 co)
-{
- float a = 12.9898;
- float b = 78.233;
- float c = 43758.5453;
- float dt= dot(co.xy ,vec2(a,b));
- float sn= mod(dt,3.14);
- return fract(sin(sn) * c);
-}
-
-vec2 hammersley2d(uint i, uint N)
-{
- // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
- uint bits = (i << 16u) | (i >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- float rdi = float(bits) * 2.3283064365386963e-10;
- return vec2(float(i) /float(N), rdi);
-}
-
-// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
-vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
-{
- // Maps a 2D point to a hemisphere with spread based on roughness
- float alpha = roughness * roughness;
- float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
- float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
- float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
- vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
-
- // Tangent space
- vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangentX = normalize(cross(up, normal));
- vec3 tangentY = normalize(cross(normal, tangentX));
-
- // Convert to world Space
- return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
-}
-
-// Geometric Shadowing function
-float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness)
-{
- float k = (roughness * roughness) / 2.0;
- float GL = dotNL / (dotNL * (1.0 - k) + k);
- float GV = dotNV / (dotNV * (1.0 - k) + k);
- return GL * GV;
-}
-
-vec2 BRDF(float NoV, float roughness)
-{
- // Normal always points along z-axis for the 2D lookup
- const vec3 N = vec3(0.0, 0.0, 1.0);
- vec3 V = vec3(sqrt(1.0 - NoV*NoV), 0.0, NoV);
-
- vec2 LUT = vec2(0.0);
- for(uint i = 0u; i < NUM_SAMPLES; i++) {
- vec2 Xi = hammersley2d(i, NUM_SAMPLES);
- vec3 H = importanceSample_GGX(Xi, roughness, N);
- vec3 L = 2.0 * dot(V, H) * H - V;
-
- float dotNL = max(dot(N, L), 0.0);
- float dotNV = max(dot(N, V), 0.0);
- float dotVH = max(dot(V, H), 0.0);
- float dotNH = max(dot(H, N), 0.0);
-
- if (dotNL > 0.0) {
- float G = G_SchlicksmithGGX(dotNL, dotNV, roughness);
- float G_Vis = (G * dotVH) / (dotNH * dotNV);
- float Fc = pow(1.0 - dotVH, 5.0);
- LUT += vec2((1.0 - Fc) * G_Vis, Fc * G_Vis);
- }
- }
- return LUT / float(NUM_SAMPLES);
-}
-
-void main()
-{
- outColor = vec4(BRDF(inUV.s, 1.0-inUV.t), 0.0, 1.0);
-} \ No newline at end of file
diff --git a/samples/pbr/shaders/genbrdflut.vert b/samples/pbr/shaders/genbrdflut.vert
deleted file mode 100644
index f3dd233..0000000
--- a/samples/pbr/shaders/genbrdflut.vert
+++ /dev/null
@@ -1,9 +0,0 @@
-#version 450
-
-layout (location = 0) out vec2 outUV;
-
-void main()
-{
- outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
- gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f);
-} \ No newline at end of file
diff --git a/samples/pbr/shaders/irradiancecube.frag b/samples/pbr/shaders/irradiancecube.frag
deleted file mode 100644
index 340d679..0000000
--- a/samples/pbr/shaders/irradiancecube.frag
+++ /dev/null
@@ -1,37 +0,0 @@
-// Generates an irradiance cube from an environment map using convolution
-
-#version 450
-
-layout (location = 0) in vec3 inPos;
-layout (location = 0) out vec4 outColor;
-layout (binding = 0) uniform samplerCube samplerEnv;
-
-layout(push_constant) uniform PushConsts {
- layout (offset = 64) float deltaPhi;
- layout (offset = 68) float deltaTheta;
-} consts;
-
-#define PI 3.1415926535897932384626433832795
-
-void main()
-{
- vec3 N = normalize(inPos);
- vec3 up = vec3(0.0, 1.0, 0.0);
- vec3 right = normalize(cross(up, N));
- up = cross(N, right);
-
- const float TWO_PI = PI * 2.0;
- const float HALF_PI = PI * 0.5;
-
- vec3 color = vec3(0.0);
- uint sampleCount = 0u;
- for (float phi = 0.0; phi < TWO_PI; phi += consts.deltaPhi) {
- for (float theta = 0.0; theta < HALF_PI; theta += consts.deltaTheta) {
- vec3 tempVec = cos(phi) * right + sin(phi) * up;
- vec3 sampleVector = cos(theta) * N + sin(theta) * tempVec;
- color += texture(samplerEnv, sampleVector).rgb * cos(theta) * sin(theta);
- sampleCount++;
- }
- }
- outColor = vec4(PI * color / float(sampleCount), 1.0);//texture(samplerEnv, inPos).rgba;
-}
diff --git a/samples/pbr/shaders/pbr.vert b/samples/pbr/shaders/pbr.vert
deleted file mode 100644
index 76ee24b..0000000
--- a/samples/pbr/shaders/pbr.vert
+++ /dev/null
@@ -1,44 +0,0 @@
-#version 450
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec3 inNormal;
-layout (location = 2) in vec2 inUV0;
-layout (location = 3) in vec2 inUV1;
-
-layout (set = 0, binding = 0) uniform UBO {
- mat4 projection;
- mat4 model;
- mat4 view;
- vec4 camPos;
- vec4 lightDir;
- float exposure;
- float gamma;
- float prefilteredCubeMipLevels;
- float scaleIBLAmbient;
-} ubo;
-
-layout(push_constant) uniform PushConsts {
- mat4 model;
-} pc;
-
-layout (location = 0) out vec3 outWorldPos;
-layout (location = 1) out vec3 outNormal;
-layout (location = 2) out vec2 outUV0;
-layout (location = 3) out vec2 outUV1;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-void main()
-{
- vec4 locPos = ubo.model * pc.model * vec4(inPos, 1.0);
- outNormal = normalize(transpose(inverse(mat3(ubo.model * pc.model))) * inNormal);
-
- //locPos.y = -locPos.y;
- outWorldPos = locPos.xyz;// / locPos.w;
- outUV0 = inUV0;
- outUV1 = inUV1;
- gl_Position = ubo.projection * ubo.view * vec4(outWorldPos, 1.0);
-}
diff --git a/samples/pbr/shaders/pbr_khr.frag b/samples/pbr/shaders/pbr_khr.frag
deleted file mode 100644
index 1f8e056..0000000
--- a/samples/pbr/shaders/pbr_khr.frag
+++ /dev/null
@@ -1,459 +0,0 @@
-// PBR shader based on the Khronos WebGL PBR implementation
-// See https://github.com/KhronosGroup/glTF-WebGL-PBR
-// Supports both metallic roughness and specular glossiness inputs
-
-#version 450
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-#define MANUAL_SRGB 0
-#define DEBUG 1
-
-struct Material {
- vec4 baseColorFactor;
- vec4 emissiveFactor;
- vec4 diffuseFactor;
- vec4 specularFactor;
- float workflow;
- uint tex0;
- uint tex1;
- float metallicFactor;
- float roughnessFactor;
- float alphaMask;
- float alphaMaskCutoff;
- int pad0;
-};
-
-const uint MAP_COLOR = 0x1;
-const uint MAP_NORMAL = 0x2;
-const uint MAP_AO = 0x4;
-const uint MAP_METAL = 0x8;
-const uint MAP_ROUGHNESS = 0x10;
-const uint MAP_METALROUGHNESS = 0x20;
-const uint MAP_EMISSIVE = 0x40;
-
-layout (location = 0) in vec3 inWorldPos;
-layout (location = 1) in vec3 inNormal;
-layout (location = 2) in vec2 inUV0;
-layout (location = 3) in vec2 inUV1;
-
-layout (set = 0, binding = 0) uniform UBO {
- mat4 projection;
- mat4 model;
- mat4 view;
- vec4 camPos;
- vec4 lightDir;
- float exposure;
- float gamma;
- float prefilteredCubeMipLevels;
- float scaleIBLAmbient;
-#if DEBUG
- float debugViewInputs;
- float debugViewEquation;
-#endif
-} ubo;
-
-layout (set = 0, binding = 4) uniform UBOMaterials {
- Material materials[16];
-};
-
-layout (set = 0, binding = 1) uniform samplerCube samplerIrradiance;
-layout (set = 0, binding = 2) uniform samplerCube prefilteredMap;
-layout (set = 0, binding = 3) uniform sampler2D samplerBRDFLUT;
-
-// Material bindings
-
-layout (set = 1, binding = 0) uniform sampler2D colorMap;
-layout (set = 1, binding = 1) uniform sampler2D physicalDescriptorMap;
-layout (set = 1, binding = 2) uniform sampler2D normalMap;
-layout (set = 1, binding = 3) uniform sampler2D aoMap;
-layout (set = 1, binding = 4) uniform sampler2D emissiveMap;
-
-
-layout (push_constant) uniform PushCsts {
- layout(offset = 64)
- int materialIdx;
-};
-
-layout (location = 0) out vec4 outColor;
-
-// Encapsulate the various inputs used by the various functions in the shading equation
-// We store values in this struct to simplify the integration of alternative implementations
-// of the shading terms, outlined in the Readme.MD Appendix.
-struct PBRInfo
-{
- float NdotL; // cos angle between normal and light direction
- float NdotV; // cos angle between normal and view direction
- float NdotH; // cos angle between normal and half vector
- float LdotH; // cos angle between light direction and half vector
- float VdotH; // cos angle between view direction and half vector
- float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)
- float metalness; // metallic value at the surface
- vec3 reflectance0; // full reflectance color (normal incidence angle)
- vec3 reflectance90; // reflectance color at grazing angle
- float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])
- vec3 diffuseColor; // color contribution from diffuse lighting
- vec3 specularColor; // color contribution from specular lighting
-};
-
-const float M_PI = 3.141592653589793;
-const float c_MinRoughness = 0.04;
-
-const float PBR_WORKFLOW_METALLIC_ROUGHNESS = 1.0;
-const float PBR_WORKFLOW_SPECULAR_GLOSINESS = 2.0f;
-
-vec3 Uncharted2Tonemap(vec3 color)
-{
- float A = 0.15;
- float B = 0.50;
- float C = 0.10;
- float D = 0.20;
- float E = 0.02;
- float F = 0.30;
- float W = 11.2;
- return ((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F;
-}
-
-vec4 tonemap(vec4 color)
-{
- vec3 outcol = Uncharted2Tonemap(color.rgb * ubo.exposure);
- outcol = outcol * (1.0f / Uncharted2Tonemap(vec3(11.2f)));
- return vec4(pow(outcol, vec3(1.0f / ubo.gamma)), color.a);
-}
-
-vec4 SRGBtoLINEAR(vec4 srgbIn)
-{
- #ifdef MANUAL_SRGB
- #ifdef SRGB_FAST_APPROXIMATION
- vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
- #else //SRGB_FAST_APPROXIMATION
- vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
- vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
- #endif //SRGB_FAST_APPROXIMATION
- return vec4(linOut,srgbIn.w);;
- #else //MANUAL_SRGB
- return srgbIn;
- #endif //MANUAL_SRGB
-}
-
-// Find the normal for this fragment, pulling either from a predefined normal map
-// or from the interpolated mesh normal and tangent attributes.
-vec3 getNormal()
-{
- vec3 tangentNormal;
- // Perturb normal, see http://www.thetenthplanet.de/archives/1180
- if ((materials[materialIdx].tex0 & MAP_NORMAL) == MAP_NORMAL)
- tangentNormal = texture(normalMap, inUV0).xyz * 2.0 - 1.0;
- else if ((materials[materialIdx].tex1 & MAP_NORMAL) == MAP_NORMAL)
- tangentNormal = texture(normalMap, inUV1).xyz * 2.0 - 1.0;
- else
- return normalize(inNormal);
-
- vec3 q1 = dFdx(inWorldPos);
- vec3 q2 = dFdy(inWorldPos);
- vec2 st1 = dFdx(inUV0);
- vec2 st2 = dFdy(inUV0);
-
- vec3 N = normalize(inNormal);
- vec3 T = normalize(q1 * st2.t - q2 * st1.t);
- vec3 B = -normalize(cross(N, T));
- mat3 TBN = mat3(T, B, N);
-
- return normalize(TBN * tangentNormal);
-}
-
-// Calculation of the lighting contribution from an optional Image Based Light source.
-// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
-// See our README.md on Environment Maps [3] for additional discussion.
-vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)
-{
- float lod = (pbrInputs.perceptualRoughness * ubo.prefilteredCubeMipLevels);
- // retrieve a scale and bias to F0. See [1], Figure 3
- vec3 brdf = (texture(samplerBRDFLUT, vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
- vec3 diffuseLight = SRGBtoLINEAR(tonemap(texture(samplerIrradiance, n))).rgb;
-
- vec3 specularLight = SRGBtoLINEAR(tonemap(textureLod(prefilteredMap, reflection, lod))).rgb;
-
- vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
- vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
-
- // For presentation, this allows us to disable IBL terms
- diffuse *= ubo.scaleIBLAmbient;
- specular *= ubo.scaleIBLAmbient;
-
- return diffuse + specular;
-}
-
-// Basic Lambertian diffuse
-// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
-// See also [1], Equation 1
-vec3 diffuse(PBRInfo pbrInputs)
-{
- return pbrInputs.diffuseColor / M_PI;
-}
-
-// The following equation models the Fresnel reflectance term of the spec equation (aka F())
-// Implementation of fresnel from [4], Equation 15
-vec3 specularReflection(PBRInfo pbrInputs)
-{
- return pbrInputs.reflectance0 + (pbrInputs.reflectance90 - pbrInputs.reflectance0) * pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
-}
-
-// This calculates the specular geometric attenuation (aka G()),
-// where rougher material will reflect less light back to the viewer.
-// This implementation is based on [1] Equation 4, and we adopt their modifications to
-// alphaRoughness as input as originally proposed in [2].
-float geometricOcclusion(PBRInfo pbrInputs)
-{
- float NdotL = pbrInputs.NdotL;
- float NdotV = pbrInputs.NdotV;
- float r = pbrInputs.alphaRoughness;
-
- float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
- float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
- return attenuationL * attenuationV;
-}
-
-// The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())
-// Implementation from "Average Irregularity Representation of a Roughened Surface for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz
-// Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.
-float microfacetDistribution(PBRInfo pbrInputs)
-{
- float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
- float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
- return roughnessSq / (M_PI * f * f);
-}
-
-// Gets metallic factor from specular glossiness workflow inputs
-float convertMetallic(vec3 diffuse, vec3 specular, float maxSpecular) {
- float perceivedDiffuse = sqrt(0.299 * diffuse.r * diffuse.r + 0.587 * diffuse.g * diffuse.g + 0.114 * diffuse.b * diffuse.b);
- float perceivedSpecular = sqrt(0.299 * specular.r * specular.r + 0.587 * specular.g * specular.g + 0.114 * specular.b * specular.b);
- if (perceivedSpecular < c_MinRoughness) {
- return 0.0;
- }
- float a = c_MinRoughness;
- float b = perceivedDiffuse * (1.0 - maxSpecular) / (1.0 - c_MinRoughness) + perceivedSpecular - 2.0 * c_MinRoughness;
- float c = c_MinRoughness - perceivedSpecular;
- float D = max(b * b - 4.0 * a * c, 0.0);
- return clamp((-b + sqrt(D)) / (2.0 * a), 0.0, 1.0);
-}
-
-void main()
-{
- float perceptualRoughness;
- float metallic;
- vec3 diffuseColor;
- vec4 baseColor;
-
- vec3 f0 = vec3(0.04);
-
- baseColor = materials[materialIdx].baseColorFactor;
-
- if (materials[materialIdx].workflow == PBR_WORKFLOW_METALLIC_ROUGHNESS) {
- perceptualRoughness = materials[materialIdx].roughnessFactor;
- metallic = materials[materialIdx].metallicFactor;
- // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
- // This layout intentionally reserves the 'r' channel for (optional) occlusion map data
- if ((materials[materialIdx].tex0 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS){
- perceptualRoughness *= texture(physicalDescriptorMap, inUV0).g;
- metallic *= texture(physicalDescriptorMap, inUV0).b;
- }else if ((materials[materialIdx].tex1 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS){
- perceptualRoughness *= texture(physicalDescriptorMap, inUV1).g;
- metallic *= texture(physicalDescriptorMap, inUV1).b;
- }
- perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
- metallic = clamp(metallic, 0.0, 1.0);
-
- // The albedo may be defined from a base texture or a flat color
- if ((materials[materialIdx].tex0 & MAP_COLOR) == MAP_COLOR)
- baseColor *= SRGBtoLINEAR(texture(colorMap, inUV0));
- else if ((materials[materialIdx].tex1 & MAP_COLOR) == MAP_COLOR)
- baseColor *= SRGBtoLINEAR(texture(colorMap, inUV1));
- }
-
- if (materials[materialIdx].alphaMask == 1.0f) {
- if (baseColor.a < materials[materialIdx].alphaMaskCutoff)
- discard;
- }
-
- if (materials[materialIdx].workflow == PBR_WORKFLOW_SPECULAR_GLOSINESS) {
- // Values from specular glossiness workflow are converted to metallic roughness
- if ((materials[materialIdx].tex0 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- perceptualRoughness = 1.0 - texture(physicalDescriptorMap, inUV0).a;
- else if ((materials[materialIdx].tex1 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- perceptualRoughness = 1.0 - texture(physicalDescriptorMap, inUV1).a;
- else
- perceptualRoughness = 0.0;
-
- const float epsilon = 1e-6;
-
- vec4 diffuse = SRGBtoLINEAR(texture(colorMap, inUV0));
- vec3 specular = SRGBtoLINEAR(texture(physicalDescriptorMap, inUV0)).rgb;
-
- float maxSpecular = max(max(specular.r, specular.g), specular.b);
-
- // Convert metallic value from specular glossiness inputs
- metallic = convertMetallic(diffuse.rgb, specular, maxSpecular);
-
- vec3 baseColorDiffusePart = diffuse.rgb * ((1.0 - maxSpecular) / (1 - c_MinRoughness) / max(1 - metallic, epsilon)) * materials[materialIdx].diffuseFactor.rgb;
- vec3 baseColorSpecularPart = specular - (vec3(c_MinRoughness) * (1 - metallic) * (1 / max(metallic, epsilon))) * materials[materialIdx].specularFactor.rgb;
- baseColor = vec4(mix(baseColorDiffusePart, baseColorSpecularPart, metallic * metallic), diffuse.a);
-
- }
-
- diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
- diffuseColor *= 1.0 - metallic;
-
- float alphaRoughness = perceptualRoughness * perceptualRoughness;
-
- vec3 specularColor = mix(f0, baseColor.rgb, metallic);
-
- // Compute reflectance.
- float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
-
- // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.
- // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.
- float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
- vec3 specularEnvironmentR0 = specularColor.rgb;
- vec3 specularEnvironmentR90 = vec3(1.0) * reflectance90;
-
- vec3 n = getNormal();
- vec3 v = normalize(ubo.camPos.xyz - inWorldPos); // Vector from surface point to camera
- vec3 l = normalize(ubo.lightDir.xyz); // Vector from surface point to light
- vec3 h = normalize(l+v); // Half vector between both l and v
- vec3 reflection = -normalize(reflect(v, n));
- reflection.y *= -1.0f;
-
- float NdotL = clamp(dot(n, l), 0.001, 1.0);
- float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
- float NdotH = clamp(dot(n, h), 0.0, 1.0);
- float LdotH = clamp(dot(l, h), 0.0, 1.0);
- float VdotH = clamp(dot(v, h), 0.0, 1.0);
-
- PBRInfo pbrInputs = PBRInfo(
- NdotL,
- NdotV,
- NdotH,
- LdotH,
- VdotH,
- perceptualRoughness,
- metallic,
- specularEnvironmentR0,
- specularEnvironmentR90,
- alphaRoughness,
- diffuseColor,
- specularColor
- );
-
- // Calculate the shading terms for the microfacet specular shading model
- vec3 F = specularReflection(pbrInputs);
- float G = geometricOcclusion(pbrInputs);
- float D = microfacetDistribution(pbrInputs);
-
- const vec3 u_LightColor = vec3(1.0);
-
- // Calculation of analytical lighting contribution
- vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
- vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
- // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
- vec3 color = NdotL * u_LightColor * (diffuseContrib + specContrib);
-
- // Calculate lighting contribution from image based lighting source (IBL)
- color += getIBLContribution(pbrInputs, n, reflection);
-
- const float u_OcclusionStrength = 1.0f;
- const float u_EmissiveFactor = 1.0f;
-
- // Apply optional PBR terms for additional (optional) shading
- if ((materials[materialIdx].tex0 & MAP_AO) == MAP_AO)
- color = mix(color, color * texture(aoMap, inUV0).r, u_OcclusionStrength);
- else if ((materials[materialIdx].tex1 & MAP_AO) == MAP_AO)
- color = mix(color, color * texture(aoMap, inUV1).r, u_OcclusionStrength);
-
- if ((materials[materialIdx].tex0 & MAP_EMISSIVE) == MAP_EMISSIVE)
- color += SRGBtoLINEAR(texture(emissiveMap, inUV0)).rgb * u_EmissiveFactor;
- else if ((materials[materialIdx].tex1 & MAP_EMISSIVE) == MAP_EMISSIVE)
- color += SRGBtoLINEAR(texture(emissiveMap, inUV1)).rgb * u_EmissiveFactor;
-
- outColor = vec4(color, baseColor.a);
-#if DEBUG
- // Shader inputs debug visualization
- if (ubo.debugViewInputs > 0.0) {
- int index = int(ubo.debugViewInputs);
- switch (index) {
- case 1:
- if ((materials[materialIdx].tex0 & MAP_COLOR) == MAP_COLOR)
- outColor.rgba = texture(colorMap, inUV0);
- else if ((materials[materialIdx].tex1 & MAP_COLOR) == MAP_COLOR)
- outColor.rgba = texture(colorMap, inUV1);
- else
- outColor.rgba = vec4(1.0f);
- break;
- case 2:
- if ((materials[materialIdx].tex0 & MAP_NORMAL) == MAP_NORMAL)
- outColor.rgb = texture(normalMap, inUV0).rgb;
- else if ((materials[materialIdx].tex1 & MAP_NORMAL) == MAP_NORMAL)
- outColor.rgb = texture(normalMap, inUV1).rgb;
- else
- outColor.rgb = normalize(inNormal);
- break;
- case 3:
- if ((materials[materialIdx].tex0 & MAP_AO) == MAP_AO)
- outColor.rgb = texture(aoMap, inUV0).rrr;
- else if ((materials[materialIdx].tex1 & MAP_AO) == MAP_AO)
- outColor.rgb = texture(aoMap, inUV1).rrr;
- else
- outColor.rgb = vec3(0);
- break;
- case 4:
- if ((materials[materialIdx].tex0 & MAP_EMISSIVE) == MAP_EMISSIVE)
- outColor.rgb = texture(emissiveMap, inUV0).rgb;
- else if ((materials[materialIdx].tex1 & MAP_EMISSIVE) == MAP_EMISSIVE)
- outColor.rgb = texture(emissiveMap, inUV1).rgb;
- else
- outColor.rgb = vec3(0);
- break;
- case 5:
- if ((materials[materialIdx].tex0 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- outColor.rgb = texture(physicalDescriptorMap, inUV0).bbb;
- else if ((materials[materialIdx].tex1 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- outColor.rgb = texture(physicalDescriptorMap, inUV1).bbb;
- else
- outColor.rgb = vec3(0);
- break;
- case 6:
- if ((materials[materialIdx].tex0 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- outColor.rgb = texture(physicalDescriptorMap, inUV0).ggg;
- else if ((materials[materialIdx].tex1 & MAP_METALROUGHNESS) == MAP_METALROUGHNESS)
- outColor.rgb = texture(physicalDescriptorMap, inUV1).ggg;
- else
- outColor.rgb = vec3(0);
- break;
- }
- outColor = SRGBtoLINEAR(outColor);
- }
-
- // PBR equation debug visualization
- // "none", "Diff (l,n)", "F (l,h)", "G (l,v,h)", "D (h)", "Specular"
- if (ubo.debugViewEquation > 0.0) {
- int index = int(ubo.debugViewEquation);
- switch (index) {
- case 1:
- outColor.rgb = diffuseContrib;
- break;
- case 2:
- outColor.rgb = F;
- break;
- case 3:
- outColor.rgb = vec3(G);
- break;
- case 4:
- outColor.rgb = vec3(D);
- break;
- case 5:
- outColor.rgb = specContrib;
- break;
- }
- }
-#endif
-}
diff --git a/samples/pbr/shaders/prefilterenvmap.frag b/samples/pbr/shaders/prefilterenvmap.frag
deleted file mode 100644
index ae1212e..0000000
--- a/samples/pbr/shaders/prefilterenvmap.frag
+++ /dev/null
@@ -1,105 +0,0 @@
-#version 450
-
-layout (location = 0) in vec3 inPos;
-layout (location = 0) out vec4 outColor;
-
-layout (binding = 0) uniform samplerCube samplerEnv;
-
-layout(push_constant) uniform PushConsts {
- layout (offset = 64) float roughness;
- layout (offset = 68) uint numSamples;
-} consts;
-
-const float PI = 3.1415926536;
-
-// Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
-float random(vec2 co)
-{
- float a = 12.9898;
- float b = 78.233;
- float c = 43758.5453;
- float dt= dot(co.xy ,vec2(a,b));
- float sn= mod(dt,3.14);
- return fract(sin(sn) * c);
-}
-
-vec2 hammersley2d(uint i, uint N)
-{
- // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
- uint bits = (i << 16u) | (i >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- float rdi = float(bits) * 2.3283064365386963e-10;
- return vec2(float(i) /float(N), rdi);
-}
-
-// Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf
-vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal)
-{
- // Maps a 2D point to a hemisphere with spread based on roughness
- float alpha = roughness * roughness;
- float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1;
- float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y));
- float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
- vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
-
- // Tangent space
- vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangentX = normalize(cross(up, normal));
- vec3 tangentY = normalize(cross(normal, tangentX));
-
- // Convert to world Space
- return normalize(tangentX * H.x + tangentY * H.y + normal * H.z);
-}
-
-// Normal Distribution function
-float D_GGX(float dotNH, float roughness)
-{
- float alpha = roughness * roughness;
- float alpha2 = alpha * alpha;
- float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0;
- return (alpha2)/(PI * denom*denom);
-}
-
-vec3 prefilterEnvMap(vec3 R, float roughness)
-{
- vec3 N = R;
- vec3 V = R;
- vec3 color = vec3(0.0);
- float totalWeight = 0.0;
- float envMapDim = float(textureSize(samplerEnv, 0).s);
- for(uint i = 0u; i < consts.numSamples; i++) {
- vec2 Xi = hammersley2d(i, consts.numSamples);
- vec3 H = importanceSample_GGX(Xi, roughness, N);
- vec3 L = 2.0 * dot(V, H) * H - V;
- float dotNL = clamp(dot(N, L), 0.0, 1.0);
- if(dotNL > 0.0) {
- // Filtering based on https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/
-
- float dotNH = clamp(dot(N, H), 0.0, 1.0);
- float dotVH = clamp(dot(V, H), 0.0, 1.0);
-
- // Probability Distribution Function
- float pdf = D_GGX(dotNH, roughness) * dotNH / (4.0 * dotVH) + 0.0001;
- // Slid angle of current smple
- float omegaS = 1.0 / (float(consts.numSamples) * pdf);
- // Solid angle of 1 pixel across all cube faces
- float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim);
- // Biased (+1.0) mip level for better result
- float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f);
- color += textureLod(samplerEnv, L, mipLevel).rgb * dotNL;
- totalWeight += dotNL;
-
- }
- }
- return (color / totalWeight);
-}
-
-
-void main()
-{
- vec3 N = normalize(inPos);
- outColor = vec4(prefilterEnvMap(N, consts.roughness), 1.0);
-}
diff --git a/samples/pbr/shaders/simpletexture.frag b/samples/pbr/shaders/simpletexture.frag
deleted file mode 100644
index d5bcf79..0000000
--- a/samples/pbr/shaders/simpletexture.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (set = 0, binding = 5) uniform sampler2D samplerColor;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = texture(samplerColor, inUV);
-}
diff --git a/samples/pbr/shaders/skybox.frag b/samples/pbr/shaders/skybox.frag
deleted file mode 100644
index 57a7dbe..0000000
--- a/samples/pbr/shaders/skybox.frag
+++ /dev/null
@@ -1,60 +0,0 @@
-#version 450
-
-layout (binding = 2) uniform samplerCube samplerEnv;
-
-layout (set = 0, location = 0) in vec3 inUVW;
-
-layout (set = 0, location = 0) out vec4 outColor;
-
-layout (set = 0, binding = 0) uniform UBO {
- mat4 projection;
- mat4 model;
- mat4 view;
- vec3 camPos;
- vec4 lightDir;
- float exposure;
- float gamma;
-} ubo;
-
-// From http://filmicworlds.com/blog/filmic-tonemapping-operators/
-vec3 Uncharted2Tonemap(vec3 color)
-{
- float A = 0.15;
- float B = 0.50;
- float C = 0.10;
- float D = 0.20;
- float E = 0.02;
- float F = 0.30;
- float W = 11.2;
- return ((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F;
-}
-
-vec4 tonemap(vec4 color)
-{
- vec3 outcol = Uncharted2Tonemap(color.rgb * ubo.exposure);
- outcol = outcol * (1.0f / Uncharted2Tonemap(vec3(11.2f)));
- return vec4(pow(outcol, vec3(1.0f / ubo.gamma)), color.a);
-}
-
-#define MANUAL_SRGB 1
-
-vec4 SRGBtoLINEAR(vec4 srgbIn)
-{
- #ifdef MANUAL_SRGB
- #ifdef SRGB_FAST_APPROXIMATION
- vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
- #else //SRGB_FAST_APPROXIMATION
- vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
- vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
- #endif //SRGB_FAST_APPROXIMATION
- return vec4(linOut,srgbIn.w);;
- #else //MANUAL_SRGB
- return srgbIn;
- #endif //MANUAL_SRGB
-}
-
-void main()
-{
- vec3 color = SRGBtoLINEAR(tonemap(textureLod(samplerEnv, inUVW, 1.5))).rgb;
- outColor = vec4(color * 1.0, 1.0);
-} \ No newline at end of file
diff --git a/samples/pbr/shaders/skybox.vert b/samples/pbr/shaders/skybox.vert
deleted file mode 100644
index 22e285e..0000000
--- a/samples/pbr/shaders/skybox.vert
+++ /dev/null
@@ -1,27 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projection;
- mat4 model;
- mat4 view;
-} ubo;
-
-layout (location = 0) out vec3 outUVW;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-void main()
-{
- outUVW = inPos;
- outUVW.y = -outUVW.y;
- gl_Position = ubo.projection * mat4(mat3(ubo.view)) * vec4(inPos, 1.0);
-}
diff --git a/samples/pbr/ui/fps.crow b/samples/pbr/ui/fps.crow
deleted file mode 100755
index 351f059..0000000
--- a/samples/pbr/ui/fps.crow
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<VerticalStack Left="10" Top="100" Width="30%" Height="Fit" Spacing="2" Background="0.3,0.3,0.3,0.9" Margin="20">
- <HorizontalStack Height="Fit">
- <Label Text="Fps:" Width="80" Background="SteelBlue"/>
- <Label Text="{fps}" />
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Text="Gamma:" Width="80" Background="SteelBlue"/>
- <Slider Height="20" Value="{²Gamma}" Maximum="10.0" SmallIncrement="0.1" LargeIncrement="1.0"/>
- <Label Text="{Gamma}" Width="40" TextAlignment="Right"/>
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Text="Exposure:" Width="80" Background="SteelBlue"/>
- <Slider Height="20" Value="{²Exposure}" Maximum="10.0" SmallIncrement="0.1" LargeIncrement="1.0"/>
- <Label Text="{Exposure}" Width="40" TextAlignment="Right"/>
- </HorizontalStack>
-<!-- <ComboBox Data="{cubemapPathes}"/>-->
-</VerticalStack>
-<!--<Window Caption="Showcase" Height="30%" Width="20%" Top="10" Left="10">-->
-<!--</Window>-->
-<!--<Label Text="{fps}" Background="SteelBlue" Margin="0" Font="mono,20"/>-->
-
diff --git a/samples/tests/Program.cs b/samples/tests/Program.cs
deleted file mode 100644
index f05fdbd..0000000
--- a/samples/tests/Program.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
- *
- * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
- *
- * port of the 'High dynamic range rendering' sample from
- * Copyright by Sascha Willems - www.saschawillems.de
- * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-*/
-
-using System;
-using CVKL;
-using VK;
-using static VK.Vk;
-
-namespace tests {
- class Program : VkWindow {
- static void Main (string[] args) {
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
-
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- DebugReport dbgReport;
- Image img;
-
- Program () : base () {
- dbgReport = new DebugReport (instance,
- VkDebugReportFlagsEXT.DebugEXT |
- VkDebugReportFlagsEXT.ErrorEXT |
- VkDebugReportFlagsEXT.WarningEXT |
- VkDebugReportFlagsEXT.PerformanceWarningEXT |
- VkDebugReportFlagsEXT.InformationEXT);
- }
-
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dbgReport?.Dispose ();
- }
- }
- base.Dispose ();
- }
- }
-}
diff --git a/samples/tests/shaders/main.vert b/samples/tests/shaders/main.vert
deleted file mode 100644
index 3b395bf..0000000
--- a/samples/tests/shaders/main.vert
+++ /dev/null
@@ -1,28 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (location = 0) in vec3 inPos;
-layout (location = 1) in vec3 inColor;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projectionMatrix;
- mat4 viewMatrix;
- mat4 modelMatrix;
-} ubo;
-
-layout (location = 0) out vec3 outColor;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-
-void main()
-{
- outColor = inColor;
- gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos.xyz, 1.0);
-}
diff --git a/samples/tests/tests.csproj b/samples/tests/tests.csproj
deleted file mode 100644
index f4c1c6b..0000000
--- a/samples/tests/tests.csproj
+++ /dev/null
@@ -1,6 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="$(RootDirectory)netfx.props" />
- <ItemGroup>
- <Folder Include="shaders\" />
- </ItemGroup>
-</Project>
diff --git a/samples/vkvg_tests/main.cs b/samples/vkvg_tests/main.cs
deleted file mode 100644
index 361e781..0000000
--- a/samples/vkvg_tests/main.cs
+++ /dev/null
@@ -1,303 +0,0 @@
-using System;
-using System.IO;
-using System.Threading;
-using CVKL;
-using VK;
-
-namespace vkvg_test {
- class Program : VkWindow {
- static void Main (string[] args) {
-#if DEBUG
- Instance.VALIDATION = true;
- Instance.DEBUG_UTILS = true;
- Instance.RENDER_DOC_CAPTURE = false;
-#endif
- using (Program vke = new Program ()) {
- vke.Run ();
- }
- }
-
- DescriptorPool descriptorPool;
- DescriptorSetLayout descLayout;
- DescriptorSet dsVkvg;
-
- GraphicPipeline uiPipeline;
- Framebuffer[] frameBuffers;
-
- #region vkvg tests
- vkvg.Device vkvgDev;
- vkvg.Surface vkvgSurf;
- Image vkvgImage;
-
- void clearAndClip (vkvg.Context ctx) {
- ctx.ClipPreserve ();
- ctx.Operator = vkvg.Operator.Clear;
- ctx.Fill ();
- ctx.Operator = vkvg.Operator.Over;
- }
- void vkvgDraw () {
- using (vkvg.Context ctx = new vkvg.Context (vkvgSurf)) {
- ctx.SetSource (1.0, 1.0, 1.0);
- ctx.Paint ();
- ctx.Translate (100, 100);
- ctx.Scale (3, 3);
- ctx.SetSource (0.1, 0.1, 0.1);
- ctx.Arc (100, 100, 10.0, 0, Math.PI * 2.0);
- ctx.LineWidth = 1.0;
- ctx.Stroke ();
- }
-
- }
- //void vkvgDrawSVG () {
- // using (vkvg.Surface svgSurf = new vkvg.Surface (vkvgDev, 300, 300)) {
- // using (vkvg.Context ctx = new vkvg.Context (svgSurf)) {
- // IntPtr nsvg = IntPtr.Zero;
-
- // using (Stream nsvgStream = Crow.Interface.StaticGetStreamFromPath ("../../../samples/data/tiger.svg")) {
- // using (StreamReader sr = new StreamReader (nsvgStream)) {
- // nsvg = vkvgDev.LoadSvgFragment (sr.ReadToEnd ());
- // }
- // }
-
-
- // ctx.SetSource (0.8f, 0.8f, 0.8f);
- // ctx.Paint ();
-
- // ctx.Scale (0.2f, 0.2f);
- // ctx.RenderSvg (nsvg, null);
-
- // vkvgDev.DestroySvg (nsvg);
- // }
-
- // //svgSurf.WriteToPng ("/mnt/data/test.png");
-
- // using (vkvg.Context ctx = new vkvg.Context (vkvgSurf)) {
- // ctx.SetSourceSurface (svgSurf, 0, 0);
- // ctx.Paint ();
- // }
- // }
- //}
- #region fps print
- void vkvgDraw1 () {
-
- using (vkvg.Context ctx = new vkvg.Context (vkvgSurf)) {
- //ctx.SetSource (1.0, 0.1, 0.1, 0.2);
- //ctx.Paint ();
-
- //ctx.Rectangle (50, 50, 200, 200);
- //ctx.Rectangle (50, 50, 250, 250);
- //clearAndClip (ctx);
- ////ctx.Rectangle (60, 60, 200, 200);
- ////clearAndClip (ctx);
-
- //ctx.LineWidth = 1;
- //ctx.SetSource (1.0, 0.1, 0.1, 0.2);
- //ctx.Rectangle (5.5, 5.5, 400, 250);
- //ctx.FillPreserve ();
- //ctx.Flush ();
- ctx.SetSource (0.8, 0.8, 0.8);
- //ctx.Stroke ();
-
- ctx.FontFace = "mono";
- ctx.FontSize = 8;
- int x = 10;
- int y = 10, dy = 14;
- for (int j = 0; j < 10; j++) {
-
- for (int i = 0; i < 50; i++) {
- ctx.Save ();
- string text = string.Format ($"fps: {fps,5}");
- vkvg.TextExtents te = ctx.TextExtents (text);
- vkvg.FontExtents fe = ctx.FontExtents;
-
- ctx.Rectangle (x, y, te.XAdvance + 1.0f, fe.Height);
- clearAndClip (ctx);
- ctx.SetSource (0.1, 0.2, 0.8);
- ctx.Fill ();
- ctx.SetSource (0.8, 0.8, 0.8);
- ctx.MoveTo (x, (float)y+fe.Ascent);
- ctx.ShowText (text);
- y += dy;
- ctx.Restore ();
- }
- ctx.Flush ();
- x += 100;
- y = 10;
-
- }
-
- }
- }
- #endregion
-
- #endregion
-
- bool recreateSurfaceStatus = true;
-
- void recreateSurface () {
- vkvgImage?.Dispose ();
- vkvgSurf?.Dispose ();
- vkvgSurf = new vkvg.Surface (vkvgDev, (int)swapChain.Width, (int)swapChain.Height);
- vkvgSurf.Clear ();
- vkvgImage = new Image (dev, new VkImage ((ulong)vkvgSurf.VkImage.ToInt64 ()), VkFormat.B8g8r8a8Unorm,
- VkImageUsageFlags.ColorAttachment, (uint)vkvgSurf.Width, (uint)vkvgSurf.Height);
- vkvgImage.CreateView (VkImageViewType.ImageView2D, VkImageAspectFlags.Color);
- vkvgImage.CreateSampler (VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder);
- recreateSurfaceStatus = false;
- }
-
- void uiThreadFunc () {
- vkvgDev = new vkvg.Device (instance.Handle, phy.Handle, dev.Handle, presentQueue.qFamIndex,
- vkvg.SampleCount.Sample_8, presentQueue.index);
-
- while (true) {
- if (recreateSurfaceStatus == true)
- recreateSurface ();
- lock (Qmutex) {
- vkvgDraw ();
- }
- Thread.Sleep (10);
- }
- }
-
- Program () : base () {
- Thread uiThread = new Thread (uiThreadFunc);
- uiThread.IsBackground = true;
- uiThread.Start ();
-
- init ();
-
- UpdateFrequency = 5;
- }
- object Qmutex = new object ();
-
- protected override void render () {
- int idx = swapChain.GetNextImage ();
- if (idx < 0) {
- OnResize ();
- return;
- }
-
- lock (Qmutex) {
- presentQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx]);
- presentQueue.Present (swapChain, drawComplete[idx]);
-
- presentQueue.WaitIdle ();
- }
- }
-
- void init (VkSampleCountFlags samples = VkSampleCountFlags.SampleCount4) {
- descriptorPool = new DescriptorPool (dev, 2,
- new VkDescriptorPoolSize (VkDescriptorType.CombinedImageSampler)
- );
-
- descLayout = new DescriptorSetLayout (dev,
- new VkDescriptorSetLayoutBinding (0, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler)
- );
-
- GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault (VkPrimitiveTopology.TriangleList, samples);
-
- cfg.Layout = new PipelineLayout (dev, descLayout);
- cfg.RenderPass = new RenderPass (dev, swapChain.ColorFormat, dev.GetSuitableDepthFormat (), samples);
-
- cfg.ResetShadersAndVerticesInfos ();
- cfg.AddShader (VkShaderStageFlags.Vertex, "#vkvg_tests.FullScreenQuad.vert.spv");
- cfg.AddShader (VkShaderStageFlags.Fragment, "#vkvg_tests.simpletexture.frag.spv");
-
- cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState (true);
-
- uiPipeline = new GraphicPipeline (cfg);
-
- dsVkvg = descriptorPool.Allocate (descLayout);
- }
-
- void buildCommandBuffers () {
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- cmds[i]?.Free ();
-
- cmds[i] = cmdPool.AllocateCommandBuffer ();
- cmds[i].Start ();
-
- recordDraw (cmds[i], frameBuffers[i]);
- cmds[i].End ();
- }
- }
- void recordDraw (CommandBuffer cmd, Framebuffer fb) {
-
- uiPipeline.RenderPass.Begin (cmd, fb);
-
- cmd.SetViewport (fb.Width, fb.Height);
- cmd.SetScissor (fb.Width, fb.Height);
-
- uiPipeline.Bind (cmd);
- cmd.BindDescriptorSet (uiPipeline.Layout, dsVkvg);
-
- vkvgImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ColorAttachmentOptimal, VkImageLayout.ShaderReadOnlyOptimal,
- VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.FragmentShader);
-
- cmd.Draw (3, 1, 0, 0);
-
- vkvgImage.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ShaderReadOnlyOptimal, VkImageLayout.ColorAttachmentOptimal,
- VkPipelineStageFlags.FragmentShader, VkPipelineStageFlags.BottomOfPipe);
-
-
- uiPipeline.RenderPass.End (cmd);
- }
-
- public override void Update () {
-
- }
- protected override void OnResize () {
- dev.WaitIdle ();
- recreateSurfaceStatus = true;
- while (recreateSurfaceStatus)
- Thread.Sleep (1);
-
- vkvgImage.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
- DescriptorSetWrites uboUpdate = new DescriptorSetWrites (dsVkvg, descLayout);
- uboUpdate.Write (dev, vkvgImage.Descriptor);
-
- if (frameBuffers!=null)
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- frameBuffers = new Framebuffer[swapChain.ImageCount];
-
- for (int i = 0; i < swapChain.ImageCount; ++i) {
- frameBuffers[i] = new Framebuffer (uiPipeline.RenderPass, swapChain.Width, swapChain.Height,
- (uiPipeline.Samples == VkSampleCountFlags.SampleCount1) ? new Image[] {
- swapChain.images[i],
- null
- } : new Image[] {
- null,
- null,
- swapChain.images[i]
- });
- frameBuffers[i].SetName ("main FB " + i);
-
- }
-
- buildCommandBuffers ();
- }
-
- protected override void Dispose (bool disposing) {
- if (disposing) {
- if (!isDisposed) {
- dev.WaitIdle ();
- for (int i = 0; i < swapChain.ImageCount; ++i)
- frameBuffers[i]?.Dispose ();
-
- uiPipeline.Dispose ();
-
- descLayout.Dispose ();
- descriptorPool.Dispose ();
- vkvgImage?.Dispose ();
- vkvgSurf?.Dispose ();
- vkvgDev.Dispose ();
- }
- }
-
- base.Dispose (disposing);
- }
- }
-}
diff --git a/samples/vkvg_tests/shaders/FullScreenQuad.vert b/samples/vkvg_tests/shaders/FullScreenQuad.vert
deleted file mode 100644
index 826720b..0000000
--- a/samples/vkvg_tests/shaders/FullScreenQuad.vert
+++ /dev/null
@@ -1,10 +0,0 @@
-#version 450
-
-layout (location = 0) out vec2 outUV;
-
-void main()
-{
- outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
- gl_Position = vec4(outUV * 2.0f + -1.0f, 0.0f, 1.0f);
- //gl_Position = vec4(outUV -1.0f, 0.0f, 1.0f);
-}
diff --git a/samples/vkvg_tests/shaders/simpletexture.frag b/samples/vkvg_tests/shaders/simpletexture.frag
deleted file mode 100644
index 792e208..0000000
--- a/samples/vkvg_tests/shaders/simpletexture.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 450
-
-#extension GL_ARB_separate_shader_objects : enable
-#extension GL_ARB_shading_language_420pack : enable
-
-layout (set = 0, binding = 0) uniform sampler2D samplerColor;
-
-layout (location = 0) in vec2 inUV;
-
-layout (location = 0) out vec4 outFragColor;
-
-void main()
-{
- outFragColor = texture(samplerColor, inUV);
-}
diff --git a/samples/vkvg_tests/vkvg_tests.csproj b/samples/vkvg_tests/vkvg_tests.csproj
deleted file mode 100644
index b7830aa..0000000
--- a/samples/vkvg_tests/vkvg_tests.csproj
+++ /dev/null
@@ -1,46 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="../../netfx.props" />
- <PropertyGroup>
- <TargetFrameworks>net471;netstandard2.0</TargetFrameworks>
- <OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
- <OutputType>Exe</OutputType>
- <RepositoryUrl>https://github.com/jpbruyere/vk.net</RepositoryUrl>
- <License>https://opensource.org/licenses/MIT</License>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <EnableDefaultCompileItems>true</EnableDefaultCompileItems>
- <EnableDefaultNoneItems>false</EnableDefaultNoneItems>
- </PropertyGroup>
-
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DefineConstants>_WITH_VKVG;TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DefineConstants>_WITH_VKVG</DefineConstants>
- </PropertyGroup>
-
- <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
- <Reference Include="System" />
- </ItemGroup>
-
- <ItemGroup>
- <PackageReference Include="Vulkan" Version="0.1.3" />
- <PackageReference Include="vkvg.net" Version="0.2.2-beta" />
- </ItemGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\..\vke\CVKL.csproj" />
- </ItemGroup>
-
- <ItemGroup>
- <GLSLShader Include="shaders\**\*.frag;shaders\**\*.vert;shaders\**\*.comp;shaders\**\*.geom" />
- <Datas Include="..\data\**\*.*">
- <Link>data\%(RecursiveDir)%(Filename)%(Extension)</Link>
- </Datas>
-
- <EmbeddedResource Include="ui\**\*.*">
- <LogicalName>deferred.%(Filename)%(Extension)</LogicalName>
- </EmbeddedResource>
- </ItemGroup>
-
- <Import Project="$(SolutionDir)spirv.targets" />
-</Project>
diff --git a/vk.net.sln b/vk.net.sln
index 1ed5788..1bbc545 100644
--- a/vk.net.sln
+++ b/vk.net.sln
@@ -1,54 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{A2A2849A-0032-4AA8-BC0E-82C69D7DE354}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CVKL", "CVKL\CVKL.csproj", "{9E12DFE6-7DC7-4BF2-8077-42DDC69FD0A1}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpirVTasks", "SpirVTasks\SpirVTasks.csproj", "{F72F73E4-86CC-4F56-B004-BCC4BF0AF30B}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vk.generator", "vk.generator\vk.generator.csproj", "{B105512C-9461-4802-B299-A6E7A29CDAEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vk.rewrite", "vk.rewrite\vk.rewrite.csproj", "{5EC0F6C6-74C9-4509-8AC8-FAE3574AF5C7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vulkan", "VK\vulkan.csproj", "{37D01BE5-5FE2-4742-BD5B-5D2C25FCF146}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CVKL.Addons", "CVKL.Addons", "{95E6BE33-0082-4E01-B064-864B411FD6B8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gltfLoader", "CVKL.Addons\gltfLoader\gltfLoader.csproj", "{39E7BD7A-0489-4681-ACBD-6CEE13C6C9C2}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DistanceFieldFontTest", "samples\DistanceFieldFontTest\DistanceFieldFontTest.csproj", "{76A29B9E-D119-4592-BB01-DBC3C17F6068}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "deferred", "samples\deferred\deferred.csproj", "{2DBE8CDD-E1E7-4930-B925-6C60E6C5C84D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DistanceFieldFont", "CVKL.Addons\DistanceFieldFont\DistanceFieldFont.csproj", "{85BDCBF2-4918-4F74-9FF1-DFEA8514A573}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Triangle", "samples\Triangle\Triangle.csproj", "{72CA1818-AF80-497D-AD9B-C67C1A0CA913}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pbr", "samples\pbr\pbr.csproj", "{08BDBB06-4B30-4B4D-A6AD-170563328F72}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TexturedCube", "samples\TexturedCube\TexturedCube.csproj", "{A5F8810A-622A-4137-B779-8A34E4C7BDDC}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "samples\Model\Model.csproj", "{2B8B9356-982A-4CAC-9AE3-69DD49890FEF}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VkvgPipeline", "CVKL.Addons\VkvgPipeline\VkvgPipeline.csproj", "{58A3D415-B90A-4C54-B28F-F66E2F5E77E3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Textured", "samples\Textured\Textured.csproj", "{D0E725A8-116C-4DED-A656-1C254AAFA953}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lines", "samples\Lines\Lines.csproj", "{164FF123-89B2-4546-8261-97D4867CE47B}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sponza", "samples\sponza\sponza.csproj", "{A5DFED73-F5CE-4D08-B5CB-3B64CCD46526}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvironmentPipeline", "CVKL.Addons\EnvironmentPipeline\EnvironmentPipeline.csproj", "{6EDDA888-7F40-4265-B50B-742BD0494807}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "datas", "samples\datas\datas.csproj", "{0819E729-64D0-4D96-B7A7-FFDE86639977}"
-EndProject
-Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "compute", "samples\compute\compute.csproj", "{C6BA22CF-826F-460D-8AD7-3D272B0ABFF7}"
-EndProject
-Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "tests", "samples\tests\tests.csproj", "{5631BE86-EF1B-458D-B53B-1A897D4FBF76}"
-EndProject
-Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "vkvg_tests", "samples\vkvg_tests\vkvg_tests.csproj", "{4090A954-C6FE-4DE7-8F9E-E09CC7C7CAF9}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -57,164 +15,20 @@ Global
BuildPackages|Any CPU = BuildPackages|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9E12DFE6-7DC7-4BF2-8077-42DDC69FD0A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9E12DFE6-7DC7-4BF2-8077-42DDC69FD0A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9E12DFE6-7DC7-4BF2-8077-42DDC69FD0A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9E12DFE6-7DC7-4BF2-8077-42DDC69FD0A1}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {9E12DFE6-7DC7-4BF2-8077-42DDC69FD0A1}.DebugCrow|Any CPU.Build.0 = Debug|Any CPU
- {9E12DFE6-7DC7-4BF2-8077-42DDC69FD0A1}.Release|Any CPU.Build.0 = Release|Any CPU
- {9E12DFE6-7DC7-4BF2-8077-42DDC69FD0A1}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {9E12DFE6-7DC7-4BF2-8077-42DDC69FD0A1}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
- {F72F73E4-86CC-4F56-B004-BCC4BF0AF30B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F72F73E4-86CC-4F56-B004-BCC4BF0AF30B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F72F73E4-86CC-4F56-B004-BCC4BF0AF30B}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {F72F73E4-86CC-4F56-B004-BCC4BF0AF30B}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {F72F73E4-86CC-4F56-B004-BCC4BF0AF30B}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
{B105512C-9461-4802-B299-A6E7A29CDAEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B105512C-9461-4802-B299-A6E7A29CDAEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B105512C-9461-4802-B299-A6E7A29CDAEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B105512C-9461-4802-B299-A6E7A29CDAEE}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {B105512C-9461-4802-B299-A6E7A29CDAEE}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {B105512C-9461-4802-B299-A6E7A29CDAEE}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
+ {B105512C-9461-4802-B299-A6E7A29CDAEE}.Release|Any CPU.Build.0 = Release|Any CPU
{5EC0F6C6-74C9-4509-8AC8-FAE3574AF5C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EC0F6C6-74C9-4509-8AC8-FAE3574AF5C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EC0F6C6-74C9-4509-8AC8-FAE3574AF5C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5EC0F6C6-74C9-4509-8AC8-FAE3574AF5C7}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {5EC0F6C6-74C9-4509-8AC8-FAE3574AF5C7}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {5EC0F6C6-74C9-4509-8AC8-FAE3574AF5C7}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
+ {5EC0F6C6-74C9-4509-8AC8-FAE3574AF5C7}.Release|Any CPU.Build.0 = Release|Any CPU
{37D01BE5-5FE2-4742-BD5B-5D2C25FCF146}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37D01BE5-5FE2-4742-BD5B-5D2C25FCF146}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37D01BE5-5FE2-4742-BD5B-5D2C25FCF146}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {37D01BE5-5FE2-4742-BD5B-5D2C25FCF146}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {37D01BE5-5FE2-4742-BD5B-5D2C25FCF146}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {37D01BE5-5FE2-4742-BD5B-5D2C25FCF146}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
- {39E7BD7A-0489-4681-ACBD-6CEE13C6C9C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {39E7BD7A-0489-4681-ACBD-6CEE13C6C9C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {39E7BD7A-0489-4681-ACBD-6CEE13C6C9C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {39E7BD7A-0489-4681-ACBD-6CEE13C6C9C2}.Release|Any CPU.Build.0 = Release|Any CPU
- {39E7BD7A-0489-4681-ACBD-6CEE13C6C9C2}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {39E7BD7A-0489-4681-ACBD-6CEE13C6C9C2}.DebugCrow|Any CPU.Build.0 = Debug|Any CPU
- {39E7BD7A-0489-4681-ACBD-6CEE13C6C9C2}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {76A29B9E-D119-4592-BB01-DBC3C17F6068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {76A29B9E-D119-4592-BB01-DBC3C17F6068}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {76A29B9E-D119-4592-BB01-DBC3C17F6068}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {76A29B9E-D119-4592-BB01-DBC3C17F6068}.Release|Any CPU.Build.0 = Release|Any CPU
- {76A29B9E-D119-4592-BB01-DBC3C17F6068}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {76A29B9E-D119-4592-BB01-DBC3C17F6068}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {2DBE8CDD-E1E7-4930-B925-6C60E6C5C84D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2DBE8CDD-E1E7-4930-B925-6C60E6C5C84D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2DBE8CDD-E1E7-4930-B925-6C60E6C5C84D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2DBE8CDD-E1E7-4930-B925-6C60E6C5C84D}.Release|Any CPU.Build.0 = Release|Any CPU
- {2DBE8CDD-E1E7-4930-B925-6C60E6C5C84D}.DebugCrow|Any CPU.ActiveCfg = DebugCrow|Any CPU
- {2DBE8CDD-E1E7-4930-B925-6C60E6C5C84D}.DebugCrow|Any CPU.Build.0 = DebugCrow|Any CPU
- {2DBE8CDD-E1E7-4930-B925-6C60E6C5C84D}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {85BDCBF2-4918-4F74-9FF1-DFEA8514A573}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {85BDCBF2-4918-4F74-9FF1-DFEA8514A573}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {85BDCBF2-4918-4F74-9FF1-DFEA8514A573}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {85BDCBF2-4918-4F74-9FF1-DFEA8514A573}.Release|Any CPU.Build.0 = Release|Any CPU
- {85BDCBF2-4918-4F74-9FF1-DFEA8514A573}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {85BDCBF2-4918-4F74-9FF1-DFEA8514A573}.DebugCrow|Any CPU.Build.0 = Debug|Any CPU
- {85BDCBF2-4918-4F74-9FF1-DFEA8514A573}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {85BDCBF2-4918-4F74-9FF1-DFEA8514A573}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
- {72CA1818-AF80-497D-AD9B-C67C1A0CA913}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {72CA1818-AF80-497D-AD9B-C67C1A0CA913}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {72CA1818-AF80-497D-AD9B-C67C1A0CA913}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {72CA1818-AF80-497D-AD9B-C67C1A0CA913}.Release|Any CPU.Build.0 = Release|Any CPU
- {72CA1818-AF80-497D-AD9B-C67C1A0CA913}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {72CA1818-AF80-497D-AD9B-C67C1A0CA913}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {08BDBB06-4B30-4B4D-A6AD-170563328F72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {08BDBB06-4B30-4B4D-A6AD-170563328F72}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {08BDBB06-4B30-4B4D-A6AD-170563328F72}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {08BDBB06-4B30-4B4D-A6AD-170563328F72}.Release|Any CPU.Build.0 = Release|Any CPU
- {08BDBB06-4B30-4B4D-A6AD-170563328F72}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {08BDBB06-4B30-4B4D-A6AD-170563328F72}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {A5F8810A-622A-4137-B779-8A34E4C7BDDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A5F8810A-622A-4137-B779-8A34E4C7BDDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A5F8810A-622A-4137-B779-8A34E4C7BDDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A5F8810A-622A-4137-B779-8A34E4C7BDDC}.Release|Any CPU.Build.0 = Release|Any CPU
- {A5F8810A-622A-4137-B779-8A34E4C7BDDC}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {A5F8810A-622A-4137-B779-8A34E4C7BDDC}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {2B8B9356-982A-4CAC-9AE3-69DD49890FEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2B8B9356-982A-4CAC-9AE3-69DD49890FEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2B8B9356-982A-4CAC-9AE3-69DD49890FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2B8B9356-982A-4CAC-9AE3-69DD49890FEF}.Release|Any CPU.Build.0 = Release|Any CPU
- {2B8B9356-982A-4CAC-9AE3-69DD49890FEF}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {2B8B9356-982A-4CAC-9AE3-69DD49890FEF}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {58A3D415-B90A-4C54-B28F-F66E2F5E77E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {58A3D415-B90A-4C54-B28F-F66E2F5E77E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {58A3D415-B90A-4C54-B28F-F66E2F5E77E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {58A3D415-B90A-4C54-B28F-F66E2F5E77E3}.Release|Any CPU.Build.0 = Release|Any CPU
- {58A3D415-B90A-4C54-B28F-F66E2F5E77E3}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {58A3D415-B90A-4C54-B28F-F66E2F5E77E3}.DebugCrow|Any CPU.Build.0 = Debug|Any CPU
- {58A3D415-B90A-4C54-B28F-F66E2F5E77E3}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {58A3D415-B90A-4C54-B28F-F66E2F5E77E3}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
- {D0E725A8-116C-4DED-A656-1C254AAFA953}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D0E725A8-116C-4DED-A656-1C254AAFA953}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D0E725A8-116C-4DED-A656-1C254AAFA953}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D0E725A8-116C-4DED-A656-1C254AAFA953}.Release|Any CPU.Build.0 = Release|Any CPU
- {D0E725A8-116C-4DED-A656-1C254AAFA953}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {D0E725A8-116C-4DED-A656-1C254AAFA953}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {164FF123-89B2-4546-8261-97D4867CE47B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {164FF123-89B2-4546-8261-97D4867CE47B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {164FF123-89B2-4546-8261-97D4867CE47B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {164FF123-89B2-4546-8261-97D4867CE47B}.Release|Any CPU.Build.0 = Release|Any CPU
- {164FF123-89B2-4546-8261-97D4867CE47B}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {164FF123-89B2-4546-8261-97D4867CE47B}.DebugCrow|Any CPU.Build.0 = Debug|Any CPU
- {164FF123-89B2-4546-8261-97D4867CE47B}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {A5DFED73-F5CE-4D08-B5CB-3B64CCD46526}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A5DFED73-F5CE-4D08-B5CB-3B64CCD46526}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A5DFED73-F5CE-4D08-B5CB-3B64CCD46526}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A5DFED73-F5CE-4D08-B5CB-3B64CCD46526}.Release|Any CPU.Build.0 = Release|Any CPU
- {A5DFED73-F5CE-4D08-B5CB-3B64CCD46526}.DebugCrow|Any CPU.ActiveCfg = DebugCrow|Any CPU
- {A5DFED73-F5CE-4D08-B5CB-3B64CCD46526}.DebugCrow|Any CPU.Build.0 = DebugCrow|Any CPU
- {A5DFED73-F5CE-4D08-B5CB-3B64CCD46526}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {6EDDA888-7F40-4265-B50B-742BD0494807}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6EDDA888-7F40-4265-B50B-742BD0494807}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6EDDA888-7F40-4265-B50B-742BD0494807}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6EDDA888-7F40-4265-B50B-742BD0494807}.Release|Any CPU.Build.0 = Release|Any CPU
- {6EDDA888-7F40-4265-B50B-742BD0494807}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {6EDDA888-7F40-4265-B50B-742BD0494807}.DebugCrow|Any CPU.Build.0 = Debug|Any CPU
- {6EDDA888-7F40-4265-B50B-742BD0494807}.BuildPackages|Any CPU.ActiveCfg = Release|Any CPU
- {6EDDA888-7F40-4265-B50B-742BD0494807}.BuildPackages|Any CPU.Build.0 = Release|Any CPU
- {0819E729-64D0-4D96-B7A7-FFDE86639977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0819E729-64D0-4D96-B7A7-FFDE86639977}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0819E729-64D0-4D96-B7A7-FFDE86639977}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0819E729-64D0-4D96-B7A7-FFDE86639977}.Release|Any CPU.Build.0 = Release|Any CPU
- {C6BA22CF-826F-460D-8AD7-3D272B0ABFF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C6BA22CF-826F-460D-8AD7-3D272B0ABFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C6BA22CF-826F-460D-8AD7-3D272B0ABFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C6BA22CF-826F-460D-8AD7-3D272B0ABFF7}.Release|Any CPU.Build.0 = Release|Any CPU
- {C6BA22CF-826F-460D-8AD7-3D272B0ABFF7}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {C6BA22CF-826F-460D-8AD7-3D272B0ABFF7}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {5631BE86-EF1B-458D-B53B-1A897D4FBF76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5631BE86-EF1B-458D-B53B-1A897D4FBF76}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5631BE86-EF1B-458D-B53B-1A897D4FBF76}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5631BE86-EF1B-458D-B53B-1A897D4FBF76}.Release|Any CPU.Build.0 = Release|Any CPU
- {5631BE86-EF1B-458D-B53B-1A897D4FBF76}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {5631BE86-EF1B-458D-B53B-1A897D4FBF76}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
- {4090A954-C6FE-4DE7-8F9E-E09CC7C7CAF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4090A954-C6FE-4DE7-8F9E-E09CC7C7CAF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4090A954-C6FE-4DE7-8F9E-E09CC7C7CAF9}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {4090A954-C6FE-4DE7-8F9E-E09CC7C7CAF9}.BuildPackages|Any CPU.ActiveCfg = Debug|Any CPU
+ {37D01BE5-5FE2-4742-BD5B-5D2C25FCF146}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {39E7BD7A-0489-4681-ACBD-6CEE13C6C9C2} = {95E6BE33-0082-4E01-B064-864B411FD6B8}
- {76A29B9E-D119-4592-BB01-DBC3C17F6068} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {2DBE8CDD-E1E7-4930-B925-6C60E6C5C84D} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {85BDCBF2-4918-4F74-9FF1-DFEA8514A573} = {95E6BE33-0082-4E01-B064-864B411FD6B8}
- {72CA1818-AF80-497D-AD9B-C67C1A0CA913} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {08BDBB06-4B30-4B4D-A6AD-170563328F72} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {A5F8810A-622A-4137-B779-8A34E4C7BDDC} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {2B8B9356-982A-4CAC-9AE3-69DD49890FEF} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {58A3D415-B90A-4C54-B28F-F66E2F5E77E3} = {95E6BE33-0082-4E01-B064-864B411FD6B8}
- {D0E725A8-116C-4DED-A656-1C254AAFA953} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {164FF123-89B2-4546-8261-97D4867CE47B} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {A5DFED73-F5CE-4D08-B5CB-3B64CCD46526} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {6EDDA888-7F40-4265-B50B-742BD0494807} = {95E6BE33-0082-4E01-B064-864B411FD6B8}
- {0819E729-64D0-4D96-B7A7-FFDE86639977} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {C6BA22CF-826F-460D-8AD7-3D272B0ABFF7} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {5631BE86-EF1B-458D-B53B-1A897D4FBF76} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {4090A954-C6FE-4DE7-8F9E-E09CC7C7CAF9} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0