fix sprite blending

Disable depth test and set dst blend factor to 1 for kRenderGlow mode.
Sprites are occluded in software.

(does this break any other code depending on Glow mode? who knows)
This commit is contained in:
Ivan Avdeev 2021-02-20 12:46:16 -08:00
parent 8dc0d4256d
commit a5e279f580
2 changed files with 15 additions and 1 deletions

View File

@ -3,13 +3,13 @@
- [x] move uniform_data_t to global render state ~inside render_draw_t, remove any mentions of uniform/slots from api; alt: global render state?~
- [x] rename RenderDraw to SubmitDraw
- [x] ~add debug label to render_draw_t?;~ alt: VK_RenderDebugNameBegin/End
- [x] fix sprite blending
# Next
- [ ] refactor vk_render interface:
- [ ] make 2nd commad buffer for resource upload
- [ ] start building command buffers in beginframe
- [ ] perform 3d rendering on corresponding refapi calls, not endframe
- [ ] fix sprite blending
# Planned
- [ ] RTX: make projection matrix independent render global/current/static state

View File

@ -124,12 +124,14 @@ static qboolean createPipelines( void )
ci.stages[1].pSpecializationInfo = NULL;
ci.blendEnable = VK_FALSE;
ci.depthWriteEnable = VK_TRUE;
ci.depthTestEnable = VK_TRUE;
name = "brush kRenderNormal";
break;
case kRenderTransColor:
ci.stages[1].pSpecializationInfo = NULL;
ci.depthWriteEnable = VK_TRUE;
ci.depthTestEnable = VK_TRUE;
ci.blendEnable = VK_TRUE;
ci.colorBlendOp = VK_BLEND_OP_ADD; // TODO check
ci.srcAlphaBlendFactor = ci.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
@ -140,6 +142,7 @@ static qboolean createPipelines( void )
case kRenderTransAdd:
ci.stages[1].pSpecializationInfo = NULL;
ci.depthWriteEnable = VK_FALSE;
ci.depthTestEnable = VK_TRUE;
ci.blendEnable = VK_TRUE;
ci.colorBlendOp = VK_BLEND_OP_ADD; // TODO check
@ -152,14 +155,25 @@ static qboolean createPipelines( void )
case kRenderTransAlpha:
ci.stages[1].pSpecializationInfo = &alpha_test_spec;
ci.depthWriteEnable = VK_TRUE;
ci.depthTestEnable = VK_TRUE;
ci.blendEnable = VK_FALSE;
name = "brush kRenderTransAlpha(test)";
break;
case kRenderGlow:
ci.stages[1].pSpecializationInfo = NULL;
ci.depthWriteEnable = VK_FALSE;
ci.depthTestEnable = VK_FALSE;
ci.blendEnable = VK_TRUE;
ci.colorBlendOp = VK_BLEND_OP_ADD; // TODO check
ci.srcAlphaBlendFactor = ci.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
ci.dstAlphaBlendFactor = ci.dstColorBlendFactor = VK_BLEND_FACTOR_ONE;
break;
case kRenderTransTexture:
ci.stages[1].pSpecializationInfo = NULL;
ci.depthWriteEnable = VK_FALSE;
ci.depthTestEnable = VK_TRUE;
ci.blendEnable = VK_TRUE;
ci.colorBlendOp = VK_BLEND_OP_ADD; // TODO check
ci.srcAlphaBlendFactor = ci.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;