|
@@ -19,7 +19,6 @@ public:
|
19
|
19
|
{
|
20
|
20
|
DKObject<DKGraphicsDevice> device = DKGraphicsDevice::SharedInstance();
|
21
|
21
|
DKObject<DKCommandQueue> queue = device->CreateCommandQueue();
|
22
|
|
- DKObject<DKCommandBuffer> buffer = queue->CreateCommandBuffer();
|
23
|
22
|
DKObject<DKSwapChain> swapChain = queue->CreateSwapChain(window);
|
24
|
23
|
|
25
|
24
|
DKTimer timer;
|
|
@@ -29,11 +28,18 @@ public:
|
29
|
28
|
while (!runningRenderThread.CompareAndSet(0, 0))
|
30
|
29
|
{
|
31
|
30
|
DKRenderPassDescriptor rpd = swapChain->CurrentRenderPassDescriptor();
|
|
31
|
+ double t = timer.Elapsed();
|
|
32
|
+ t = (cos(t) + 1.0) * 0.5;
|
|
33
|
+ rpd.colorAttachments.Value(0).clearColor = DKColor(t, 0.0, 0.0, 0.0);
|
|
34
|
+
|
|
35
|
+ DKObject<DKCommandBuffer> buffer = queue->CreateCommandBuffer();
|
32
|
36
|
DKObject<DKRenderCommandEncoder> encoder = buffer->CreateRenderCommandEncoder(rpd);
|
33
|
37
|
if (encoder)
|
34
|
38
|
{
|
35
|
39
|
// draw scene!
|
36
|
40
|
|
|
41
|
+ encoder->EndEncoding();
|
|
42
|
+ buffer->Commit();
|
37
|
43
|
swapChain->Present();
|
38
|
44
|
}
|
39
|
45
|
else
|