mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
Vulkan: Use single VBO in filter chain.
No need to have two separate buffers here.
This commit is contained in:
parent
939bc70ac6
commit
b7b03c531a
@ -213,7 +213,7 @@ struct CommonResources
|
|||||||
const VkPhysicalDeviceMemoryProperties &memory_properties);
|
const VkPhysicalDeviceMemoryProperties &memory_properties);
|
||||||
~CommonResources();
|
~CommonResources();
|
||||||
|
|
||||||
unique_ptr<Buffer> vbo_offscreen, vbo_final;
|
unique_ptr<Buffer> vbo;
|
||||||
VkSampler samplers[2];
|
VkSampler samplers[2];
|
||||||
|
|
||||||
vector<Texture> original_history;
|
vector<Texture> original_history;
|
||||||
@ -1176,33 +1176,26 @@ CommonResources::CommonResources(VkDevice device,
|
|||||||
{
|
{
|
||||||
// The final pass uses an MVP designed for [0, 1] range VBO.
|
// The final pass uses an MVP designed for [0, 1] range VBO.
|
||||||
// For in-between passes, we just go with identity matrices, so keep it simple.
|
// For in-between passes, we just go with identity matrices, so keep it simple.
|
||||||
const float vbo_data_offscreen[] = {
|
const float vbo_data[] = {
|
||||||
|
// Offscreen
|
||||||
-1.0f, -1.0f, 0.0f, 0.0f,
|
-1.0f, -1.0f, 0.0f, 0.0f,
|
||||||
-1.0f, +1.0f, 0.0f, 1.0f,
|
-1.0f, +1.0f, 0.0f, 1.0f,
|
||||||
1.0f, -1.0f, 1.0f, 0.0f,
|
1.0f, -1.0f, 1.0f, 0.0f,
|
||||||
1.0f, +1.0f, 1.0f, 1.0f,
|
1.0f, +1.0f, 1.0f, 1.0f,
|
||||||
};
|
|
||||||
|
|
||||||
const float vbo_data_final[] = {
|
// Final
|
||||||
0.0f, 0.0f, 0.0f, 0.0f,
|
0.0f, 0.0f, 0.0f, 0.0f,
|
||||||
0.0f, +1.0f, 0.0f, 1.0f,
|
0.0f, +1.0f, 0.0f, 1.0f,
|
||||||
1.0f, 0.0f, 1.0f, 0.0f,
|
1.0f, 0.0f, 1.0f, 0.0f,
|
||||||
1.0f, +1.0f, 1.0f, 1.0f,
|
1.0f, +1.0f, 1.0f, 1.0f,
|
||||||
};
|
};
|
||||||
|
|
||||||
vbo_offscreen = unique_ptr<Buffer>(new Buffer(device,
|
vbo = unique_ptr<Buffer>(new Buffer(device,
|
||||||
memory_properties, sizeof(vbo_data_offscreen), VK_BUFFER_USAGE_VERTEX_BUFFER_BIT));
|
memory_properties, sizeof(vbo_data), VK_BUFFER_USAGE_VERTEX_BUFFER_BIT));
|
||||||
|
|
||||||
void *ptr = vbo_offscreen->map();
|
void *ptr = vbo->map();
|
||||||
memcpy(ptr, vbo_data_offscreen, sizeof(vbo_data_offscreen));
|
memcpy(ptr, vbo_data, sizeof(vbo_data));
|
||||||
vbo_offscreen->unmap();
|
vbo->unmap();
|
||||||
|
|
||||||
vbo_final = unique_ptr<Buffer>(new Buffer(device,
|
|
||||||
memory_properties, sizeof(vbo_data_final), VK_BUFFER_USAGE_VERTEX_BUFFER_BIT));
|
|
||||||
|
|
||||||
ptr = vbo_final->map();
|
|
||||||
memcpy(ptr, vbo_data_final, sizeof(vbo_data_final));
|
|
||||||
vbo_final->unmap();
|
|
||||||
|
|
||||||
VkSamplerCreateInfo info = { VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO };
|
VkSamplerCreateInfo info = { VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO };
|
||||||
info.magFilter = VK_FILTER_NEAREST;
|
info.magFilter = VK_FILTER_NEAREST;
|
||||||
@ -1521,9 +1514,9 @@ void Pass::build_commands(
|
|||||||
VKFUNC(vkCmdBindDescriptorSets)(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout,
|
VKFUNC(vkCmdBindDescriptorSets)(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout,
|
||||||
0, 1, &sets[sync_index], 0, nullptr);
|
0, 1, &sets[sync_index], 0, nullptr);
|
||||||
|
|
||||||
VkDeviceSize offset = 0;
|
VkDeviceSize offset = final_pass ? 16 * sizeof(float) : 0;
|
||||||
VKFUNC(vkCmdBindVertexBuffers)(cmd, 0, 1,
|
VKFUNC(vkCmdBindVertexBuffers)(cmd, 0, 1,
|
||||||
final_pass ? &common->vbo_final->get_buffer() : &common->vbo_offscreen->get_buffer(),
|
&common->vbo->get_buffer(),
|
||||||
&offset);
|
&offset);
|
||||||
|
|
||||||
if (final_pass)
|
if (final_pass)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user