rsx/common/d3d12: Consider separate index range as a whole.

Fix Wolf of the Battlefield 3
This commit is contained in:
Vincent Lejeune 2016-01-12 00:54:07 +01:00
parent 68f9898171
commit 689dee9944
16 changed files with 490 additions and 415 deletions

View file

@ -270,57 +270,6 @@ namespace rsx
}
}
void thread::load_vertex_data(u32 first, u32 count)
{
vertex_draw_count += count;
for (int index = 0; index < limits::vertex_count; ++index)
{
const auto &info = vertex_arrays_info[index];
if (info.size == 0) // disabled
continue;
auto &data = vertex_arrays[index];
u32 element_size = get_vertex_type_size_on_host(info.type, info.size);
u32 dst_position = (u32)data.size();
data.resize(dst_position + count * element_size);
write_vertex_array_data_to_buffer(data.data() + dst_position, first, count, index, info);
}
}
void thread::load_vertex_index_data(u32 first, u32 count)
{
u32 address = get_address(method_registers[NV4097_SET_INDEX_ARRAY_ADDRESS], method_registers[NV4097_SET_INDEX_ARRAY_DMA] & 0xf);
u32 type = method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4;
u32 type_size = type == CELL_GCM_DRAW_INDEX_ARRAY_TYPE_32 ? sizeof(u32) : sizeof(u16);
u32 dst_offset = (u32)vertex_index_array.size();
vertex_index_array.resize(dst_offset + count * type_size);
u32 base_offset = method_registers[NV4097_SET_VERTEX_DATA_BASE_OFFSET];
u32 base_index = method_registers[NV4097_SET_VERTEX_DATA_BASE_INDEX];
switch (type)
{
case CELL_GCM_DRAW_INDEX_ARRAY_TYPE_32:
for (u32 i = 0; i < count; ++i)
{
(u32&)vertex_index_array[dst_offset + i * sizeof(u32)] = vm::read32(address + (first + i) * sizeof(u32));
}
break;
case CELL_GCM_DRAW_INDEX_ARRAY_TYPE_16:
for (u32 i = 0; i < count; ++i)
{
(u16&)vertex_index_array[dst_offset + i * sizeof(u16)] = vm::read16(address + (first + i) * sizeof(u16));
}
break;
}
}
void thread::capture_frame(const std::string &name)
{
frame_capture_data::draw_state draw_state = {};
@ -372,18 +321,12 @@ namespace rsx
void thread::begin()
{
draw_mode = method_registers[NV4097_SET_BEGIN_END];
first_count_commands.clear();
draw_mode = to_primitive_type(method_registers[NV4097_SET_BEGIN_END]);
}
void thread::end()
{
vertex_index_array.clear();
for (auto &vertex_array : vertex_arrays)
{
vertex_array.clear();
}
transform_constants.clear();
if (capture_current_frame)