mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
rsx: Align down index array offset
* Also use improved to_be_t<> template (recetly ignoring one byte long types) for vm gsl::byte referencing, remove redundent narrow<> cast (same type)
This commit is contained in:
parent
3bb70e837a
commit
945abcc6cd
6 changed files with 16 additions and 14 deletions
|
@ -171,9 +171,9 @@ namespace rsx
|
|||
const u32 base_address = method_registers.index_array_address();
|
||||
const u32 memory_location = method_registers.index_array_location();
|
||||
|
||||
const u32 base_addr = get_address(base_address, memory_location);
|
||||
const u32 type_size = get_index_type_size(method_registers.index_type());
|
||||
const auto index_type = method_registers.index_type();
|
||||
const u32 type_size = get_index_type_size(index_type);
|
||||
const u32 base_addr = get_address(base_address, memory_location) & ~(type_size - 1);
|
||||
|
||||
// manually parse index buffer and copy vertex buffer
|
||||
u32 min_index = 0xFFFFFFFF, max_index = 0;
|
||||
|
|
|
@ -450,7 +450,7 @@ std::vector<rsx_subresource_layout> get_subresources_layout_impl(const RsxTextur
|
|||
int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
|
||||
|
||||
const u32 texaddr = rsx::get_address(texture.offset(), texture.location());
|
||||
auto pixels = reinterpret_cast<const gsl::byte*>(vm::_ptr<const u8>(texaddr));
|
||||
auto pixels = vm::_ptr<const gsl::byte>(texaddr);
|
||||
|
||||
const bool is_swizzled = !(texture.format() & CELL_GCM_TEXTURE_LN);
|
||||
const bool has_border = !texture.border_type();
|
||||
|
|
|
@ -2407,7 +2407,7 @@ namespace rsx
|
|||
subres.height_in_block = image_height;
|
||||
subres.pitch_in_block = full_width;
|
||||
subres.depth = 1;
|
||||
subres.data = { reinterpret_cast<const gsl::byte*>(vm::base(image_base)), src.pitch * image_height };
|
||||
subres.data = { vm::_ptr<const gsl::byte>(image_base), src.pitch * image_height };
|
||||
subresource_layout.push_back(subres);
|
||||
|
||||
vram_texture = upload_image_from_cpu(cmd, rsx_range, image_width, image_height, 1, 1, src.pitch, gcm_format, texture_upload_context::blit_engine_src,
|
||||
|
@ -2539,7 +2539,7 @@ namespace rsx
|
|||
subres.height_in_block = dst_dimensions.height;
|
||||
subres.pitch_in_block = pitch_in_block;
|
||||
subres.depth = 1;
|
||||
subres.data = { reinterpret_cast<const gsl::byte*>(vm::get_super_ptr(dst.rsx_address)), dst.pitch * dst_dimensions.height };
|
||||
subres.data = { vm::get_super_ptr<const gsl::byte>(dst.rsx_address), dst.pitch * dst_dimensions.height };
|
||||
subresource_layout.push_back(subres);
|
||||
|
||||
cached_dest = upload_image_from_cpu(cmd, rsx_range, dst_dimensions.width, dst_dimensions.height, 1, 1, dst.pitch,
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace
|
|||
rsx::index_array_type::u32:
|
||||
rsx::method_registers.index_type();
|
||||
|
||||
u32 type_size = ::narrow<u32>(get_index_type_size(type));
|
||||
u32 type_size = get_index_type_size(type);
|
||||
|
||||
const u32 vertex_count = rsx::method_registers.current_draw_clause.get_elements_count();
|
||||
u32 index_count = vertex_count;
|
||||
|
|
|
@ -838,17 +838,19 @@ namespace rsx
|
|||
return{(const gsl::byte*)element_push_buffer.data(), ::narrow<u32>(element_push_buffer.size() * sizeof(u32))};
|
||||
}
|
||||
|
||||
u32 address = rsx::get_address(rsx::method_registers.index_array_address(), rsx::method_registers.index_array_location());
|
||||
rsx::index_array_type type = rsx::method_registers.index_type();
|
||||
const rsx::index_array_type type = rsx::method_registers.index_type();
|
||||
const u32 type_size = get_index_type_size(type);
|
||||
|
||||
u32 type_size = ::narrow<u32>(get_index_type_size(type));
|
||||
bool is_primitive_restart_enabled = rsx::method_registers.restart_index_enabled();
|
||||
u32 primitive_restart_index = rsx::method_registers.restart_index();
|
||||
u32 address = rsx::get_address(rsx::method_registers.index_array_address(), rsx::method_registers.index_array_location());
|
||||
address &= ~(type_size - 1); // Force aligned indices as realhw
|
||||
|
||||
const bool is_primitive_restart_enabled = rsx::method_registers.restart_index_enabled();
|
||||
const u32 primitive_restart_index = rsx::method_registers.restart_index();
|
||||
|
||||
const u32 first = draw_indexed_clause.min_index();
|
||||
const u32 count = draw_indexed_clause.get_elements_count();
|
||||
|
||||
const gsl::byte* ptr = static_cast<const gsl::byte*>(vm::base(address));
|
||||
const auto ptr = vm::_ptr<const gsl::byte>(address);
|
||||
return{ ptr + first * type_size, count * type_size };
|
||||
}
|
||||
|
||||
|
@ -862,7 +864,7 @@ namespace rsx
|
|||
const u32 first = draw_array_clause.min_index();
|
||||
const u32 count = draw_array_clause.get_elements_count();
|
||||
|
||||
const gsl::byte* ptr = gsl::narrow_cast<const gsl::byte*>(vm::base(address));
|
||||
const gsl::byte* ptr = vm::_ptr<const gsl::byte>(address);
|
||||
return {ptr + first * vertex_array_info.stride(), count * vertex_array_info.stride() + element_size};
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace
|
|||
rsx::index_array_type::u32 :
|
||||
rsx::method_registers.index_type();
|
||||
|
||||
u32 type_size = gsl::narrow<u32>(get_index_type_size(index_type));
|
||||
u32 type_size = get_index_type_size(index_type);
|
||||
|
||||
u32 index_count = rsx::method_registers.current_draw_clause.get_elements_count();
|
||||
if (primitives_emulated)
|
||||
|
|
Loading…
Add table
Reference in a new issue