Browse Source

Compute Shader Working in Progress ( Currently Crashed at the layout sampler)

Heedong Arkiny Lee 4 years ago
parent
commit
a0879a5495

+ 10
- 0
Samples.sln View File

@@ -11,6 +11,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Texture", "Samples\Texture\
11 11
 EndProject
12 12
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mesh", "Samples\Mesh\Mesh.vcxproj", "{B26FBAF5-AD65-4E87-B0B3-5D7FA63C9228}"
13 13
 EndProject
14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ComputeShader", "Samples\ComputeShader\ComputeShader.vcxproj", "{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}"
15
+EndProject
14 16
 Global
15 17
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 18
 		Debug|x64 = Debug|x64
@@ -51,6 +53,14 @@ Global
51 53
 		{B26FBAF5-AD65-4E87-B0B3-5D7FA63C9228}.Release|x64.Build.0 = Release|x64
52 54
 		{B26FBAF5-AD65-4E87-B0B3-5D7FA63C9228}.Release|x86.ActiveCfg = Release|Win32
53 55
 		{B26FBAF5-AD65-4E87-B0B3-5D7FA63C9228}.Release|x86.Build.0 = Release|Win32
56
+		{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}.Debug|x64.ActiveCfg = Debug|x64
57
+		{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}.Debug|x64.Build.0 = Debug|x64
58
+		{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}.Debug|x86.ActiveCfg = Debug|Win32
59
+		{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}.Debug|x86.Build.0 = Debug|Win32
60
+		{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}.Release|x64.ActiveCfg = Release|x64
61
+		{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}.Release|x64.Build.0 = Release|x64
62
+		{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}.Release|x86.ActiveCfg = Release|Win32
63
+		{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}.Release|x86.Build.0 = Release|Win32
54 64
 	EndGlobalSection
55 65
 	GlobalSection(SolutionProperties) = preSolution
56 66
 		HideSolutionNode = FALSE

+ 13
- 0
Samples/Common/util.h View File

@@ -270,3 +270,16 @@ void PrintPipelineReflection(const DKPipelineReflection* reflection, DKLogCatego
270 270
     }
271 271
     DKLog(c, "=========================================================");
272 272
 }
273
+
274
+class GPUGeometry
275
+{
276
+protected:
277
+    DKObject<DKGpuBuffer> indexBuffer;
278
+    DKObject<DKGpuBuffer> vertexBuffer;
279
+    DKVertexDescriptor vertexDesc;
280
+public:
281
+    virtual void InitializeGpuResource(DKCommandQueue* queue) = 0;
282
+    virtual DKGpuBuffer* VertexBuffer()  final  { return vertexBuffer; }
283
+    virtual DKGpuBuffer* IndexBuffer()  final { return indexBuffer; }
284
+    virtual const DKVertexDescriptor& VertexDescriptor() const final { return vertexDesc; }
285
+};

+ 577
- 0
Samples/ComputeShader/ComputeShader.cpp View File

