mirror of
https://github.com/Yours3lf/rpi-vk-driver.git
synced 2025-02-20 17:54:17 +01:00
fixed bincl dump, depth bias, z scale offset, restoring old vp
This commit is contained in:
parent
a22c31a9d2
commit
81d097bb67
@ -540,7 +540,11 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkQueueSubmit)(
|
||||
|
||||
/**
|
||||
printf("BCL:\n");
|
||||
clDump(((uint8_t*)marker) + sizeof(CLMarker), marker->size);
|
||||
uint8_t* mem = malloc(marker->size);
|
||||
memcpy(mem, marker+1, marker->size);
|
||||
clDump(mem, marker->size);
|
||||
free(mem);
|
||||
|
||||
printf("BO handles: ");
|
||||
for(int d = 0; d < marker->handlesSize / 4; ++d)
|
||||
{
|
||||
|
@ -104,13 +104,30 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
|
||||
|
||||
//TODO Depth Offset
|
||||
clFit(commandBuffer, &commandBuffer->binCl, V3D21_DEPTH_OFFSET_length);
|
||||
clInsertDepthOffset(&commandBuffer->binCl, cb->graphicsPipeline->depthBiasConstantFactor, cb->graphicsPipeline->depthBiasSlopeFactor);
|
||||
|
||||
float depthBiasConstant = cb->graphicsPipeline->depthBiasConstantFactor;
|
||||
float depthBiasSlope = cb->graphicsPipeline->depthBiasSlopeFactor;
|
||||
|
||||
for(uint32_t c = 0; c < cb->graphicsPipeline->dynamicStateCount; ++c)
|
||||
{
|
||||
if(cb->graphicsPipeline->dynamicStates[c] == VK_DYNAMIC_STATE_DEPTH_BIAS)
|
||||
{
|
||||
depthBiasConstant = cb->depthBiasConstantFactor;
|
||||
depthBiasSlope = cb->depthBiasSlopeFactor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
clInsertDepthOffset(&commandBuffer->binCl, depthBiasConstant, depthBiasSlope);
|
||||
|
||||
//Vulkan conventions, we expect the resulting NDC space Z axis to be in range [0...1] close->far
|
||||
//cb->graphicsPipeline->minDepthBounds;
|
||||
//Clipper Z Scale and Offset
|
||||
clFit(commandBuffer, &commandBuffer->binCl, V3D21_CLIPPER_Z_SCALE_AND_OFFSET_length);
|
||||
clInsertClipperZScaleOffset(&commandBuffer->binCl, 0.0f, 1.0f);
|
||||
//offset, scale
|
||||
float scale = vp.maxDepth - vp.minDepth;
|
||||
float offset = vp.minDepth;
|
||||
clInsertClipperZScaleOffset(&commandBuffer->binCl, offset, scale);
|
||||
|
||||
cb->vertexBufferDirty = 0;
|
||||
cb->depthBoundsDirty = 0;
|
||||
|
@ -620,8 +620,10 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearAttachments)(
|
||||
_buffer* oldVertexBuffers[8];
|
||||
char oldPushConstantBufferVertex[256];
|
||||
char oldPushConstantBufferPixel[256];
|
||||
VkViewport oldViewport;
|
||||
|
||||
//save the state that we'll modify
|
||||
oldViewport = cmdBuf->viewport;
|
||||
oldPipeline = cmdBuf->graphicsPipeline;
|
||||
memcpy(oldVertexBufferOffsets, cmdBuf->vertexBufferOffsets, sizeof(oldVertexBufferOffsets));
|
||||
memcpy(oldVertexBuffers, cmdBuf->vertexBuffers, sizeof(oldVertexBuffers));
|
||||
@ -722,6 +724,7 @@ VKAPI_ATTR void VKAPI_CALL RPIFUNC(vkCmdClearAttachments)(
|
||||
}
|
||||
|
||||
//restore state
|
||||
cmdBuf->viewport = oldViewport;
|
||||
cmdBuf->graphicsPipeline = oldPipeline;
|
||||
memcpy(cmdBuf->vertexBufferOffsets, oldVertexBufferOffsets, sizeof(oldVertexBufferOffsets));
|
||||
memcpy(cmdBuf->vertexBuffers, oldVertexBuffers, sizeof(oldVertexBuffers));
|
||||
|
Loading…
x
Reference in New Issue
Block a user