mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-27 03:55:42 +00:00
Separate BeginFrame from BeginSurfaceRenderPass
This commit is contained in:
parent
499b32e5ec
commit
4407445d50
@ -215,7 +215,7 @@ void VulkanContext::QueueBeforeSurfaceRender(VkCommandBuffer cmd) {
|
|||||||
cmdQueue_.push_back(cmd);
|
cmdQueue_.push_back(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkCommandBuffer VulkanContext::BeginSurfaceRenderPass(VkClearValue clear_values[2]) {
|
VkCommandBuffer VulkanContext::BeginFrame() {
|
||||||
FrameData *frame = &frame_[curFrame_];
|
FrameData *frame = &frame_[curFrame_];
|
||||||
|
|
||||||
// Get the index of the next available swapchain image, and a semaphore to block command buffer execution on.
|
// Get the index of the next available swapchain image, and a semaphore to block command buffer execution on.
|
||||||
@ -238,7 +238,11 @@ VkCommandBuffer VulkanContext::BeginSurfaceRenderPass(VkClearValue clear_values[
|
|||||||
res = vkBeginCommandBuffer(frame->cmdBuf, &begin);
|
res = vkBeginCommandBuffer(frame->cmdBuf, &begin);
|
||||||
|
|
||||||
TransitionFromPresent(frame->cmdBuf, swapChainBuffers[current_buffer].image);
|
TransitionFromPresent(frame->cmdBuf, swapChainBuffers[current_buffer].image);
|
||||||
|
return frame->cmdBuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
VkCommandBuffer VulkanContext::BeginSurfaceRenderPass(VkClearValue clear_values[2]) {
|
||||||
|
FrameData *frame = &frame_[curFrame_];
|
||||||
VkRenderPassBeginInfo rp_begin = { VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO };
|
VkRenderPassBeginInfo rp_begin = { VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO };
|
||||||
rp_begin.renderPass = surface_render_pass_;
|
rp_begin.renderPass = surface_render_pass_;
|
||||||
rp_begin.framebuffer = framebuffers_[current_buffer];
|
rp_begin.framebuffer = framebuffers_[current_buffer];
|
||||||
@ -259,7 +263,10 @@ VkCommandBuffer VulkanContext::BeginSurfaceRenderPass(VkClearValue clear_values[
|
|||||||
void VulkanContext::EndSurfaceRenderPass() {
|
void VulkanContext::EndSurfaceRenderPass() {
|
||||||
FrameData *frame = &frame_[curFrame_];
|
FrameData *frame = &frame_[curFrame_];
|
||||||
vkCmdEndRenderPass(frame->cmdBuf);
|
vkCmdEndRenderPass(frame->cmdBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VulkanContext::EndFrame() {
|
||||||
|
FrameData *frame = &frame_[curFrame_];
|
||||||
TransitionToPresent(frame->cmdBuf, swapChainBuffers[current_buffer].image);
|
TransitionToPresent(frame->cmdBuf, swapChainBuffers[current_buffer].image);
|
||||||
|
|
||||||
VkResult res = vkEndCommandBuffer(frame->cmdBuf);
|
VkResult res = vkEndCommandBuffer(frame->cmdBuf);
|
||||||
|
@ -263,12 +263,14 @@ public:
|
|||||||
return frame_[curFrame_ & 1].cmdBuf;
|
return frame_[curFrame_ & 1].cmdBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VkCommandBuffer BeginFrame();
|
||||||
// The surface render pass is special because it has to acquire the backbuffer, and may thus "block".
|
// The surface render pass is special because it has to acquire the backbuffer, and may thus "block".
|
||||||
// Use the returned command buffer to enqueue commands that render to the backbuffer.
|
// Use the returned command buffer to enqueue commands that render to the backbuffer.
|
||||||
// To render to other buffers first, you can submit additional commandbuffers using QueueBeforeSurfaceRender(cmd).
|
// To render to other buffers first, you can submit additional commandbuffers using QueueBeforeSurfaceRender(cmd).
|
||||||
VkCommandBuffer BeginSurfaceRenderPass(VkClearValue clear_values[2]);
|
VkCommandBuffer BeginSurfaceRenderPass(VkClearValue clear_values[2]);
|
||||||
// May eventually need the ability to break and resume the backbuffer render pass in a few rare cases.
|
// May eventually need the ability to break and resume the backbuffer render pass in a few rare cases.
|
||||||
void EndSurfaceRenderPass();
|
void EndSurfaceRenderPass();
|
||||||
|
void EndFrame();
|
||||||
|
|
||||||
void QueueBeforeSurfaceRender(VkCommandBuffer cmd);
|
void QueueBeforeSurfaceRender(VkCommandBuffer cmd);
|
||||||
|
|
||||||
|
@ -732,6 +732,8 @@ VKContext::~VKContext() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VKContext::Begin(bool clear, uint32_t colorval, float depthVal, int stencilVal) {
|
void VKContext::Begin(bool clear, uint32_t colorval, float depthVal, int stencilVal) {
|
||||||
|
cmd_ = vulkan_->BeginFrame();
|
||||||
|
|
||||||
VkClearValue clearVal[2] = {};
|
VkClearValue clearVal[2] = {};
|
||||||
Uint8x4ToFloat4(colorval, clearVal[0].color.float32);
|
Uint8x4ToFloat4(colorval, clearVal[0].color.float32);
|
||||||
|
|
||||||
@ -742,7 +744,7 @@ void VKContext::Begin(bool clear, uint32_t colorval, float depthVal, int stencil
|
|||||||
clearVal[1].depthStencil.depth = depthVal;
|
clearVal[1].depthStencil.depth = depthVal;
|
||||||
clearVal[1].depthStencil.stencil = stencilVal;
|
clearVal[1].depthStencil.stencil = stencilVal;
|
||||||
|
|
||||||
cmd_ = vulkan_->BeginSurfaceRenderPass(clearVal);
|
vulkan_->BeginSurfaceRenderPass(clearVal);
|
||||||
|
|
||||||
FrameData *frame = &frame_[frameNum_ & 1];
|
FrameData *frame = &frame_[frameNum_ & 1];
|
||||||
push_ = frame->pushBuffer;
|
push_ = frame->pushBuffer;
|
||||||
@ -765,6 +767,7 @@ void VKContext::End() {
|
|||||||
// Stop collecting data in the frame's data pushbuffer.
|
// Stop collecting data in the frame's data pushbuffer.
|
||||||
push_->End();
|
push_->End();
|
||||||
vulkan_->EndSurfaceRenderPass();
|
vulkan_->EndSurfaceRenderPass();
|
||||||
|
vulkan_->EndFrame();
|
||||||
|
|
||||||
frameNum_++;
|
frameNum_++;
|
||||||
cmd_ = nullptr; // will be set on the next begin
|
cmd_ = nullptr; // will be set on the next begin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user