rsx: Move inline array to draw_clause structure.

This commit is contained in:
vlj 2016-08-27 19:22:12 +02:00
parent ce21db2ce3
commit 03c86ae43b
7 changed files with 26 additions and 15 deletions

View File

@ -347,10 +347,12 @@ std::tuple<bool, size_t, std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC>> D3D12GSRe
{
size_t vertex_count;
std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC> vertex_buffer_view;
std::tie(vertex_buffer_view, vertex_count) = upload_inlined_vertex_array(
rsx::method_registers.vertex_arrays_info,
{ (const gsl::byte*) inline_vertex_array.data(), ::narrow<int>(inline_vertex_array.size() * sizeof(uint)) },
m_buffer_data, m_vertex_buffer_data.Get(), command_list);
std::tie(vertex_buffer_view, vertex_count) =
upload_inlined_vertex_array(rsx::method_registers.vertex_arrays_info,
{(const gsl::byte*)rsx::method_registers.current_draw_clause.inline_vertex_array.data(),
::narrow<int>(rsx::method_registers.current_draw_clause.inline_vertex_array.size() *
sizeof(uint))},
m_buffer_data, m_vertex_buffer_data.Get(), command_list);
if (is_primitive_native(rsx::method_registers.current_draw_clause.primitive))
return std::make_tuple(false, vertex_count, vertex_buffer_view);

View File

@ -418,7 +418,9 @@ u32 GLGSRender::upload_inline_array(const u32 &max_vertex_attrib_size, const u32
stride += rsx::get_vertex_type_size_on_host(info.type(), info.size());
}
u32 vertex_draw_count = (u32)(inline_vertex_array.size() * sizeof(u32)) / stride;
u32 vertex_draw_count =
(u32)(rsx::method_registers.current_draw_clause.inline_vertex_array.size() * sizeof(u32)) /
stride;
m_attrib_ring_buffer.reserve_and_map(vertex_draw_count * max_vertex_attrib_size);
for (int index = 0; index < rsx::limits::vertex_count; ++index)
@ -443,7 +445,8 @@ u32 GLGSRender::upload_inline_array(const u32 &max_vertex_attrib_size, const u32
auto &texture = m_gl_attrib_buffers[index];
u8 *src = reinterpret_cast<u8*>(inline_vertex_array.data());
u8* src =
reinterpret_cast<u8*>(rsx::method_registers.current_draw_clause.inline_vertex_array.data());
auto mapping = m_attrib_ring_buffer.alloc_from_reserve(data_size, m_min_texbuffer_alignment);
u8 *dst = static_cast<u8*>(mapping.first);

View File

@ -327,7 +327,7 @@ namespace rsx
void thread::begin()
{
inline_vertex_array.clear();
rsx::method_registers.current_draw_clause.inline_vertex_array.clear();
}
void thread::end()
@ -521,11 +521,13 @@ namespace rsx
void thread::write_inline_array_to_buffer(void *dst_buffer)
{
u8* src = reinterpret_cast<u8*>(inline_vertex_array.data());
u8* src =
reinterpret_cast<u8*>(rsx::method_registers.current_draw_clause.inline_vertex_array.data());
u8* dst = (u8*)dst_buffer;
size_t bytes_written = 0;
while (bytes_written < inline_vertex_array.size() * sizeof(u32))
while (bytes_written <
rsx::method_registers.current_draw_clause.inline_vertex_array.size() * sizeof(u32))
{
for (int index = 0; index < rsx::limits::vertex_count; ++index)
{

View File

@ -183,8 +183,6 @@ namespace rsx
u32 local_mem_addr, main_mem_addr;
bool strict_ordering[0x1000];
std::vector<u32> inline_vertex_array;
bool m_rtts_dirty;
bool m_transform_constants_dirty;
bool m_textures_dirty[16];

View File

@ -394,7 +394,9 @@ u32 VKGSRender::upload_inlined_array()
stride += rsx::get_vertex_type_size_on_host(info.type(), info.size());
}
u32 vertex_draw_count = (u32)(inline_vertex_array.size() * sizeof(u32)) / stride;
u32 vertex_draw_count =
(u32)(rsx::method_registers.current_draw_clause.inline_vertex_array.size() * sizeof(u32)) /
stride;
for (int index = 0; index < rsx::limits::vertex_count; ++index)
{
@ -413,7 +415,8 @@ u32 VKGSRender::upload_inlined_array()
const VkFormat format = vk::get_suitable_vk_format(vertex_info.type(), vertex_info.size());
u32 offset_in_attrib_buffer = m_attrib_ring_info.alloc<256>(data_size);
u8 *src = reinterpret_cast<u8*>(inline_vertex_array.data());
u8* src =
reinterpret_cast<u8*>(rsx::method_registers.current_draw_clause.inline_vertex_array.data());
u8 *dst = static_cast<u8*>(m_attrib_ring_info.map(offset_in_attrib_buffer, data_size));
src += offsets[index];

View File

@ -206,7 +206,7 @@ namespace rsx
void draw_inline_array(thread* rsx, u32 _reg, u32 arg)
{
rsx::method_registers.current_draw_clause.command = rsx::draw_command::inlined_array;
rsx->inline_vertex_array.push_back(arg);
rsx::method_registers.current_draw_clause.inline_vertex_array.push_back(arg);
}
template<u32 index>
@ -269,7 +269,8 @@ namespace rsx
rsx::method_registers.current_draw_clause.first_count_commands.push_back(std::make_pair(0, max_vertex_count));
}
if (!(rsx::method_registers.current_draw_clause.first_count_commands.empty() && rsxthr->inline_vertex_array.empty()))
if (!(rsx::method_registers.current_draw_clause.first_count_commands.empty() &&
rsx::method_registers.current_draw_clause.inline_vertex_array.empty()))
{
rsxthr->end();
}

View File

@ -28,6 +28,8 @@ namespace rsx
primitive_type primitive;
draw_command command;
std::vector<u32> inline_vertex_array;
/**
* Stores the first and count argument from draw/draw indexed parameters between begin/end clauses.
*/