diff --git a/driver/draw.c b/driver/draw.c index a5f954c..cbaca8e 100644 --- a/driver/draw.c +++ b/driver/draw.c @@ -37,6 +37,18 @@ void vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t ins //uint32_t descriptorSetDirty; //uint32_t pushConstantDirty; + //TODO multiple viewports + VkViewport vp; + vp = cb->graphicsPipeline->viewports[0]; + + for(uint32_t c = 0; c < cb->graphicsPipeline->dynamicStateCount; ++c) + { + if(cb->graphicsPipeline->dynamicStates[c] == VK_DYNAMIC_STATE_VIEWPORT) + { + vp = cb->viewport; + } + } + //if(cb->lineWidthDirty) { //Line width @@ -51,19 +63,19 @@ void vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t ins //Clip Window clFit(commandBuffer, &commandBuffer->binCl, V3D21_CLIP_WINDOW_length); clInsertClipWindow(&commandBuffer->binCl, - cb->viewport.width, - cb->viewport.height, - cb->viewport.y, //bottom pixel coord - cb->viewport.x); //left pixel coord + vp.width, + vp.height, + vp.y, //bottom pixel coord + vp.x); //left pixel coord //TODO why flipped??? //Clipper XY Scaling clFit(commandBuffer, &commandBuffer->binCl, V3D21_CLIPPER_XY_SCALING_length); - clInsertClipperXYScaling(&commandBuffer->binCl, (float)(cb->viewport.width) * 0.5f * 16.0f, -1.0f * (float)(cb->viewport.height) * 0.5f * 16.0f); + clInsertClipperXYScaling(&commandBuffer->binCl, (float)(vp.width) * 0.5f * 16.0f, -1.0f * (float)(vp.height) * 0.5f * 16.0f); //Viewport Offset clFit(commandBuffer, &commandBuffer->binCl, V3D21_VIEWPORT_OFFSET_length); - clInsertViewPortOffset(&commandBuffer->binCl, ((int16_t)cb->viewport.width) >> 1, ((int16_t)cb->viewport.height) >> 1); + clInsertViewPortOffset(&commandBuffer->binCl, ((int16_t)vp.width) >> 1, ((int16_t)vp.height) >> 1); cb->viewportDirty = 0; } diff --git a/driver/sync.c b/driver/sync.c index 0cd433e..c03953b 100644 --- a/driver/sync.c +++ b/driver/sync.c @@ -35,6 +35,8 @@ //ie. stall shader until a value is something? //and increment said value? //but we'd need to patch shaders and it'd probably be slow... +// +//Apparently the RPi contains 16 4bit semaphores that are accessible for each QPU via SFU //----------------------------- /* diff --git a/test/triangle/triangle.cpp b/test/triangle/triangle.cpp index 9af10f5..978eb53 100644 --- a/test/triangle/triangle.cpp +++ b/test/triangle/triangle.cpp @@ -1340,7 +1340,7 @@ void CreateTexture() 0, 0, nullptr, 0, nullptr, 1, &imageMemoryBarrier); //TODO - //vkEndCommandBuffer(copyCommandBuffer); + vkEndCommandBuffer(copyCommandBuffer); VkFenceCreateInfo fenceInfo = {}; fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; @@ -1355,9 +1355,9 @@ void CreateTexture() submitInfo.pCommandBuffers = ©CommandBuffer; //TODO - //vkQueueSubmit(graphicsQueue, 1, &submitInfo, fence); + vkQueueSubmit(graphicsQueue, 1, &submitInfo, fence); - //vkWaitForFences(device, 1, &fence, VK_TRUE, -1); + vkWaitForFences(device, 1, &fence, VK_TRUE, -1); vkDestroyFence(device, fence, 0); vkFreeCommandBuffers(device, commandPool, 1, ©CommandBuffer);