Implemented r_drawFlickerBox with Vulkan

This commit is contained in:
Robert Beckebans 2018-11-02 11:00:05 +01:00
parent 526138de89
commit 1e4b171b8a
3 changed files with 40 additions and 3 deletions

View file

@ -5207,7 +5207,7 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds )
break;
case RC_SET_BUFFER:
//RB_SetBuffer( cmds );
SetBuffer( cmds );
c_setBuffers++;
break;

View file

@ -773,11 +773,17 @@ const emptyCommand_t* idRenderSystemLocal::SwapCommandBuffers_FinishCommandBuffe
// set the time for shader effects in 2D rendering
frameShaderTime = Sys_Milliseconds() * 0.001;
#if !defined(USE_VULKAN)
#if 1 //!defined(USE_VULKAN)
// RB: TODO RC_SET_BUFFER is not handled in OpenGL
setBufferCommand_t* cmd2 = ( setBufferCommand_t* )R_GetCommandBuffer( sizeof( *cmd2 ) );
cmd2->commandId = RC_SET_BUFFER;
#if defined(USE_VULKAN)
cmd2->buffer = 0;
#else
cmd2->buffer = ( int )GL_BACK;
#endif
#endif
// the old command buffer can now be rendered, while the new one can

View file

@ -2114,7 +2114,38 @@ void idRenderBackend::DrawFlickerBox()
return;
}
// TODO
VkClearAttachment attachment = {};
attachment.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
attachment.colorAttachment = 0;
VkClearColorValue& color = attachment.clearValue.color;
if( vkcontext.currentFrameData & 1 )
{
color.float32[ 0 ] = 1;
color.float32[ 1 ] = 0;
color.float32[ 2 ] = 0;
color.float32[ 3 ] = 1;
}
else
{
color.float32[ 0 ] = 0;
color.float32[ 1 ] = 1;
color.float32[ 2 ] = 0;
color.float32[ 3 ] = 1;
}
VkExtent2D extent;
extent.width = 256;
extent.height = 256;
VkClearRect clearRect = {};
clearRect.baseArrayLayer = 0;
clearRect.layerCount = 1;
clearRect.rect.extent = extent;
vkCmdClearAttachments( vkcontext.commandBuffer[ vkcontext.currentFrameData ], 1, &attachment, 1, &clearRect );
/*
if( tr.frameCount & 1 )