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 descriptorSetDirty;
//uint32_t pushConstantDirty; //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) //if(cb->lineWidthDirty)
{ {
//Line width //Line width
@ -51,19 +63,19 @@ void vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t ins
//Clip Window //Clip Window
clFit(commandBuffer, &commandBuffer->binCl, V3D21_CLIP_WINDOW_length); clFit(commandBuffer, &commandBuffer->binCl, V3D21_CLIP_WINDOW_length);
clInsertClipWindow(&commandBuffer->binCl, clInsertClipWindow(&commandBuffer->binCl,
cb->viewport.width, vp.width,
cb->viewport.height, vp.height,
cb->viewport.y, //bottom pixel coord vp.y, //bottom pixel coord
cb->viewport.x); //left pixel coord vp.x); //left pixel coord
//TODO why flipped??? //TODO why flipped???
//Clipper XY Scaling //Clipper XY Scaling
clFit(commandBuffer, &commandBuffer->binCl, V3D21_CLIPPER_XY_SCALING_length); 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 //Viewport Offset
clFit(commandBuffer, &commandBuffer->binCl, V3D21_VIEWPORT_OFFSET_length); 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; cb->viewportDirty = 0;
} }

View File

@ -35,6 +35,8 @@
//ie. stall shader until a value is something? //ie. stall shader until a value is something?
//and increment said value? //and increment said value?
//but we'd need to patch shaders and it'd probably be slow... //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); 0, 0, nullptr, 0, nullptr, 1, &imageMemoryBarrier);
//TODO //TODO
//vkEndCommandBuffer(copyCommandBuffer); vkEndCommandBuffer(copyCommandBuffer);
VkFenceCreateInfo fenceInfo = {}; VkFenceCreateInfo fenceInfo = {};
fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
@ -1355,9 +1355,9 @@ void CreateTexture()
submitInfo.pCommandBuffers = &copyCommandBuffer; submitInfo.pCommandBuffers = &copyCommandBuffer;
//TODO //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); vkDestroyFence(device, fence, 0);
vkFreeCommandBuffers(device, commandPool, 1, &copyCommandBuffer); vkFreeCommandBuffers(device, commandPool, 1, &copyCommandBuffer);