mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12:00
rsx/common/d3d12/gl: Implement draw inline array support
This commit is contained in:
parent
34336ebfce
commit
cae2d929ab
6 changed files with 293 additions and 125 deletions
|
@ -175,6 +175,7 @@ namespace rsx
|
|||
|
||||
force_inline void draw_arrays(thread* rsx, u32 arg)
|
||||
{
|
||||
rsx->draw_command = thread::Draw_command::draw_command_array;
|
||||
u32 first = arg & 0xffffff;
|
||||
u32 count = (arg >> 24) + 1;
|
||||
|
||||
|
@ -183,6 +184,7 @@ namespace rsx
|
|||
|
||||
force_inline void draw_index_array(thread* rsx, u32 arg)
|
||||
{
|
||||
rsx->draw_command = thread::Draw_command::draw_command_indexed;
|
||||
u32 first = arg & 0xffffff;
|
||||
u32 count = (arg >> 24) + 1;
|
||||
|
||||
|
@ -190,6 +192,13 @@ namespace rsx
|
|||
rsx->load_vertex_index_data(first, count);
|
||||
}
|
||||
|
||||
force_inline void draw_inline_array(thread* rsx, u32 arg)
|
||||
{
|
||||
rsx->draw_command = thread::Draw_command::draw_command_inlined_array;
|
||||
rsx->draw_inline_vertex_array = true;
|
||||
rsx->inline_vertex_array.push_back(arg);
|
||||
}
|
||||
|
||||
template<u32 index>
|
||||
struct set_transform_constant
|
||||
{
|
||||
|
@ -225,6 +234,8 @@ namespace rsx
|
|||
{
|
||||
if (arg)
|
||||
{
|
||||
rsx->draw_inline_vertex_array = false;
|
||||
rsx->inline_vertex_array.clear();
|
||||
rsx->begin();
|
||||
return;
|
||||
}
|
||||
|
@ -774,6 +785,7 @@ namespace rsx
|
|||
bind<NV4097_CLEAR_SURFACE>();
|
||||
bind<NV4097_DRAW_ARRAYS, nv4097::draw_arrays>();
|
||||
bind<NV4097_DRAW_INDEX_ARRAY, nv4097::draw_index_array>();
|
||||
bind<NV4097_INLINE_ARRAY, nv4097::draw_inline_array>();
|
||||
bind_range<NV4097_SET_VERTEX_DATA_ARRAY_FORMAT, 1, 16, nv4097::set_vertex_data_array_format>();
|
||||
bind_range<NV4097_SET_VERTEX_DATA4UB_M, 1, 16, nv4097::set_vertex_data4ub_m>();
|
||||
bind_range<NV4097_SET_VERTEX_DATA1F_M, 1, 16, nv4097::set_vertex_data1f_m>();
|
||||
|
@ -1001,7 +1013,7 @@ namespace rsx
|
|||
color_index_to_record = { 0, 1, 2, 3 };
|
||||
break;
|
||||
}
|
||||
for (size_t i : color_index_to_record)
|
||||
/* for (size_t i : color_index_to_record)
|
||||
{
|
||||
draw_state.color_buffer[i].width = clip_w;
|
||||
draw_state.color_buffer[i].height = clip_h;
|
||||
|
@ -1018,7 +1030,7 @@ namespace rsx
|
|||
draw_state.stencil.height = clip_h;
|
||||
draw_state.stencil.data.resize(clip_w * clip_h * 4);
|
||||
copy_stencil_buffer_to_memory(draw_state.stencil.data.data());
|
||||
}
|
||||
}*/
|
||||
draw_state.programs = get_programs();
|
||||
draw_state.name = name;
|
||||
frame_debug.draw_calls.push_back(draw_state);
|
||||
|
@ -1199,6 +1211,42 @@ namespace rsx
|
|||
stream_vector_from_memory((char*)buffer + entry.first * 4 * sizeof(float), (void*)entry.second.rgba);
|
||||
}
|
||||
|
||||
void thread::write_inline_array_to_buffer(void *dst_buffer)
|
||||
{
|
||||
u8* src = reinterpret_cast<u8*>(inline_vertex_array.data());
|
||||
u8* dst = (u8*)dst_buffer;
|
||||
|
||||
size_t bytes_written = 0;
|
||||
while (bytes_written < inline_vertex_array.size() * sizeof(u32))
|
||||
{
|
||||
for (int index = 0; index < rsx::limits::vertex_count; ++index)
|
||||
{
|
||||
const auto &info = vertex_arrays_info[index];
|
||||
|
||||
if (!info.size) // disabled
|
||||
continue;
|
||||
|
||||
u32 type_size = rsx::get_vertex_type_size(info.type);
|
||||
u32 element_size = type_size * info.size;
|
||||
|
||||
if (type_size == 1 && info.size == 4)
|
||||
{
|
||||
dst[0] = src[3];
|
||||
dst[1] = src[2];
|
||||
dst[2] = src[1];
|
||||
dst[3] = src[0];
|
||||
}
|
||||
else
|
||||
memcpy(dst, src, element_size);
|
||||
|
||||
src += element_size;
|
||||
dst += element_size;
|
||||
|
||||
bytes_written += element_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u64 thread::timestamp() const
|
||||
{
|
||||
// Get timestamp, and convert it from microseconds to nanoseconds
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue