1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-01-30 22:52:14 +01:00

fixed viewport state

This commit is contained in:
Unknown 2019-09-20 10:30:03 +01:00
parent 7254e90101
commit a89a23504c
3 changed files with 23 additions and 9 deletions

View File

@ -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;
}

View File

@ -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
//-----------------------------
/*

View File

@ -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 = &copyCommandBuffer;
//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, &copyCommandBuffer);