mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 12:32:43 +00:00
vk: Minor cleanup
This commit is contained in:
parent
3a466d6fd2
commit
3ef1eb8529
@ -83,5 +83,10 @@ namespace rsx
|
|||||||
auto bytes = data();
|
auto bytes = data();
|
||||||
return { utils::bless<T>(bytes), m_size / sizeof(T) };
|
return { utils::bless<T>(bytes), m_size / sizeof(T) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool empty() const
|
||||||
|
{
|
||||||
|
return m_size == 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2139,24 +2139,21 @@ void VKGSRender::load_program_env()
|
|||||||
if (update_transform_constants)
|
if (update_transform_constants)
|
||||||
{
|
{
|
||||||
// Transform constants
|
// Transform constants
|
||||||
usz transform_constants_size = 0;
|
|
||||||
usz mem_offset = 0;
|
usz mem_offset = 0;
|
||||||
|
|
||||||
auto alloc_storage = [&](usz size) -> std::pair<void*, usz>
|
auto alloc_storage = [&](usz size) -> std::pair<void*, usz>
|
||||||
{
|
{
|
||||||
const auto alignment = m_device->gpu().get_limits().minUniformBufferOffsetAlignment;
|
const auto alignment = m_device->gpu().get_limits().minUniformBufferOffsetAlignment;
|
||||||
mem_offset = m_transform_constants_ring_info.alloc<1>(utils::align(size, alignment));
|
mem_offset = m_transform_constants_ring_info.alloc<1>(utils::align(size, alignment));
|
||||||
transform_constants_size = size;
|
return std::make_pair(m_transform_constants_ring_info.map(mem_offset, size), size);
|
||||||
return std::make_pair(m_transform_constants_ring_info.map(mem_offset, transform_constants_size), size);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
auto io_buf = rsx::io_buffer(alloc_storage);
|
auto io_buf = rsx::io_buffer(alloc_storage);
|
||||||
upload_transform_constants(io_buf);
|
upload_transform_constants(io_buf);
|
||||||
|
|
||||||
if (transform_constants_size)
|
if (!io_buf.empty())
|
||||||
{
|
{
|
||||||
m_transform_constants_ring_info.unmap();
|
m_transform_constants_ring_info.unmap();
|
||||||
m_vertex_constants_buffer_info = { m_transform_constants_ring_info.heap->value, mem_offset, transform_constants_size };
|
m_vertex_constants_buffer_info = { m_transform_constants_ring_info.heap->value, mem_offset, io_buf.size() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2375,8 +2372,8 @@ void VKGSRender::patch_transform_constants(rsx::context* ctx, u32 index, u32 cou
|
|||||||
// Indexed. This is a bit trickier. Use scratchpad to avoid UAF
|
// Indexed. This is a bit trickier. Use scratchpad to avoid UAF
|
||||||
auto allocate_mem = [&](usz size) -> std::pair<void*, usz>
|
auto allocate_mem = [&](usz size) -> std::pair<void*, usz>
|
||||||
{
|
{
|
||||||
scratchpad.resize(size);
|
m_scratch_mem.resize(size);
|
||||||
return { scratchpad.data(), size };
|
return { m_scratch_mem.data(), size };
|
||||||
};
|
};
|
||||||
|
|
||||||
rsx::io_buffer iobuf(allocate_mem);
|
rsx::io_buffer iobuf(allocate_mem);
|
||||||
|
@ -234,7 +234,7 @@ private:
|
|||||||
VkDescriptorSet allocate_descriptor_set();
|
VkDescriptorSet allocate_descriptor_set();
|
||||||
|
|
||||||
vk::vertex_upload_info upload_vertex_data();
|
vk::vertex_upload_info upload_vertex_data();
|
||||||
rsx::simple_array<u8> scratchpad;
|
rsx::simple_array<u8> m_scratch_mem;
|
||||||
|
|
||||||
bool load_program();
|
bool load_program();
|
||||||
void load_program_env();
|
void load_program_env();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user