@@ -0,0 +1,577 @@
1
+#include <cstddef>
2
+#include "app.h"
3
+#include "util.h"
4
+
5
+class UVQuad : public GPUGeometry
6
+{
7
+private:
8
+    struct Vertex
9
+    {
10
+        DKVector3 Pos;
11
+        DKVector2 UV;
12
+    };
13
+
14
+    DKArray<UVQuad::Vertex> vertices =
15
+    {
16
+        { { 1.0f, 1.0f, 0.0f }, { 1.0f, 1.0f } },
17
+        { { -1.0f, 1.0f, 0.0f }, { 0.0f, 1.0f } },
18
+        { { -1.0f, -1.0f, 0.0f }, { 0.0f, 0.0f } },
19
+        { { 1.0f, -1.0f, 0.0f }, { 1.0f, 0.0f } }
20
+    };
21
+
22
+    DKArray<uint32_t> indices = { 0,1,2,2,3,0 };
23
+
24
+public:
25
+    UVQuad() = default;
26
+    
27
+    size_t VerticesCount() const { return vertices.Count(); }
28
+    size_t IndicesCount() const { return indices.Count(); }
29
+    UVQuad::Vertex* VerticesData() { return vertices; }
30
+    uint32_t* IndicesData() { return indices; }
31
+
32
+    void InitializeGpuResource(DKCommandQueue* queue)
33
+    {
34
+        DKGraphicsDevice* device = queue->Device();
35
+        uint32_t vertexBufferSize = static_cast<uint32_t>(VerticesCount()) * sizeof(UVQuad::Vertex);
36
+        uint32_t indexBufferSize = IndicesCount() * sizeof(uint32_t);
37
+
38
+        vertexBuffer = device->CreateBuffer(vertexBufferSize, DKGpuBuffer::StorageModeShared, DKCpuCacheModeReadWrite);
39
+        memcpy(vertexBuffer->Contents(), VerticesData(), vertexBufferSize);
40
+        vertexBuffer->Flush();
41
+
42
+        indexBuffer = device->CreateBuffer(indexBufferSize, DKGpuBuffer::StorageModeShared, DKCpuCacheModeReadWrite);
43
+        memcpy(indexBuffer->Contents(), IndicesData(), indexBufferSize);
44
+        indexBuffer->Flush();
45
+
46
+        // setup vertex buffer and attributes
47
+        vertexDesc.attributes = {
48
+            { DKVertexFormat::Float3, offsetof(UVQuad::Vertex, Pos), 0, 0 },
49
+            { DKVertexFormat::Float2, offsetof(UVQuad::Vertex, UV), 0, 2 },
50
+        };
51
+        vertexDesc.layouts = {
52
+            { DKVertexStepRate::Vertex, sizeof(UVQuad::Vertex), 0 },
53
+        };
54
+    }
55
+};
56
+
57
+class TextureComputeTarget
58
+{
59
+private:
60
+    DKObject<DKTexture> textureTarget = nullptr;
61
+
62
+public:
63
+    TextureComputeTarget() = default;
64
+
65
+    DKTexture* ComputeTarget(DKCommandQueue* queue, int w, int h)
66
+    {
67
+        auto device = queue->Device();
68
+
69
+        if (textureTarget)
70
+        {
71
+            if (textureTarget->Width() != w ||
72
+                textureTarget->Height() != h)
73
+                textureTarget = nullptr;
74
+        }
75
+
76
+        if (textureTarget == nullptr)
77
+        {
78
+            // create depth buffer
79
+            DKTextureDescriptor texDesc = {};
80
+            texDesc.textureType = DKTexture::Type2D;
81
+            texDesc.pixelFormat = DKPixelFormat::BGRA8Unorm;
82
+            texDesc.width = w;
83
+            texDesc.height = h;
84
+            texDesc.depth = 1;
85
+            texDesc.mipmapLevels = 1;
86
+            texDesc.sampleCount = 1;
87
+            texDesc.arrayLength = 1;
88
+            texDesc.usage = DKTexture::UsageShaderRead | DKTexture::UsageShaderWrite;
89
+            textureTarget = device->CreateTexture(texDesc);
90
+        }
91
+
92
+        return textureTarget;
93
+    }
94
+};
95
+
96
+class GPUShader
97
+{
98
+private:
99
+    DKObject<DKData> shaderData = nullptr;
100
+    DKObject<DKShaderModule> shaderModule = nullptr;
101
+    DKObject<DKShaderFunction> shaderFunc = nullptr;
102
+public:
103
+    GPUShader(DKData* data) : shaderData(data)
104
+    {
105
+    }
106
+
107
+    void InitializeGpuResource(DKCommandQueue* queue)
108
+    {
109
+        if (shaderData)
110
+        {
111
+            DKGraphicsDevice* device = queue->Device();
112
+            DKShader shader(shaderData);
113
+            shaderModule = device->CreateShaderModule(&shader);
114
+            shaderFunc = shaderModule->CreateFunction(shaderModule->FunctionNames().Value(0));
115
+        }
116
+    }
117
+
118
+    DKShaderFunction* Function() { return shaderFunc; }
119
+};
120
+
121
+class GraphicShaderBindingSet
122
+{
123
+public:
124
+    struct UBO
125
+    {
126
+        DKMatrix4 projectionMatrix;
127
+        DKMatrix4 modelMatrix;
128
+        DKMatrix4 viewMatrix;
129
+    };
130
+private:
131
+    DKShaderBindingSetLayout descriptorSetLayout;
132
+    DKObject<DKShaderBindingSet> descriptorSetPreCompute;
133
+    DKObject<DKShaderBindingSet> descriptorSetPostCompute;
134
+    DKObject<DKRenderPipelineState> pipelineState;
135
+    DKObject<DKGpuBuffer> uniformBuffer;
136
+    UBO* ubo = nullptr;
137
+public:
138
+    GraphicShaderBindingSet() = default;
139
+    DKShaderBindingSet* PrecomputeDescSet() { return descriptorSetPreCompute; }
140
+    DKShaderBindingSet* PostcomputeDescSet() { return descriptorSetPostCompute; }
141
+    DKRenderPipelineState* GraphicPipelineState() { return pipelineState; }
142
+
143
+    void InitializeGpuResource(DKGraphicsDevice* device)
144
+    {
145
+        if (1)
146
+        {
147
+            DKShaderBinding bindings[2] = {
148
+                {
149
+                    0,
150
+                    DKShader::DescriptorTypeUniformBuffer,
151
+                    1,
152
+                    nullptr
153
+                },
154
+                {
155
+                    1,
156
+                    DKShader::DescriptorTypeTextureSampler,
157
+                    1,
158
+                    nullptr
159
+                },
160
+            };
161
+            descriptorSetLayout.bindings.Add(bindings, 2);
162
+        }
163
+
164
+        descriptorSetPreCompute = device->CreateShaderBindingSet(descriptorSetLayout);
165
+        descriptorSetPostCompute = device->CreateShaderBindingSet(descriptorSetLayout);
166
+
167
+        uniformBuffer = device->CreateBuffer(sizeof(GraphicShaderBindingSet::UBO), DKGpuBuffer::StorageModeShared, DKCpuCacheModeReadWrite);
168
+        
169
+        if (descriptorSetPreCompute)
170
+        {
171
+            if (uniformBuffer)
172
+            {
173
+                ubo = reinterpret_cast<UBO*>(uniformBuffer->Contents());
174
+                ubo->projectionMatrix = DKMatrix4::identity;
175
+                ubo->modelMatrix = DKMatrix4::identity;
176
+                ubo->viewMatrix = DKMatrix4::identity;
177
+                uniformBuffer->Flush();
178
+
179
+                descriptorSetPreCompute->SetBuffer(0, uniformBuffer, 0, sizeof(UBO));
180
+            }
181
+        }
182
+
183
+        if (descriptorSetPostCompute)
184
+        {
185
+            if (uniformBuffer && ubo)
186
+            {
187
+                descriptorSetPostCompute->SetBuffer(0, uniformBuffer, 0, sizeof(UBO));
188
+            }
189
+        }
190
+
191
+
192
+
193
+
194
+        //descriptorSetPreCompute->SetTexture(1, texture);
195
+        //descriptorSetPreCompute->SetSamplerState(1, sampler);
196
+    }
197
+
198
+    DKGpuBuffer* UniformBuffer() { return uniformBuffer; }
199
+    UBO* UniformBufferO() { return ubo; }
200
+};
201
+
202
+class MeshDemo : public SampleApp
203
+{
204
+    DKObject<DKWindow> window;
205
+	DKObject<DKThread> renderThread;
206
+	DKAtomicNumber32 runningRenderThread;
207
+
208
+    //Resource
209
+	DKObject<UVQuad> Quad;
210
+    DKObject<DKTexture> textureColorMap;
211
+
212
+    DKObject<TextureComputeTarget> ComputeTarget;
213
+    DKObject<DKSamplerState> sampleState = nullptr;;
214
+
215
+    DKObject<GraphicShaderBindingSet> graphicShaderBindingSet = nullptr;
216
+
217
+public:
218
+	DKObject<DKTexture> LoadTexture2D(DKCommandQueue* queue, DKData* data)
219
+    {
220
+        DKObject<DKImage> image = DKImage::Create(data);
221
+        if (image)
222
+        {
223
+            DKGraphicsDevice* device = queue->Device();
224
+            DKTextureDescriptor texDesc = {};
225
+            texDesc.textureType = DKTexture::Type2D;
226
+            texDesc.pixelFormat = DKPixelFormat::RGBA8Unorm;
227
+            texDesc.width = image->Width();
228
+            texDesc.height = image->Height();
229
+            texDesc.depth = 1;
230
+            texDesc.mipmapLevels = 1;
231
+            texDesc.sampleCount = 1;
232
+            texDesc.arrayLength = 1;
233
+            texDesc.usage = DKTexture::UsageCopyDestination | DKTexture::UsageSampled;
234
+            DKObject<DKTexture> tex = device->CreateTexture(texDesc);
235
+            if (tex)
236
+            {
237
+                size_t bytesPerPixel = image->BytesPerPixel();
238
+                DKASSERT_DESC(bytesPerPixel == DKPixelFormatBytesPerPixel(texDesc.pixelFormat), "BytesPerPixel mismatch!");
239
+
240
+                uint32_t width = image->Width();
241
+                uint32_t height = image->Height();
242
+
243
+                size_t bufferLength = bytesPerPixel * width * height;
244
+                DKObject<DKGpuBuffer> stagingBuffer = device->CreateBuffer(bufferLength, DKGpuBuffer::StorageModeShared, DKCpuCacheModeReadWrite);
245
+                
246
+                memcpy(stagingBuffer->Contents(), image->Contents(), bufferLength);
247
+                stagingBuffer->Flush();
248
+
249
+                DKObject<DKCommandBuffer> cb = queue->CreateCommandBuffer();
250
+                DKObject<DKCopyCommandEncoder> encoder = cb->CreateCopyCommandEncoder();
251
+                encoder->CopyFromBufferToTexture(stagingBuffer,
252
+                                                 { 0, width, height },
253
+                                                 tex,
254
+                                                 { 0,0, 0,0,0 },
255
+                                                 { width,height,1 });
256
+                encoder->EndEncoding();
257
+                cb->Commit();
258
+
259
+                DKLog("Texture created!");
260
+                return tex;
261
+            }
262
+        }
263
+        return nullptr;
264
+    }
265
+
266
+
267
+
268
+    void RenderThread(void)
269
+    {
270
+        // Device and Queue Preperation
271
+        DKObject<DKGraphicsDevice> device = DKGraphicsDevice::SharedInstance();
272
+        DKObject<DKCommandQueue> graphicsQueue = device->CreateCommandQueue(DKCommandQueue::Graphics);
273
+        DKObject<DKCommandQueue> computeQueue = device->CreateCommandQueue(DKCommandQueue::Compute);
274
+
275
+        // create shaders
276
+		DKObject<DKData> vertData = resourcePool.LoadResourceData("shaders/ComputeShader/texture.vert.spv");
277
+		DKObject<DKData> fragData = resourcePool.LoadResourceData("shaders/ComputeShader/texture.frag.spv");
278
+        DKObject<DKData> embossData = resourcePool.LoadResourceData("shaders/ComputeShader/emboss.comp.spv");
279
+        DKObject<DKData> edgedetectData = resourcePool.LoadResourceData("shaders/ComputeShader/edgedetect.comp.spv");
280
+        DKObject<DKData> sharpenData = resourcePool.LoadResourceData("shaders/ComputeShader/sharpen.comp.spv");
281
+
282
+
283
+        DKObject<GPUShader> VS = DKOBJECT_NEW GPUShader(vertData);
284
+        DKObject<GPUShader> FS = DKOBJECT_NEW GPUShader(fragData);
285
+
286
+        DKObject<GPUShader> CS_E = DKOBJECT_NEW GPUShader(embossData);
287
+        DKObject<GPUShader> CS_ED = DKOBJECT_NEW GPUShader(edgedetectData);
288
+        DKObject<GPUShader> CS_SH = DKOBJECT_NEW GPUShader(sharpenData);
289
+
290
+        VS->InitializeGpuResource(graphicsQueue);
291
+        FS->InitializeGpuResource(graphicsQueue);
292
+
293
+        CS_E->InitializeGpuResource(computeQueue);
294
+        CS_ED->InitializeGpuResource(computeQueue);
295
+        CS_SH->InitializeGpuResource(computeQueue);
296
+
297
+        auto VSF = VS->Function();
298
+        auto FSF = FS->Function();
299
+        auto CS_EF = CS_E->Function();
300
+        auto CS_EDF = CS_ED->Function();
301
+        auto CS_SHF = CS_SH->Function();
302
+
303
+        // Geometry Initialzie
304
+        Quad->InitializeGpuResource(graphicsQueue);
305
+
306
+        // Texture Resource Initialize
307
+        
308
+        ComputeTarget = DKOBJECT_NEW TextureComputeTarget();
309
+        
310
+        DKSamplerDescriptor computeSamplerDesc = {};
311
+        computeSamplerDesc.magFilter = DKSamplerDescriptor::MinMagFilterLinear;
312
+        computeSamplerDesc.minFilter = DKSamplerDescriptor::MinMagFilterLinear;
313
+        computeSamplerDesc.mipFilter = DKSamplerDescriptor::MipFilterLinear;
314
+        computeSamplerDesc.addressModeU = DKSamplerDescriptor::AddressModeClampToEdge;
315
+        computeSamplerDesc.addressModeV = DKSamplerDescriptor::AddressModeClampToEdge;
316
+        computeSamplerDesc.addressModeW = DKSamplerDescriptor::AddressModeClampToEdge;
317
+        computeSamplerDesc.maxAnisotropy = 1.0f;
318
+        computeSamplerDesc.compareFunction = DKCompareFunctionNever;
319
+        DKObject<DKSamplerState> computeSampler = device->CreateSamplerState(computeSamplerDesc);
320
+
321
+
322
+		// create texture
323
+		DKObject<DKTexture> texture = LoadTexture2D(graphicsQueue, resourcePool.LoadResourceData("textures/deathstar3.png"));
324
+		
325
+        // create sampler
326
+		DKSamplerDescriptor samplerDesc = {};
327
+		samplerDesc.magFilter = DKSamplerDescriptor::MinMagFilterLinear;
328
+		samplerDesc.minFilter = DKSamplerDescriptor::MinMagFilterLinear;
329
+		samplerDesc.addressModeU = DKSamplerDescriptor::AddressModeClampToEdge;
330
+		samplerDesc.addressModeV = DKSamplerDescriptor::AddressModeClampToEdge;
331
+		samplerDesc.addressModeW = DKSamplerDescriptor::AddressModeClampToEdge;
332
+		samplerDesc.maxAnisotropy = 1;
333
+        DKObject<DKSamplerState> sampler = device->CreateSamplerState(samplerDesc);
334
+
335
+		
336
+		DKObject<DKSwapChain> swapChain = graphicsQueue->CreateSwapChain(window);
337
+
338
+		DKLog("VertexFunction.VertexAttributes: %d", VSF->StageInputAttributes().Count());
339
+		for (int i = 0; i < VSF->StageInputAttributes().Count(); ++i)
340
+		{
341
+			const DKShaderAttribute& attr = VSF->StageInputAttributes().Value(i);
342
+			DKLog("  --> VertexAttribute[%d]: \"%ls\" (location:%u)", i, (const wchar_t*)attr.name, attr.location);
343
+		}
344
+
345
+		
346
+		DKRenderPipelineDescriptor pipelineDescriptor;
347
+        // setup shader
348
+        pipelineDescriptor.vertexFunction = VSF;
349
+		pipelineDescriptor.fragmentFunction = FSF;
350
+        
351
+        // setup color-attachment render-targets
352
+		pipelineDescriptor.colorAttachments.Resize(1);
353
+		pipelineDescriptor.colorAttachments.Value(0).pixelFormat = swapChain->ColorPixelFormat();
354
+        pipelineDescriptor.colorAttachments.Value(0).blendingEnabled = false;
355
+        pipelineDescriptor.colorAttachments.Value(0).sourceRGBBlendFactor = DKBlendFactor::SourceAlpha;
356
+        pipelineDescriptor.colorAttachments.Value(0).destinationRGBBlendFactor = DKBlendFactor::OneMinusSourceAlpha;
357
+        // setup depth-stencil
358
+		pipelineDescriptor.depthStencilAttachmentPixelFormat = DKPixelFormat::D32Float;
359
+        pipelineDescriptor.depthStencilDescriptor.depthWriteEnabled = true;
360
+        pipelineDescriptor.depthStencilDescriptor.depthCompareFunction = DKCompareFunctionLessEqual;
361
+   
362
+        // setup vertex buffer and attributes
363
+        pipelineDescriptor.vertexDescriptor = Quad->VertexDescriptor();
364
+
365
+        // setup topology and rasterization
366
+		pipelineDescriptor.primitiveTopology = DKPrimitiveType::Triangle;
367
+		pipelineDescriptor.frontFace = DKFrontFace::CCW;
368
+		pipelineDescriptor.triangleFillMode = DKTriangleFillMode::Fill;
369
+		pipelineDescriptor.depthClipMode = DKDepthClipMode::Clip;
370
+		pipelineDescriptor.cullMode = DKCullMode::Back;
371
+		pipelineDescriptor.rasterizationEnabled = true;
372
+
373
+		DKPipelineReflection reflection;
374
+		DKObject<DKRenderPipelineState> pipelineState = device->CreateRenderPipeline(pipelineDescriptor, &reflection);
375
+		if (pipelineState)
376
+		{
377
+            PrintPipelineReflection(&reflection, DKLogCategory::Verbose);
378
+		}
379
+        ///
380
+        graphicShaderBindingSet = DKOBJECT_NEW GraphicShaderBindingSet();
381
+        graphicShaderBindingSet->InitializeGpuResource(device);
382
+        auto uboBuffer = graphicShaderBindingSet->UniformBuffer();
383
+        auto ubo = graphicShaderBindingSet->UniformBufferO();
384
+
385
+        // ComputerBuffer Layout
386
+        DKShaderBindingSetLayout ComputeLayout;
387
+        if (1)
388
+        {
389
+            DKShaderBinding bindings[2] = {
390
+                {
391
+                    0,
392
+                    DKShader::DescriptorTypeStorageTexture,
393
+                    1,
394
+                    nullptr
395
+                }, // Input Image (read-only)
396
+                {
397
+                    1,
398
+                    DKShader::DescriptorTypeStorageTexture,
399
+                    1,
400
+                    nullptr
401
+                }, // Output image (write)
402
+            };
403
+            ComputeLayout.bindings.Add(bindings, 2);
404
+        }
405
+        DKObject<DKShaderBindingSet> computebindSet = device->CreateShaderBindingSet(ComputeLayout);
406
+
407
+        //auto CS_EF = CS_E->Function();
408
+        //auto CS_EDF = CS_ED->Function();
409
+        //auto CS_SHF = CS_SH->Function();
410
+
411
+        DKComputePipelineDescriptor embossComputePipelineDescriptor;
412
+        embossComputePipelineDescriptor.computeFunction = CS_EF;
413
+        auto Emboss = device->CreateComputePipeline(embossComputePipelineDescriptor);
414
+        
415
+        
416
+        DKObject<DKTexture> depthBuffer = nullptr;
417
+        DKObject<DKTexture> targettex = nullptr;
418
+
419
+        DKCamera camera;
420
+        DKVector3 cameraPosition = { 0, 5, 10 };
421
+        DKVector3 cameraTartget = { 0, 0, 0 };
422
+		
423
+        DKAffineTransform3 tm(DKLinearTransform3().Scale(5).Rotate(DKVector3(-1,0,0), DKGL_PI * 0.5));
424
+
425
+        DKTimer timer;
426
+		timer.Reset();
427
+
428
+		DKLog("Render thread begin");
429
+		while (!runningRenderThread.CompareAndSet(0, 0))
430
+		{
431
+			DKRenderPassDescriptor rpd = swapChain->CurrentRenderPassDescriptor();
432
+			double t = timer.Elapsed();
433
+			double waveT = (cos(t) + 1.0) * 0.5;
434
+			rpd.colorAttachments.Value(0).clearColor = DKColor(waveT, 0.0, 0.0, 0.0);
435
+
436
+            int width = rpd.colorAttachments.Value(0).renderTarget->Width();
437
+            int height = rpd.colorAttachments.Value(0).renderTarget->Height();
438
+            if (depthBuffer)
439
+            {
440
+                if (depthBuffer->Width() !=  width ||
441
+                    depthBuffer->Height() != height )
442
+                    depthBuffer = nullptr;
443
+            }
444
+            if (depthBuffer == nullptr)
445
+            {
446
+                // create depth buffer
447
+                DKTextureDescriptor texDesc = {};
448
+                texDesc.textureType = DKTexture::Type2D;
449
+                texDesc.pixelFormat = DKPixelFormat::D32Float;
450
+                texDesc.width = width;
451
+                texDesc.height = height;
452
+                texDesc.depth = 1;
453
+                texDesc.mipmapLevels = 1;
454
+                texDesc.sampleCount = 1;
455
+                texDesc.arrayLength = 1;
456
+                texDesc.usage = DKTexture::UsageRenderTarget;
457
+                depthBuffer = device->CreateTexture(texDesc);
458
+            }
459
+            rpd.depthStencilAttachment.renderTarget = depthBuffer;
460
+            rpd.depthStencilAttachment.loadAction = DKRenderPassAttachmentDescriptor::LoadActionClear;
461
+            rpd.depthStencilAttachment.storeAction = DKRenderPassAttachmentDescriptor::StoreActionDontCare;
462
+
463
+            targettex = ComputeTarget->ComputeTarget(computeQueue, width, height);
464
+
465
+            DKObject<DKCommandBuffer> computeCmdbuffer = computeQueue->CreateCommandBuffer();
466
+            DKObject<DKComputeCommandEncoder> computeEncoder = computeCmdbuffer->CreateComputeCommandEncoder();
467
+            if (computeEncoder)
468
+            {
469
+                if (computebindSet)
470
+                {
471
+                    computebindSet->SetTexture(0, texture);
472
+                    computebindSet->SetSamplerState(0, sampler);
473
+                    computebindSet->SetTexture(1, targettex);
474
+                    computebindSet->SetSamplerState(1, sampler);
475
+                }
476
+                computeEncoder->SetComputePipelineState(Emboss);
477
+                computeEncoder->SetResources(0, computebindSet);
478
+                computeEncoder->Dispatch(width / 16, height / 16, 1);
479
+                computeEncoder->EndEncoding();
480
+            }
481
+
482
+			DKObject<DKCommandBuffer> buffer = graphicsQueue->CreateCommandBuffer();
483
+			DKObject<DKRenderCommandEncoder> encoder = buffer->CreateRenderCommandEncoder(rpd);
484
+
485
+			if (encoder)
486
+			{
487
+                if (graphicShaderBindingSet->PostcomputeDescSet() && ubo)
488
+                {
489
+                    camera.SetView(cameraPosition, cameraTartget - cameraPosition, DKVector3(0, 1, 0));
490
+                    camera.SetPerspective(DKGL_DEGREE_TO_RADIAN(90), float(width)/float(height), 1, 1000);
491
+
492
+                    ubo->projectionMatrix = camera.ProjectionMatrix();
493
+                    ubo->viewMatrix = camera.ViewMatrix();
494
+
495
+                    DKQuaternion quat(DKVector3(0, 1, 0), t);
496
+                    DKAffineTransform3 trans = tm * DKAffineTransform3(quat);
497
+                    ubo->modelMatrix = trans.Matrix4();
498
+                    uboBuffer->Flush();
499
+                    graphicShaderBindingSet->PostcomputeDescSet()->SetBuffer(0, uboBuffer, 0, sizeof(GraphicShaderBindingSet::UBO));
500
+
501
+                    graphicShaderBindingSet->PostcomputeDescSet()->SetTexture(0, targettex);
502
+                    graphicShaderBindingSet->PostcomputeDescSet()->SetSamplerState(0, sampler);
503
+                }
504
+
505
+				encoder->SetRenderPipelineState(pipelineState);
506
+				encoder->SetVertexBuffer(Quad->VertexBuffer(), 0, 0);
507
+				encoder->SetIndexBuffer(Quad->IndexBuffer(), 0, DKIndexType::UInt32);
508
+                encoder->SetResources(0, graphicShaderBindingSet->PostcomputeDescSet());
509
+				// draw scene!
510
+				encoder->DrawIndexed(Quad->IndicesCount(), 1, 0, 0, 0);
511
+                encoder->EndEncoding();
512
+
513
+                if (computeCmdbuffer)
514
+                    computeCmdbuffer->Commit();
515
+
516
+				buffer->Commit();
517
+
518
+				swapChain->Present();
519
+			}
520
+			else
521
+			{
522
+			}
523
+			DKThread::Sleep(0.01);
524
+		}
525
+		DKLog("RenderThread terminating...");
526
+	}
527
+
528
+	void OnInitialize(void) override
529
+	{
530
+        SampleApp::OnInitialize();
531
+		DKLogD("%s", DKGL_FUNCTION_NAME);
532
+
533
+        // create window
534
+        window = DKWindow::Create("DefaultWindow");
535
+        window->SetOrigin({ 0, 0 });
536
+        window->Resize({ 320, 240 });
537
+        window->Activate();
538
+
539
+        window->AddEventHandler(this, DKFunction([this](const DKWindow::WindowEvent& e)
540
+        {
541
+            if (e.type == DKWindow::WindowEvent::WindowClosed)
542
+                DKApplication::Instance()->Terminate(0);
543
+        }), NULL, NULL);
544
+
545
+        Quad = DKOBJECT_NEW UVQuad();
546
+
547
+		runningRenderThread = 1;
548
+		renderThread = DKThread::Create(DKFunction(this, &MeshDemo::RenderThread)->Invocation());
549
+	}
550
+	void OnTerminate(void) override
551
+	{
552
+		DKLogD("%s", DKGL_FUNCTION_NAME);
553
+
554
+		runningRenderThread = 0;
555
+		renderThread->WaitTerminate();
556
+		renderThread = NULL;
557
+        window = NULL;
558
+
559
+        SampleApp::OnTerminate();
560
+	}
561
+};
562
+
563
+
564
+#ifdef _WIN32
565
+int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
566
+					  _In_opt_ HINSTANCE hPrevInstance,
567
+					  _In_ LPWSTR    lpCmdLine,
568
+					  _In_ int       nCmdShow)
569
+#else
570
+int main(int argc, const char * argv[])
571
+#endif
572
+{
573
+    MeshDemo app;
574
+	DKPropertySet::SystemConfig().SetValue("AppDelegate", "AppDelegate");
575
+	DKPropertySet::SystemConfig().SetValue("GraphicsAPI", "Vulkan");
576
+	return app.Run();
577
+}

