mirror of
https://github.com/Yours3lf/rpi-vk-driver.git
synced 2025-01-18 10:52:14 +01:00
fixed depth bias
This commit is contained in:
parent
4617c9b0b4
commit
84befd0ff4
@ -506,14 +506,20 @@ void clInsertRHTXBoundary(ControlList* cl,
|
|||||||
*(uint16_t*)cl->nextFreeByte = moveBits(boundary, 16, 0); cl->nextFreeByte += 2;
|
*(uint16_t*)cl->nextFreeByte = moveBits(boundary, 16, 0); cl->nextFreeByte += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t f32_to_f187(float f32)
|
||||||
|
{
|
||||||
|
uint32_t bits = *(uint32_t*)&f32;
|
||||||
|
return bits >> 16;
|
||||||
|
}
|
||||||
|
|
||||||
void clInsertDepthOffset(ControlList* cl,
|
void clInsertDepthOffset(ControlList* cl,
|
||||||
uint32_t units, //float 187
|
float units,
|
||||||
uint32_t factor) //float 187
|
float factor)
|
||||||
{
|
{
|
||||||
assert(cl);
|
assert(cl);
|
||||||
assert(cl->nextFreeByte);
|
assert(cl->nextFreeByte);
|
||||||
*cl->nextFreeByte = V3D21_DEPTH_OFFSET_opcode; cl->nextFreeByte++;
|
*cl->nextFreeByte = V3D21_DEPTH_OFFSET_opcode; cl->nextFreeByte++;
|
||||||
*(uint32_t*)cl->nextFreeByte = moveBits(factor, 16, 0) | moveBits(units, 16, 16); cl->nextFreeByte += 4;
|
*(uint32_t*)cl->nextFreeByte = moveBits(f32_to_f187(factor), 16, 0) | moveBits(f32_to_f187(units), 16, 16); cl->nextFreeByte += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clInsertClipWindow(ControlList* cl,
|
void clInsertClipWindow(ControlList* cl,
|
||||||
|
@ -137,8 +137,8 @@ void clInsertLineWidth(ControlList* cl,
|
|||||||
void clInsertRHTXBoundary(ControlList* cl,
|
void clInsertRHTXBoundary(ControlList* cl,
|
||||||
uint32_t boundary); //sint16
|
uint32_t boundary); //sint16
|
||||||
void clInsertDepthOffset(ControlList* cl,
|
void clInsertDepthOffset(ControlList* cl,
|
||||||
uint32_t units, //float 187
|
float units,
|
||||||
uint32_t factor); //float 187
|
float factor);
|
||||||
void clInsertClipWindow(ControlList* cl,
|
void clInsertClipWindow(ControlList* cl,
|
||||||
uint32_t width, //uint16
|
uint32_t width, //uint16
|
||||||
uint32_t height, //uint16
|
uint32_t height, //uint16
|
||||||
|
@ -1349,6 +1349,9 @@ void CreatePipeline()
|
|||||||
rastCreateInfo.cullMode = VK_CULL_MODE_NONE;
|
rastCreateInfo.cullMode = VK_CULL_MODE_NONE;
|
||||||
rastCreateInfo.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
rastCreateInfo.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||||
rastCreateInfo.lineWidth = 1.0f;
|
rastCreateInfo.lineWidth = 1.0f;
|
||||||
|
rastCreateInfo.depthBiasEnable = 1;
|
||||||
|
rastCreateInfo.depthBiasConstantFactor = -2.0f;
|
||||||
|
rastCreateInfo.depthBiasSlopeFactor = -1.0f;
|
||||||
|
|
||||||
VkPipelineMultisampleStateCreateInfo pipelineMSCreateInfo = {};
|
VkPipelineMultisampleStateCreateInfo pipelineMSCreateInfo = {};
|
||||||
pipelineMSCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
pipelineMSCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user