+ 195
- 0
Samples/ComputeShader/ComputeShader.vcxproj View File

@@ -0,0 +1,195 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <ItemGroup Label="ProjectConfigurations">
4
+    <ProjectConfiguration Include="Debug|Win32">
5
+      <Configuration>Debug</Configuration>
6
+      <Platform>Win32</Platform>
7
+    </ProjectConfiguration>
8
+    <ProjectConfiguration Include="Release|Win32">
9
+      <Configuration>Release</Configuration>
10
+      <Platform>Win32</Platform>
11
+    </ProjectConfiguration>
12
+    <ProjectConfiguration Include="Debug|x64">
13
+      <Configuration>Debug</Configuration>
14
+      <Platform>x64</Platform>
15
+    </ProjectConfiguration>
16
+    <ProjectConfiguration Include="Release|x64">
17
+      <Configuration>Release</Configuration>
18
+      <Platform>x64</Platform>
19
+    </ProjectConfiguration>
20
+  </ItemGroup>
21
+  <ItemGroup>
22
+    <ClInclude Include="..\Common\app.h" />
23
+    <ClInclude Include="..\Common\util.h" />
24
+    <ClInclude Include="..\Common\Win32\Resource.h" />
25
+    <ClInclude Include="..\Common\Win32\stdafx.h" />
26
+    <ClInclude Include="..\Common\Win32\targetver.h" />
27
+  </ItemGroup>
28
+  <ItemGroup>
29
+    <Image Include="..\Common\Win32\SampleApp.ico" />
30
+    <Image Include="..\Common\Win32\small.ico" />
31
+  </ItemGroup>
32
+  <ItemGroup>
33
+    <ResourceCompile Include="..\Common\Win32\SampleApp.rc" />
34
+  </ItemGroup>
35
+  <ItemGroup>
36
+    <ClCompile Include="..\Common\dkgl_new.cpp" />
37
+    <ClCompile Include="ComputeShader.cpp" />
38
+  </ItemGroup>
39
+  <ItemGroup>
40
+    <ProjectReference Include="..\..\..\DKGL2\DK\DK_static.vcxproj">
41
+      <Project>{c7312831-a3f6-4e7d-962b-6786972f0a6a}</Project>
42
+    </ProjectReference>
43
+  </ItemGroup>
44
+  <PropertyGroup Label="Globals">
45
+    <VCProjectVersion>15.0</VCProjectVersion>
46
+    <ProjectGuid>{2EFDB5BA-86ED-4C3A-8473-9CF51719FD82}</ProjectGuid>
47
+    <Keyword>Win32Proj</Keyword>
48
+    <RootNamespace>Texture</RootNamespace>
49
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
50
+  </PropertyGroup>
51
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
52
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
53
+    <ConfigurationType>Application</ConfigurationType>
54
+    <UseDebugLibraries>true</UseDebugLibraries>
55
+    <PlatformToolset>v142</PlatformToolset>
56
+    <CharacterSet>Unicode</CharacterSet>
57
+  </PropertyGroup>
58
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
59
+    <ConfigurationType>Application</ConfigurationType>
60
+    <UseDebugLibraries>false</UseDebugLibraries>
61
+    <PlatformToolset>v142</PlatformToolset>
62
+    <WholeProgramOptimization>true</WholeProgramOptimization>
63
+    <CharacterSet>Unicode</CharacterSet>
64
+  </PropertyGroup>
65
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
66
+    <ConfigurationType>Application</ConfigurationType>
67
+    <UseDebugLibraries>true</UseDebugLibraries>
68
+    <PlatformToolset>v142</PlatformToolset>
69
+    <CharacterSet>Unicode</CharacterSet>
70
+  </PropertyGroup>
71
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
72
+    <ConfigurationType>Application</ConfigurationType>
73
+    <UseDebugLibraries>false</UseDebugLibraries>
74
+    <PlatformToolset>v142</PlatformToolset>
75
+    <WholeProgramOptimization>true</WholeProgramOptimization>
76
+    <CharacterSet>Unicode</CharacterSet>
77
+  </PropertyGroup>
78
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
79
+  <ImportGroup Label="ExtensionSettings">
80
+  </ImportGroup>
81
+  <ImportGroup Label="Shared">
82
+  </ImportGroup>
83
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
84
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
85
+    <Import Project="..\..\Samples.props" />
86
+  </ImportGroup>
87
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
88
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
89
+    <Import Project="..\..\Samples.props" />
90
+  </ImportGroup>
91
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
92
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
93
+    <Import Project="..\..\Samples.props" />
94
+  </ImportGroup>
95
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
96
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
97
+    <Import Project="..\..\Samples.props" />
98
+  </ImportGroup>
99
+  <PropertyGroup Label="UserMacros" />
100
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
101
+    <LinkIncremental>true</LinkIncremental>
102
+  </PropertyGroup>
103
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
104
+    <LinkIncremental>true</LinkIncremental>
105
+  </PropertyGroup>
106
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
107
+    <LinkIncremental>false</LinkIncremental>
108
+  </PropertyGroup>
109
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
110
+    <LinkIncremental>false</LinkIncremental>
111
+  </PropertyGroup>
112
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
113
+    <ClCompile>
114
+      <WarningLevel>Level3</WarningLevel>
115
+      <Optimization>Disabled</Optimization>
116
+      <SDLCheck>true</SDLCheck>
117
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
118
+      <ConformanceMode>true</ConformanceMode>
119
+    </ClCompile>
120
+    <Link>
121
+      <SubSystem>Windows</SubSystem>
122
+      <GenerateDebugInformation>true</GenerateDebugInformation>
123
+    </Link>
124
+    <PostBuildEvent>
125
+      <Command>echo Copying Resource Files...
126
+xcopy /Y /D /R /Q /E "$(SolutionDir)Samples\Data" "$(OutDir)Data\"
127
+</Command>
128
+    </PostBuildEvent>
129
+  </ItemDefinitionGroup>
130
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
131
+    <ClCompile>
132
+      <WarningLevel>Level3</WarningLevel>
133
+      <Optimization>Disabled</Optimization>
134
+      <SDLCheck>true</SDLCheck>
135
+      <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
136
+      <ConformanceMode>true</ConformanceMode>
137
+    </ClCompile>
138
+    <Link>
139
+      <SubSystem>Windows</SubSystem>
140
+      <GenerateDebugInformation>true</GenerateDebugInformation>
141
+    </Link>
142
+    <PostBuildEvent>
143
+      <Command>echo Copying Resource Files...
144
+xcopy /Y /D /R /Q /E "$(SolutionDir)Samples\Data" "$(OutDir)Data\"
145
+</Command>
146
+    </PostBuildEvent>
147
+  </ItemDefinitionGroup>
148
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
149
+    <ClCompile>
150
+      <WarningLevel>Level3</WarningLevel>
151
+      <Optimization>MaxSpeed</Optimization>
152
+      <FunctionLevelLinking>true</FunctionLevelLinking>
153
+      <IntrinsicFunctions>true</IntrinsicFunctions>
154
+      <SDLCheck>true</SDLCheck>
155
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
156
+      <ConformanceMode>true</ConformanceMode>
157
+    </ClCompile>
158
+    <Link>
159
+      <SubSystem>Windows</SubSystem>
160
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
161
+      <OptimizeReferences>true</OptimizeReferences>
162
+      <GenerateDebugInformation>true</GenerateDebugInformation>
163
+    </Link>
164
+    <PostBuildEvent>
165
+      <Command>echo Copying Resource Files...
166
+xcopy /Y /D /R /Q /E "$(SolutionDir)Samples\Data" "$(OutDir)Data\"
167
+</Command>
168
+    </PostBuildEvent>
169
+  </ItemDefinitionGroup>
170
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
171
+    <ClCompile>
172
+      <WarningLevel>Level3</WarningLevel>
173
+      <Optimization>MaxSpeed</Optimization>
174
+      <FunctionLevelLinking>true</FunctionLevelLinking>
175
+      <IntrinsicFunctions>true</IntrinsicFunctions>
176
+      <SDLCheck>true</SDLCheck>
177
+      <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
178
+      <ConformanceMode>true</ConformanceMode>
179
+    </ClCompile>
180
+    <Link>
181
+      <SubSystem>Windows</SubSystem>
182
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
183
+      <OptimizeReferences>true</OptimizeReferences>
184
+      <GenerateDebugInformation>true</GenerateDebugInformation>
185
+    </Link>
186
+    <PostBuildEvent>
187
+      <Command>echo Copying Resource Files...
188
+xcopy /Y /D /R /Q /E "$(SolutionDir)Samples\Data" "$(OutDir)Data\"
189
+</Command>
190
+    </PostBuildEvent>
191
+  </ItemDefinitionGroup>
192
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
193
+  <ImportGroup Label="ExtensionTargets">
194
+  </ImportGroup>
195
+</Project>

+ 52
- 0
Samples/ComputeShader/ComputeShader.vcxproj.filters View File

@@ -0,0 +1,52 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <ItemGroup>
4
+    <Filter Include="Source Files">
5
+      <UniqueIdentifier>{b5dc83ca-43a3-419d-ad59-977da7f4e408}</UniqueIdentifier>
6
+    </Filter>
7
+    <Filter Include="Common">
8
+      <UniqueIdentifier>{e5e3c3a7-54d9-4bd7-bb17-507ba17c21ff}</UniqueIdentifier>
9
+    </Filter>
10
+    <Filter Include="Common\Win32">
11
+      <UniqueIdentifier>{1e5cf7df-b5b9-4e2b-b747-f1a2d7810117}</UniqueIdentifier>
12
+    </Filter>
13
+  </ItemGroup>
14
+  <ItemGroup>
15
+    <ClInclude Include="..\Common\Win32\Resource.h">
16
+      <Filter>Common\Win32</Filter>
17
+    </ClInclude>
18
+    <ClInclude Include="..\Common\Win32\stdafx.h">
19
+      <Filter>Common\Win32</Filter>
20
+    </ClInclude>
21
+    <ClInclude Include="..\Common\Win32\targetver.h">
22
+      <Filter>Common\Win32</Filter>
23
+    </ClInclude>
24
+    <ClInclude Include="..\Common\app.h">
25
+      <Filter>Common</Filter>
26
+    </ClInclude>
27
+    <ClInclude Include="..\Common\util.h">
28
+      <Filter>Common</Filter>
29
+    </ClInclude>
30
+  </ItemGroup>
31
+  <ItemGroup>
32
+    <Image Include="..\Common\Win32\SampleApp.ico">
33
+      <Filter>Common\Win32</Filter>
34
+    </Image>
35
+    <Image Include="..\Common\Win32\small.ico">
36
+      <Filter>Common\Win32</Filter>
37
+    </Image>
38
+  </ItemGroup>
39
+  <ItemGroup>
40
+    <ResourceCompile Include="..\Common\Win32\SampleApp.rc">
41
+      <Filter>Common\Win32</Filter>
42
+    </ResourceCompile>
43
+  </ItemGroup>
44
+  <ItemGroup>
45
+    <ClCompile Include="..\Common\dkgl_new.cpp">
46
+      <Filter>Common</Filter>
47
+    </ClCompile>
48
+    <ClCompile Include="ComputeShader.cpp">
49
+      <Filter>Source Files</Filter>
50
+    </ClCompile>
51
+  </ItemGroup>
52
+</Project>

+ 587
- 0
Samples/ComputeShader/ComputeShader.xcodeproj/project.pbxproj View File

@@ -0,0 +1,587 @@
1
+// !$*UTF8*$!
2
+{
3
+	archiveVersion = 1;
4
+	classes = {
5
+	};
6
+	objectVersion = 46;
7
+	objects = {
8
+
9
+/* Begin PBXBuildFile section */
10
+		66DA89941DD3117F00338015 /* Mesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 844A9A801DD0C080007DCC89 /* Mesh.cpp */; };
11
+		66DA89971DD3118000338015 /* Mesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 844A9A801DD0C080007DCC89 /* Mesh.cpp */; };
12
+		8406D1D821E715E400E0EA0F /* libDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8406D1BF21E701FF00E0EA0F /* libDK.a */; };
13
+		8406D1F921E71C5500E0EA0F /* libDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8406D1C121E701FF00E0EA0F /* libDK.a */; };
14
+		841948EB1DDCBE6000E039F0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 841948E91DDCBE5000E039F0 /* AppDelegate.m */; };
15
+		841948EF1DDCBE7B00E039F0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 841948ED1DDCBE7500E039F0 /* AppDelegate.m */; };
16
+		8420EE201EE5BA6500A20933 /* Data in Resources */ = {isa = PBXBuildFile; fileRef = 8420EE1F1EE5BA6500A20933 /* Data */; };
17
+		8420EE211EE5BA6500A20933 /* Data in Resources */ = {isa = PBXBuildFile; fileRef = 8420EE1F1EE5BA6500A20933 /* Data */; };
18
+		844A9A851DD0C080007DCC89 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 844A9A781DD0C080007DCC89 /* Assets.xcassets */; };
19
+		844A9A8B1DD0C08F007DCC89 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 844A9A741DD0C080007DCC89 /* Assets.xcassets */; };
20
+		844A9A8D1DD0C08F007DCC89 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 844A9A761DD0C080007DCC89 /* LaunchScreen.storyboard */; };
21
+		84A81E9D226443700060BCBB /* tiny_obj_loader.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84A81E9C226443700060BCBB /* tiny_obj_loader.cc */; };
22
+		84A81E9E226443700060BCBB /* tiny_obj_loader.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84A81E9C226443700060BCBB /* tiny_obj_loader.cc */; };
23
+		84A81EAF22644A7D0060BCBB /* dkgl_new.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84B5FE4B20726C3600B52742 /* dkgl_new.cpp */; };
24
+		84A81EB222644A7E0060BCBB /* dkgl_new.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84B5FE4B20726C3600B52742 /* dkgl_new.cpp */; };
25
+/* End PBXBuildFile section */
26
+
27
+/* Begin PBXContainerItemProxy section */
28
+		8406D1BE21E701FF00E0EA0F /* PBXContainerItemProxy */ = {
29
+			isa = PBXContainerItemProxy;
30
+			containerPortal = 840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */;
31
+			proxyType = 2;
32
+			remoteGlobalIDString = 84E42A5D13AF8B4200BF31EA;
33
+			remoteInfo = DK_iOS_static;
34
+		};
35
+		8406D1C021E701FF00E0EA0F /* PBXContainerItemProxy */ = {
36
+			isa = PBXContainerItemProxy;
37
+			containerPortal = 840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */;
38
+			proxyType = 2;
39
+			remoteGlobalIDString = 84E42A5C13AF8B4200BF31EA;
40
+			remoteInfo = DK_macOS_static;
41
+		};
42
+		8406D1C221E701FF00E0EA0F /* PBXContainerItemProxy */ = {
43
+			isa = PBXContainerItemProxy;
44
+			containerPortal = 840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */;
45
+			proxyType = 2;
46
+			remoteGlobalIDString = 84798B7119E51CBA009378A6;
47
+			remoteInfo = DK_iOS;
48
+		};
49
+		8406D1C421E701FF00E0EA0F /* PBXContainerItemProxy */ = {
50
+			isa = PBXContainerItemProxy;
51
+			containerPortal = 840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */;
52
+			proxyType = 2;
53
+			remoteGlobalIDString = 840CA4ED1928946800689BB6;
54
+			remoteInfo = DK_macOS;
55
+		};
56
+		8406D1D921E715F400E0EA0F /* PBXContainerItemProxy */ = {
57
+			isa = PBXContainerItemProxy;
58
+			containerPortal = 840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */;
59
+			proxyType = 1;
60
+			remoteGlobalIDString = 84C5F9EC13013FDD005F4449;
61
+			remoteInfo = DK_iOS_static;
62
+		};
63
+		8406D1DB21E715FD00E0EA0F /* PBXContainerItemProxy */ = {
64
+			isa = PBXContainerItemProxy;
65
+			containerPortal = 840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */;
66
+			proxyType = 1;
67
+			remoteGlobalIDString = D2AAC045055464E500DB518D;
68
+			remoteInfo = DK_macOS_static;
69
+		};
70
+/* End PBXContainerItemProxy section */
71
+
72
+/* Begin PBXFileReference section */
73
+		840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "wrapper.pb-project"; name = DK.xcodeproj; path = ../../DK/DK.xcodeproj; sourceTree = "<group>"; };
74
+		841948E81DDCBE5000E039F0 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
75
+		841948E91DDCBE5000E039F0 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
76
+		841948EC1DDCBE7500E039F0 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
77
+		841948ED1DDCBE7500E039F0 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
78
+		8420EE1F1EE5BA6500A20933 /* Data */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Data; path = ../Data; sourceTree = "<group>"; };
79
+		844A9A441DD0BCFD007DCC89 /* Mesh_macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mesh_macOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
80
+		844A9A5C1DD0BEDD007DCC89 /* Mesh_iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mesh_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
81
+		844A9A741DD0C080007DCC89 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
82
+		844A9A751DD0C080007DCC89 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
83
+		844A9A761DD0C080007DCC89 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
84
+		844A9A781DD0C080007DCC89 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
85
+		844A9A791DD0C080007DCC89 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
86
+		844A9A7B1DD0C080007DCC89 /* Resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Resource.h; sourceTree = "<group>"; };
87
+		844A9A7C1DD0C080007DCC89 /* small.ico */ = {isa = PBXFileReference; lastKnownFileType = image.ico; path = small.ico; sourceTree = "<group>"; };
88
+		844A9A7D1DD0C080007DCC89 /* targetver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = targetver.h; sourceTree = "<group>"; };
89
+		844A9A7E1DD0C080007DCC89 /* SampleApp.ico */ = {isa = PBXFileReference; lastKnownFileType = image.ico; path = SampleApp.ico; sourceTree = "<group>"; };
90
+		844A9A7F1DD0C080007DCC89 /* SampleApp.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SampleApp.rc; sourceTree = "<group>"; };
91
+		844A9A801DD0C080007DCC89 /* Mesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mesh.cpp; sourceTree = "<group>"; };
92
+		84A81E9C226443700060BCBB /* tiny_obj_loader.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tiny_obj_loader.cc; path = ../Libs/tinyobjLoader/tiny_obj_loader.cc; sourceTree = "<group>"; };
93
+		84B5FE4B20726C3600B52742 /* dkgl_new.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dkgl_new.cpp; sourceTree = "<group>"; };
94
+		84B81E9021E6FF8400E0C5FF /* app.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = app.h; sourceTree = "<group>"; };
95
+		84B81E9121E6FF8400E0C5FF /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
96
+/* End PBXFileReference section */
97
+
98
+/* Begin PBXFrameworksBuildPhase section */
99
+		844A9A411DD0BCFD007DCC89 /* Frameworks */ = {
100
+			isa = PBXFrameworksBuildPhase;
101
+			buildActionMask = 2147483647;
102
+			files = (
103
+				8406D1F921E71C5500E0EA0F /* libDK.a in Frameworks */,
104
+			);
105
+			runOnlyForDeploymentPostprocessing = 0;
106
+		};
107
+		844A9A591DD0BEDD007DCC89 /* Frameworks */ = {
108
+			isa = PBXFrameworksBuildPhase;
109
+			buildActionMask = 2147483647;
110
+			files = (
111
+				8406D1D821E715E400E0EA0F /* libDK.a in Frameworks */,
112
+			);
113
+			runOnlyForDeploymentPostprocessing = 0;
114
+		};
115
+/* End PBXFrameworksBuildPhase section */
116
+
117
+/* Begin PBXGroup section */
118
+		66DA89141DD1887A00338015 /* Frameworks */ = {
119
+			isa = PBXGroup;
120
+			children = (
121
+			);
122
+			name = Frameworks;
123
+			sourceTree = "<group>";
124
+		};
125
+		8406D1B821E701FF00E0EA0F /* Products */ = {
126
+			isa = PBXGroup;
127
+			children = (
128
+				8406D1BF21E701FF00E0EA0F /* libDK.a */,
129
+				8406D1C121E701FF00E0EA0F /* libDK.a */,
130
+				8406D1C321E701FF00E0EA0F /* DK.framework */,
131
+				8406D1C521E701FF00E0EA0F /* DK.framework */,
132
+			);
133
+			name = Products;
134
+			sourceTree = "<group>";
135
+		};
136
+		844A9A3B1DD0BCFD007DCC89 = {
137
+			isa = PBXGroup;
138
+			children = (
139
+				840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */,
140
+				66DA89141DD1887A00338015 /* Frameworks */,
141
+				844A9A451DD0BCFD007DCC89 /* Products */,
142
+				84B81E8F21E6FF4700E0C5FF /* Common */,
143
+				8420EE1F1EE5BA6500A20933 /* Data */,
144
+				844A9A461DD0BCFD007DCC89 /* Source Files */,
145
+			);
146
+			sourceTree = "<group>";
147
+		};
148
+		844A9A451DD0BCFD007DCC89 /* Products */ = {
149
+			isa = PBXGroup;
150
+			children = (
151
+				844A9A441DD0BCFD007DCC89 /* Mesh_macOS.app */,
152
+				844A9A5C1DD0BEDD007DCC89 /* Mesh_iOS.app */,
153
+			);
154
+			name = Products;
155
+			sourceTree = "<group>";
156
+		};
157
+		844A9A461DD0BCFD007DCC89 /* Source Files */ = {
158
+			isa = PBXGroup;
159
+			children = (
160
+				84A81E9C226443700060BCBB /* tiny_obj_loader.cc */,
161
+				844A9A801DD0C080007DCC89 /* Mesh.cpp */,
162
+			);
163
+			name = "Source Files";
164
+			sourceTree = "<group>";
165
+		};
166
+		844A9A731DD0C080007DCC89 /* iOS */ = {
167
+			isa = PBXGroup;
168
+			children = (
169
+				841948E81DDCBE5000E039F0 /* AppDelegate.h */,
170
+				841948E91DDCBE5000E039F0 /* AppDelegate.m */,
171
+				844A9A741DD0C080007DCC89 /* Assets.xcassets */,
172
+				844A9A751DD0C080007DCC89 /* Info.plist */,
173
+				844A9A761DD0C080007DCC89 /* LaunchScreen.storyboard */,
174
+			);
175
+			path = iOS;
176
+			sourceTree = "<group>";
177
+		};
178
+		844A9A771DD0C080007DCC89 /* macOS */ = {
179
+			isa = PBXGroup;
180
+			children = (
181
+				841948EC1DDCBE7500E039F0 /* AppDelegate.h */,
182
+				841948ED1DDCBE7500E039F0 /* AppDelegate.m */,
183
+				844A9A781DD0C080007DCC89 /* Assets.xcassets */,
184
+				844A9A791DD0C080007DCC89 /* Info.plist */,
185
+			);
186
+			path = macOS;
187
+			sourceTree = "<group>";
188
+		};
189
+		844A9A7A1DD0C080007DCC89 /* Win32 */ = {
190
+			isa = PBXGroup;
191
+			children = (
192
+				844A9A7B1DD0C080007DCC89 /* Resource.h */,
193
+				844A9A7E1DD0C080007DCC89 /* SampleApp.ico */,
194
+				844A9A7F1DD0C080007DCC89 /* SampleApp.rc */,
195
+				844A9A7C1DD0C080007DCC89 /* small.ico */,
196
+				844A9A7D1DD0C080007DCC89 /* targetver.h */,
197
+			);
198
+			path = Win32;
199
+			sourceTree = "<group>";
200
+		};
201
+		84B81E8F21E6FF4700E0C5FF /* Common */ = {
202
+			isa = PBXGroup;
203
+			children = (
204
+				84B5FE4B20726C3600B52742 /* dkgl_new.cpp */,
205
+				84B81E9021E6FF8400E0C5FF /* app.h */,
206
+				84B81E9121E6FF8400E0C5FF /* util.h */,
207
+				844A9A731DD0C080007DCC89 /* iOS */,
208
+				844A9A771DD0C080007DCC89 /* macOS */,
209
+				844A9A7A1DD0C080007DCC89 /* Win32 */,
210
+			);
211
+			name = Common;
212
+			path = ../Common;
213
+			sourceTree = "<group>";
214
+		};
215
+/* End PBXGroup section */
216
+
217
+/* Begin PBXNativeTarget section */
218
+		844A9A431DD0BCFD007DCC89 /* Mesh_macOS */ = {
219
+			isa = PBXNativeTarget;
220
+			buildConfigurationList = 844A9A551DD0BCFD007DCC89 /* Build configuration list for PBXNativeTarget "Mesh_macOS" */;
221
+			buildPhases = (
222
+				844A9A401DD0BCFD007DCC89 /* Sources */,
223
+				844A9A411DD0BCFD007DCC89 /* Frameworks */,
224
+				844A9A421DD0BCFD007DCC89 /* Resources */,
225
+			);
226
+			buildRules = (
227
+			);
228
+			dependencies = (
229
+				8406D1DC21E715FD00E0EA0F /* PBXTargetDependency */,
230
+			);
231
+			name = Mesh_macOS;
232
+			productName = TestApp1;
233
+			productReference = 844A9A441DD0BCFD007DCC89 /* Mesh_macOS.app */;
234
+			productType = "com.apple.product-type.application";
235
+		};
236
+		844A9A5B1DD0BEDD007DCC89 /* Mesh_iOS */ = {
237
+			isa = PBXNativeTarget;
238
+			buildConfigurationList = 844A9A701DD0BEDD007DCC89 /* Build configuration list for PBXNativeTarget "Mesh_iOS" */;
239
+			buildPhases = (
240
+				844A9A581DD0BEDD007DCC89 /* Sources */,
241
+				844A9A591DD0BEDD007DCC89 /* Frameworks */,
242
+				844A9A5A1DD0BEDD007DCC89 /* Resources */,
243
+			);
244
+			buildRules = (
245
+			);
246
+			dependencies = (
247
+				8406D1DA21E715F400E0EA0F /* PBXTargetDependency */,
248
+			);
249
+			name = Mesh_iOS;
250
+			productName = TestApp1_iOS;
251
+			productReference = 844A9A5C1DD0BEDD007DCC89 /* Mesh_iOS.app */;
252
+			productType = "com.apple.product-type.application";
253
+		};
254
+/* End PBXNativeTarget section */
255
+
256
+/* Begin PBXProject section */
257
+		844A9A3C1DD0BCFD007DCC89 /* Project object */ = {
258
+			isa = PBXProject;
259
+			attributes = {
260
+				LastUpgradeCheck = 0810;
261
+				ORGANIZATIONNAME = icondb;
262
+				TargetAttributes = {
263
+					844A9A431DD0BCFD007DCC89 = {
264
+						CreatedOnToolsVersion = 8.1;
265
+						ProvisioningStyle = Manual;
266
+					};
267
+					844A9A5B1DD0BEDD007DCC89 = {
268
+						CreatedOnToolsVersion = 8.1;
269
+						DevelopmentTeam = F599L375TZ;
270
+						ProvisioningStyle = Automatic;
271
+					};
272
+				};
273
+			};
274
+			buildConfigurationList = 844A9A3F1DD0BCFD007DCC89 /* Build configuration list for PBXProject "Mesh" */;
275
+			compatibilityVersion = "Xcode 3.2";
276
+			developmentRegion = English;
277
+			hasScannedForEncodings = 0;
278
+			knownRegions = (
279
+				English,
280
+				en,
281
+				Base,
282
+			);
283
+			mainGroup = 844A9A3B1DD0BCFD007DCC89;
284
+			productRefGroup = 844A9A451DD0BCFD007DCC89 /* Products */;
285
+			projectDirPath = "";
286
+			projectReferences = (
287
+				{
288
+					ProductGroup = 8406D1B821E701FF00E0EA0F /* Products */;
289
+					ProjectRef = 840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */;
290
+				},
291
+			);
292
+			projectRoot = "";
293
+			targets = (
294
+				844A9A431DD0BCFD007DCC89 /* Mesh_macOS */,
295
+				844A9A5B1DD0BEDD007DCC89 /* Mesh_iOS */,
296
+			);
297
+		};
298
+/* End PBXProject section */
299
+
300
+/* Begin PBXReferenceProxy section */
301
+		8406D1BF21E701FF00E0EA0F /* libDK.a */ = {
302
+			isa = PBXReferenceProxy;
303
+			fileType = archive.ar;
304
+			path = libDK.a;
305
+			remoteRef = 8406D1BE21E701FF00E0EA0F /* PBXContainerItemProxy */;
306
+			sourceTree = BUILT_PRODUCTS_DIR;
307
+		};
308
+		8406D1C121E701FF00E0EA0F /* libDK.a */ = {
309
+			isa = PBXReferenceProxy;
310
+			fileType = archive.ar;
311
+			path = libDK.a;
312
+			remoteRef = 8406D1C021E701FF00E0EA0F /* PBXContainerItemProxy */;
313
+			sourceTree = BUILT_PRODUCTS_DIR;
314
+		};
315
+		8406D1C321E701FF00E0EA0F /* DK.framework */ = {
316
+			isa = PBXReferenceProxy;
317
+			fileType = wrapper.framework;
318
+			path = DK.framework;
319
+			remoteRef = 8406D1C221E701FF00E0EA0F /* PBXContainerItemProxy */;
320
+			sourceTree = BUILT_PRODUCTS_DIR;
321
+		};
322
+		8406D1C521E701FF00E0EA0F /* DK.framework */ = {
323
+			isa = PBXReferenceProxy;
324
+			fileType = wrapper.framework;
325
+			path = DK.framework;
326
+			remoteRef = 8406D1C421E701FF00E0EA0F /* PBXContainerItemProxy */;
327
+			sourceTree = BUILT_PRODUCTS_DIR;
328
+		};
329
+/* End PBXReferenceProxy section */
330
+
331
+/* Begin PBXResourcesBuildPhase section */
332
+		844A9A421DD0BCFD007DCC89 /* Resources */ = {
333
+			isa = PBXResourcesBuildPhase;
334
+			buildActionMask = 2147483647;
335
+			files = (
336
+				8420EE201EE5BA6500A20933 /* Data in Resources */,
337
+				844A9A851DD0C080007DCC89 /* Assets.xcassets in Resources */,
338
+			);
339
+			runOnlyForDeploymentPostprocessing = 0;
340
+		};
341
+		844A9A5A1DD0BEDD007DCC89 /* Resources */ = {
342
+			isa = PBXResourcesBuildPhase;
343
+			buildActionMask = 2147483647;
344
+			files = (
345
+				844A9A8D1DD0C08F007DCC89 /* LaunchScreen.storyboard in Resources */,
346
+				844A9A8B1DD0C08F007DCC89 /* Assets.xcassets in Resources */,
347
+				8420EE211EE5BA6500A20933 /* Data in Resources */,
348
+			);
349
+			runOnlyForDeploymentPostprocessing = 0;
350
+		};
351
+/* End PBXResourcesBuildPhase section */
352
+
353
+/* Begin PBXSourcesBuildPhase section */
354
+		844A9A401DD0BCFD007DCC89 /* Sources */ = {
355
+			isa = PBXSourcesBuildPhase;
356
+			buildActionMask = 2147483647;
357
+			files = (
358
+				84A81EAF22644A7D0060BCBB /* dkgl_new.cpp in Sources */,
359
+				841948EF1DDCBE7B00E039F0 /* AppDelegate.m in Sources */,
360
+				84A81E9D226443700060BCBB /* tiny_obj_loader.cc in Sources */,
361
+				66DA89941DD3117F00338015 /* Mesh.cpp in Sources */,
362
+			);
363
+			runOnlyForDeploymentPostprocessing = 0;
364
+		};
365
+		844A9A581DD0BEDD007DCC89 /* Sources */ = {
366
+			isa = PBXSourcesBuildPhase;
367
+			buildActionMask = 2147483647;
368
+			files = (
369
+				84A81EB222644A7E0060BCBB /* dkgl_new.cpp in Sources */,
370
+				841948EB1DDCBE6000E039F0 /* AppDelegate.m in Sources */,
371
+				84A81E9E226443700060BCBB /* tiny_obj_loader.cc in Sources */,
372
+				66DA89971DD3118000338015 /* Mesh.cpp in Sources */,
373
+			);
374
+			runOnlyForDeploymentPostprocessing = 0;
375
+		};
376
+/* End PBXSourcesBuildPhase section */
377
+
378
+/* Begin PBXTargetDependency section */
379
+		8406D1DA21E715F400E0EA0F /* PBXTargetDependency */ = {
380
+			isa = PBXTargetDependency;
381
+			name = DK_iOS_static;
382
+			targetProxy = 8406D1D921E715F400E0EA0F /* PBXContainerItemProxy */;
383
+		};
384
+		8406D1DC21E715FD00E0EA0F /* PBXTargetDependency */ = {
385
+			isa = PBXTargetDependency;
386
+			name = DK_macOS_static;
387
+			targetProxy = 8406D1DB21E715FD00E0EA0F /* PBXContainerItemProxy */;
388
+		};
389
+/* End PBXTargetDependency section */
390
+
391
+/* Begin XCBuildConfiguration section */
392
+		844A9A531DD0BCFD007DCC89 /* Debug */ = {
393
+			isa = XCBuildConfiguration;
394
+			buildSettings = {
395
+				ALWAYS_SEARCH_USER_PATHS = NO;
396
+				CLANG_ANALYZER_NONNULL = YES;
397
+				CLANG_CXX_LANGUAGE_STANDARD = "c++17";
398
+				CLANG_CXX_LIBRARY = "libc++";
399
+				CLANG_ENABLE_MODULES = YES;
400
+				CLANG_ENABLE_OBJC_ARC = YES;
401
+				CLANG_WARN_BOOL_CONVERSION = YES;
402
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
403
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
404
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
405
+				CLANG_WARN_EMPTY_BODY = YES;
406
+				CLANG_WARN_ENUM_CONVERSION = YES;
407
+				CLANG_WARN_INFINITE_RECURSION = YES;
408
+				CLANG_WARN_INT_CONVERSION = YES;
409
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
410
+				CLANG_WARN_SUSPICIOUS_MOVES = YES;
411
+				CLANG_WARN_UNREACHABLE_CODE = YES;
412
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
413
+				CODE_SIGN_IDENTITY = "";
414
+				COPY_PHASE_STRIP = NO;
415
+				DEBUG_INFORMATION_FORMAT = dwarf;
416
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
417
+				ENABLE_TESTABILITY = YES;
418
+				GCC_C_LANGUAGE_STANDARD = gnu99;
419
+				GCC_DYNAMIC_NO_PIC = NO;
420
+				GCC_NO_COMMON_BLOCKS = YES;
421
+				GCC_OPTIMIZATION_LEVEL = 0;
422
+				GCC_PREPROCESSOR_DEFINITIONS = (
423
+					DKGL_STATIC,
424
+					"DEBUG=1",
425
+					"$(inherited)",
426
+				);
427
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
428
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
429
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
430
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
431
+				GCC_WARN_UNUSED_FUNCTION = YES;
432
+				GCC_WARN_UNUSED_VARIABLE = YES;
433
+				HEADER_SEARCH_PATHS = (
434
+					../Common,
435
+					../../DK,
436
+				);
437
+				MTL_ENABLE_DEBUG_INFO = YES;
438
+				ONLY_ACTIVE_ARCH = NO;
439
+				SDKROOT = macosx;
440
+			};
441
+			name = Debug;
442
+		};
443
+		844A9A541DD0BCFD007DCC89 /* Release */ = {
444
+			isa = XCBuildConfiguration;
445
+			buildSettings = {
446
+				ALWAYS_SEARCH_USER_PATHS = NO;
447
+				CLANG_ANALYZER_NONNULL = YES;
448
+				CLANG_CXX_LANGUAGE_STANDARD = "c++17";
449
+				CLANG_CXX_LIBRARY = "libc++";
450
+				CLANG_ENABLE_MODULES = YES;
451
+				CLANG_ENABLE_OBJC_ARC = YES;
452
+				CLANG_WARN_BOOL_CONVERSION = YES;
453
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
454
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
455
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
456
+				CLANG_WARN_EMPTY_BODY = YES;
457
+				CLANG_WARN_ENUM_CONVERSION = YES;
458
+				CLANG_WARN_INFINITE_RECURSION = YES;
459
+				CLANG_WARN_INT_CONVERSION = YES;
460
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
461
+				CLANG_WARN_SUSPICIOUS_MOVES = YES;
462
+				CLANG_WARN_UNREACHABLE_CODE = YES;
463
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
464
+				CODE_SIGN_IDENTITY = "";
465
+				COPY_PHASE_STRIP = NO;
466
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
467
+				ENABLE_NS_ASSERTIONS = NO;
468
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
469
+				GCC_C_LANGUAGE_STANDARD = gnu99;
470
+				GCC_NO_COMMON_BLOCKS = YES;
471
+				GCC_PREPROCESSOR_DEFINITIONS = "DKGL_STATIC=1";
472
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
473
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
474
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
475
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
476
+				GCC_WARN_UNUSED_FUNCTION = YES;
477
+				GCC_WARN_UNUSED_VARIABLE = YES;
478
+				HEADER_SEARCH_PATHS = (
479
+					../Common,
480
+					../../DK,
481
+				);
482
+				MTL_ENABLE_DEBUG_INFO = NO;
483
+				SDKROOT = macosx;
484
+			};
485
+			name = Release;
486
+		};
487
+		844A9A561DD0BCFD007DCC89 /* Debug */ = {
488
+			isa = XCBuildConfiguration;
489
+			buildSettings = {
490
+				ARCHS = "$(ARCHS_STANDARD)";
491
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
492
+				COMBINE_HIDPI_IMAGES = YES;
493
+				INFOPLIST_FILE = "$(SRCROOT)/../Common/macOS/Info.plist";
494
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
495
+				PRODUCT_BUNDLE_IDENTIFIER = "com.palcube.triangle-macos";
496
+				PRODUCT_NAME = "$(TARGET_NAME)";
497
+				SDKROOT = macosx;
498
+			};
499
+			name = Debug;
500
+		};
501
+		844A9A571DD0BCFD007DCC89 /* Release */ = {
502
+			isa = XCBuildConfiguration;
503
+			buildSettings = {
504
+				ARCHS = "$(ARCHS_STANDARD)";
505
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
506
+				COMBINE_HIDPI_IMAGES = YES;
507
+				INFOPLIST_FILE = "$(SRCROOT)/../Common/macOS/Info.plist";
508
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
509
+				PRODUCT_BUNDLE_IDENTIFIER = "com.palcube.triangle-macos";
510
+				PRODUCT_NAME = "$(TARGET_NAME)";
511
+				SDKROOT = macosx;
512
+			};
513
+			name = Release;
514
+		};
515
+		844A9A711DD0BEDD007DCC89 /* Debug */ = {
516
+			isa = XCBuildConfiguration;
517
+			buildSettings = {
518
+				ARCHS = "$(ARCHS_STANDARD)";
519
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
520
+				CODE_SIGN_IDENTITY = "iPhone Developer";
521
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
522
+				CODE_SIGN_STYLE = Automatic;
523
+				DEVELOPMENT_TEAM = F599L375TZ;
524
+				INFOPLIST_FILE = "$(SRCROOT)/../Common/iOS/Info.plist";
525
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
526
+				PRODUCT_BUNDLE_IDENTIFIER = "com.palcube.triangle-iOS";
527
+				PRODUCT_NAME = "$(TARGET_NAME)";
528
+				PROVISIONING_PROFILE_SPECIFIER = "";
529
+				SDKROOT = iphoneos;
530
+				TARGETED_DEVICE_FAMILY = "1,2";
531
+			};
532
+			name = Debug;
533
+		};
534
+		844A9A721DD0BEDD007DCC89 /* Release */ = {
535
+			isa = XCBuildConfiguration;
536
+			buildSettings = {
537
+				ARCHS = "$(ARCHS_STANDARD)";
538
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
539
+				CODE_SIGN_IDENTITY = "iPhone Developer";
540
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
541
+				CODE_SIGN_STYLE = Automatic;
542
+				DEVELOPMENT_TEAM = F599L375TZ;
543
+				INFOPLIST_FILE = "$(SRCROOT)/../Common/iOS/Info.plist";
544
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
545
+				PRODUCT_BUNDLE_IDENTIFIER = "com.palcube.triangle-iOS";
546
+				PRODUCT_NAME = "$(TARGET_NAME)";
547
+				PROVISIONING_PROFILE_SPECIFIER = "";
548
+				SDKROOT = iphoneos;
549
+				TARGETED_DEVICE_FAMILY = "1,2";
550
+				VALIDATE_PRODUCT = YES;
551
+			};
552
+			name = Release;
553
+		};
554
+/* End XCBuildConfiguration section */
555
+
556
+/* Begin XCConfigurationList section */
557
+		844A9A3F1DD0BCFD007DCC89 /* Build configuration list for PBXProject "Mesh" */ = {
558
+			isa = XCConfigurationList;
559
+			buildConfigurations = (
560
+				844A9A531DD0BCFD007DCC89 /* Debug */,
561
+				844A9A541DD0BCFD007DCC89 /* Release */,
562
+			);
563
+			defaultConfigurationIsVisible = 0;
564
+			defaultConfigurationName = Release;
565
+		};
566
+		844A9A551DD0BCFD007DCC89 /* Build configuration list for PBXNativeTarget "Mesh_macOS" */ = {
567
+			isa = XCConfigurationList;
568
+			buildConfigurations = (
569
+				844A9A561DD0BCFD007DCC89 /* Debug */,
570
+				844A9A571DD0BCFD007DCC89 /* Release */,
571
+			);
572
+			defaultConfigurationIsVisible = 0;
573
+			defaultConfigurationName = Release;
574
+		};
575
+		844A9A701DD0BEDD007DCC89 /* Build configuration list for PBXNativeTarget "Mesh_iOS" */ = {
576
+			isa = XCConfigurationList;
577
+			buildConfigurations = (
578
+				844A9A711DD0BEDD007DCC89 /* Debug */,
579
+				844A9A721DD0BEDD007DCC89 /* Release */,
580
+			);
581
+			defaultConfigurationIsVisible = 0;
582
+			defaultConfigurationName = Release;
583
+		};
584
+/* End XCConfigurationList section */
585
+	};
586
+	rootObject = 844A9A3C1DD0BCFD007DCC89 /* Project object */;
587
+}

+ 44
- 0
Samples/Data/shaders/ComputeShader/edgedetect.comp View File

@@ -0,0 +1,44 @@
1
+#version 450
2
+
3
+layout (local_size_x = 16, local_size_y = 16) in;
4
+layout (binding = 0, rgba8) uniform readonly image2D inputImage;
5
+layout (binding = 1, rgba8) uniform image2D resultImage;
6
+
7
+float conv(in float[9] kernel, in float[9] data, in float denom, in float offset) 
8
+{
9
+   float res = 0.0;
10
+   for (int i=0; i<9; ++i) 
11
+   {
12
+      res += kernel[i] * data[i];
13
+   }
14
+   return clamp(res/denom + offset, 0.0, 1.0);
15
+}
16
+
17
+struct ImageData 
18
+{
19
+	float avg[9];
20
+} imageData;	
21
+
22
+void main()
23
+{	
24
+	// Fetch neighbouring texels
25
+	int n = -1;
26
+	for (int i=-1; i<2; ++i) 
27
+	{   
28
+		for(int j=-1; j<2; ++j) 
29
+		{    
30
+			n++;    
31
+			vec3 rgb = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.x + i, gl_GlobalInvocationID.y + j)).rgb;
32
+			imageData.avg[n] = (rgb.r + rgb.g + rgb.b) / 3.0;
33
+		}
34
+	}
35
+
36
+	float[9] kernel;
37
+	kernel[0] = -1.0/8.0; kernel[1] = -1.0/8.0; kernel[2] = -1.0/8.0;
38
+	kernel[3] = -1.0/8.0; kernel[4] =  1.0;     kernel[5] = -1.0/8.0;
39
+	kernel[6] = -1.0/8.0; kernel[7] = -1.0/8.0; kernel[8] = -1.0/8.0;
40
+									
41
+	vec4 res = vec4(vec3(conv(kernel, imageData.avg, 0.1, 0.0)), 1.0);
42
+
43
+	imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), res);
44
+}

BIN
Samples/Data/shaders/ComputeShader/edgedetect.comp.spv View File


+ 44
- 0
Samples/Data/shaders/ComputeShader/emboss.comp View File

@@ -0,0 +1,44 @@
1
+#version 450
2
+
3
+layout (local_size_x = 16, local_size_y = 16) in;
4
+layout (binding = 0, rgba8) uniform readonly image2D inputImage;
5
+layout (binding = 1, rgba8) uniform image2D resultImage;
6
+
7
+float conv(in float[9] kernel, in float[9] data, in float denom, in float offset) 
8
+{
9
+   float res = 0.0;
10
+   for (int i=0; i<9; ++i) 
11
+   {
12
+      res += kernel[i] * data[i];
13
+   }
14
+   return clamp(res/denom + offset, 0.0, 1.0);
15
+}
16
+
17
+struct ImageData 
18
+{
19
+	float avg[9];
20
+} imageData;	
21
+
22
+void main()
23
+{	
24
+	// Fetch neighbouring texels
25
+	int n = -1;
26
+	for (int i=-1; i<2; ++i) 
27
+	{   
28
+		for(int j=-1; j<2; ++j) 
29
+		{    
30
+			n++;    
31
+			vec3 rgb = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.x + i, gl_GlobalInvocationID.y + j)).rgb;
32
+			imageData.avg[n] = (rgb.r + rgb.g + rgb.b) / 3.0;
33
+		}
34
+	}
35
+
36
+	float[9] kernel;
37
+	kernel[0] = -1.0; kernel[1] =  0.0; kernel[2] =  0.0;
38
+	kernel[3] = 0.0; kernel[4] = -1.0; kernel[5] =  0.0;
39
+	kernel[6] = 0.0; kernel[7] =  0.0; kernel[8] = 2.0;
40
+									
41
+	vec4 res = vec4(vec3(conv(kernel, imageData.avg, 1.0, 0.50)), 1.0);
42
+
43
+	imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), res);
44
+}

BIN
Samples/Data/shaders/ComputeShader/emboss.comp.spv View File


+ 53
- 0
Samples/Data/shaders/ComputeShader/sharpen.comp View File

@@ -0,0 +1,53 @@
1
+#version 450
2
+
3
+layout (local_size_x = 16, local_size_y = 16) in;
4
+layout (binding = 0, rgba8) uniform readonly image2D inputImage;
5
+layout (binding = 1, rgba8) uniform image2D resultImage;
6
+
7
+float conv(in float[9] kernel, in float[9] data, in float denom, in float offset) 
8
+{
9
+   float res = 0.0;
10
+   for (int i=0; i<9; ++i) 
11
+   {
12
+      res += kernel[i] * data[i];
13
+   }
14
+   return clamp(res/denom + offset, 0.0, 1.0);
15
+}
16
+
17
+struct ImageData 
18
+{
19
+	float r[9];
20
+	float g[9];
21
+	float b[9];
22
+} imageData;	
23
+
24
+void main()
25
+{
26
+	
27
+	// Fetch neighbouring texels
28
+	int n = -1;
29
+	for (int i=-1; i<2; ++i) 
30
+	{   
31
+		for(int j=-1; j<2; ++j) 
32
+		{    
33
+			n++;    
34
+			vec3 rgb = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.x + i, gl_GlobalInvocationID.y + j)).rgb;
35
+			imageData.r[n] = rgb.r;
36
+			imageData.g[n] = rgb.g;
37
+			imageData.b[n] = rgb.b;
38
+		}
39
+	}
40
+
41
+	float[9] kernel;
42
+	kernel[0] = -1.0; kernel[1] = -1.0; kernel[2] = -1.0;
43
+	kernel[3] = -1.0; kernel[4] =  9.0; kernel[5] = -1.0;
44
+	kernel[6] = -1.0; kernel[7] = -1.0; kernel[8] = -1.0;
45
+								
46
+	vec4 res = vec4(
47
+		conv(kernel, imageData.r, 1.0, 0.0), 
48
+		conv(kernel, imageData.g, 1.0, 0.0), 
49
+		conv(kernel, imageData.b, 1.0, 0.0),
50
+		1.0);
51
+
52
+	imageStore(resultImage, ivec2(gl_GlobalInvocationID.xy), res);
53
+}

BIN
Samples/Data/shaders/ComputeShader/sharpen.comp.spv View File


+ 12
- 0
Samples/Data/shaders/ComputeShader/texture.frag View File

@@ -0,0 +1,12 @@
1
+#version 450
2
+
3
+layout (binding = 1) uniform sampler2D samplerColor;
4
+
5
+layout (location = 0) in vec2 inUV;
6
+
7
+layout (location = 0) out vec4 outFragColor;
8
+
9
+void main() 
10
+{
11
+  outFragColor = texture(samplerColor, inUV);
12
+}

BIN
Samples/Data/shaders/ComputeShader/texture.frag.spv View File


+ 23
- 0
Samples/Data/shaders/ComputeShader/texture.vert View File

@@ -0,0 +1,23 @@
1
+#version 450
2
+
3
+layout (location = 0) in vec3 inPos;
4
+layout (location = 1) in vec2 inUV;
5
+
6
+layout (binding = 0) uniform UBO 
7
+{
8
+	mat4 projection;
9
+	mat4 model;
10
+} ubo;
11
+
12
+layout (location = 0) out vec2 outUV;
13
+
14
+out gl_PerVertex
15
+{
16
+	vec4 gl_Position;
17
+};
18
+
19
+void main() 
20
+{
21
+	outUV = inUV;
22
+	gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
23
+}

BIN
Samples/Data/shaders/ComputeShader/texture.vert.spv View File