mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
C-style cast cleanup VI
This commit is contained in:
parent
d973835bef
commit
377e7d2a73
@ -149,27 +149,27 @@ llvm::Constant* cpu_translator::make_const_vector<v128>(v128 v, llvm::Type* t)
|
|||||||
|
|
||||||
if (sct->isIntegerTy(8))
|
if (sct->isIntegerTy(8))
|
||||||
{
|
{
|
||||||
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef((const u8*)v._bytes, 16));
|
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const u8*>(v._bytes), 16));
|
||||||
}
|
}
|
||||||
else if (sct->isIntegerTy(16))
|
else if (sct->isIntegerTy(16))
|
||||||
{
|
{
|
||||||
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef((const u16*)v._bytes, 8));
|
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const u16*>(v._bytes), 8));
|
||||||
}
|
}
|
||||||
else if (sct->isIntegerTy(32))
|
else if (sct->isIntegerTy(32))
|
||||||
{
|
{
|
||||||
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef((const u32*)v._bytes, 4));
|
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const u32*>(v._bytes), 4));
|
||||||
}
|
}
|
||||||
else if (sct->isIntegerTy(64))
|
else if (sct->isIntegerTy(64))
|
||||||
{
|
{
|
||||||
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef((const u64*)v._bytes, 2));
|
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const u64*>(v._bytes), 2));
|
||||||
}
|
}
|
||||||
else if (sct->isFloatTy())
|
else if (sct->isFloatTy())
|
||||||
{
|
{
|
||||||
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef((const f32*)v._bytes, 4));
|
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const f32*>(v._bytes), 4));
|
||||||
}
|
}
|
||||||
else if (sct->isDoubleTy())
|
else if (sct->isDoubleTy())
|
||||||
{
|
{
|
||||||
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef((const f64*)v._bytes, 2));
|
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const f64*>(v._bytes), 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::raw_error("No supported constant type" HERE);
|
fmt::raw_error("No supported constant type" HERE);
|
||||||
|
@ -207,11 +207,11 @@ namespace rsx
|
|||||||
for (u32 i = 0; i < idxCount; ++i)
|
for (u32 i = 0; i < idxCount; ++i)
|
||||||
{
|
{
|
||||||
u16 index = fifo[i];
|
u16 index = fifo[i];
|
||||||
if (is_primitive_restart_enabled && (u32)index == primitive_restart_index)
|
if (is_primitive_restart_enabled && u32{index} == primitive_restart_index)
|
||||||
continue;
|
continue;
|
||||||
index = (u16)get_index_from_base(index, method_registers.vertex_data_base_index());
|
index = static_cast<u16>(get_index_from_base(index, method_registers.vertex_data_base_index()));
|
||||||
min_index = (u16)std::min(index, (u16)min_index);
|
min_index = std::min<u16>(index, static_cast<u16>(min_index));
|
||||||
max_index = (u16)std::max(index, (u16)max_index);
|
max_index = std::max<u16>(index, static_cast<u16>(max_index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ namespace rsx
|
|||||||
block.location = src_dma & 0xf;
|
block.location = src_dma & 0xf;
|
||||||
|
|
||||||
const auto src_address = rsx::get_address(block.offset, block.location);
|
const auto src_address = rsx::get_address(block.offset, block.location);
|
||||||
u8* pixels_src = (u8*)vm::base(src_address);
|
u8* pixels_src = vm::_ptr<u8>(src_address);
|
||||||
|
|
||||||
const u32 src_size = in_pitch * (in_h - 1) + (in_w * in_bpp);
|
const u32 src_size = in_pitch * (in_h - 1) + (in_w * in_bpp);
|
||||||
rsx->read_barrier(src_address, src_size, true);
|
rsx->read_barrier(src_address, src_size, true);
|
||||||
|
@ -134,7 +134,7 @@ namespace rsx
|
|||||||
|
|
||||||
cs.buffer_state.buffers[i] = buf;
|
cs.buffer_state.buffers[i] = buf;
|
||||||
sys_rsx_context_attribute(context_id, 0x104, i,
|
sys_rsx_context_attribute(context_id, 0x104, i,
|
||||||
(u64)dbstate.buffers[i].width << 32 | dbstate.buffers[i].height, (u64)dbstate.buffers[i].pitch << 32 | dbstate.buffers[i].offset, 0);
|
u64{dbstate.buffers[i].width} << 32 | dbstate.buffers[i].height, u64{dbstate.buffers[i].pitch} << 32 | dbstate.buffers[i].offset, 0);
|
||||||
}
|
}
|
||||||
cs.display_buffer_hash = replay_cmd.display_buffer_state;
|
cs.display_buffer_hash = replay_cmd.display_buffer_state;
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ namespace rsx
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
cs.tile_state.tiles[i] = ti;
|
cs.tile_state.tiles[i] = ti;
|
||||||
sys_rsx_context_attribute(context_id, 0x300, i, (u64)ti.tile << 32 | ti.limit, (u64)ti.pitch << 32 | ti.format, 0);
|
sys_rsx_context_attribute(context_id, 0x300, i, u64{ti.tile} << 32 | ti.limit, u64{ti.pitch} << 32 | ti.format, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 i = 0; i < limits::zculls_count; ++i)
|
for (u32 i = 0; i < limits::zculls_count; ++i)
|
||||||
@ -163,7 +163,7 @@ namespace rsx
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
cs.tile_state.zculls[i] = zci;
|
cs.tile_state.zculls[i] = zci;
|
||||||
sys_rsx_context_attribute(context_id, 0x301, i, (u64)zci.region << 32 | zci.size, (u64)zci.start << 32 | zci.offset, (u64)zci.status0 << 32 | zci.status1);
|
sys_rsx_context_attribute(context_id, 0x301, i, u64{zci.region} << 32 | zci.size, u64{zci.start} << 32 | zci.offset, u64{zci.status0} << 32 | zci.status1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cs.tile_hash = replay_cmd.tile_state;
|
cs.tile_hash = replay_cmd.tile_state;
|
||||||
|
@ -213,7 +213,7 @@ std::string FragmentProgramDecompiler::AddConst()
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto data = (be_t<u32>*) ((char*)m_prog.addr + m_size + 4 * u32{sizeof(u32)});
|
auto data = reinterpret_cast<be_t<u32>*>(static_cast<char*>(m_prog.addr) + m_size + 4 * sizeof(u32));
|
||||||
m_offset = 2 * 4 * sizeof(u32);
|
m_offset = 2 * 4 * sizeof(u32);
|
||||||
u32 x = GetData(data[0]);
|
u32 x = GetData(data[0]);
|
||||||
u32 y = GetData(data[1]);
|
u32 y = GetData(data[1]);
|
||||||
@ -1072,7 +1072,7 @@ bool FragmentProgramDecompiler::handle_tex_srb(u32 opcode)
|
|||||||
|
|
||||||
std::string FragmentProgramDecompiler::Decompile()
|
std::string FragmentProgramDecompiler::Decompile()
|
||||||
{
|
{
|
||||||
auto data = (be_t<u32>*) m_prog.addr;
|
auto data = static_cast<be_t<u32>*>(m_prog.addr);
|
||||||
m_size = 0;
|
m_size = 0;
|
||||||
m_location = 0;
|
m_location = 0;
|
||||||
m_loop_count = 0;
|
m_loop_count = 0;
|
||||||
|
@ -213,7 +213,7 @@ public:
|
|||||||
|
|
||||||
for (auto &entry : glyph_map)
|
for (auto &entry : glyph_map)
|
||||||
{
|
{
|
||||||
entry.glyph_point_offset = (u32)result.size();
|
entry.glyph_point_offset = ::size32(result);
|
||||||
|
|
||||||
for (std::size_t j = 0; j < entry.plot.size(); ++j)
|
for (std::size_t j = 0; j < entry.plot.size(); ++j)
|
||||||
{
|
{
|
||||||
@ -226,14 +226,14 @@ public:
|
|||||||
if (line & (1 << i))
|
if (line & (1 << i))
|
||||||
{
|
{
|
||||||
// Font is inverted, so we correct it for conventional renderers
|
// Font is inverted, so we correct it for conventional renderers
|
||||||
const auto x = (float)(7 - i);
|
const auto x = static_cast<float>(7 - i);
|
||||||
const auto y = (float)(15 - j);
|
const auto y = static_cast<float>(15 - j);
|
||||||
result.emplace_back(x, y);
|
result.emplace_back(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.points_count = (u32)result.size() - entry.glyph_point_offset;
|
entry.points_count = ::size32(result) - entry.glyph_point_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -29,13 +29,13 @@ namespace
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
gsl::span<T> as_span_workaround(gsl::span<std::byte> unformated_span)
|
gsl::span<T> as_span_workaround(gsl::span<std::byte> unformated_span)
|
||||||
{
|
{
|
||||||
return{ (T*)unformated_span.data(), unformated_span.size_bytes() / sizeof(T) };
|
return{ reinterpret_cast<T*>(unformated_span.data()), unformated_span.size_bytes() / sizeof(T) };
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
gsl::span<T> as_const_span(gsl::span<const std::byte> unformated_span)
|
gsl::span<T> as_const_span(gsl::span<const std::byte> unformated_span)
|
||||||
{
|
{
|
||||||
return{ (T*)unformated_span.data(), unformated_span.size_bytes() / sizeof(T) };
|
return{ reinterpret_cast<T*>(unformated_span.data()), unformated_span.size_bytes() / sizeof(T) };
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make this function part of GSL
|
// TODO: Make this function part of GSL
|
||||||
@ -106,7 +106,7 @@ struct copy_unmodified_block_swizzled
|
|||||||
{
|
{
|
||||||
if (std::is_same<T, U>::value && dst_pitch_in_block == width_in_block && words_per_block == 1 && !border)
|
if (std::is_same<T, U>::value && dst_pitch_in_block == width_in_block && words_per_block == 1 && !border)
|
||||||
{
|
{
|
||||||
rsx::convert_linear_swizzle_3d<T>((void*)src.data(), (void*)dst.data(), width_in_block, row_count, depth);
|
rsx::convert_linear_swizzle_3d<T>(src.data(), dst.data(), width_in_block, row_count, depth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -127,20 +127,20 @@ struct copy_unmodified_block_swizzled
|
|||||||
|
|
||||||
if (LIKELY(words_per_block == 1))
|
if (LIKELY(words_per_block == 1))
|
||||||
{
|
{
|
||||||
rsx::convert_linear_swizzle_3d<T>((void*)src.data(), tmp.data(), padded_width, padded_height, depth);
|
rsx::convert_linear_swizzle_3d<T>(src.data(), tmp.data(), padded_width, padded_height, depth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (words_per_block * sizeof(T))
|
switch (words_per_block * sizeof(T))
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
rsx::convert_linear_swizzle_3d<u32>((void*)src.data(), tmp.data(), padded_width, padded_height, depth);
|
rsx::convert_linear_swizzle_3d<u32>(src.data(), tmp.data(), padded_width, padded_height, depth);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
rsx::convert_linear_swizzle_3d<u64>((void*)src.data(), tmp.data(), padded_width, padded_height, depth);
|
rsx::convert_linear_swizzle_3d<u64>(src.data(), tmp.data(), padded_width, padded_height, depth);
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
rsx::convert_linear_swizzle_3d<u128>((void*)src.data(), tmp.data(), padded_width, padded_height, depth);
|
rsx::convert_linear_swizzle_3d<u128>(src.data(), tmp.data(), padded_width, padded_height, depth);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Failed to decode swizzled format, words_per_block=%d, src_type_size=%d", words_per_block, sizeof(T));
|
fmt::throw_exception("Failed to decode swizzled format, words_per_block=%d, src_type_size=%d", words_per_block, sizeof(T));
|
||||||
@ -303,7 +303,7 @@ struct copy_rgb655_block_swizzled
|
|||||||
u32 size = padded_width * padded_height * depth * 2;
|
u32 size = padded_width * padded_height * depth * 2;
|
||||||
std::vector<U> tmp(size);
|
std::vector<U> tmp(size);
|
||||||
|
|
||||||
rsx::convert_linear_swizzle_3d<U>((void*)src.data(), tmp.data(), padded_width, padded_height, depth);
|
rsx::convert_linear_swizzle_3d<U>(src.data(), tmp.data(), padded_width, padded_height, depth);
|
||||||
|
|
||||||
gsl::span<const U> src_span = tmp;
|
gsl::span<const U> src_span = tmp;
|
||||||
copy_rgb655_block::copy_mipmap_level(dst, src_span, width_in_block, row_count, depth, border, dst_pitch_in_block, padded_width);
|
copy_rgb655_block::copy_mipmap_level(dst, src_span, width_in_block, row_count, depth, border, dst_pitch_in_block, padded_width);
|
||||||
@ -687,7 +687,7 @@ texture_memory_info upload_texture_subresource(gsl::span<std::byte> dst_buffer,
|
|||||||
else if (word_size == 4)
|
else if (word_size == 4)
|
||||||
{
|
{
|
||||||
result.require_deswizzle = (is_swizzled && caps.supports_hw_deswizzle);
|
result.require_deswizzle = (is_swizzled && caps.supports_hw_deswizzle);
|
||||||
|
|
||||||
if (is_swizzled && !caps.supports_hw_deswizzle)
|
if (is_swizzled && !caps.supports_hw_deswizzle)
|
||||||
copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround<u32>(dst_buffer), as_const_span<const u32>(src_layout.data), words_per_block, w, h, depth, src_layout.border, dst_pitch_in_block);
|
copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround<u32>(dst_buffer), as_const_span<const u32>(src_layout.data), words_per_block, w, h, depth, src_layout.border, dst_pitch_in_block);
|
||||||
else
|
else
|
||||||
@ -818,7 +818,7 @@ u8 get_format_block_size_in_bytes(rsx::surface_color_format format)
|
|||||||
case rsx::surface_color_format::w32z32y32x32:
|
case rsx::surface_color_format::w32z32y32x32:
|
||||||
return 16;
|
return 16;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Invalid color format 0x%x" HERE, (u32)format);
|
fmt::throw_exception("Invalid color format 0x%x" HERE, static_cast<u32>(format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,7 +890,7 @@ size_t get_placed_texture_storage_size(u16 width, u16 height, u32 depth, u8 form
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mipmap, height and width aren't allowed to be zero
|
// Mipmap, height and width aren't allowed to be zero
|
||||||
return verify("Texture params" HERE, result) * (cubemap ? 6 : 1);
|
return verify("Texture params" HERE, result) * (cubemap ? 6 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t get_placed_texture_storage_size(const rsx::fragment_texture &texture, size_t row_pitch_alignment, size_t mipmap_alignment)
|
size_t get_placed_texture_storage_size(const rsx::fragment_texture &texture, size_t row_pitch_alignment, size_t mipmap_alignment)
|
||||||
@ -1026,7 +1026,7 @@ std::pair<u32, bool> get_compatible_gcm_format(rsx::surface_color_format format)
|
|||||||
case rsx::surface_color_format::x32:
|
case rsx::surface_color_format::x32:
|
||||||
return{ CELL_GCM_TEXTURE_X32_FLOAT, true }; //verified
|
return{ CELL_GCM_TEXTURE_X32_FLOAT, true }; //verified
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unhandled surface format 0x%x", (u32)format);
|
fmt::throw_exception("Unhandled surface format 0x%x", static_cast<u32>(format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ namespace rsx
|
|||||||
if (Traits::surface_is_pitch_compatible(aliased_surface->second, pitch))
|
if (Traits::surface_is_pitch_compatible(aliased_surface->second, pitch))
|
||||||
{
|
{
|
||||||
auto surface = Traits::get(aliased_surface->second);
|
auto surface = Traits::get(aliased_surface->second);
|
||||||
split_surface_region<!depth>(command_list, address, surface, (u16)width, (u16)height, bpp, antialias);
|
split_surface_region<!depth>(command_list, address, surface, static_cast<u16>(width), static_cast<u16>(height), bpp, antialias);
|
||||||
|
|
||||||
if (!old_surface || old_surface->last_use_tag < surface->last_use_tag)
|
if (!old_surface || old_surface->last_use_tag < surface->last_use_tag)
|
||||||
{
|
{
|
||||||
|
@ -938,7 +938,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
auto &tex = *It;
|
auto &tex = *It;
|
||||||
|
|
||||||
if (!tex.is_dirty() && (context_mask & (u32)tex.get_context()))
|
if (!tex.is_dirty() && (context_mask & static_cast<u32>(tex.get_context())))
|
||||||
{
|
{
|
||||||
if constexpr (check_unlocked)
|
if constexpr (check_unlocked)
|
||||||
{
|
{
|
||||||
@ -1362,7 +1362,7 @@ namespace rsx
|
|||||||
desc.external_handle,
|
desc.external_handle,
|
||||||
surface_transform::coordinate_transform,
|
surface_transform::coordinate_transform,
|
||||||
0,
|
0,
|
||||||
0, (u16)(desc.slice_h * n),
|
0, static_cast<u16>(desc.slice_h * n),
|
||||||
0, 0, n,
|
0, 0, n,
|
||||||
desc.width, desc.height,
|
desc.width, desc.height,
|
||||||
desc.width, desc.height
|
desc.width, desc.height
|
||||||
@ -1388,7 +1388,7 @@ namespace rsx
|
|||||||
desc.external_handle,
|
desc.external_handle,
|
||||||
surface_transform::coordinate_transform,
|
surface_transform::coordinate_transform,
|
||||||
0,
|
0,
|
||||||
0, (u16)(desc.slice_h * n),
|
0, static_cast<u16>(desc.slice_h * n),
|
||||||
0, 0, n,
|
0, 0, n,
|
||||||
desc.width, desc.height,
|
desc.width, desc.height,
|
||||||
desc.width, desc.height
|
desc.width, desc.height
|
||||||
@ -1417,7 +1417,7 @@ namespace rsx
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
//Throw
|
//Throw
|
||||||
fmt::throw_exception("Invalid deferred command op 0x%X" HERE, (u32)desc.op);
|
fmt::throw_exception("Invalid deferred command op 0x%X" HERE, static_cast<u32>(desc.op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1730,14 +1730,14 @@ namespace rsx
|
|||||||
case rsx::texture_dimension_extended::texture_dimension_cubemap:
|
case rsx::texture_dimension_extended::texture_dimension_cubemap:
|
||||||
attributes.depth = 6;
|
attributes.depth = 6;
|
||||||
subsurface_count = 1;
|
subsurface_count = 1;
|
||||||
tex_size = (u32)get_texture_size(tex);
|
tex_size = static_cast<u32>(get_texture_size(tex));
|
||||||
required_surface_height = tex_size / attributes.pitch;
|
required_surface_height = tex_size / attributes.pitch;
|
||||||
attributes.slice_h = required_surface_height / attributes.depth;
|
attributes.slice_h = required_surface_height / attributes.depth;
|
||||||
break;
|
break;
|
||||||
case rsx::texture_dimension_extended::texture_dimension_3d:
|
case rsx::texture_dimension_extended::texture_dimension_3d:
|
||||||
attributes.depth = tex.depth();
|
attributes.depth = tex.depth();
|
||||||
subsurface_count = 1;
|
subsurface_count = 1;
|
||||||
tex_size = (u32)get_texture_size(tex);
|
tex_size = static_cast<u32>(get_texture_size(tex));
|
||||||
required_surface_height = tex_size / attributes.pitch;
|
required_surface_height = tex_size / attributes.pitch;
|
||||||
attributes.slice_h = required_surface_height / attributes.depth;
|
attributes.slice_h = required_surface_height / attributes.depth;
|
||||||
break;
|
break;
|
||||||
@ -1752,7 +1752,7 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_ERROR(RSX, "Unimplemented unnormalized sampling for texture type %d", (u32)extended_dimension);
|
LOG_ERROR(RSX, "Unimplemented unnormalized sampling for texture type %d", static_cast<u32>(extended_dimension));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1872,7 +1872,7 @@ namespace rsx
|
|||||||
|
|
||||||
if (!tex_size)
|
if (!tex_size)
|
||||||
{
|
{
|
||||||
tex_size = (u32)get_texture_size(tex);
|
tex_size = static_cast<u32>(get_texture_size(tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
lock.upgrade();
|
lock.upgrade();
|
||||||
@ -1916,8 +1916,8 @@ namespace rsx
|
|||||||
|
|
||||||
// Offset in x and y for src is 0 (it is already accounted for when getting pixels_src)
|
// Offset in x and y for src is 0 (it is already accounted for when getting pixels_src)
|
||||||
// Reproject final clip onto source...
|
// Reproject final clip onto source...
|
||||||
u16 src_w = (u16)((f32)dst.clip_width / scale_x);
|
u16 src_w = static_cast<u16>(dst.clip_width / scale_x);
|
||||||
u16 src_h = (u16)((f32)dst.clip_height / scale_y);
|
u16 src_h = static_cast<u16>(dst.clip_height / scale_y);
|
||||||
|
|
||||||
u16 dst_w = dst.clip_width;
|
u16 dst_w = dst.clip_width;
|
||||||
u16 dst_h = dst.clip_height;
|
u16 dst_h = dst.clip_height;
|
||||||
@ -2100,7 +2100,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
// Enable type scaling in src
|
// Enable type scaling in src
|
||||||
typeless_info.src_is_typeless = true;
|
typeless_info.src_is_typeless = true;
|
||||||
typeless_info.src_scaling_hint = (f32)bpp / src_bpp;
|
typeless_info.src_scaling_hint = static_cast<f32>(bpp) / src_bpp;
|
||||||
typeless_info.src_gcm_format = helpers::get_sized_blit_format(src_is_argb8, false);
|
typeless_info.src_gcm_format = helpers::get_sized_blit_format(src_is_argb8, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2126,7 +2126,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
// Enable type scaling in dst
|
// Enable type scaling in dst
|
||||||
typeless_info.dst_is_typeless = true;
|
typeless_info.dst_is_typeless = true;
|
||||||
typeless_info.dst_scaling_hint = (f32)bpp / dst_bpp;
|
typeless_info.dst_scaling_hint = static_cast<f32>(bpp) / dst_bpp;
|
||||||
typeless_info.dst_gcm_format = helpers::get_sized_blit_format(dst_is_argb8, false);
|
typeless_info.dst_gcm_format = helpers::get_sized_blit_format(dst_is_argb8, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2232,8 +2232,8 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate clipping region
|
// Validate clipping region
|
||||||
if ((unsigned)dst_area.x2 <= surface->get_width() &&
|
if (static_cast<uint>(dst_area.x2) <= surface->get_width() &&
|
||||||
(unsigned)dst_area.y2 <= surface->get_height())
|
static_cast<uint>(dst_area.y2) <= surface->get_height())
|
||||||
{
|
{
|
||||||
cached_dest = surface;
|
cached_dest = surface;
|
||||||
dest_texture = cached_dest->get_raw_texture();
|
dest_texture = cached_dest->get_raw_texture();
|
||||||
@ -2291,7 +2291,7 @@ namespace rsx
|
|||||||
typeless_info.dst_context = texture_upload_context::framebuffer_storage;
|
typeless_info.dst_context = texture_upload_context::framebuffer_storage;
|
||||||
dst_is_depth_surface = typeless_info.dst_is_typeless ? false : dst_subres.is_depth;
|
dst_is_depth_surface = typeless_info.dst_is_typeless ? false : dst_subres.is_depth;
|
||||||
|
|
||||||
max_dst_width = (u16)(dst_subres.surface->get_surface_width(rsx::surface_metrics::samples) * typeless_info.dst_scaling_hint);
|
max_dst_width = static_cast<u16>(dst_subres.surface->get_surface_width(rsx::surface_metrics::samples) * typeless_info.dst_scaling_hint);
|
||||||
max_dst_height = dst_subres.surface->get_surface_height(rsx::surface_metrics::samples);
|
max_dst_height = dst_subres.surface->get_surface_height(rsx::surface_metrics::samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2458,8 +2458,8 @@ namespace rsx
|
|||||||
// Reproject clip offsets onto source to simplify blit
|
// Reproject clip offsets onto source to simplify blit
|
||||||
if (dst.clip_x || dst.clip_y)
|
if (dst.clip_x || dst.clip_y)
|
||||||
{
|
{
|
||||||
const u16 scaled_clip_offset_x = (const u16)((f32)dst.clip_x / (scale_x * typeless_info.src_scaling_hint));
|
const u16 scaled_clip_offset_x = static_cast<u16>(dst.clip_x / (scale_x * typeless_info.src_scaling_hint));
|
||||||
const u16 scaled_clip_offset_y = (const u16)((f32)dst.clip_y / scale_y);
|
const u16 scaled_clip_offset_y = static_cast<u16>(dst.clip_y / scale_y);
|
||||||
|
|
||||||
src_area.x1 += scaled_clip_offset_x;
|
src_area.x1 += scaled_clip_offset_x;
|
||||||
src_area.x2 += scaled_clip_offset_x;
|
src_area.x2 += scaled_clip_offset_x;
|
||||||
@ -2625,14 +2625,14 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (src_subres.surface->get_surface_width(rsx::surface_metrics::pixels) > g_cfg.video.min_scalable_dimension)
|
if (src_subres.surface->get_surface_width(rsx::surface_metrics::pixels) > g_cfg.video.min_scalable_dimension)
|
||||||
{
|
{
|
||||||
src_area.x1 = (u16)(src_area.x1 * resolution_scale);
|
src_area.x1 = static_cast<u16>(src_area.x1 * resolution_scale);
|
||||||
src_area.x2 = (u16)(src_area.x2 * resolution_scale);
|
src_area.x2 = static_cast<u16>(src_area.x2 * resolution_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_subres.surface->get_surface_height(rsx::surface_metrics::pixels) > g_cfg.video.min_scalable_dimension)
|
if (src_subres.surface->get_surface_height(rsx::surface_metrics::pixels) > g_cfg.video.min_scalable_dimension)
|
||||||
{
|
{
|
||||||
src_area.y1 = (u16)(src_area.y1 * resolution_scale);
|
src_area.y1 = static_cast<u16>(src_area.y1 * resolution_scale);
|
||||||
src_area.y2 = (u16)(src_area.y2 * resolution_scale);
|
src_area.y2 = static_cast<u16>(src_area.y2 * resolution_scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2640,14 +2640,14 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (dst_subres.surface->get_surface_width(rsx::surface_metrics::pixels) > g_cfg.video.min_scalable_dimension)
|
if (dst_subres.surface->get_surface_width(rsx::surface_metrics::pixels) > g_cfg.video.min_scalable_dimension)
|
||||||
{
|
{
|
||||||
dst_area.x1 = (u16)(dst_area.x1 * resolution_scale);
|
dst_area.x1 = static_cast<u16>(dst_area.x1 * resolution_scale);
|
||||||
dst_area.x2 = (u16)(dst_area.x2 * resolution_scale);
|
dst_area.x2 = static_cast<u16>(dst_area.x2 * resolution_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst_subres.surface->get_surface_height(rsx::surface_metrics::pixels) > g_cfg.video.min_scalable_dimension)
|
if (dst_subres.surface->get_surface_height(rsx::surface_metrics::pixels) > g_cfg.video.min_scalable_dimension)
|
||||||
{
|
{
|
||||||
dst_area.y1 = (u16)(dst_area.y1 * resolution_scale);
|
dst_area.y1 = static_cast<u16>(dst_area.y1 * resolution_scale);
|
||||||
dst_area.y2 = (u16)(dst_area.y2 * resolution_scale);
|
dst_area.y2 = static_cast<u16>(dst_area.y2 * resolution_scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2819,7 +2819,7 @@ namespace rsx
|
|||||||
f32 get_cache_miss_ratio() const
|
f32 get_cache_miss_ratio() const
|
||||||
{
|
{
|
||||||
const auto num_flushes = m_flushes_this_frame.load();
|
const auto num_flushes = m_flushes_this_frame.load();
|
||||||
return (num_flushes == 0u) ? 0.f : (f32)m_misses_this_frame.load() / num_flushes;
|
return (num_flushes == 0u) ? 0.f : static_cast<f32>(m_misses_this_frame.load()) / num_flushes;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -289,8 +289,8 @@ namespace rsx
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto slice_begin = u32(slice * attr.slice_h);
|
const u32 slice_begin = slice * attr.slice_h;
|
||||||
const auto slice_end = u32(slice_begin + attr.height);
|
const u32 slice_end = slice_begin + attr.height;
|
||||||
|
|
||||||
const auto dst_y = std::get<1>(clipped).y;
|
const auto dst_y = std::get<1>(clipped).y;
|
||||||
const auto dst_h = std::get<2>(clipped).height;
|
const auto dst_h = std::get<2>(clipped).height;
|
||||||
@ -302,9 +302,9 @@ namespace rsx
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u16 dst_w = (u16)std::get<2>(clipped).width;
|
const u16 dst_w = static_cast<u16>(std::get<2>(clipped).width);
|
||||||
const u16 src_w = u16(dst_w * attr.bpp) / section_bpp;
|
const u16 src_w = static_cast<u16>(dst_w * attr.bpp) / section_bpp;
|
||||||
const u16 height = (u16)std::get<2>(clipped).height;
|
const u16 height = static_cast<u16>(std::get<2>(clipped).height);
|
||||||
|
|
||||||
if (scaling)
|
if (scaling)
|
||||||
{
|
{
|
||||||
@ -314,10 +314,10 @@ namespace rsx
|
|||||||
section->get_raw_texture(),
|
section->get_raw_texture(),
|
||||||
surface_transform::identity,
|
surface_transform::identity,
|
||||||
0,
|
0,
|
||||||
(u16)std::get<0>(clipped).x,
|
static_cast<u16>(std::get<0>(clipped).x),
|
||||||
(u16)std::get<0>(clipped).y,
|
static_cast<u16>(std::get<0>(clipped).y),
|
||||||
rsx::apply_resolution_scale((u16)std::get<1>(clipped).x, true),
|
rsx::apply_resolution_scale(static_cast<u16>(std::get<1>(clipped).x), true),
|
||||||
rsx::apply_resolution_scale((u16)std::get<1>(clipped).y, true),
|
rsx::apply_resolution_scale(static_cast<u16>(std::get<1>(clipped).y), true),
|
||||||
slice,
|
slice,
|
||||||
src_w,
|
src_w,
|
||||||
height,
|
height,
|
||||||
@ -332,10 +332,10 @@ namespace rsx
|
|||||||
section->get_raw_texture(),
|
section->get_raw_texture(),
|
||||||
surface_transform::identity,
|
surface_transform::identity,
|
||||||
0,
|
0,
|
||||||
(u16)std::get<0>(clipped).x,
|
static_cast<u16>(std::get<0>(clipped).x),
|
||||||
(u16)std::get<0>(clipped).y,
|
static_cast<u16>(std::get<0>(clipped).y),
|
||||||
(u16)std::get<1>(clipped).x,
|
static_cast<u16>(std::get<1>(clipped).x),
|
||||||
(u16)std::get<1>(clipped).y,
|
static_cast<u16>(std::get<1>(clipped).y),
|
||||||
0,
|
0,
|
||||||
src_w,
|
src_w,
|
||||||
height,
|
height,
|
||||||
|
@ -37,7 +37,7 @@ namespace gl
|
|||||||
optimal_group_size = 128;
|
optimal_group_size = 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, (GLint*)&max_invocations_x);
|
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, reinterpret_cast<GLint*>(&max_invocations_x));
|
||||||
}
|
}
|
||||||
|
|
||||||
void create()
|
void create()
|
||||||
@ -79,7 +79,7 @@ namespace gl
|
|||||||
m_program.use();
|
m_program.use();
|
||||||
glDispatchCompute(invocations_x, invocations_y, 1);
|
glDispatchCompute(invocations_x, invocations_y, 1);
|
||||||
|
|
||||||
glUseProgram((GLuint)old_program);
|
glUseProgram(old_program);
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(u32 num_invocations)
|
void run(u32 num_invocations)
|
||||||
@ -93,7 +93,7 @@ namespace gl
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Since all the invocations will run, the optimal distribution is sqrt(count)
|
// Since all the invocations will run, the optimal distribution is sqrt(count)
|
||||||
const auto optimal_length = (u32)floor(std::sqrt(num_invocations));
|
const u32 optimal_length = static_cast<u32>(floor(std::sqrt(num_invocations)));
|
||||||
invocations_x = optimal_length;
|
invocations_x = optimal_length;
|
||||||
invocations_y = invocations_x;
|
invocations_y = invocations_x;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ namespace gl
|
|||||||
|
|
||||||
void clear_color(u8 r, u8 g, u8 b, u8 a)
|
void clear_color(u8 r, u8 g, u8 b, u8 a)
|
||||||
{
|
{
|
||||||
u32 value = (u32)r | (u32)g << 8 | (u32)b << 16 | (u32)a << 24;
|
u32 value = u32{r} | u32{g} << 8 | u32{b} << 16 | u32{a} << 24;
|
||||||
if (!test_property(GL_COLOR_CLEAR_VALUE, value))
|
if (!test_property(GL_COLOR_CLEAR_VALUE, value))
|
||||||
{
|
{
|
||||||
glClearColor(r / 255.f, g / 255.f, b / 255.f, a / 255.f);
|
glClearColor(r / 255.f, g / 255.f, b / 255.f, a / 255.f);
|
||||||
@ -156,7 +156,7 @@ namespace gl
|
|||||||
|
|
||||||
void clear_color(const color4f& color)
|
void clear_color(const color4f& color)
|
||||||
{
|
{
|
||||||
clear_color(u8(color.r * 255), u8(color.g * 255), u8(color.b * 255), u8(color.a * 255));
|
clear_color(static_cast<u8>(color.r * 255), static_cast<u8>(color.g * 255), static_cast<u8>(color.b * 255), static_cast<u8>(color.a * 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
void depth_bounds(float min, float max)
|
void depth_bounds(float min, float max)
|
||||||
|
@ -59,7 +59,7 @@ namespace
|
|||||||
case rsx::comparison_function::greater_or_equal: return GL_GEQUAL;
|
case rsx::comparison_function::greater_or_equal: return GL_GEQUAL;
|
||||||
case rsx::comparison_function::always: return GL_ALWAYS;
|
case rsx::comparison_function::always: return GL_ALWAYS;
|
||||||
}
|
}
|
||||||
fmt::throw_exception("Unsupported comparison op 0x%X" HERE, (u32)op);
|
fmt::throw_exception("Unsupported comparison op 0x%X" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum stencil_op(rsx::stencil_op op)
|
GLenum stencil_op(rsx::stencil_op op)
|
||||||
@ -75,7 +75,7 @@ namespace
|
|||||||
case rsx::stencil_op::incr_wrap: return GL_INCR_WRAP;
|
case rsx::stencil_op::incr_wrap: return GL_INCR_WRAP;
|
||||||
case rsx::stencil_op::decr_wrap: return GL_DECR_WRAP;
|
case rsx::stencil_op::decr_wrap: return GL_DECR_WRAP;
|
||||||
}
|
}
|
||||||
fmt::throw_exception("Unsupported stencil op 0x%X" HERE, (u32)op);
|
fmt::throw_exception("Unsupported stencil op 0x%X" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum blend_equation(rsx::blend_equation op)
|
GLenum blend_equation(rsx::blend_equation op)
|
||||||
@ -94,7 +94,7 @@ namespace
|
|||||||
case rsx::blend_equation::reverse_substract: return GL_FUNC_REVERSE_SUBTRACT;
|
case rsx::blend_equation::reverse_substract: return GL_FUNC_REVERSE_SUBTRACT;
|
||||||
case rsx::blend_equation::reverse_add_signed:
|
case rsx::blend_equation::reverse_add_signed:
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(RSX, "Blend equation 0x%X is unimplemented!", (u32)op);
|
LOG_ERROR(RSX, "Blend equation 0x%X is unimplemented!", static_cast<u32>(op));
|
||||||
return GL_FUNC_ADD;
|
return GL_FUNC_ADD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ namespace
|
|||||||
case rsx::blend_factor::constant_alpha: return GL_CONSTANT_ALPHA;
|
case rsx::blend_factor::constant_alpha: return GL_CONSTANT_ALPHA;
|
||||||
case rsx::blend_factor::one_minus_constant_alpha: return GL_ONE_MINUS_CONSTANT_ALPHA;
|
case rsx::blend_factor::one_minus_constant_alpha: return GL_ONE_MINUS_CONSTANT_ALPHA;
|
||||||
}
|
}
|
||||||
fmt::throw_exception("Unsupported blend factor 0x%X" HERE, (u32)op);
|
fmt::throw_exception("Unsupported blend factor 0x%X" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum logic_op(rsx::logic_op op)
|
GLenum logic_op(rsx::logic_op op)
|
||||||
@ -143,7 +143,7 @@ namespace
|
|||||||
case rsx::logic_op::logic_nand: return GL_NAND;
|
case rsx::logic_op::logic_nand: return GL_NAND;
|
||||||
case rsx::logic_op::logic_set: return GL_SET;
|
case rsx::logic_op::logic_set: return GL_SET;
|
||||||
}
|
}
|
||||||
fmt::throw_exception("Unsupported logic op 0x%X" HERE, (u32)op);
|
fmt::throw_exception("Unsupported logic op 0x%X" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum front_face(rsx::front_face op)
|
GLenum front_face(rsx::front_face op)
|
||||||
@ -157,7 +157,7 @@ namespace
|
|||||||
case rsx::front_face::cw: return GL_CCW;
|
case rsx::front_face::cw: return GL_CCW;
|
||||||
case rsx::front_face::ccw: return GL_CW;
|
case rsx::front_face::ccw: return GL_CW;
|
||||||
}
|
}
|
||||||
fmt::throw_exception("Unsupported front face 0x%X" HERE, (u32)op);
|
fmt::throw_exception("Unsupported front face 0x%X" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum cull_face(rsx::cull_face op)
|
GLenum cull_face(rsx::cull_face op)
|
||||||
@ -168,7 +168,7 @@ namespace
|
|||||||
case rsx::cull_face::back: return GL_BACK;
|
case rsx::cull_face::back: return GL_BACK;
|
||||||
case rsx::cull_face::front_and_back: return GL_FRONT_AND_BACK;
|
case rsx::cull_face::front_and_back: return GL_FRONT_AND_BACK;
|
||||||
}
|
}
|
||||||
fmt::throw_exception("Unsupported cull face 0x%X" HERE, (u32)op);
|
fmt::throw_exception("Unsupported cull face 0x%X" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,9 +543,9 @@ void GLGSRender::end()
|
|||||||
bool use_draw_arrays_fallback = false;
|
bool use_draw_arrays_fallback = false;
|
||||||
|
|
||||||
m_scratch_buffer.resize(draw_count * 24);
|
m_scratch_buffer.resize(draw_count * 24);
|
||||||
GLint* firsts = (GLint*)m_scratch_buffer.data();
|
GLint* firsts = reinterpret_cast<GLint*>(m_scratch_buffer.data());
|
||||||
GLsizei* counts = (GLsizei*)(firsts + draw_count);
|
GLsizei* counts = (firsts + draw_count);
|
||||||
const GLvoid** offsets = (const GLvoid**)(counts + draw_count);
|
const GLvoid** offsets = reinterpret_cast<const GLvoid**>(counts + draw_count);
|
||||||
|
|
||||||
u32 first = 0;
|
u32 first = 0;
|
||||||
u32 dst_index = 0;
|
u32 dst_index = 0;
|
||||||
@ -553,7 +553,7 @@ void GLGSRender::end()
|
|||||||
{
|
{
|
||||||
firsts[dst_index] = first;
|
firsts[dst_index] = first;
|
||||||
counts[dst_index] = range.count;
|
counts[dst_index] = range.count;
|
||||||
offsets[dst_index++] = (const GLvoid*)(u64(first << 2));
|
offsets[dst_index++] = reinterpret_cast<const GLvoid*>(u64{first << 2});
|
||||||
|
|
||||||
if (driver_caps.vendor_AMD && (first + range.count) > (0x100000 >> 2))
|
if (driver_caps.vendor_AMD && (first + range.count) > (0x100000 >> 2))
|
||||||
{
|
{
|
||||||
@ -577,12 +577,12 @@ void GLGSRender::end()
|
|||||||
{
|
{
|
||||||
//Use identity index buffer to fix broken vertexID on AMD
|
//Use identity index buffer to fix broken vertexID on AMD
|
||||||
m_identity_index_buffer->bind();
|
m_identity_index_buffer->bind();
|
||||||
glMultiDrawElements(draw_mode, counts, GL_UNSIGNED_INT, offsets, (GLsizei)draw_count);
|
glMultiDrawElements(draw_mode, counts, GL_UNSIGNED_INT, offsets, static_cast<GLsizei>(draw_count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Normal render
|
//Normal render
|
||||||
glMultiDrawArrays(draw_mode, firsts, counts, (GLsizei)draw_count);
|
glMultiDrawArrays(draw_mode, firsts, counts, static_cast<GLsizei>(draw_count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -601,7 +601,7 @@ void GLGSRender::end()
|
|||||||
|
|
||||||
if (rsx::method_registers.current_draw_clause.is_single_draw())
|
if (rsx::method_registers.current_draw_clause.is_single_draw())
|
||||||
{
|
{
|
||||||
glDrawElements(draw_mode, upload_info.vertex_draw_count, index_type, (GLvoid *)(uintptr_t)index_offset);
|
glDrawElements(draw_mode, upload_info.vertex_draw_count, index_type, reinterpret_cast<GLvoid*>(u64{index_offset}));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -611,20 +611,20 @@ void GLGSRender::end()
|
|||||||
uintptr_t index_ptr = index_offset;
|
uintptr_t index_ptr = index_offset;
|
||||||
m_scratch_buffer.resize(draw_count * 16);
|
m_scratch_buffer.resize(draw_count * 16);
|
||||||
|
|
||||||
GLsizei *counts = (GLsizei*)m_scratch_buffer.data();
|
GLsizei *counts = reinterpret_cast<GLsizei*>(m_scratch_buffer.data());
|
||||||
const GLvoid** offsets = (const GLvoid**)(counts + draw_count);
|
const GLvoid** offsets = reinterpret_cast<const GLvoid**>(counts + draw_count);
|
||||||
int dst_index = 0;
|
int dst_index = 0;
|
||||||
|
|
||||||
for (const auto &range : subranges)
|
for (const auto &range : subranges)
|
||||||
{
|
{
|
||||||
const auto index_size = get_index_count(rsx::method_registers.current_draw_clause.primitive, range.count);
|
const auto index_size = get_index_count(rsx::method_registers.current_draw_clause.primitive, range.count);
|
||||||
counts[dst_index] = index_size;
|
counts[dst_index] = index_size;
|
||||||
offsets[dst_index++] = (const GLvoid*)index_ptr;
|
offsets[dst_index++] = reinterpret_cast<const GLvoid*>(index_ptr);
|
||||||
|
|
||||||
index_ptr += (index_size << type_scale);
|
index_ptr += (index_size << type_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
glMultiDrawElements(draw_mode, counts, index_type, offsets, (GLsizei)draw_count);
|
glMultiDrawElements(draw_mode, counts, index_type, offsets, static_cast<GLsizei>(draw_count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (rsx::method_registers.current_draw_clause.next());
|
} while (rsx::method_registers.current_draw_clause.next());
|
||||||
@ -691,9 +691,9 @@ void GLGSRender::on_init_thread()
|
|||||||
if (g_cfg.video.debug_output)
|
if (g_cfg.video.debug_output)
|
||||||
gl::enable_debugging();
|
gl::enable_debugging();
|
||||||
|
|
||||||
LOG_NOTICE(RSX, "GL RENDERER: %s (%s)", (const char*)glGetString(GL_RENDERER), (const char*)glGetString(GL_VENDOR));
|
LOG_NOTICE(RSX, "GL RENDERER: %s (%s)", reinterpret_cast<const char*>(glGetString(GL_RENDERER)), reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
|
||||||
LOG_NOTICE(RSX, "GL VERSION: %s", (const char*)glGetString(GL_VERSION));
|
LOG_NOTICE(RSX, "GL VERSION: %s", reinterpret_cast<const char*>(glGetString(GL_VERSION)));
|
||||||
LOG_NOTICE(RSX, "GLSL VERSION: %s", (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
|
LOG_NOTICE(RSX, "GLSL VERSION: %s", reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
|
||||||
|
|
||||||
auto& gl_caps = gl::get_driver_caps();
|
auto& gl_caps = gl::get_driver_caps();
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ void GLGSRender::on_init_thread()
|
|||||||
m_identity_index_buffer->create(gl::buffer::target::element_array, 1 * 0x100000, nullptr, gl::buffer::memory_type::host_visible);
|
m_identity_index_buffer->create(gl::buffer::target::element_array, 1 * 0x100000, nullptr, gl::buffer::memory_type::host_visible);
|
||||||
|
|
||||||
// Initialize with 256k identity entries
|
// Initialize with 256k identity entries
|
||||||
auto* dst = (u32*)m_identity_index_buffer->map(gl::buffer::access::write);
|
auto* dst = reinterpret_cast<u32*>(m_identity_index_buffer->map(gl::buffer::access::write));
|
||||||
for (u32 n = 0; n < (0x100000 >> 2); ++n)
|
for (u32 n = 0; n < (0x100000 >> 2); ++n)
|
||||||
{
|
{
|
||||||
dst[n] = n;
|
dst[n] = n;
|
||||||
@ -842,8 +842,8 @@ void GLGSRender::on_init_thread()
|
|||||||
backend_config.supports_hw_renormalization = true;
|
backend_config.supports_hw_renormalization = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_persistent_stream_view.update(m_attrib_ring_buffer.get(), 0, std::min<u32>((u32)m_attrib_ring_buffer->size(), m_max_texbuffer_size));
|
m_persistent_stream_view.update(m_attrib_ring_buffer.get(), 0, std::min<u32>(static_cast<u32>(m_attrib_ring_buffer->size()), m_max_texbuffer_size));
|
||||||
m_volatile_stream_view.update(m_attrib_ring_buffer.get(), 0, std::min<u32>((u32)m_attrib_ring_buffer->size(), m_max_texbuffer_size));
|
m_volatile_stream_view.update(m_attrib_ring_buffer.get(), 0, std::min<u32>(static_cast<u32>(m_attrib_ring_buffer->size()), m_max_texbuffer_size));
|
||||||
m_gl_persistent_stream_buffer->copy_from(m_persistent_stream_view);
|
m_gl_persistent_stream_buffer->copy_from(m_persistent_stream_view);
|
||||||
m_gl_volatile_stream_buffer->copy_from(m_volatile_stream_view);
|
m_gl_volatile_stream_buffer->copy_from(m_volatile_stream_view);
|
||||||
|
|
||||||
@ -885,7 +885,7 @@ void GLGSRender::on_init_thread()
|
|||||||
auto &query = m_occlusion_query_data[i];
|
auto &query = m_occlusion_query_data[i];
|
||||||
glGenQueries(1, &handle);
|
glGenQueries(1, &handle);
|
||||||
|
|
||||||
query.driver_handle = (u64)handle;
|
query.driver_handle = handle;
|
||||||
query.pending = false;
|
query.pending = false;
|
||||||
query.active = false;
|
query.active = false;
|
||||||
query.result = 0;
|
query.result = 0;
|
||||||
@ -927,7 +927,7 @@ void GLGSRender::on_init_thread()
|
|||||||
type.disable_cancel = true;
|
type.disable_cancel = true;
|
||||||
type.progress_bar_count = 2;
|
type.progress_bar_count = 2;
|
||||||
|
|
||||||
dlg = g_fxo->get<rsx::overlays::display_manager>()->create<rsx::overlays::message_dialog>((bool)g_cfg.video.shader_preloading_dialog.use_custom_background);
|
dlg = g_fxo->get<rsx::overlays::display_manager>()->create<rsx::overlays::message_dialog>(!!g_cfg.video.shader_preloading_dialog.use_custom_background);
|
||||||
dlg->progress_bar_set_taskbar_index(-1);
|
dlg->progress_bar_set_taskbar_index(-1);
|
||||||
dlg->show("Loading precompiled shaders from disk...", type, [](s32 status)
|
dlg->show("Loading precompiled shaders from disk...", type, [](s32 status)
|
||||||
{
|
{
|
||||||
@ -945,7 +945,7 @@ void GLGSRender::on_init_thread()
|
|||||||
|
|
||||||
void inc_value(u32 index, u32 value) override
|
void inc_value(u32 index, u32 value) override
|
||||||
{
|
{
|
||||||
dlg->progress_bar_increment(index, (f32)value);
|
dlg->progress_bar_increment(index, static_cast<f32>(value));
|
||||||
owner->flip({});
|
owner->flip({});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1087,7 +1087,7 @@ void GLGSRender::on_exit()
|
|||||||
query.active = false;
|
query.active = false;
|
||||||
query.pending = false;
|
query.pending = false;
|
||||||
|
|
||||||
GLuint handle = (GLuint)query.driver_handle;
|
GLuint handle = query.driver_handle;
|
||||||
glDeleteQueries(1, &handle);
|
glDeleteQueries(1, &handle);
|
||||||
query.driver_handle = 0;
|
query.driver_handle = 0;
|
||||||
}
|
}
|
||||||
@ -1236,7 +1236,7 @@ bool GLGSRender::do_method(u32 cmd, u32 arg)
|
|||||||
if (arg & 0xF0) ctx |= rsx::framebuffer_creation_context::context_clear_color;
|
if (arg & 0xF0) ctx |= rsx::framebuffer_creation_context::context_clear_color;
|
||||||
if (arg & 0x3) ctx |= rsx::framebuffer_creation_context::context_clear_depth;
|
if (arg & 0x3) ctx |= rsx::framebuffer_creation_context::context_clear_depth;
|
||||||
|
|
||||||
init_buffers((rsx::framebuffer_creation_context)ctx, true);
|
init_buffers(rsx::framebuffer_creation_context{ctx}, true);
|
||||||
clear_surface(arg);
|
clear_surface(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,7 +1426,7 @@ void GLGSRender::update_vertex_env(const gl::vertex_upload_info& upload_info)
|
|||||||
buf[1] = upload_info.vertex_index_offset;
|
buf[1] = upload_info.vertex_index_offset;
|
||||||
buf += 4;
|
buf += 4;
|
||||||
|
|
||||||
fill_vertex_layout_state(m_vertex_layout, upload_info.first_vertex, upload_info.allocated_vertex_count, (s32*)buf, upload_info.persistent_mapping_offset, upload_info.volatile_mapping_offset);
|
fill_vertex_layout_state(m_vertex_layout, upload_info.first_vertex, upload_info.allocated_vertex_count, reinterpret_cast<s32*>(buf), upload_info.persistent_mapping_offset, upload_info.volatile_mapping_offset);
|
||||||
|
|
||||||
m_vertex_layout_buffer->bind_range(GL_VERTEX_LAYOUT_BIND_SLOT, mapping.second, 128 + 16);
|
m_vertex_layout_buffer->bind_range(GL_VERTEX_LAYOUT_BIND_SLOT, mapping.second, 128 + 16);
|
||||||
|
|
||||||
@ -1615,25 +1615,25 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
|||||||
|
|
||||||
if (!g_cfg.video.stretch_to_display_area)
|
if (!g_cfg.video.stretch_to_display_area)
|
||||||
{
|
{
|
||||||
const double aq = (double)buffer_width / buffer_height;
|
const double aq = 1. * buffer_width / buffer_height;
|
||||||
const double rq = (double)new_size.width / new_size.height;
|
const double rq = 1. * new_size.width / new_size.height;
|
||||||
const double q = aq / rq;
|
const double q = aq / rq;
|
||||||
|
|
||||||
if (q > 1.0)
|
if (q > 1.0)
|
||||||
{
|
{
|
||||||
new_size.height = int(new_size.height / q);
|
new_size.height = static_cast<int>(new_size.height / q);
|
||||||
aspect_ratio.y = (csize.height - new_size.height) / 2;
|
aspect_ratio.y = (csize.height - new_size.height) / 2;
|
||||||
}
|
}
|
||||||
else if (q < 1.0)
|
else if (q < 1.0)
|
||||||
{
|
{
|
||||||
new_size.width = int(new_size.width * q);
|
new_size.width = static_cast<int>(new_size.width * q);
|
||||||
aspect_ratio.x = (csize.width - new_size.width) / 2;
|
aspect_ratio.x = (csize.width - new_size.width) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aspect_ratio.size = new_size;
|
aspect_ratio.size = new_size;
|
||||||
|
|
||||||
if ((u32)info.buffer < display_buffers_count && buffer_width && buffer_height)
|
if (info.buffer < display_buffers_count && buffer_width && buffer_height)
|
||||||
{
|
{
|
||||||
// Find the source image
|
// Find the source image
|
||||||
const u32 absolute_address = rsx::get_address(display_buffers[info.buffer].offset, CELL_GCM_LOCATION_LOCAL);
|
const u32 absolute_address = rsx::get_address(display_buffers[info.buffer].offset, CELL_GCM_LOCATION_LOCAL);
|
||||||
@ -1690,7 +1690,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
|||||||
gl::pixel_unpack_settings unpack_settings;
|
gl::pixel_unpack_settings unpack_settings;
|
||||||
unpack_settings.alignment(1).row_length(buffer_pitch / 4);
|
unpack_settings.alignment(1).row_length(buffer_pitch / 4);
|
||||||
|
|
||||||
if (!m_flip_tex_color || m_flip_tex_color->size2D() != sizei{ (int)buffer_width, (int)buffer_height })
|
if (!m_flip_tex_color || m_flip_tex_color->size2D() != sizei{ static_cast<int>(buffer_width), static_cast<int>(buffer_height) })
|
||||||
{
|
{
|
||||||
m_flip_tex_color = std::make_unique<gl::texture>(GL_TEXTURE_2D, buffer_width, buffer_height, 1, 1, GL_RGBA8);
|
m_flip_tex_color = std::make_unique<gl::texture>(GL_TEXTURE_2D, buffer_width, buffer_height, 1, 1, GL_RGBA8);
|
||||||
}
|
}
|
||||||
@ -1723,7 +1723,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
|||||||
m_frame->take_screenshot(std::move(sshot_frame), buffer_width, buffer_height);
|
m_frame->take_screenshot(std::move(sshot_frame), buffer_width, buffer_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
areai screen_area = coordi({}, { (int)buffer_width, (int)buffer_height });
|
areai screen_area = coordi({}, { static_cast<int>(buffer_width), static_cast<int>(buffer_height) });
|
||||||
|
|
||||||
if (g_cfg.video.full_rgb_range_output && rsx::fcmp(avconfig->gamma, 1.f))
|
if (g_cfg.video.full_rgb_range_output && rsx::fcmp(avconfig->gamma, 1.f))
|
||||||
{
|
{
|
||||||
@ -1797,7 +1797,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
|||||||
const auto num_speculate = m_gl_texture_cache.get_num_cache_speculative_writes();
|
const auto num_speculate = m_gl_texture_cache.get_num_cache_speculative_writes();
|
||||||
const auto num_misses = m_gl_texture_cache.get_num_cache_misses();
|
const auto num_misses = m_gl_texture_cache.get_num_cache_misses();
|
||||||
const auto num_unavoidable = m_gl_texture_cache.get_num_unavoidable_hard_faults();
|
const auto num_unavoidable = m_gl_texture_cache.get_num_unavoidable_hard_faults();
|
||||||
const auto cache_miss_ratio = (u32)ceil(m_gl_texture_cache.get_cache_miss_ratio() * 100);
|
const auto cache_miss_ratio = static_cast<u32>(ceil(m_gl_texture_cache.get_cache_miss_ratio() * 100));
|
||||||
m_text_printer.print_text(0, 126, m_frame->client_width(), m_frame->client_height(), fmt::format("Unreleased textures: %7d", num_dirty_textures));
|
m_text_printer.print_text(0, 126, m_frame->client_width(), m_frame->client_height(), fmt::format("Unreleased textures: %7d", num_dirty_textures));
|
||||||
m_text_printer.print_text(0, 144, m_frame->client_width(), m_frame->client_height(), fmt::format("Texture memory: %12dM", texture_memory_size));
|
m_text_printer.print_text(0, 144, m_frame->client_width(), m_frame->client_height(), fmt::format("Texture memory: %12dM", texture_memory_size));
|
||||||
m_text_printer.print_text(0, 162, m_frame->client_width(), m_frame->client_height(), fmt::format("Flush requests: %12d = %2d (%3d%%) hard faults, %2d unavoidable, %2d misprediction(s), %2d speculation(s)", num_flushes, num_misses, cache_miss_ratio, num_unavoidable, num_mispredict, num_speculate));
|
m_text_printer.print_text(0, 162, m_frame->client_width(), m_frame->client_height(), fmt::format("Flush requests: %12d = %2d (%3d%%) hard faults, %2d unavoidable, %2d misprediction(s), %2d speculation(s)", num_flushes, num_misses, cache_miss_ratio, num_unavoidable, num_mispredict, num_speculate));
|
||||||
@ -1967,7 +1967,7 @@ void GLGSRender::notify_tile_unbound(u32 tile)
|
|||||||
void GLGSRender::begin_occlusion_query(rsx::reports::occlusion_query_info* query)
|
void GLGSRender::begin_occlusion_query(rsx::reports::occlusion_query_info* query)
|
||||||
{
|
{
|
||||||
query->result = 0;
|
query->result = 0;
|
||||||
glBeginQuery(GL_ANY_SAMPLES_PASSED, (GLuint)query->driver_handle);
|
glBeginQuery(GL_ANY_SAMPLES_PASSED, query->driver_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGSRender::end_occlusion_query(rsx::reports::occlusion_query_info* query)
|
void GLGSRender::end_occlusion_query(rsx::reports::occlusion_query_info* query)
|
||||||
@ -1982,7 +1982,7 @@ bool GLGSRender::check_occlusion_query_status(rsx::reports::occlusion_query_info
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
GLint status = GL_TRUE;
|
GLint status = GL_TRUE;
|
||||||
glGetQueryObjectiv((GLuint)query->driver_handle, GL_QUERY_RESULT_AVAILABLE, &status);
|
glGetQueryObjectiv(query->driver_handle, GL_QUERY_RESULT_AVAILABLE, &status);
|
||||||
|
|
||||||
return status != GL_FALSE;
|
return status != GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -1992,7 +1992,7 @@ void GLGSRender::get_occlusion_query_result(rsx::reports::occlusion_query_info*
|
|||||||
if (query->num_draws)
|
if (query->num_draws)
|
||||||
{
|
{
|
||||||
GLint result = 0;
|
GLint result = 0;
|
||||||
glGetQueryObjectiv((GLuint)query->driver_handle, GL_QUERY_RESULT, &result);
|
glGetQueryObjectiv(query->driver_handle, GL_QUERY_RESULT, &result);
|
||||||
|
|
||||||
query->result += result;
|
query->result += result;
|
||||||
}
|
}
|
||||||
|
@ -94,12 +94,12 @@ namespace gl
|
|||||||
glBlitFramebuffer(
|
glBlitFramebuffer(
|
||||||
src_area.x1, src_area.y1, src_area.x2, src_area.y2,
|
src_area.x1, src_area.y1, src_area.x2, src_area.y2,
|
||||||
dst_area.x1, dst_area.y1, dst_area.x2, dst_area.y2,
|
dst_area.x1, dst_area.y1, dst_area.x2, dst_area.y2,
|
||||||
(GLbitfield)buffers_, (GLenum)filter_);
|
static_cast<GLbitfield>(buffers_), static_cast<GLenum>(filter_));
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::bind_as(target target_) const
|
void fbo::bind_as(target target_) const
|
||||||
{
|
{
|
||||||
glBindFramebuffer((int)target_, id());
|
glBindFramebuffer(static_cast<int>(target_), id());
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::remove()
|
void fbo::remove()
|
||||||
@ -151,7 +151,7 @@ namespace gl
|
|||||||
for (auto &index : indexes)
|
for (auto &index : indexes)
|
||||||
ids.push_back(index.id());
|
ids.push_back(index.id());
|
||||||
|
|
||||||
glDrawBuffers((GLsizei)ids.size(), ids.data());
|
glDrawBuffers(::narrow<GLsizei>(ids.size()), ids.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::read_buffer(const attachment& buffer) const
|
void fbo::read_buffer(const attachment& buffer) const
|
||||||
@ -183,19 +183,19 @@ namespace gl
|
|||||||
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
||||||
{
|
{
|
||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
glDrawElements(draw_mode(mode), count, (GLenum)type, indices);
|
glDrawElements(draw_mode(mode), count, static_cast<GLenum>(type), indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
void fbo::draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
||||||
{
|
{
|
||||||
buffer.bind(buffer::target::array);
|
buffer.bind(buffer::target::array);
|
||||||
glDrawElements(draw_mode(mode), count, (GLenum)type, indices);
|
glDrawElements(draw_mode(mode), count, static_cast<GLenum>(type), indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
||||||
{
|
{
|
||||||
indices.bind(buffer::target::element_array);
|
indices.bind(buffer::target::element_array);
|
||||||
glDrawElements(draw_mode(mode), count, (GLenum)type, (GLvoid*)indices_buffer_offset);
|
glDrawElements(draw_mode(mode), count, static_cast<GLenum>(type), reinterpret_cast<GLvoid*>(indices_buffer_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
void fbo::draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
||||||
@ -237,7 +237,7 @@ namespace gl
|
|||||||
void fbo::clear(buffers buffers_) const
|
void fbo::clear(buffers buffers_) const
|
||||||
{
|
{
|
||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
glClear((GLbitfield)buffers_);
|
glClear(static_cast<GLbitfield>(buffers_));
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::clear(buffers buffers_, color4f color_value, double depth_value, u8 stencil_value) const
|
void fbo::clear(buffers buffers_, color4f color_value, double depth_value, u8 stencil_value) const
|
||||||
@ -253,7 +253,7 @@ namespace gl
|
|||||||
{
|
{
|
||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
pixel_settings.apply();
|
pixel_settings.apply();
|
||||||
glDrawPixels(size.width, size.height, (GLenum)format_, (GLenum)type_, pixels);
|
glDrawPixels(size.width, size.height, static_cast<GLenum>(format_), static_cast<GLenum>(type_), pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::copy_from(const buffer& buf, const sizei& size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings) const
|
void fbo::copy_from(const buffer& buf, const sizei& size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings) const
|
||||||
@ -261,14 +261,14 @@ namespace gl
|
|||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
buffer::save_binding_state save_buffer(buffer::target::pixel_unpack, buf);
|
buffer::save_binding_state save_buffer(buffer::target::pixel_unpack, buf);
|
||||||
pixel_settings.apply();
|
pixel_settings.apply();
|
||||||
glDrawPixels(size.width, size.height, (GLenum)format_, (GLenum)type_, nullptr);
|
glDrawPixels(size.width, size.height, static_cast<GLenum>(format_), static_cast<GLenum>(type_), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::copy_to(void* pixels, coordi coord, gl::texture::format format_, gl::texture::type type_, class pixel_pack_settings pixel_settings) const
|
void fbo::copy_to(void* pixels, coordi coord, gl::texture::format format_, gl::texture::type type_, class pixel_pack_settings pixel_settings) const
|
||||||
{
|
{
|
||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
pixel_settings.apply();
|
pixel_settings.apply();
|
||||||
glReadPixels(coord.x, coord.y, coord.width, coord.height, (GLenum)format_, (GLenum)type_, pixels);
|
glReadPixels(coord.x, coord.y, coord.width, coord.height, static_cast<GLenum>(format_), static_cast<GLenum>(type_), pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::copy_to(const buffer& buf, coordi coord, gl::texture::format format_, gl::texture::type type_, class pixel_pack_settings pixel_settings) const
|
void fbo::copy_to(const buffer& buf, coordi coord, gl::texture::format format_, gl::texture::type type_, class pixel_pack_settings pixel_settings) const
|
||||||
@ -276,7 +276,7 @@ namespace gl
|
|||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
buffer::save_binding_state save_buffer(buffer::target::pixel_pack, buf);
|
buffer::save_binding_state save_buffer(buffer::target::pixel_pack, buf);
|
||||||
pixel_settings.apply();
|
pixel_settings.apply();
|
||||||
glReadPixels(coord.x, coord.y, coord.width, coord.height, (GLenum)format_, (GLenum)type_, nullptr);
|
glReadPixels(coord.x, coord.y, coord.width, coord.height, static_cast<GLenum>(format_), static_cast<GLenum>(type_), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fbo fbo::get_binded_draw_buffer()
|
fbo fbo::get_binded_draw_buffer()
|
||||||
@ -284,7 +284,7 @@ namespace gl
|
|||||||
GLint value;
|
GLint value;
|
||||||
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &value);
|
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &value);
|
||||||
|
|
||||||
return{ (GLuint)value };
|
return{ static_cast<GLuint>(value) };
|
||||||
}
|
}
|
||||||
|
|
||||||
fbo fbo::get_binded_read_buffer()
|
fbo fbo::get_binded_read_buffer()
|
||||||
@ -292,7 +292,7 @@ namespace gl
|
|||||||
GLint value;
|
GLint value;
|
||||||
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &value);
|
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &value);
|
||||||
|
|
||||||
return{ (GLuint)value };
|
return{ static_cast<GLuint>(value) };
|
||||||
}
|
}
|
||||||
|
|
||||||
fbo fbo::get_binded_buffer()
|
fbo fbo::get_binded_buffer()
|
||||||
@ -300,7 +300,7 @@ namespace gl
|
|||||||
GLint value;
|
GLint value;
|
||||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value);
|
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value);
|
||||||
|
|
||||||
return{ (GLuint)value };
|
return{ static_cast<GLuint>(value) };
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint fbo::id() const
|
GLuint fbo::id() const
|
||||||
@ -390,13 +390,13 @@ namespace gl
|
|||||||
|
|
||||||
if (static_cast<gl::texture::internal_format>(internal_fmt) != src->get_internal_format())
|
if (static_cast<gl::texture::internal_format>(internal_fmt) != src->get_internal_format())
|
||||||
{
|
{
|
||||||
const auto internal_width = (u16)(src->width() * xfer_info.src_scaling_hint);
|
const u16 internal_width = static_cast<u16>(src->width() * xfer_info.src_scaling_hint);
|
||||||
typeless_src = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, src->height(), 1, 1, internal_fmt);
|
typeless_src = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, src->height(), 1, 1, internal_fmt);
|
||||||
copy_typeless(typeless_src.get(), src);
|
copy_typeless(typeless_src.get(), src);
|
||||||
|
|
||||||
real_src = typeless_src.get();
|
real_src = typeless_src.get();
|
||||||
src_rect.x1 = (u16)(src_rect.x1 * xfer_info.src_scaling_hint);
|
src_rect.x1 = static_cast<u16>(src_rect.x1 * xfer_info.src_scaling_hint);
|
||||||
src_rect.x2 = (u16)(src_rect.x2 * xfer_info.src_scaling_hint);
|
src_rect.x2 = static_cast<u16>(src_rect.x2 * xfer_info.src_scaling_hint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,13 +408,13 @@ namespace gl
|
|||||||
|
|
||||||
if (static_cast<gl::texture::internal_format>(internal_fmt) != dst->get_internal_format())
|
if (static_cast<gl::texture::internal_format>(internal_fmt) != dst->get_internal_format())
|
||||||
{
|
{
|
||||||
const auto internal_width = (u16)(dst->width() * xfer_info.dst_scaling_hint);
|
const auto internal_width = static_cast<u16>(dst->width() * xfer_info.dst_scaling_hint);
|
||||||
typeless_dst = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, dst->height(), 1, 1, internal_fmt);
|
typeless_dst = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, dst->height(), 1, 1, internal_fmt);
|
||||||
copy_typeless(typeless_dst.get(), dst);
|
copy_typeless(typeless_dst.get(), dst);
|
||||||
|
|
||||||
real_dst = typeless_dst.get();
|
real_dst = typeless_dst.get();
|
||||||
dst_rect.x1 = (u16)(dst_rect.x1 * xfer_info.dst_scaling_hint);
|
dst_rect.x1 = static_cast<u16>(dst_rect.x1 * xfer_info.dst_scaling_hint);
|
||||||
dst_rect.x2 = (u16)(dst_rect.x2 * xfer_info.dst_scaling_hint);
|
dst_rect.x2 = static_cast<u16>(dst_rect.x2 * xfer_info.dst_scaling_hint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ namespace gl
|
|||||||
|
|
||||||
glBlitFramebuffer(src_rect.x1, src_rect.y1, src_rect.x2, src_rect.y2,
|
glBlitFramebuffer(src_rect.x1, src_rect.y1, src_rect.x2, src_rect.y2,
|
||||||
dst_rect.x1, dst_rect.y1, dst_rect.x2, dst_rect.y2,
|
dst_rect.x1, dst_rect.y1, dst_rect.x2, dst_rect.y2,
|
||||||
(GLbitfield)target, (GLenum)interp);
|
static_cast<GLbitfield>(target), static_cast<GLenum>(interp));
|
||||||
|
|
||||||
if (xfer_info.dst_is_typeless)
|
if (xfer_info.dst_is_typeless)
|
||||||
{
|
{
|
||||||
@ -513,7 +513,7 @@ namespace gl
|
|||||||
attachment = GL_DEPTH_STENCIL_ATTACHMENT;
|
attachment = GL_DEPTH_STENCIL_ATTACHMENT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Invalid texture passed to clear depth function, format=0x%x", (u32)fmt);
|
fmt::throw_exception("Invalid texture passed to clear depth function, format=0x%x", static_cast<u32>(fmt));
|
||||||
}
|
}
|
||||||
|
|
||||||
save_binding_state saved;
|
save_binding_state saved;
|
||||||
|
@ -746,7 +746,7 @@ namespace gl
|
|||||||
}
|
}
|
||||||
|
|
||||||
glGetIntegerv(pname, &m_last_binding);
|
glGetIntegerv(pname, &m_last_binding);
|
||||||
m_target = (GLenum)target_;
|
m_target = static_cast<GLenum>(target_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -800,7 +800,7 @@ namespace gl
|
|||||||
flags |= GL_CLIENT_STORAGE_BIT;
|
flags |= GL_CLIENT_STORAGE_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBufferStorage((GLenum)target_, size, data_, flags);
|
glBufferStorage(static_cast<GLenum>(target_), size, data_, flags);
|
||||||
m_size = size;
|
m_size = size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -866,7 +866,7 @@ namespace gl
|
|||||||
|
|
||||||
void bind(target target_) const
|
void bind(target target_) const
|
||||||
{
|
{
|
||||||
glBindBuffer((GLenum)target_, m_id);
|
glBindBuffer(static_cast<GLenum>(target_), m_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bind() const
|
void bind() const
|
||||||
@ -916,7 +916,7 @@ namespace gl
|
|||||||
|
|
||||||
target target_ = current_target();
|
target target_ = current_target();
|
||||||
save_binding_state save(target_, *this);
|
save_binding_state save(target_, *this);
|
||||||
glBufferData((GLenum)target_, size, data_, usage);
|
glBufferData(static_cast<GLenum>(target_), size, data_, usage);
|
||||||
m_size = size;
|
m_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,23 +925,23 @@ namespace gl
|
|||||||
verify(HERE), m_memory_type == memory_type::host_visible;
|
verify(HERE), m_memory_type == memory_type::host_visible;
|
||||||
|
|
||||||
bind(current_target());
|
bind(current_target());
|
||||||
return (GLubyte*)glMapBuffer((GLenum)current_target(), (GLenum)access_);
|
return reinterpret_cast<GLubyte*>(glMapBuffer(static_cast<GLenum>(current_target()), static_cast<GLenum>(access_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmap()
|
void unmap()
|
||||||
{
|
{
|
||||||
verify(HERE), m_memory_type == memory_type::host_visible;
|
verify(HERE), m_memory_type == memory_type::host_visible;
|
||||||
glUnmapBuffer((GLenum)current_target());
|
glUnmapBuffer(static_cast<GLenum>(current_target()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void bind_range(u32 index, u32 offset, u32 size) const
|
void bind_range(u32 index, u32 offset, u32 size) const
|
||||||
{
|
{
|
||||||
glBindBufferRange((GLenum)current_target(), index, id(), offset, size);
|
glBindBufferRange(static_cast<GLenum>(current_target()), index, id(), offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bind_range(target target_, u32 index, u32 offset, u32 size) const
|
void bind_range(target target_, u32 index, u32 offset, u32 size) const
|
||||||
{
|
{
|
||||||
glBindBufferRange((GLenum)target_, index, id(), offset, size);
|
glBindBufferRange(static_cast<GLenum>(target_), index, id(), offset, size);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -969,9 +969,9 @@ namespace gl
|
|||||||
GLbitfield buffer_storage_flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
|
GLbitfield buffer_storage_flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
|
||||||
if (gl::get_driver_caps().vendor_MESA) buffer_storage_flags |= GL_CLIENT_STORAGE_BIT;
|
if (gl::get_driver_caps().vendor_MESA) buffer_storage_flags |= GL_CLIENT_STORAGE_BIT;
|
||||||
|
|
||||||
glBindBuffer((GLenum)m_target, m_id);
|
glBindBuffer(static_cast<GLenum>(m_target), m_id);
|
||||||
glBufferStorage((GLenum)m_target, size, data, buffer_storage_flags);
|
glBufferStorage(static_cast<GLenum>(m_target), size, data, buffer_storage_flags);
|
||||||
m_memory_mapping = glMapBufferRange((GLenum)m_target, 0, size, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
|
m_memory_mapping = glMapBufferRange(static_cast<GLenum>(m_target), 0, size, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
|
||||||
|
|
||||||
verify(HERE), m_memory_mapping != nullptr;
|
verify(HERE), m_memory_mapping != nullptr;
|
||||||
m_data_loc = 0;
|
m_data_loc = 0;
|
||||||
@ -1007,15 +1007,15 @@ namespace gl
|
|||||||
|
|
||||||
//Align data loc to 256; allows some "guard" region so we dont trample our own data inadvertently
|
//Align data loc to 256; allows some "guard" region so we dont trample our own data inadvertently
|
||||||
m_data_loc = align(offset + alloc_size, 256);
|
m_data_loc = align(offset + alloc_size, 256);
|
||||||
return std::make_pair(((char*)m_memory_mapping) + offset, offset);
|
return std::make_pair(static_cast<char*>(m_memory_mapping) + offset, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void remove()
|
virtual void remove()
|
||||||
{
|
{
|
||||||
if (m_memory_mapping)
|
if (m_memory_mapping)
|
||||||
{
|
{
|
||||||
glBindBuffer((GLenum)m_target, m_id);
|
glBindBuffer(static_cast<GLenum>(m_target), m_id);
|
||||||
glUnmapBuffer((GLenum)m_target);
|
glUnmapBuffer(static_cast<GLenum>(m_target));
|
||||||
|
|
||||||
m_memory_mapping = nullptr;
|
m_memory_mapping = nullptr;
|
||||||
m_data_loc = 0;
|
m_data_loc = 0;
|
||||||
@ -1082,14 +1082,14 @@ namespace gl
|
|||||||
m_data_loc = 0;
|
m_data_loc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindBuffer((GLenum)m_target, m_id);
|
glBindBuffer(static_cast<GLenum>(m_target), m_id);
|
||||||
m_memory_mapping = glMapBufferRange((GLenum)m_target, m_data_loc, block_size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
|
m_memory_mapping = glMapBufferRange(static_cast<GLenum>(m_target), m_data_loc, block_size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
|
||||||
m_mapped_bytes = block_size;
|
m_mapped_bytes = block_size;
|
||||||
m_mapping_offset = m_data_loc;
|
m_mapping_offset = m_data_loc;
|
||||||
m_alignment_offset = 0;
|
m_alignment_offset = 0;
|
||||||
|
|
||||||
//When using debugging tools, the mapped base might not be aligned as expected
|
//When using debugging tools, the mapped base might not be aligned as expected
|
||||||
const u64 mapped_address_base = (u64)m_memory_mapping;
|
const u64 mapped_address_base = reinterpret_cast<u64>(m_memory_mapping);
|
||||||
if (mapped_address_base & 0xF)
|
if (mapped_address_base & 0xF)
|
||||||
{
|
{
|
||||||
//Unaligned result was returned. We have to modify the base address a bit
|
//Unaligned result was returned. We have to modify the base address a bit
|
||||||
@ -1097,7 +1097,7 @@ namespace gl
|
|||||||
const u64 new_base = (mapped_address_base & ~0xF) + 16;
|
const u64 new_base = (mapped_address_base & ~0xF) + 16;
|
||||||
const u64 diff_bytes = new_base - mapped_address_base;
|
const u64 diff_bytes = new_base - mapped_address_base;
|
||||||
|
|
||||||
m_memory_mapping = (void *)new_base;
|
m_memory_mapping = reinterpret_cast<void*>(new_base);
|
||||||
m_mapped_bytes -= ::narrow<u32>(diff_bytes);
|
m_mapped_bytes -= ::narrow<u32>(diff_bytes);
|
||||||
m_alignment_offset = ::narrow<u32>(diff_bytes);
|
m_alignment_offset = ::narrow<u32>(diff_bytes);
|
||||||
}
|
}
|
||||||
@ -1131,7 +1131,7 @@ namespace gl
|
|||||||
m_mapped_bytes -= real_size;
|
m_mapped_bytes -= real_size;
|
||||||
|
|
||||||
u32 local_offset = (offset - m_mapping_offset);
|
u32 local_offset = (offset - m_mapping_offset);
|
||||||
return std::make_pair(((char*)m_memory_mapping) + local_offset, offset + m_alignment_offset);
|
return std::make_pair(static_cast<char*>(m_memory_mapping) + local_offset, offset + m_alignment_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove() override
|
void remove() override
|
||||||
@ -1224,7 +1224,7 @@ namespace gl
|
|||||||
vao& m_parent;
|
vao& m_parent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using save_binding_state = save_binding_state_base<entry, (GLuint)BindId, GetStateId>;
|
using save_binding_state = save_binding_state_base<entry, (static_cast<GLuint>(BindId)), GetStateId>;
|
||||||
|
|
||||||
entry(vao* parent) noexcept : m_parent(*parent)
|
entry(vao* parent) noexcept : m_parent(*parent)
|
||||||
{
|
{
|
||||||
@ -1248,7 +1248,7 @@ namespace gl
|
|||||||
entry<buffer::target::element_array, GL_ELEMENT_ARRAY_BUFFER_BINDING> element_array_buffer{ this };
|
entry<buffer::target::element_array, GL_ELEMENT_ARRAY_BUFFER_BINDING> element_array_buffer{ this };
|
||||||
|
|
||||||
vao() = default;
|
vao() = default;
|
||||||
vao(vao&) = delete;
|
vao(const vao&) = delete;
|
||||||
|
|
||||||
vao(vao&& vao_) noexcept
|
vao(vao&& vao_) noexcept
|
||||||
{
|
{
|
||||||
@ -1341,19 +1341,19 @@ namespace gl
|
|||||||
disable_for_attributes({ index });
|
disable_for_attributes({ index });
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_pointer operator + (u32 offset) const noexcept
|
buffer_pointer operator + (u32 offset) noexcept
|
||||||
{
|
{
|
||||||
return{ (vao*)this, offset };
|
return{ this, offset };
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_pointer operator >> (u32 stride) const noexcept
|
buffer_pointer operator >> (u32 stride) noexcept
|
||||||
{
|
{
|
||||||
return{ (vao*)this, {}, stride };
|
return{ this, {}, stride };
|
||||||
}
|
}
|
||||||
|
|
||||||
operator buffer_pointer() const noexcept
|
operator buffer_pointer() noexcept
|
||||||
{
|
{
|
||||||
return{ (vao*)this };
|
return{ this };
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_t operator [] (u32 index) const noexcept;
|
attrib_t operator [] (u32 index) const noexcept;
|
||||||
@ -1389,8 +1389,8 @@ namespace gl
|
|||||||
void operator = (buffer_pointer& pointer) const
|
void operator = (buffer_pointer& pointer) const
|
||||||
{
|
{
|
||||||
pointer.get_vao().enable_for_attribute(m_location);
|
pointer.get_vao().enable_for_attribute(m_location);
|
||||||
glVertexAttribPointer(location(), pointer.size(), (GLenum)pointer.get_type(), pointer.normalize(),
|
glVertexAttribPointer(location(), pointer.size(), static_cast<GLenum>(pointer.get_type()), pointer.normalize(),
|
||||||
pointer.stride(), (const void*)(size_t)pointer.offset());
|
pointer.stride(), reinterpret_cast<const void*>(u64{pointer.offset()}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1582,19 +1582,19 @@ namespace gl
|
|||||||
switch (target)
|
switch (target)
|
||||||
{
|
{
|
||||||
case GL_TEXTURE_1D:
|
case GL_TEXTURE_1D:
|
||||||
glGetIntegerv(GL_TEXTURE_BINDING_1D, (GLint*)&old_binding);
|
glGetIntegerv(GL_TEXTURE_BINDING_1D, reinterpret_cast<GLint*>(&old_binding));
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_2D:
|
case GL_TEXTURE_2D:
|
||||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&old_binding);
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, reinterpret_cast<GLint*>(&old_binding));
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_3D:
|
case GL_TEXTURE_3D:
|
||||||
glGetIntegerv(GL_TEXTURE_BINDING_3D, (GLint*)&old_binding);
|
glGetIntegerv(GL_TEXTURE_BINDING_3D, reinterpret_cast<GLint*>(&old_binding));
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_CUBE_MAP:
|
case GL_TEXTURE_CUBE_MAP:
|
||||||
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, (GLint*)&old_binding);
|
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, reinterpret_cast<GLint*>(&old_binding));
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_BUFFER:
|
case GL_TEXTURE_BUFFER:
|
||||||
glGetIntegerv(GL_TEXTURE_BINDING_BUFFER, (GLint*)&old_binding);
|
glGetIntegerv(GL_TEXTURE_BINDING_BUFFER, reinterpret_cast<GLint*>(&old_binding));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1807,37 +1807,37 @@ namespace gl
|
|||||||
{
|
{
|
||||||
pixel_settings.apply();
|
pixel_settings.apply();
|
||||||
|
|
||||||
switch ((GLenum)m_target)
|
switch (static_cast<GLenum>(m_target))
|
||||||
{
|
{
|
||||||
case GL_TEXTURE_1D:
|
case GL_TEXTURE_1D:
|
||||||
{
|
{
|
||||||
DSA_CALL(TextureSubImage1D, m_id, GL_TEXTURE_1D, 0, region.x, region.width, (GLenum)format, (GLenum)type, src);
|
DSA_CALL(TextureSubImage1D, m_id, GL_TEXTURE_1D, 0, region.x, region.width, static_cast<GLenum>(format), static_cast<GLenum>(type), src);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GL_TEXTURE_2D:
|
case GL_TEXTURE_2D:
|
||||||
{
|
{
|
||||||
DSA_CALL(TextureSubImage2D, m_id, GL_TEXTURE_2D, 0, region.x, region.y, region.width, region.height, (GLenum)format, (GLenum)type, src);
|
DSA_CALL(TextureSubImage2D, m_id, GL_TEXTURE_2D, 0, region.x, region.y, region.width, region.height, static_cast<GLenum>(format), static_cast<GLenum>(type), src);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GL_TEXTURE_3D:
|
case GL_TEXTURE_3D:
|
||||||
{
|
{
|
||||||
DSA_CALL(TextureSubImage3D, m_id, GL_TEXTURE_3D, 0, region.x, region.y, region.z, region.width, region.height, region.depth, (GLenum)format, (GLenum)type, src);
|
DSA_CALL(TextureSubImage3D, m_id, GL_TEXTURE_3D, 0, region.x, region.y, region.z, region.width, region.height, region.depth, static_cast<GLenum>(format), static_cast<GLenum>(type), src);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GL_TEXTURE_CUBE_MAP:
|
case GL_TEXTURE_CUBE_MAP:
|
||||||
{
|
{
|
||||||
if (get_driver_caps().ARB_dsa_supported)
|
if (get_driver_caps().ARB_dsa_supported)
|
||||||
{
|
{
|
||||||
glTextureSubImage3D(m_id, 0, region.x, region.y, region.z, region.width, region.height, region.depth, (GLenum)format, (GLenum)type, src);
|
glTextureSubImage3D(m_id, 0, region.x, region.y, region.z, region.width, region.height, region.depth, static_cast<GLenum>(format), static_cast<GLenum>(type), src);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_WARNING(RSX, "Cubemap upload via texture::copy_from is halfplemented!");
|
LOG_WARNING(RSX, "Cubemap upload via texture::copy_from is halfplemented!");
|
||||||
u8* ptr = (u8*)src;
|
auto ptr = static_cast<const u8*>(src);
|
||||||
const auto end = std::min(6u, region.z + region.depth);
|
const auto end = std::min(6u, region.z + region.depth);
|
||||||
for (unsigned face = region.z; face < end; ++face)
|
for (unsigned face = region.z; face < end; ++face)
|
||||||
{
|
{
|
||||||
glTextureSubImage2DEXT(m_id, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, region.x, region.y, region.width, region.height, (GLenum)format, (GLenum)type, ptr);
|
glTextureSubImage2DEXT(m_id, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, region.x, region.y, region.width, region.height, static_cast<GLenum>(format), static_cast<GLenum>(type), ptr);
|
||||||
ptr += (region.width * region.height * 4); //TODO
|
ptr += (region.width * region.height * 4); //TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1874,20 +1874,20 @@ namespace gl
|
|||||||
region.width == m_width && region.height == m_height && region.depth == m_depth)
|
region.width == m_width && region.height == m_height && region.depth == m_depth)
|
||||||
{
|
{
|
||||||
if (caps.ARB_dsa_supported)
|
if (caps.ARB_dsa_supported)
|
||||||
glGetTextureImage(m_id, 0, (GLenum)format, (GLenum)type, INT32_MAX, dst);
|
glGetTextureImage(m_id, 0, static_cast<GLenum>(format), static_cast<GLenum>(type), INT32_MAX, dst);
|
||||||
else
|
else
|
||||||
glGetTextureImageEXT(m_id, (GLenum)m_target, 0, (GLenum)format, (GLenum)type, dst);
|
glGetTextureImageEXT(m_id, static_cast<GLenum>(m_target), 0, static_cast<GLenum>(format), static_cast<GLenum>(type), dst);
|
||||||
}
|
}
|
||||||
else if (caps.ARB_dsa_supported)
|
else if (caps.ARB_dsa_supported)
|
||||||
{
|
{
|
||||||
glGetTextureSubImage(m_id, 0, region.x, region.y, region.z, region.width, region.height, region.depth,
|
glGetTextureSubImage(m_id, 0, region.x, region.y, region.z, region.width, region.height, region.depth,
|
||||||
(GLenum)format, (GLenum)type, INT32_MAX, dst);
|
static_cast<GLenum>(format), static_cast<GLenum>(type), INT32_MAX, dst);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Worst case scenario. For some reason, EXT_dsa does not have glGetTextureSubImage
|
// Worst case scenario. For some reason, EXT_dsa does not have glGetTextureSubImage
|
||||||
const auto target_ = static_cast<GLenum>(m_target);
|
const auto target_ = static_cast<GLenum>(m_target);
|
||||||
texture tmp{ target_, region.width, region.height, region.depth, 1, (GLenum)m_internal_format };
|
texture tmp{ target_, region.width, region.height, region.depth, 1, static_cast<GLenum>(m_internal_format) };
|
||||||
glCopyImageSubData(m_id, target_, 0, region.x, region.y, region.z, tmp.id(), target_, 0, 0, 0, 0,
|
glCopyImageSubData(m_id, target_, 0, region.x, region.y, region.z, tmp.id(), target_, 0, 0, 0, 0,
|
||||||
region.width, region.height, region.depth);
|
region.width, region.height, region.depth);
|
||||||
|
|
||||||
@ -1934,7 +1934,7 @@ namespace gl
|
|||||||
component_swizzle[3] = argb_swizzle[0];
|
component_swizzle[3] = argb_swizzle[0];
|
||||||
|
|
||||||
glBindTexture(m_target, m_id);
|
glBindTexture(m_target, m_id);
|
||||||
glTexParameteriv(m_target, GL_TEXTURE_SWIZZLE_RGBA, (GLint*)component_swizzle);
|
glTexParameteriv(m_target, GL_TEXTURE_SWIZZLE_RGBA, reinterpret_cast<GLint*>(component_swizzle));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1968,8 +1968,8 @@ namespace gl
|
|||||||
texture_view(texture* data, const GLenum* argb_swizzle = nullptr,
|
texture_view(texture* data, const GLenum* argb_swizzle = nullptr,
|
||||||
GLenum aspect_flags = image_aspect::color | image_aspect::depth)
|
GLenum aspect_flags = image_aspect::color | image_aspect::depth)
|
||||||
{
|
{
|
||||||
GLenum target = (GLenum)data->get_target();
|
GLenum target = static_cast<GLenum>(data->get_target());
|
||||||
GLenum sized_format = (GLenum)data->get_internal_format();
|
GLenum sized_format = static_cast<GLenum>(data->get_internal_format());
|
||||||
create(data, target, sized_format, aspect_flags, argb_swizzle);
|
create(data, target, sized_format, aspect_flags, argb_swizzle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2137,7 +2137,7 @@ public:
|
|||||||
void storage(texture::format format, u32 width, u32 height)
|
void storage(texture::format format, u32 width, u32 height)
|
||||||
{
|
{
|
||||||
save_binding_state save(*this);
|
save_binding_state save(*this);
|
||||||
glRenderbufferStorage(GL_RENDERBUFFER, (GLenum)format, width, height);
|
glRenderbufferStorage(GL_RENDERBUFFER, static_cast<GLenum>(format), width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove()
|
void remove()
|
||||||
@ -2236,7 +2236,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
attachment(fbo& parent, type type)
|
attachment(fbo& parent, type type)
|
||||||
: m_id((int)type)
|
: m_id(static_cast<int>(type))
|
||||||
, m_parent(parent)
|
, m_parent(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -2470,14 +2470,14 @@ public:
|
|||||||
|
|
||||||
void create(type type_)
|
void create(type type_)
|
||||||
{
|
{
|
||||||
m_id = glCreateShader((GLenum)type_);
|
m_id = glCreateShader(static_cast<GLenum>(type_));
|
||||||
shader_type = type_;
|
shader_type = type_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void source(const std::string& src) const
|
void source(const std::string& src) const
|
||||||
{
|
{
|
||||||
const char* str = src.c_str();
|
const char* str = src.c_str();
|
||||||
const GLint length = (GLint)src.length();
|
const GLint length = ::narrow<GLint>(src.length());
|
||||||
if (g_cfg.video.log_programs)
|
if (g_cfg.video.log_programs)
|
||||||
{
|
{
|
||||||
std::string base_name;
|
std::string base_name;
|
||||||
@ -2708,7 +2708,7 @@ public:
|
|||||||
{
|
{
|
||||||
GLint id;
|
GLint id;
|
||||||
glGetIntegerv(GL_CURRENT_PROGRAM, &id);
|
glGetIntegerv(GL_CURRENT_PROGRAM, &id);
|
||||||
return{ (GLuint)id };
|
return{ static_cast<GLuint>(id) };
|
||||||
}
|
}
|
||||||
|
|
||||||
void use()
|
void use()
|
||||||
@ -2899,7 +2899,7 @@ public:
|
|||||||
|
|
||||||
save_binding_state()
|
save_binding_state()
|
||||||
{
|
{
|
||||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*)&old_fbo);
|
glGetIntegerv(GL_FRAMEBUFFER_BINDING, reinterpret_cast<GLint*>(&old_fbo));
|
||||||
}
|
}
|
||||||
|
|
||||||
~save_binding_state()
|
~save_binding_state()
|
||||||
|
@ -37,7 +37,7 @@ namespace gl
|
|||||||
saved_sampler_state(GLuint _unit, const gl::sampler_state& sampler)
|
saved_sampler_state(GLuint _unit, const gl::sampler_state& sampler)
|
||||||
{
|
{
|
||||||
glActiveTexture(GL_TEXTURE0 + _unit);
|
glActiveTexture(GL_TEXTURE0 + _unit);
|
||||||
glGetIntegerv(GL_SAMPLER_BINDING, (GLint*)&saved);
|
glGetIntegerv(GL_SAMPLER_BINDING, reinterpret_cast<GLint*>(&saved));
|
||||||
|
|
||||||
unit = _unit;
|
unit = _unit;
|
||||||
sampler.bind(_unit);
|
sampler.bind(_unit);
|
||||||
@ -240,7 +240,7 @@ namespace gl
|
|||||||
glBindFramebuffer(GL_FRAMEBUFFER, old_fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, old_fbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
glUseProgram((GLuint)program);
|
glUseProgram(program);
|
||||||
|
|
||||||
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
|
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
|
||||||
glColorMask(color_writes[0], color_writes[1], color_writes[2], color_writes[3]);
|
glColorMask(color_writes[0], color_writes[1], color_writes[2], color_writes[3]);
|
||||||
@ -493,8 +493,8 @@ namespace gl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u64 key = (u64)desc;
|
u64 key = reinterpret_cast<u64>(desc);
|
||||||
temp_image_cache[key] = std::move(std::make_pair(owner_uid, std::move(tex)));
|
temp_image_cache[key] = std::make_pair(owner_uid, std::move(tex));
|
||||||
temp_view_cache[key] = std::move(view);
|
temp_view_cache[key] = std::move(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,13 +544,13 @@ namespace gl
|
|||||||
|
|
||||||
gl::texture_view* find_font(rsx::overlays::font *font)
|
gl::texture_view* find_font(rsx::overlays::font *font)
|
||||||
{
|
{
|
||||||
u64 key = (u64)font;
|
u64 key = reinterpret_cast<u64>(font);
|
||||||
auto found = view_cache.find(key);
|
auto found = view_cache.find(key);
|
||||||
if (found != view_cache.end())
|
if (found != view_cache.end())
|
||||||
return found->second.get();
|
return found->second.get();
|
||||||
|
|
||||||
//Create font file
|
//Create font file
|
||||||
auto tex = std::make_unique<gl::texture>(GL_TEXTURE_2D, (int)font->width, (int)font->height, 1, 1, GL_R8);
|
auto tex = std::make_unique<gl::texture>(GL_TEXTURE_2D, font->width, font->height, 1, 1, GL_R8);
|
||||||
tex->copy_from(font->glyph_data.data(), gl::texture::format::r, gl::texture::type::ubyte, {});
|
tex->copy_from(font->glyph_data.data(), gl::texture::format::r, gl::texture::type::ubyte, {});
|
||||||
|
|
||||||
GLenum remap[] = { GL_RED, GL_RED, GL_RED, GL_RED };
|
GLenum remap[] = { GL_RED, GL_RED, GL_RED, GL_RED };
|
||||||
@ -565,7 +565,7 @@ namespace gl
|
|||||||
|
|
||||||
gl::texture_view* find_temp_image(rsx::overlays::image_info *desc, u32 owner_uid)
|
gl::texture_view* find_temp_image(rsx::overlays::image_info *desc, u32 owner_uid)
|
||||||
{
|
{
|
||||||
auto key = (u64)desc;
|
auto key = reinterpret_cast<u64>(desc);
|
||||||
auto cached = temp_view_cache.find(key);
|
auto cached = temp_view_cache.find(key);
|
||||||
if (cached != temp_view_cache.end())
|
if (cached != temp_view_cache.end())
|
||||||
{
|
{
|
||||||
@ -632,17 +632,17 @@ namespace gl
|
|||||||
|
|
||||||
void run(const areau& viewport, GLuint target, rsx::overlays::overlay& ui)
|
void run(const areau& viewport, GLuint target, rsx::overlays::overlay& ui)
|
||||||
{
|
{
|
||||||
program_handle.uniforms["viewport"] = color2f((f32)viewport.width(), (f32)viewport.height());
|
program_handle.uniforms["viewport"] = color2f(static_cast<f32>(viewport.width()), static_cast<f32>(viewport.height()));
|
||||||
program_handle.uniforms["ui_scale"] = color4f((f32)ui.virtual_width, (f32)ui.virtual_height, 1.f, 1.f);
|
program_handle.uniforms["ui_scale"] = color4f(static_cast<f32>(ui.virtual_width), static_cast<f32>(ui.virtual_height), 1.f, 1.f);
|
||||||
program_handle.uniforms["time"] = (f32)(get_system_time() / 1000) * 0.005f;
|
program_handle.uniforms["time"] = static_cast<f32>(get_system_time() / 1000) * 0.005f;
|
||||||
|
|
||||||
saved_sampler_state saved(31, m_sampler);
|
saved_sampler_state saved(31, m_sampler);
|
||||||
|
|
||||||
for (auto &cmd : ui.get_compiled().draw_commands)
|
for (auto &cmd : ui.get_compiled().draw_commands)
|
||||||
{
|
{
|
||||||
set_primitive_type(cmd.config.primitives);
|
set_primitive_type(cmd.config.primitives);
|
||||||
upload_vertex_data((f32*)cmd.verts.data(), (u32)cmd.verts.size() * 4u);
|
upload_vertex_data(reinterpret_cast<f32*>(cmd.verts.data()), ::size32(cmd.verts) * 4u);
|
||||||
num_drawable_elements = (u32)cmd.verts.size();
|
num_drawable_elements = ::size32(cmd.verts);
|
||||||
GLint texture_exists = GL_TRUE;
|
GLint texture_exists = GL_TRUE;
|
||||||
|
|
||||||
switch (cmd.config.texture_ref)
|
switch (cmd.config.texture_ref)
|
||||||
@ -658,7 +658,7 @@ namespace gl
|
|||||||
}
|
}
|
||||||
case rsx::overlays::image_resource_id::raw_image:
|
case rsx::overlays::image_resource_id::raw_image:
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, find_temp_image((rsx::overlays::image_info*)cmd.config.external_data_ref, ui.uid)->id());
|
glBindTexture(GL_TEXTURE_2D, find_temp_image(static_cast<rsx::overlays::image_info*>(cmd.config.external_data_ref), ui.uid)->id());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case rsx::overlays::image_resource_id::font_file:
|
case rsx::overlays::image_resource_id::font_file:
|
||||||
@ -675,9 +675,9 @@ namespace gl
|
|||||||
|
|
||||||
program_handle.uniforms["color"] = cmd.config.color;
|
program_handle.uniforms["color"] = cmd.config.color;
|
||||||
program_handle.uniforms["read_texture"] = texture_exists;
|
program_handle.uniforms["read_texture"] = texture_exists;
|
||||||
program_handle.uniforms["pulse_glow"] = (s32)cmd.config.pulse_glow;
|
program_handle.uniforms["pulse_glow"] = static_cast<s32>(cmd.config.pulse_glow);
|
||||||
program_handle.uniforms["blur_strength"] = (s32)cmd.config.blur_strength;
|
program_handle.uniforms["blur_strength"] = static_cast<s32>(cmd.config.blur_strength);
|
||||||
program_handle.uniforms["clip_region"] = (s32)cmd.config.clip_region;
|
program_handle.uniforms["clip_region"] = static_cast<s32>(cmd.config.clip_region);
|
||||||
program_handle.uniforms["clip_bounds"] = cmd.config.clip_rect;
|
program_handle.uniforms["clip_bounds"] = cmd.config.clip_rect;
|
||||||
overlay_pass::run(viewport, target, false, true);
|
overlay_pass::run(viewport, target, false, true);
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ namespace gl
|
|||||||
void run(const areau& viewport, GLuint source, f32 gamma, bool limited_rgb)
|
void run(const areau& viewport, GLuint source, f32 gamma, bool limited_rgb)
|
||||||
{
|
{
|
||||||
program_handle.uniforms["gamma"] = gamma;
|
program_handle.uniforms["gamma"] = gamma;
|
||||||
program_handle.uniforms["limit_range"] = (int)limited_rgb;
|
program_handle.uniforms["limit_range"] = limited_rgb + 0;
|
||||||
|
|
||||||
saved_sampler_state saved(31, m_sampler);
|
saved_sampler_state saved(31, m_sampler);
|
||||||
glBindTexture(GL_TEXTURE_2D, source);
|
glBindTexture(GL_TEXTURE_2D, source);
|
||||||
|
@ -62,7 +62,7 @@ color_format rsx::internals::surface_color_format_to_gl(rsx::surface_color_forma
|
|||||||
{ ::gl::texture::channel::a, ::gl::texture::channel::b, ::gl::texture::channel::g, ::gl::texture::channel::r } };
|
{ ::gl::texture::channel::a, ::gl::texture::channel::b, ::gl::texture::channel::g, ::gl::texture::channel::r } };
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unsupported surface color format 0x%x" HERE, (u32)color_format);
|
fmt::throw_exception("Unsupported surface color format 0x%x" HERE, static_cast<u32>(color_format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,9 +78,9 @@ depth_format rsx::internals::surface_depth_format_to_gl(rsx::surface_depth_forma
|
|||||||
return{ ::gl::texture::type::uint_24_8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth32f_stencil8 };
|
return{ ::gl::texture::type::uint_24_8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth32f_stencil8 };
|
||||||
else
|
else
|
||||||
return{ ::gl::texture::type::uint_24_8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth24_stencil8 };
|
return{ ::gl::texture::type::uint_24_8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth24_stencil8 };
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unsupported depth format 0x%x" HERE, (u32)depth_format);
|
fmt::throw_exception("Unsupported depth format 0x%x" HERE, static_cast<u32>(depth_format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk
|
|||||||
|
|
||||||
m_draw_fbo = &fbo;
|
m_draw_fbo = &fbo;
|
||||||
m_draw_fbo->bind();
|
m_draw_fbo->bind();
|
||||||
m_draw_fbo->set_extents({ (int)m_framebuffer_layout.width, (int)m_framebuffer_layout.height });
|
m_draw_fbo->set_extents({ m_framebuffer_layout.width, m_framebuffer_layout.height });
|
||||||
|
|
||||||
framebuffer_status_valid = true;
|
framebuffer_status_valid = true;
|
||||||
break;
|
break;
|
||||||
@ -267,7 +267,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk
|
|||||||
m_draw_fbo = &m_framebuffer_cache.back();
|
m_draw_fbo = &m_framebuffer_cache.back();
|
||||||
m_draw_fbo->create();
|
m_draw_fbo->create();
|
||||||
m_draw_fbo->bind();
|
m_draw_fbo->bind();
|
||||||
m_draw_fbo->set_extents({ (int)m_framebuffer_layout.width, (int)m_framebuffer_layout.height });
|
m_draw_fbo->set_extents({ m_framebuffer_layout.width, m_framebuffer_layout.height });
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
@ -479,13 +479,13 @@ void gl::render_target::memory_barrier(gl::command_context& cmd, bool force_init
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Mem cast, generate typeless xfer info
|
// Mem cast, generate typeless xfer info
|
||||||
if (!formats_are_bitcast_compatible((GLenum)get_internal_format(), (GLenum)src_texture->get_internal_format()) ||
|
if (!formats_are_bitcast_compatible(static_cast<GLenum>(get_internal_format()), static_cast<GLenum>(src_texture->get_internal_format())) ||
|
||||||
aspect() != src_texture->aspect())
|
aspect() != src_texture->aspect())
|
||||||
{
|
{
|
||||||
typeless_info.src_is_typeless = true;
|
typeless_info.src_is_typeless = true;
|
||||||
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
|
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
|
||||||
typeless_info.src_native_format_override = (u32)get_internal_format();
|
typeless_info.src_native_format_override = static_cast<u32>(get_internal_format());
|
||||||
typeless_info.src_scaling_hint = f32(src_bpp) / dst_bpp;
|
typeless_info.src_scaling_hint = static_cast<f32>(src_bpp) / dst_bpp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ namespace gl
|
|||||||
texture* get_surface(rsx::surface_access /*access_type*/) override
|
texture* get_surface(rsx::surface_access /*access_type*/) override
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return (gl::texture*)this;
|
return static_cast<gl::texture*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 raw_handle() const
|
u32 raw_handle() const
|
||||||
@ -141,15 +141,15 @@ struct gl_render_target_traits
|
|||||||
{
|
{
|
||||||
auto format = rsx::internals::surface_color_format_to_gl(surface_color_format);
|
auto format = rsx::internals::surface_color_format_to_gl(surface_color_format);
|
||||||
|
|
||||||
std::unique_ptr<gl::render_target> result(new gl::render_target(rsx::apply_resolution_scale((u16)width, true),
|
std::unique_ptr<gl::render_target> result(new gl::render_target(rsx::apply_resolution_scale(static_cast<u16>(width), true),
|
||||||
rsx::apply_resolution_scale((u16)height, true), (GLenum)format.internal_format));
|
rsx::apply_resolution_scale(static_cast<u16>(height), true), static_cast<GLenum>(format.internal_format)));
|
||||||
|
|
||||||
result->set_aa_mode(antialias);
|
result->set_aa_mode(antialias);
|
||||||
result->set_native_pitch((u16)width * get_format_block_size_in_bytes(surface_color_format) * result->samples_x);
|
result->set_native_pitch(static_cast<u16>(width) * get_format_block_size_in_bytes(surface_color_format) * result->samples_x);
|
||||||
result->set_surface_dimensions((u16)width, (u16)height, (u16)pitch);
|
result->set_surface_dimensions(static_cast<u16>(width), static_cast<u16>(height), static_cast<u16>(pitch));
|
||||||
result->set_format(surface_color_format);
|
result->set_format(surface_color_format);
|
||||||
|
|
||||||
std::array<GLenum, 4> native_layout = { (GLenum)format.swizzle.a, (GLenum)format.swizzle.r, (GLenum)format.swizzle.g, (GLenum)format.swizzle.b };
|
std::array<GLenum, 4> native_layout = { static_cast<GLenum>(format.swizzle.a), static_cast<GLenum>(format.swizzle.r), static_cast<GLenum>(format.swizzle.g), static_cast<GLenum>(format.swizzle.b) };
|
||||||
result->set_native_component_layout(native_layout);
|
result->set_native_component_layout(native_layout);
|
||||||
|
|
||||||
result->memory_usage_flags = rsx::surface_usage_flags::attachment;
|
result->memory_usage_flags = rsx::surface_usage_flags::attachment;
|
||||||
@ -168,14 +168,14 @@ struct gl_render_target_traits
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto format = rsx::internals::surface_depth_format_to_gl(surface_depth_format);
|
auto format = rsx::internals::surface_depth_format_to_gl(surface_depth_format);
|
||||||
std::unique_ptr<gl::render_target> result(new gl::render_target(rsx::apply_resolution_scale((u16)width, true),
|
std::unique_ptr<gl::render_target> result(new gl::render_target(rsx::apply_resolution_scale(static_cast<u16>(width), true),
|
||||||
rsx::apply_resolution_scale((u16)height, true), (GLenum)format.internal_format));
|
rsx::apply_resolution_scale(static_cast<u16>(height), true), static_cast<GLenum>(format.internal_format)));
|
||||||
|
|
||||||
result->set_aa_mode(antialias);
|
result->set_aa_mode(antialias);
|
||||||
result->set_surface_dimensions((u16)width, (u16)height, (u16)pitch);
|
result->set_surface_dimensions(static_cast<u16>(width), static_cast<u16>(height), static_cast<u16>(pitch));
|
||||||
result->set_format(surface_depth_format);
|
result->set_format(surface_depth_format);
|
||||||
|
|
||||||
u16 native_pitch = (u16)width * 2 * result->samples_x;
|
u16 native_pitch = static_cast<u16>(width) * 2 * result->samples_x;
|
||||||
if (surface_depth_format == rsx::surface_depth_format::z24s8)
|
if (surface_depth_format == rsx::surface_depth_format::z24s8)
|
||||||
native_pitch *= 2;
|
native_pitch *= 2;
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ struct gl_render_target_traits
|
|||||||
{
|
{
|
||||||
if (!sink)
|
if (!sink)
|
||||||
{
|
{
|
||||||
auto internal_format = (GLenum)ref->get_internal_format();
|
auto internal_format = static_cast<GLenum>(ref->get_internal_format());
|
||||||
const auto new_w = rsx::apply_resolution_scale(prev.width, true, ref->get_surface_width(rsx::surface_metrics::pixels));
|
const auto new_w = rsx::apply_resolution_scale(prev.width, true, ref->get_surface_width(rsx::surface_metrics::pixels));
|
||||||
const auto new_h = rsx::apply_resolution_scale(prev.height, true, ref->get_surface_height(rsx::surface_metrics::pixels));
|
const auto new_h = rsx::apply_resolution_scale(prev.height, true, ref->get_surface_height(rsx::surface_metrics::pixels));
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ struct gl_render_target_traits
|
|||||||
static
|
static
|
||||||
void invalidate_surface_contents(gl::command_context&, gl::render_target *surface, u32 address, size_t pitch)
|
void invalidate_surface_contents(gl::command_context&, gl::render_target *surface, u32 address, size_t pitch)
|
||||||
{
|
{
|
||||||
surface->set_rsx_pitch((u16)pitch);
|
surface->set_rsx_pitch(static_cast<u16>(pitch));
|
||||||
surface->queue_tag(address);
|
surface->queue_tag(address);
|
||||||
surface->last_use_tag = 0;
|
surface->last_use_tag = 0;
|
||||||
surface->stencil_init_flags = 0;
|
surface->stencil_init_flags = 0;
|
||||||
@ -309,7 +309,7 @@ struct gl_render_target_traits
|
|||||||
|
|
||||||
return surface->get_internal_format() == format &&
|
return surface->get_internal_format() == format &&
|
||||||
surface->get_spp() == get_format_sample_count(antialias) &&
|
surface->get_spp() == get_format_sample_count(antialias) &&
|
||||||
surface->matches_dimensions((u16)width, (u16)height);
|
surface->matches_dimensions(static_cast<u16>(width), static_cast<u16>(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -73,7 +73,7 @@ namespace gl
|
|||||||
m_program.use();
|
m_program.use();
|
||||||
|
|
||||||
m_program.uniforms["draw_color"] = color;
|
m_program.uniforms["draw_color"] = color;
|
||||||
glProgramUniform2fv(m_program.id(), m_program.uniforms["offsets"].location(), (GLsizei)nb_offsets, offsets);
|
glProgramUniform2fv(m_program.id(), m_program.uniforms["offsets"].location(), static_cast<GLsizei>(nb_offsets), offsets);
|
||||||
glProgramUniform2fv(m_program.id(), m_program.uniforms["scale"].location(), 1, scale);
|
glProgramUniform2fv(m_program.id(), m_program.uniforms["scale"].location(), 1, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,9 +141,8 @@ namespace gl
|
|||||||
float base_offset = 0.f;
|
float base_offset = 0.f;
|
||||||
shader_offsets.reserve(text.length() * 2);
|
shader_offsets.reserve(text.length() * 2);
|
||||||
|
|
||||||
while (*s)
|
while (u8 offset = static_cast<u8>(*s))
|
||||||
{
|
{
|
||||||
u8 offset = (u8)*s;
|
|
||||||
bool to_draw = false; //Can be false for space or unsupported characters
|
bool to_draw = false; //Can be false for space or unsupported characters
|
||||||
|
|
||||||
auto o = m_offsets.find(offset);
|
auto o = m_offsets.find(offset);
|
||||||
@ -183,7 +182,7 @@ namespace gl
|
|||||||
|
|
||||||
m_vao.bind();
|
m_vao.bind();
|
||||||
|
|
||||||
glMultiDrawArrays(GL_POINTS, (const GLint*)offsets.data(), (const GLsizei*)counts.data(), (GLsizei)counts.size());
|
glMultiDrawArrays(GL_POINTS, offsets.data(), counts.data(), static_cast<GLsizei>(counts.size()));
|
||||||
glBindVertexArray(old_vao);
|
glBindVertexArray(old_vao);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ namespace gl
|
|||||||
case texture::internal_format::depth32f_stencil8:
|
case texture::internal_format::depth32f_stencil8:
|
||||||
return { GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 4, true };
|
return { GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 4, true };
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unexpected internal format 0x%X" HERE, (u32)format);
|
fmt::throw_exception("Unexpected internal format 0x%X" HERE, static_cast<u32>(format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ namespace gl
|
|||||||
case rsx::texture_wrap_mode::mirror_once_clamp: return GL_MIRROR_CLAMP_EXT;
|
case rsx::texture_wrap_mode::mirror_once_clamp: return GL_MIRROR_CLAMP_EXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ERROR(RSX, "Texture wrap error: bad wrap (%d)", (u32)wrap);
|
LOG_ERROR(RSX, "Texture wrap error: bad wrap (%d)", static_cast<u32>(wrap));
|
||||||
return GL_REPEAT;
|
return GL_REPEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ namespace gl
|
|||||||
case rsx::texture_max_anisotropy::x16: return 16.0f;
|
case rsx::texture_max_anisotropy::x16: return 16.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ERROR(RSX, "Texture anisotropy error: bad max aniso (%d)", (u32)aniso);
|
LOG_ERROR(RSX, "Texture anisotropy error: bad max aniso (%d)", static_cast<u32>(aniso));
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ namespace gl
|
|||||||
case GL_LINEAR_MIPMAP_LINEAR:
|
case GL_LINEAR_MIPMAP_LINEAR:
|
||||||
min_filter = GL_LINEAR; break;
|
min_filter = GL_LINEAR; break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(RSX, "No mipmap fallback defined for rsx_min_filter = 0x%X", (u32)tex.min_filter());
|
LOG_ERROR(RSX, "No mipmap fallback defined for rsx_min_filter = 0x%X", static_cast<u32>(tex.min_filter()));
|
||||||
min_filter = GL_NEAREST;
|
min_filter = GL_NEAREST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ namespace gl
|
|||||||
texture_format == CELL_GCM_TEXTURE_DEPTH16_FLOAT || texture_format == CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT)
|
texture_format == CELL_GCM_TEXTURE_DEPTH16_FLOAT || texture_format == CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT)
|
||||||
{
|
{
|
||||||
//NOTE: The stored texture function is reversed wrt the textureProj compare function
|
//NOTE: The stored texture function is reversed wrt the textureProj compare function
|
||||||
GLenum compare_mode = (GLenum)tex.zfunc() | GL_NEVER;
|
GLenum compare_mode = static_cast<GLenum>(tex.zfunc()) | GL_NEVER;
|
||||||
|
|
||||||
switch (compare_mode)
|
switch (compare_mode)
|
||||||
{
|
{
|
||||||
@ -672,7 +672,7 @@ namespace gl
|
|||||||
case GL_DEPTH32F_STENCIL8:
|
case GL_DEPTH32F_STENCIL8:
|
||||||
return 4;
|
return 4;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unexpected internal format 0x%X" HERE, (u32)format);
|
fmt::throw_exception("Unexpected internal format 0x%X" HERE, static_cast<u32>(format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +703,7 @@ namespace gl
|
|||||||
case GL_DEPTH32F_STENCIL8:
|
case GL_DEPTH32F_STENCIL8:
|
||||||
return { true, 4 };
|
return { true, 4 };
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unexpected internal format 0x%X" HERE, (u32)format);
|
fmt::throw_exception("Unexpected internal format 0x%X" HERE, static_cast<u32>(format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,13 +794,13 @@ namespace gl
|
|||||||
if (LIKELY(caps.ARB_compute_shader_supported))
|
if (LIKELY(caps.ARB_compute_shader_supported))
|
||||||
{
|
{
|
||||||
// Raw copy
|
// Raw copy
|
||||||
src->copy_to(nullptr, (texture::format)pack_info.format, (texture::type)pack_info.type, src_region, {});
|
src->copy_to(nullptr, static_cast<texture::format>(pack_info.format), static_cast<texture::type>(pack_info.type), src_region, {});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pixel_pack_settings pack_settings{};
|
pixel_pack_settings pack_settings{};
|
||||||
pack_settings.swap_bytes(pack_info.swap_bytes);
|
pack_settings.swap_bytes(pack_info.swap_bytes);
|
||||||
src->copy_to(nullptr, (texture::format)pack_info.format, (texture::type)pack_info.type, src_region, pack_settings);
|
src->copy_to(nullptr, static_cast<texture::format>(pack_info.format), static_cast<texture::type>(pack_info.type), src_region, pack_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, GL_NONE);
|
glBindBuffer(GL_PIXEL_PACK_BUFFER, GL_NONE);
|
||||||
@ -847,7 +847,7 @@ namespace gl
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_typeless_transfer_buffer.bind(buffer::target::pixel_unpack);
|
g_typeless_transfer_buffer.bind(buffer::target::pixel_unpack);
|
||||||
dst->copy_from(nullptr, (texture::format)unpack_info.format, (texture::type)unpack_info.type, dst_region, unpack_settings);
|
dst->copy_from(nullptr, static_cast<texture::format>(pack_info.format), static_cast<texture::type>(pack_info.type), dst_region, unpack_settings);
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, GL_NONE);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, GL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +184,11 @@ namespace gl
|
|||||||
// AMD driver bug
|
// AMD driver bug
|
||||||
// Pixel transfer fails with GL_OUT_OF_MEMORY. Usually happens with float textures or operations attempting to swap endianness.
|
// Pixel transfer fails with GL_OUT_OF_MEMORY. Usually happens with float textures or operations attempting to swap endianness.
|
||||||
// Failed operations also leak a large amount of memory
|
// Failed operations also leak a large amount of memory
|
||||||
LOG_ERROR(RSX, "Memory transfer failure (AMD bug). Please update your driver to Adrenalin 19.4.3 or newer. Format=0x%x, Type=0x%x, Swap=%d", (u32)format, (u32)type, pack_unpack_swap_bytes);
|
LOG_ERROR(RSX, "Memory transfer failure (AMD bug). Please update your driver to Adrenalin 19.4.3 or newer. Format=0x%x, Type=0x%x, Swap=%d", static_cast<u32>(format), static_cast<u32>(type), pack_unpack_swap_bytes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_ERROR(RSX, "Memory transfer failed with error 0x%x. Format=0x%x, Type=0x%x", error, (u32)format, (u32)type);
|
LOG_ERROR(RSX, "Memory transfer failed with error 0x%x. Format=0x%x, Type=0x%x", error, static_cast<u32>(format), static_cast<u32>(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ namespace gl
|
|||||||
}
|
}
|
||||||
|
|
||||||
areai src_area = { 0, 0, 0, 0 };
|
areai src_area = { 0, 0, 0, 0 };
|
||||||
const areai dst_area = { 0, 0, (s32)real_width, (s32)real_height };
|
const areai dst_area = { 0, 0, static_cast<s32>(real_width), static_cast<s32>(real_height) };
|
||||||
|
|
||||||
auto ifmt = vram_texture->get_internal_format();
|
auto ifmt = vram_texture->get_internal_format();
|
||||||
src_area.x2 = vram_texture->width();
|
src_area.x2 = vram_texture->width();
|
||||||
@ -255,7 +255,7 @@ namespace gl
|
|||||||
|
|
||||||
if (!scaled_texture)
|
if (!scaled_texture)
|
||||||
{
|
{
|
||||||
scaled_texture = std::make_unique<gl::texture>(GL_TEXTURE_2D, real_width, real_height, 1, 1, (GLenum)ifmt);
|
scaled_texture = std::make_unique<gl::texture>(GL_TEXTURE_2D, real_width, real_height, 1, 1, static_cast<GLenum>(ifmt));
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool linear_interp = is_depth_texture() ? false : true;
|
const bool linear_interp = is_depth_texture() ? false : true;
|
||||||
@ -510,7 +510,7 @@ namespace gl
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::array<GLenum, 4> swizzle;
|
std::array<GLenum, 4> swizzle;
|
||||||
if (!src || (GLenum)src->get_internal_format() != sized_internal_fmt)
|
if (!src || static_cast<GLenum>(src->get_internal_format()) != sized_internal_fmt)
|
||||||
{
|
{
|
||||||
// Apply base component map onto the new texture if a data cast has been done
|
// Apply base component map onto the new texture if a data cast has been done
|
||||||
swizzle = get_component_mapping(gcm_format, rsx::texture_create_flags::default_component_order);
|
swizzle = get_component_mapping(gcm_format, rsx::texture_create_flags::default_component_order);
|
||||||
@ -575,7 +575,7 @@ namespace gl
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
const bool typeless = dst_aspect != slice.src->aspect() ||
|
const bool typeless = dst_aspect != slice.src->aspect() ||
|
||||||
!formats_are_bitcast_compatible((GLenum)slice.src->get_internal_format(), (GLenum)dst_image->get_internal_format());
|
!formats_are_bitcast_compatible(static_cast<GLenum>(slice.src->get_internal_format()), static_cast<GLenum>(dst_image->get_internal_format()));
|
||||||
|
|
||||||
std::unique_ptr<gl::texture> tmp;
|
std::unique_ptr<gl::texture> tmp;
|
||||||
auto src_image = slice.src;
|
auto src_image = slice.src;
|
||||||
@ -601,7 +601,7 @@ namespace gl
|
|||||||
{
|
{
|
||||||
const auto src_bpp = slice.src->pitch() / slice.src->width();
|
const auto src_bpp = slice.src->pitch() / slice.src->width();
|
||||||
const u16 convert_w = u16(slice.src->width() * src_bpp) / dst_bpp;
|
const u16 convert_w = u16(slice.src->width() * src_bpp) / dst_bpp;
|
||||||
tmp = std::make_unique<texture>(GL_TEXTURE_2D, convert_w, slice.src->height(), 1, 1, (GLenum)dst_image->get_internal_format());
|
tmp = std::make_unique<texture>(GL_TEXTURE_2D, convert_w, slice.src->height(), 1, 1, static_cast<GLenum>(dst_image->get_internal_format()));
|
||||||
|
|
||||||
src_image = tmp.get();
|
src_image = tmp.get();
|
||||||
|
|
||||||
@ -620,7 +620,7 @@ namespace gl
|
|||||||
if (src_w == slice.dst_w && src_h == slice.dst_h)
|
if (src_w == slice.dst_w && src_h == slice.dst_h)
|
||||||
{
|
{
|
||||||
glCopyImageSubData(src_image->id(), GL_TEXTURE_2D, 0, src_x, src_y, 0,
|
glCopyImageSubData(src_image->id(), GL_TEXTURE_2D, 0, src_x, src_y, 0,
|
||||||
dst_image->id(), (GLenum)dst_image->get_target(), slice.level, slice.dst_x, slice.dst_y, slice.dst_z, src_w, src_h, 1);
|
dst_image->id(), static_cast<GLenum>(dst_image->get_target()), slice.level, slice.dst_x, slice.dst_y, slice.dst_z, src_w, src_h, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -637,7 +637,7 @@ namespace gl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp = std::make_unique<texture>(GL_TEXTURE_2D, dst_rect.x2, dst_rect.y2, 1, 1, (GLenum)slice.src->get_internal_format());
|
tmp = std::make_unique<texture>(GL_TEXTURE_2D, dst_rect.x2, dst_rect.y2, 1, 1, static_cast<GLenum>(slice.src->get_internal_format()));
|
||||||
_dst = tmp.get();
|
_dst = tmp.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,7 +648,7 @@ namespace gl
|
|||||||
{
|
{
|
||||||
// Data cast comes after scaling
|
// Data cast comes after scaling
|
||||||
glCopyImageSubData(tmp->id(), GL_TEXTURE_2D, 0, slice.dst_x, slice.dst_y, 0,
|
glCopyImageSubData(tmp->id(), GL_TEXTURE_2D, 0, slice.dst_x, slice.dst_y, 0,
|
||||||
dst_image->id(), (GLenum)dst_image->get_target(), slice.level, slice.dst_x, slice.dst_y, slice.dst_z, slice.dst_w, slice.dst_h, 1);
|
dst_image->id(), static_cast<GLenum>(dst_image->get_target()), slice.level, slice.dst_x, slice.dst_y, slice.dst_z, slice.dst_w, slice.dst_h, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -702,7 +702,7 @@ namespace gl
|
|||||||
gl::texture_view* create_temporary_subresource_view(gl::command_context &cmd, gl::texture* src, u32 gcm_format, u16 x, u16 y, u16 w, u16 h,
|
gl::texture_view* create_temporary_subresource_view(gl::command_context &cmd, gl::texture* src, u32 gcm_format, u16 x, u16 y, u16 w, u16 h,
|
||||||
const rsx::texture_channel_remap_t& remap_vector) override
|
const rsx::texture_channel_remap_t& remap_vector) override
|
||||||
{
|
{
|
||||||
return create_temporary_subresource_impl(cmd, src, (GLenum)src->get_internal_format(),
|
return create_temporary_subresource_impl(cmd, src, static_cast<GLenum>(src->get_internal_format()),
|
||||||
GL_TEXTURE_2D, gcm_format, x, y, w, h, remap_vector, true);
|
GL_TEXTURE_2D, gcm_format, x, y, w, h, remap_vector, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,8 +764,8 @@ namespace gl
|
|||||||
const rsx::texture_channel_remap_t& remap_vector) override
|
const rsx::texture_channel_remap_t& remap_vector) override
|
||||||
{
|
{
|
||||||
const auto _template = sections_to_copy.front().src;
|
const auto _template = sections_to_copy.front().src;
|
||||||
const GLenum ifmt = (GLenum)_template->get_internal_format();
|
const GLenum ifmt = static_cast<GLenum>(_template->get_internal_format());
|
||||||
const u8 mipmaps = (u8)sections_to_copy.size();
|
const u8 mipmaps = ::narrow<u8>(sections_to_copy.size());
|
||||||
const auto swizzle = _template->get_native_component_layout();
|
const auto swizzle = _template->get_native_component_layout();
|
||||||
|
|
||||||
auto image_ptr = new gl::viewable_image(GL_TEXTURE_2D, width, height, 1, mipmaps, ifmt);
|
auto image_ptr = new gl::viewable_image(GL_TEXTURE_2D, width, height, 1, mipmaps, ifmt);
|
||||||
@ -932,7 +932,7 @@ namespace gl
|
|||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
//TODO
|
//TODO
|
||||||
warn_once("Format incompatibility detected, reporting failure to force data copy (GL_INTERNAL_FORMAT=0x%X, GCM_FORMAT=0x%X)", (u32)ifmt, gcm_format);
|
warn_once("Format incompatibility detected, reporting failure to force data copy (GL_INTERNAL_FORMAT=0x%X, GCM_FORMAT=0x%X)", static_cast<u32>(ifmt), gcm_format);
|
||||||
return false;
|
return false;
|
||||||
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
|
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
|
||||||
return (ifmt == gl::texture::internal_format::rgba16f);
|
return (ifmt == gl::texture::internal_format::rgba16f);
|
||||||
|
@ -26,7 +26,7 @@ namespace
|
|||||||
verify(HERE), !gl::is_primitive_native(primitive_mode);
|
verify(HERE), !gl::is_primitive_native(primitive_mode);
|
||||||
|
|
||||||
auto mapping = dst.alloc_from_heap(element_count * sizeof(u16), 256);
|
auto mapping = dst.alloc_from_heap(element_count * sizeof(u16), 256);
|
||||||
char *mapped_buffer = (char *)mapping.first;
|
auto mapped_buffer = static_cast<char*>(mapping.first);
|
||||||
|
|
||||||
write_index_array_for_non_indexed_non_native_primitive_to_buffer(mapped_buffer, primitive_mode, vertex_count);
|
write_index_array_for_non_indexed_non_native_primitive_to_buffer(mapped_buffer, primitive_mode, vertex_count);
|
||||||
return std::make_tuple(element_count, mapping.second);
|
return std::make_tuple(element_count, mapping.second);
|
||||||
@ -92,14 +92,14 @@ namespace
|
|||||||
rsx::index_array_type type = rsx::method_registers.current_draw_clause.is_immediate_draw?
|
rsx::index_array_type type = rsx::method_registers.current_draw_clause.is_immediate_draw?
|
||||||
rsx::index_array_type::u32:
|
rsx::index_array_type::u32:
|
||||||
rsx::method_registers.index_type();
|
rsx::method_registers.index_type();
|
||||||
|
|
||||||
u32 type_size = 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();
|
const u32 vertex_count = rsx::method_registers.current_draw_clause.get_elements_count();
|
||||||
u32 index_count = vertex_count;
|
u32 index_count = vertex_count;
|
||||||
|
|
||||||
if (!gl::is_primitive_native(rsx::method_registers.current_draw_clause.primitive))
|
if (!gl::is_primitive_native(rsx::method_registers.current_draw_clause.primitive))
|
||||||
index_count = (u32)get_index_count(rsx::method_registers.current_draw_clause.primitive, vertex_count);
|
index_count = static_cast<u32>(get_index_count(rsx::method_registers.current_draw_clause.primitive, vertex_count));
|
||||||
|
|
||||||
u32 max_size = index_count * type_size;
|
u32 max_size = index_count * type_size;
|
||||||
auto mapping = m_index_ring_buffer.alloc_from_heap(max_size, 256);
|
auto mapping = m_index_ring_buffer.alloc_from_heap(max_size, 256);
|
||||||
@ -228,7 +228,7 @@ gl::vertex_upload_info GLGSRender::set_vertex_buffer()
|
|||||||
const size_t view_size = ((upload_info.persistent_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ?
|
const size_t view_size = ((upload_info.persistent_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ?
|
||||||
(m_attrib_ring_buffer->size() - upload_info.persistent_mapping_offset) : m_max_texbuffer_size;
|
(m_attrib_ring_buffer->size() - upload_info.persistent_mapping_offset) : m_max_texbuffer_size;
|
||||||
|
|
||||||
m_persistent_stream_view.update(m_attrib_ring_buffer.get(), upload_info.persistent_mapping_offset, (u32)view_size);
|
m_persistent_stream_view.update(m_attrib_ring_buffer.get(), upload_info.persistent_mapping_offset, static_cast<u32>(view_size));
|
||||||
m_gl_persistent_stream_buffer->copy_from(m_persistent_stream_view);
|
m_gl_persistent_stream_buffer->copy_from(m_persistent_stream_view);
|
||||||
upload_info.persistent_mapping_offset = 0;
|
upload_info.persistent_mapping_offset = 0;
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ gl::vertex_upload_info GLGSRender::set_vertex_buffer()
|
|||||||
const size_t view_size = ((upload_info.volatile_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ?
|
const size_t view_size = ((upload_info.volatile_mapping_offset + m_max_texbuffer_size) > m_attrib_ring_buffer->size()) ?
|
||||||
(m_attrib_ring_buffer->size() - upload_info.volatile_mapping_offset) : m_max_texbuffer_size;
|
(m_attrib_ring_buffer->size() - upload_info.volatile_mapping_offset) : m_max_texbuffer_size;
|
||||||
|
|
||||||
m_volatile_stream_view.update(m_attrib_ring_buffer.get(), upload_info.volatile_mapping_offset, (u32)view_size);
|
m_volatile_stream_view.update(m_attrib_ring_buffer.get(), upload_info.volatile_mapping_offset, static_cast<u32>(view_size));
|
||||||
m_gl_volatile_stream_buffer->copy_from(m_volatile_stream_view);
|
m_gl_volatile_stream_buffer->copy_from(m_volatile_stream_view);
|
||||||
upload_info.volatile_mapping_offset = 0;
|
upload_info.volatile_mapping_offset = 0;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ namespace rsx
|
|||||||
|
|
||||||
background_poster.set_size(1280, 720);
|
background_poster.set_size(1280, 720);
|
||||||
background_poster.set_raw_image(background_image.get());
|
background_poster.set_raw_image(background_image.get());
|
||||||
background_poster.set_blur_strength((u8)g_cfg.video.shader_preloading_dialog.blur_strength);
|
background_poster.set_blur_strength(static_cast<u8>(g_cfg.video.shader_preloading_dialog.blur_strength));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ namespace rsx
|
|||||||
progress_2.inc(value);
|
progress_2.inc(value);
|
||||||
|
|
||||||
if (index == taskbar_index || taskbar_index == -1)
|
if (index == taskbar_index || taskbar_index == -1)
|
||||||
Emu.GetCallbacks().handle_taskbar_progress(1, (s32)value);
|
Emu.GetCallbacks().handle_taskbar_progress(1, static_cast<s32>(value));
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
@ -274,9 +274,9 @@ namespace rsx
|
|||||||
return CELL_MSGDIALOG_ERROR_PARAM;
|
return CELL_MSGDIALOG_ERROR_PARAM;
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
progress_1.set_limit((float)limit);
|
progress_1.set_limit(static_cast<f32>(limit));
|
||||||
else
|
else
|
||||||
progress_2.set_limit((float)limit);
|
progress_2.set_limit(static_cast<f32>(limit));
|
||||||
|
|
||||||
if (index == taskbar_index)
|
if (index == taskbar_index)
|
||||||
{
|
{
|
||||||
|
@ -239,7 +239,7 @@ namespace rsx
|
|||||||
auto on_accept = [&]()
|
auto on_accept = [&]()
|
||||||
{
|
{
|
||||||
const u32 current_index = (selected_y * num_columns) + selected_x;
|
const u32 current_index = (selected_y * num_columns) + selected_x;
|
||||||
const u32 output_count = (u32)m_grid[current_index].outputs.size();
|
const u32 output_count = ::size32(m_grid[current_index].outputs);
|
||||||
|
|
||||||
if (output_count)
|
if (output_count)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ namespace rsx
|
|||||||
m_value = std::clamp(value, 0.f, m_limit);
|
m_value = std::clamp(value, 0.f, m_limit);
|
||||||
|
|
||||||
f32 indicator_width = (w * m_value) / m_limit;
|
f32 indicator_width = (w * m_value) / m_limit;
|
||||||
indicator.set_size((u16)indicator_width, h);
|
indicator.set_size(static_cast<u16>(indicator_width), h);
|
||||||
is_compiled = false;
|
is_compiled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ namespace rsx
|
|||||||
m_list->select_next(10);
|
m_list->select_next(10);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_TRACE(RSX, "[ui] Button %d pressed", (u8)button_press);
|
LOG_TRACE(RSX, "[ui] Button %d pressed", static_cast<u8>(button_press));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,13 +58,19 @@ static auto s_ascii_lowering_map = []()
|
|||||||
|
|
||||||
std::string utf8_to_ascii8(const std::string& utf8_string)
|
std::string utf8_to_ascii8(const std::string& utf8_string)
|
||||||
{
|
{
|
||||||
std::vector<u8> out;
|
std::string out;
|
||||||
out.reserve(utf8_string.length() + 1);
|
out.reserve(utf8_string.length());
|
||||||
|
|
||||||
const auto end = utf8_string.length();
|
const auto end = utf8_string.length();
|
||||||
for (u32 index = 0; index < end; ++index)
|
for (u32 index = 0; index < end; ++index)
|
||||||
{
|
{
|
||||||
const auto code = (u8)utf8_string[index];
|
const u8 code = static_cast<u8>(utf8_string[index]);
|
||||||
|
|
||||||
|
if (code == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (code <= 0x7F)
|
if (code <= 0x7F)
|
||||||
{
|
{
|
||||||
out.push_back(code);
|
out.push_back(code);
|
||||||
@ -103,7 +109,7 @@ std::string utf8_to_ascii8(const std::string& utf8_string)
|
|||||||
if (u_code <= 0xFF)
|
if (u_code <= 0xFF)
|
||||||
{
|
{
|
||||||
// Latin-1 supplement block
|
// Latin-1 supplement block
|
||||||
out.push_back(u8(u_code));
|
out.push_back(static_cast<u8>(u_code));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,37 +123,40 @@ std::string utf8_to_ascii8(const std::string& utf8_string)
|
|||||||
out.push_back(replace->second);
|
out.push_back(replace->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.push_back(0);
|
return out;
|
||||||
return { reinterpret_cast<char*>(out.data()) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string utf16_to_ascii8(const std::u16string& utf16_string)
|
std::string utf16_to_ascii8(const std::u16string& utf16_string)
|
||||||
{
|
{
|
||||||
// Strip extended codes, map to '#' instead (placeholder)
|
// Strip extended codes, map to '#' instead (placeholder)
|
||||||
std::vector<u8> out;
|
std::string out;
|
||||||
out.reserve(utf16_string.length() + 1);
|
out.reserve(utf16_string.length());
|
||||||
|
|
||||||
for (const auto& code : utf16_string)
|
for (const auto& code : utf16_string)
|
||||||
{
|
{
|
||||||
out.push_back(code > 0xFF ? '#': (u8)code);
|
if (!code)
|
||||||
|
break;
|
||||||
|
|
||||||
|
out.push_back(code > 0xFF ? '#': static_cast<char>(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
out.push_back(0);
|
return out;
|
||||||
return { reinterpret_cast<char*>(out.data()) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u16string ascii8_to_utf16(const std::string& ascii_string)
|
std::u16string ascii8_to_utf16(const std::string& ascii_string)
|
||||||
{
|
{
|
||||||
std::vector<char16_t> out;
|
std::u16string out;
|
||||||
out.reserve(ascii_string.length() + 1);
|
out.reserve(ascii_string.length());
|
||||||
|
|
||||||
for (const auto& code : ascii_string)
|
for (const auto& code : ascii_string)
|
||||||
{
|
{
|
||||||
out.push_back((char16_t)code);
|
if (!code)
|
||||||
|
break;
|
||||||
|
|
||||||
|
out.push_back(static_cast<char16_t>(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
out.push_back(0);
|
return out;
|
||||||
return { out.data() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace rsx
|
namespace rsx
|
||||||
|
@ -154,7 +154,7 @@ namespace rsx
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fmt::throw_exception("RSXVertexData::GetTypeSize: Bad vertex data type (%d)!" HERE, (u8)type);
|
fmt::throw_exception("RSXVertexData::GetTypeSize: Bad vertex data type (%d)!" HERE, static_cast<u8>(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tiled_region::write(const void *src, u32 width, u32 height, u32 pitch)
|
void tiled_region::write(const void *src, u32 width, u32 height, u32 pitch)
|
||||||
@ -174,7 +174,7 @@ namespace rsx
|
|||||||
case CELL_GCM_COMPMODE_DISABLED:
|
case CELL_GCM_COMPMODE_DISABLED:
|
||||||
for (u32 y = 0; y < height; ++y)
|
for (u32 y = 0; y < height; ++y)
|
||||||
{
|
{
|
||||||
memcpy(ptr + (offset_y + y) * tile->pitch + offset_x, (u8*)src + pitch * y, pitch);
|
memcpy(ptr + (offset_y + y) * tile->pitch + offset_x, static_cast<const u8*>(src) + pitch * y, pitch);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
@ -196,12 +196,12 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
for (u32 x = 0; x < width; ++x)
|
for (u32 x = 0; x < width; ++x)
|
||||||
{
|
{
|
||||||
u32 value = *(u32*)((u8*)src + pitch * y + x * sizeof(u32));
|
u32 value = *reinterpret_cast<const u32*>(static_cast<const u8*>(src) + pitch * y + x * sizeof(u32));
|
||||||
|
|
||||||
*(u32*)(ptr + (offset_y + y * 2 + 0) * tile->pitch + offset_x + (x * 2 + 0) * sizeof(u32)) = value;
|
*reinterpret_cast<u32*>(ptr + (offset_y + y * 2 + 0) * tile->pitch + offset_x + (x * 2 + 0) * sizeof(u32)) = value;
|
||||||
*(u32*)(ptr + (offset_y + y * 2 + 0) * tile->pitch + offset_x + (x * 2 + 1) * sizeof(u32)) = value;
|
*reinterpret_cast<u32*>(ptr + (offset_y + y * 2 + 0) * tile->pitch + offset_x + (x * 2 + 1) * sizeof(u32)) = value;
|
||||||
*(u32*)(ptr + (offset_y + y * 2 + 1) * tile->pitch + offset_x + (x * 2 + 0) * sizeof(u32)) = value;
|
*reinterpret_cast<u32*>(ptr + (offset_y + y * 2 + 1) * tile->pitch + offset_x + (x * 2 + 0) * sizeof(u32)) = value;
|
||||||
*(u32*)(ptr + (offset_y + y * 2 + 1) * tile->pitch + offset_x + (x * 2 + 1) * sizeof(u32)) = value;
|
*reinterpret_cast<u32*>(ptr + (offset_y + y * 2 + 1) * tile->pitch + offset_x + (x * 2 + 1) * sizeof(u32)) = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -227,7 +227,7 @@ namespace rsx
|
|||||||
case CELL_GCM_COMPMODE_DISABLED:
|
case CELL_GCM_COMPMODE_DISABLED:
|
||||||
for (u32 y = 0; y < height; ++y)
|
for (u32 y = 0; y < height; ++y)
|
||||||
{
|
{
|
||||||
memcpy((u8*)dst + pitch * y, ptr + (offset_y + y) * tile->pitch + offset_x, pitch);
|
memcpy(static_cast<u8*>(dst) + pitch * y, ptr + (offset_y + y) * tile->pitch + offset_x, pitch);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
@ -248,9 +248,9 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
for (u32 x = 0; x < width; ++x)
|
for (u32 x = 0; x < width; ++x)
|
||||||
{
|
{
|
||||||
u32 value = *(u32*)(ptr + (offset_y + y * 2 + 0) * tile->pitch + offset_x + (x * 2 + 0) * sizeof(u32));
|
u32 value = *reinterpret_cast<u32*>(ptr + (offset_y + y * 2 + 0) * tile->pitch + offset_x + (x * 2 + 0) * sizeof(u32));
|
||||||
|
|
||||||
*(u32*)((u8*)dst + pitch * y + x * sizeof(u32)) = value;
|
*reinterpret_cast<u32*>(static_cast<u8*>(dst) + pitch * y + x * sizeof(u32)) = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -342,7 +342,7 @@ namespace rsx
|
|||||||
|
|
||||||
u32 thread::get_push_buffer_index_count() const
|
u32 thread::get_push_buffer_index_count() const
|
||||||
{
|
{
|
||||||
return (u32)element_push_buffer.size();
|
return ::size32(element_push_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void thread::end()
|
void thread::end()
|
||||||
@ -497,7 +497,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
// Save the difference before pause
|
// Save the difference before pause
|
||||||
start_time = get_system_time() - start_time;
|
start_time = get_system_time() - start_time;
|
||||||
|
|
||||||
while (Emu.IsPaused() && !m_rsx_thread_exiting)
|
while (Emu.IsPaused() && !m_rsx_thread_exiting)
|
||||||
{
|
{
|
||||||
thread_ctrl::wait_for(wait_sleep);
|
thread_ctrl::wait_for(wait_sleep);
|
||||||
@ -631,9 +631,9 @@ namespace rsx
|
|||||||
float one = 1.f;
|
float one = 1.f;
|
||||||
|
|
||||||
stream_vector(buffer, std::bit_cast<u32>(scale_x), 0, 0, std::bit_cast<u32>(offset_x));
|
stream_vector(buffer, std::bit_cast<u32>(scale_x), 0, 0, std::bit_cast<u32>(offset_x));
|
||||||
stream_vector((char*)buffer + 16, 0, std::bit_cast<u32>(scale_y), 0, std::bit_cast<u32>(offset_y));
|
stream_vector(static_cast<char*>(buffer) + 16, 0, std::bit_cast<u32>(scale_y), 0, std::bit_cast<u32>(offset_y));
|
||||||
stream_vector((char*)buffer + 32, 0, 0, std::bit_cast<u32>(scale_z), std::bit_cast<u32>(offset_z));
|
stream_vector(static_cast<char*>(buffer) + 32, 0, 0, std::bit_cast<u32>(scale_z), std::bit_cast<u32>(offset_z));
|
||||||
stream_vector((char*)buffer + 48, 0, 0, 0, std::bit_cast<u32>(one));
|
stream_vector(static_cast<char*>(buffer) + 48, 0, 0, 0, std::bit_cast<u32>(one));
|
||||||
}
|
}
|
||||||
|
|
||||||
void thread::fill_user_clip_data(void *buffer) const
|
void thread::fill_user_clip_data(void *buffer) const
|
||||||
@ -657,7 +657,7 @@ namespace rsx
|
|||||||
switch (clip_plane_control[index])
|
switch (clip_plane_control[index])
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(RSX, "bad clip plane control (0x%x)", (u8)clip_plane_control[index]);
|
LOG_ERROR(RSX, "bad clip plane control (0x%x)", static_cast<u8>(clip_plane_control[index]));
|
||||||
|
|
||||||
case rsx::user_clip_plane_op::disable:
|
case rsx::user_clip_plane_op::disable:
|
||||||
clip_enabled_flags[index] = 0;
|
clip_enabled_flags[index] = 0;
|
||||||
@ -749,7 +749,7 @@ namespace rsx
|
|||||||
|
|
||||||
const auto window_origin = rsx::method_registers.shader_window_origin();
|
const auto window_origin = rsx::method_registers.shader_window_origin();
|
||||||
const u32 window_height = rsx::method_registers.shader_window_height();
|
const u32 window_height = rsx::method_registers.shader_window_height();
|
||||||
const f32 resolution_scale = (window_height <= (u32)g_cfg.video.min_scalable_dimension)? 1.f : rsx::get_resolution_scale();
|
const f32 resolution_scale = (window_height <= static_cast<u32>(g_cfg.video.min_scalable_dimension)) ? 1.f : rsx::get_resolution_scale();
|
||||||
const f32 wpos_scale = (window_origin == rsx::window_origin::top) ? (1.f / resolution_scale) : (-1.f / resolution_scale);
|
const f32 wpos_scale = (window_origin == rsx::window_origin::top) ? (1.f / resolution_scale) : (-1.f / resolution_scale);
|
||||||
const f32 wpos_bias = (window_origin == rsx::window_origin::top) ? 0.f : window_height;
|
const f32 wpos_bias = (window_origin == rsx::window_origin::top) ? 0.f : window_height;
|
||||||
|
|
||||||
@ -783,7 +783,7 @@ namespace rsx
|
|||||||
if (!element_push_buffer.empty())
|
if (!element_push_buffer.empty())
|
||||||
{
|
{
|
||||||
//Indices provided via immediate mode
|
//Indices provided via immediate mode
|
||||||
return{(const std::byte*)element_push_buffer.data(), ::narrow<u32>(element_push_buffer.size() * sizeof(u32))};
|
return{reinterpret_cast<const std::byte*>(element_push_buffer.data()), ::narrow<u32>(element_push_buffer.size() * sizeof(u32))};
|
||||||
}
|
}
|
||||||
|
|
||||||
const rsx::index_array_type type = rsx::method_registers.index_type();
|
const rsx::index_array_type type = rsx::method_registers.index_type();
|
||||||
@ -1019,7 +1019,7 @@ namespace rsx
|
|||||||
m_framebuffer_state_contested = color_buffer_unused || depth_buffer_unused;
|
m_framebuffer_state_contested = color_buffer_unused || depth_buffer_unused;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unknown framebuffer context 0x%x" HERE, (u32)context);
|
fmt::throw_exception("Unknown framebuffer context 0x%x" HERE, static_cast<u32>(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Swizzled render does tight packing of bytes
|
// Swizzled render does tight packing of bytes
|
||||||
@ -1030,7 +1030,7 @@ namespace rsx
|
|||||||
switch (const auto mode = rsx::method_registers.surface_type())
|
switch (const auto mode = rsx::method_registers.surface_type())
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(RSX, "Unknown raster mode 0x%x", (u32)mode);
|
LOG_ERROR(RSX, "Unknown raster mode 0x%x", static_cast<u32>(mode));
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case rsx::surface_raster_type::linear:
|
case rsx::surface_raster_type::linear:
|
||||||
break;
|
break;
|
||||||
@ -1085,7 +1085,7 @@ namespace rsx
|
|||||||
// Unlike the depth buffer, when given a color target we know it is intended to be rendered to
|
// Unlike the depth buffer, when given a color target we know it is intended to be rendered to
|
||||||
LOG_ERROR(RSX, "Framebuffer setup error: Color target failed pitch check, Pitch=[%d, %d, %d, %d] + %d, target=%d, context=%d",
|
LOG_ERROR(RSX, "Framebuffer setup error: Color target failed pitch check, Pitch=[%d, %d, %d, %d] + %d, target=%d, context=%d",
|
||||||
layout.color_pitch[0], layout.color_pitch[1], layout.color_pitch[2], layout.color_pitch[3],
|
layout.color_pitch[0], layout.color_pitch[1], layout.color_pitch[2], layout.color_pitch[3],
|
||||||
layout.zeta_pitch, (u32)layout.target, (u32)context);
|
layout.zeta_pitch, static_cast<u32>(layout.target), static_cast<u32>(context));
|
||||||
|
|
||||||
// Do not remove this buffer for now as it implies something went horribly wrong anyway
|
// Do not remove this buffer for now as it implies something went horribly wrong anyway
|
||||||
break;
|
break;
|
||||||
@ -1094,7 +1094,7 @@ namespace rsx
|
|||||||
if (layout.color_addresses[index] == layout.zeta_address)
|
if (layout.color_addresses[index] == layout.zeta_address)
|
||||||
{
|
{
|
||||||
LOG_WARNING(RSX, "Framebuffer at 0x%X has aliasing color/depth targets, color_index=%d, zeta_pitch = %d, color_pitch=%d, context=%d",
|
LOG_WARNING(RSX, "Framebuffer at 0x%X has aliasing color/depth targets, color_index=%d, zeta_pitch = %d, color_pitch=%d, context=%d",
|
||||||
layout.zeta_address, index, layout.zeta_pitch, layout.color_pitch[index], (u32)context);
|
layout.zeta_address, index, layout.zeta_pitch, layout.color_pitch[index], static_cast<u32>(context));
|
||||||
|
|
||||||
m_framebuffer_state_contested = true;
|
m_framebuffer_state_contested = true;
|
||||||
|
|
||||||
@ -1316,7 +1316,7 @@ namespace rsx
|
|||||||
const auto &tex = rsx::method_registers.vertex_textures[i];
|
const auto &tex = rsx::method_registers.vertex_textures[i];
|
||||||
if (tex.enabled() && (current_vp_metadata.referenced_textures_mask & (1 << i)))
|
if (tex.enabled() && (current_vp_metadata.referenced_textures_mask & (1 << i)))
|
||||||
{
|
{
|
||||||
current_vertex_program.texture_dimensions |= ((u32)sampler_descriptors[i]->image_type << (i << 1));
|
current_vertex_program.texture_dimensions |= (static_cast<u32>(sampler_descriptors[i]->image_type) << (i << 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1548,7 +1548,7 @@ namespace rsx
|
|||||||
result.addr = vm::base(rsx::get_address(program_offset, program_location));
|
result.addr = vm::base(rsx::get_address(program_offset, program_location));
|
||||||
current_fp_metadata = program_hash_util::fragment_program_utils::analyse_fragment_program(result.addr);
|
current_fp_metadata = program_hash_util::fragment_program_utils::analyse_fragment_program(result.addr);
|
||||||
|
|
||||||
result.addr = ((u8*)result.addr + current_fp_metadata.program_start_offset);
|
result.addr = (static_cast<u8*>(result.addr) + current_fp_metadata.program_start_offset);
|
||||||
result.offset = program_offset + current_fp_metadata.program_start_offset;
|
result.offset = program_offset + current_fp_metadata.program_start_offset;
|
||||||
result.ucode_length = current_fp_metadata.program_ucode_length;
|
result.ucode_length = current_fp_metadata.program_ucode_length;
|
||||||
result.valid = true;
|
result.valid = true;
|
||||||
@ -1578,7 +1578,7 @@ namespace rsx
|
|||||||
if (tex.enabled() && (current_fp_metadata.referenced_textures_mask & (1 << i)))
|
if (tex.enabled() && (current_fp_metadata.referenced_textures_mask & (1 << i)))
|
||||||
{
|
{
|
||||||
u32 texture_control = 0;
|
u32 texture_control = 0;
|
||||||
result.texture_dimensions |= ((u32)sampler_descriptors[i]->image_type << (i << 1));
|
result.texture_dimensions |= (static_cast<u32>(sampler_descriptors[i]->image_type) << (i << 1));
|
||||||
|
|
||||||
if (tex.alpha_kill_enabled())
|
if (tex.alpha_kill_enabled())
|
||||||
{
|
{
|
||||||
@ -1747,7 +1747,7 @@ namespace rsx
|
|||||||
u32 persistent_memory_size = 0;
|
u32 persistent_memory_size = 0;
|
||||||
u32 volatile_memory_size = 0;
|
u32 volatile_memory_size = 0;
|
||||||
|
|
||||||
volatile_memory_size += (u32)layout.referenced_registers.size() * 16u;
|
volatile_memory_size += ::size32(layout.referenced_registers) * 16u;
|
||||||
|
|
||||||
if (rsx::method_registers.current_draw_clause.command == rsx::draw_command::inlined_array)
|
if (rsx::method_registers.current_draw_clause.command == rsx::draw_command::inlined_array)
|
||||||
{
|
{
|
||||||
@ -1847,7 +1847,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (layout.attribute_placement[index] == attribute_buffer_placement::none)
|
if (layout.attribute_placement[index] == attribute_buffer_placement::none)
|
||||||
{
|
{
|
||||||
((u64*)buffer)[index] = 0ull;
|
reinterpret_cast<u64*>(buffer)[index] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1988,8 +1988,8 @@ namespace rsx
|
|||||||
|
|
||||||
void thread::write_vertex_data_to_memory(const vertex_input_layout& layout, u32 first_vertex, u32 vertex_count, void *persistent_data, void *volatile_data)
|
void thread::write_vertex_data_to_memory(const vertex_input_layout& layout, u32 first_vertex, u32 vertex_count, void *persistent_data, void *volatile_data)
|
||||||
{
|
{
|
||||||
char *transient = (char *)volatile_data;
|
auto transient = static_cast<char*>(volatile_data);
|
||||||
char *persistent = (char *)persistent_data;
|
auto persistent = static_cast<char*>(persistent_data);
|
||||||
|
|
||||||
auto &draw_call = rsx::method_registers.current_draw_clause;
|
auto &draw_call = rsx::method_registers.current_draw_clause;
|
||||||
|
|
||||||
@ -2035,7 +2035,7 @@ namespace rsx
|
|||||||
const u32 data_size = range.second * block.attribute_stride;
|
const u32 data_size = range.second * block.attribute_stride;
|
||||||
const u32 vertex_base = range.first * block.attribute_stride;
|
const u32 vertex_base = range.first * block.attribute_stride;
|
||||||
|
|
||||||
g_dma_manager.copy(persistent, (char*)vm::base(block.real_offset_address) + vertex_base, data_size);
|
g_dma_manager.copy(persistent, vm::_ptr<char>(block.real_offset_address) + vertex_base, data_size);
|
||||||
persistent += data_size;
|
persistent += data_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2312,7 +2312,7 @@ namespace rsx
|
|||||||
const auto elapsed = timestamp - performance_counters.last_update_timestamp;
|
const auto elapsed = timestamp - performance_counters.last_update_timestamp;
|
||||||
|
|
||||||
if (elapsed > idle)
|
if (elapsed > idle)
|
||||||
performance_counters.approximate_load = (u32)((elapsed - idle) * 100 / elapsed);
|
performance_counters.approximate_load = static_cast<u32>((elapsed - idle) * 100 / elapsed);
|
||||||
else
|
else
|
||||||
performance_counters.approximate_load = 0u;
|
performance_counters.approximate_load = 0u;
|
||||||
|
|
||||||
|
@ -1,8 +1,22 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "VKCommonDecompiler.h"
|
#include "VKCommonDecompiler.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push, 0)
|
||||||
|
#else
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wall"
|
||||||
|
#pragma GCC diagnostic ignored "-Wextra"
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
|
#endif
|
||||||
#include "restore_new.h"
|
#include "restore_new.h"
|
||||||
#include "SPIRV/GlslangToSpv.h"
|
#include "SPIRV/GlslangToSpv.h"
|
||||||
#include "define_new_memleakdetect.h"
|
#include "define_new_memleakdetect.h"
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#else
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace vk
|
namespace vk
|
||||||
{
|
{
|
||||||
@ -155,7 +169,7 @@ namespace vk
|
|||||||
|
|
||||||
shader_object.setStrings(&shader_text, 1);
|
shader_object.setStrings(&shader_text, 1);
|
||||||
|
|
||||||
EShMessages msg = (EShMessages)(EShMsgVulkanRules | EShMsgSpvRules);
|
EShMessages msg = static_cast<EShMessages>(EShMsgVulkanRules | EShMsgSpvRules);
|
||||||
if (shader_object.parse(&g_default_config, 400, EProfile::ECoreProfile, false, true, msg))
|
if (shader_object.parse(&g_default_config, 400, EProfile::ECoreProfile, false, true, msg))
|
||||||
{
|
{
|
||||||
program.addShader(&shader_object);
|
program.addShader(&shader_object);
|
||||||
|
@ -59,12 +59,12 @@ namespace vk
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reserve descriptor pools
|
// Reserve descriptor pools
|
||||||
m_descriptor_pool.create(*get_current_renderer(), descriptor_pool_sizes.data(), (u32)descriptor_pool_sizes.size(), VK_MAX_COMPUTE_TASKS, 2);
|
m_descriptor_pool.create(*get_current_renderer(), descriptor_pool_sizes.data(), ::size32(descriptor_pool_sizes), VK_MAX_COMPUTE_TASKS, 2);
|
||||||
|
|
||||||
VkDescriptorSetLayoutCreateInfo infos = {};
|
VkDescriptorSetLayoutCreateInfo infos = {};
|
||||||
infos.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
infos.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
||||||
infos.pBindings = bindings.data();
|
infos.pBindings = bindings.data();
|
||||||
infos.bindingCount = (u32)bindings.size();
|
infos.bindingCount = ::size32(bindings);
|
||||||
|
|
||||||
CHECK_RESULT(vkCreateDescriptorSetLayout(*get_current_renderer(), &infos, nullptr, &m_descriptor_layout));
|
CHECK_RESULT(vkCreateDescriptorSetLayout(*get_current_renderer(), &infos, nullptr, &m_descriptor_layout));
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ namespace vk
|
|||||||
{
|
{
|
||||||
// AMD hw reports an annoyingly small maximum number of invocations in the X dimension
|
// AMD hw reports an annoyingly small maximum number of invocations in the X dimension
|
||||||
// Split the 1D job into 2 dimensions to accomodate this
|
// Split the 1D job into 2 dimensions to accomodate this
|
||||||
invocations_x = (u32)floor(std::sqrt(num_invocations));
|
invocations_x = static_cast<u32>(floor(std::sqrt(num_invocations)));
|
||||||
invocations_y = invocations_x;
|
invocations_y = invocations_x;
|
||||||
|
|
||||||
if (num_invocations % invocations_x) invocations_y++;
|
if (num_invocations % invocations_x) invocations_y++;
|
||||||
@ -584,7 +584,7 @@ namespace vk
|
|||||||
u32 in_offset = 0;
|
u32 in_offset = 0;
|
||||||
u32 out_offset = 0;
|
u32 out_offset = 0;
|
||||||
u32 block_length = 0;
|
u32 block_length = 0;
|
||||||
|
|
||||||
cs_deswizzle_3d()
|
cs_deswizzle_3d()
|
||||||
{
|
{
|
||||||
verify("Unsupported block type" HERE), (sizeof(_BlockType) & 3) == 0;
|
verify("Unsupported block type" HERE), (sizeof(_BlockType) & 3) == 0;
|
||||||
|
@ -45,7 +45,7 @@ namespace vk
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fmt::throw_exception("Invalid format (0x%x)" HERE, (u32)format);
|
fmt::throw_exception("Invalid format (0x%x)" HERE, static_cast<u32>(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
minification_filter get_min_filter(rsx::texture_minify_filter min_filter)
|
minification_filter get_min_filter(rsx::texture_minify_filter min_filter)
|
||||||
@ -77,7 +77,7 @@ namespace vk
|
|||||||
ASSUME(0);
|
ASSUME(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fmt::throw_exception("Invalid mag filter (0x%x)" HERE, (u32)mag_filter);
|
fmt::throw_exception("Invalid mag filter (0x%x)" HERE, static_cast<u32>(mag_filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
VkBorderColor get_border_color(u32 color)
|
VkBorderColor get_border_color(u32 color)
|
||||||
@ -151,7 +151,7 @@ namespace vk
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::throw_exception("Texture anisotropy error: bad max aniso (%d)" HERE, (u32)gcm_aniso);
|
fmt::throw_exception("Texture anisotropy error: bad max aniso (%d)" HERE, static_cast<u32>(gcm_aniso));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ namespace vk
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::throw_exception("Unexpected vkFormat 0x%X", (u32)format);
|
fmt::throw_exception("Unexpected vkFormat 0x%X", static_cast<u32>(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<u8, u8> get_format_element_size(VkFormat format)
|
std::pair<u8, u8> get_format_element_size(VkFormat format)
|
||||||
@ -386,7 +386,7 @@ namespace vk
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::throw_exception("Unexpected vkFormat 0x%X", (u32)format);
|
fmt::throw_exception("Unexpected vkFormat 0x%X", static_cast<u32>(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<bool, u32> get_format_convert_flags(VkFormat format)
|
std::pair<bool, u32> get_format_convert_flags(VkFormat format)
|
||||||
@ -438,7 +438,7 @@ namespace vk
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::throw_exception("Unknown vkFormat 0x%x" HERE, (u32)format);
|
fmt::throw_exception("Unknown vkFormat 0x%x" HERE, static_cast<u32>(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool formats_are_bitcast_compatible(VkFormat format1, VkFormat format2)
|
bool formats_are_bitcast_compatible(VkFormat format1, VkFormat format2)
|
||||||
|
@ -54,7 +54,7 @@ namespace vk
|
|||||||
case rsx::comparison_function::not_equal: return VK_COMPARE_OP_NOT_EQUAL;
|
case rsx::comparison_function::not_equal: return VK_COMPARE_OP_NOT_EQUAL;
|
||||||
case rsx::comparison_function::always: return VK_COMPARE_OP_ALWAYS;
|
case rsx::comparison_function::always: return VK_COMPARE_OP_ALWAYS;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unknown compare op: 0x%x" HERE, (u32)op);
|
fmt::throw_exception("Unknown compare op: 0x%x" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ namespace vk
|
|||||||
return std::make_pair(VK_FORMAT_R32_SFLOAT, vk::default_component_map());
|
return std::make_pair(VK_FORMAT_R32_SFLOAT, vk::default_component_map());
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(RSX, "Surface color buffer: Unsupported surface color format (0x%x)", (u32)color_format);
|
LOG_ERROR(RSX, "Surface color buffer: Unsupported surface color format (0x%x)", static_cast<u32>(color_format));
|
||||||
return std::make_pair(VK_FORMAT_B8G8R8A8_UNORM, vk::default_component_map());
|
return std::make_pair(VK_FORMAT_B8G8R8A8_UNORM, vk::default_component_map());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ namespace vk
|
|||||||
case rsx::logic_op::logic_nand: return VK_LOGIC_OP_NAND;
|
case rsx::logic_op::logic_nand: return VK_LOGIC_OP_NAND;
|
||||||
case rsx::logic_op::logic_set: return VK_LOGIC_OP_SET;
|
case rsx::logic_op::logic_set: return VK_LOGIC_OP_SET;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unknown logic op 0x%x" HERE, (u32)op);
|
fmt::throw_exception("Unknown logic op 0x%x" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ namespace vk
|
|||||||
case rsx::blend_factor::one_minus_constant_color: return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
|
case rsx::blend_factor::one_minus_constant_color: return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
|
||||||
case rsx::blend_factor::src_alpha_saturate: return VK_BLEND_FACTOR_SRC_ALPHA_SATURATE;
|
case rsx::blend_factor::src_alpha_saturate: return VK_BLEND_FACTOR_SRC_ALPHA_SATURATE;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unknown blend factor 0x%x" HERE, (u32)factor);
|
fmt::throw_exception("Unknown blend factor 0x%x" HERE, static_cast<u32>(factor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ namespace vk
|
|||||||
case rsx::blend_equation::min: return VK_BLEND_OP_MIN;
|
case rsx::blend_equation::min: return VK_BLEND_OP_MIN;
|
||||||
case rsx::blend_equation::max: return VK_BLEND_OP_MAX;
|
case rsx::blend_equation::max: return VK_BLEND_OP_MAX;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unknown blend op: 0x%x" HERE, (u32)op);
|
fmt::throw_exception("Unknown blend op: 0x%x" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ namespace vk
|
|||||||
case rsx::stencil_op::incr_wrap: return VK_STENCIL_OP_INCREMENT_AND_WRAP;
|
case rsx::stencil_op::incr_wrap: return VK_STENCIL_OP_INCREMENT_AND_WRAP;
|
||||||
case rsx::stencil_op::decr_wrap: return VK_STENCIL_OP_DECREMENT_AND_WRAP;
|
case rsx::stencil_op::decr_wrap: return VK_STENCIL_OP_DECREMENT_AND_WRAP;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unknown stencil op: 0x%x" HERE, (u32)op);
|
fmt::throw_exception("Unknown stencil op: 0x%x" HERE, static_cast<u32>(op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ namespace vk
|
|||||||
case rsx::front_face::cw: return VK_FRONT_FACE_CLOCKWISE;
|
case rsx::front_face::cw: return VK_FRONT_FACE_CLOCKWISE;
|
||||||
case rsx::front_face::ccw: return VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
case rsx::front_face::ccw: return VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unknown front face value: 0x%x" HERE, (u32)ffv);
|
fmt::throw_exception("Unknown front face value: 0x%x" HERE, static_cast<u32>(ffv));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ namespace vk
|
|||||||
case rsx::cull_face::front: return VK_CULL_MODE_FRONT_BIT;
|
case rsx::cull_face::front: return VK_CULL_MODE_FRONT_BIT;
|
||||||
case rsx::cull_face::front_and_back: return VK_CULL_MODE_FRONT_AND_BACK;
|
case rsx::cull_face::front_and_back: return VK_CULL_MODE_FRONT_AND_BACK;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unknown cull face value: 0x%x" HERE, (u32)cfv);
|
fmt::throw_exception("Unknown cull face value: 0x%x" HERE, static_cast<u32>(cfv));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ VKGSRender::VKGSRender() : GSRender()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_device = (vk::render_device*)(&m_swapchain->get_device());
|
m_device = const_cast<vk::render_device*>(&m_swapchain->get_device());
|
||||||
|
|
||||||
vk::set_current_thread_ctx(m_thread_context);
|
vk::set_current_thread_ctx(m_thread_context);
|
||||||
vk::set_current_renderer(m_swapchain->get_device());
|
vk::set_current_renderer(m_swapchain->get_device());
|
||||||
@ -1381,12 +1381,12 @@ void VKGSRender::end()
|
|||||||
f32 actual_mipmaps;
|
f32 actual_mipmaps;
|
||||||
if (sampler_state->upload_context == rsx::texture_upload_context::shader_read)
|
if (sampler_state->upload_context == rsx::texture_upload_context::shader_read)
|
||||||
{
|
{
|
||||||
actual_mipmaps = (f32)mipmap_count;
|
actual_mipmaps = static_cast<f32>(mipmap_count);
|
||||||
}
|
}
|
||||||
else if (sampler_state->external_subresource_desc.op == rsx::deferred_request_command::mipmap_gather)
|
else if (sampler_state->external_subresource_desc.op == rsx::deferred_request_command::mipmap_gather)
|
||||||
{
|
{
|
||||||
// Clamp min and max lod
|
// Clamp min and max lod
|
||||||
actual_mipmaps = (f32)sampler_state->external_subresource_desc.sections_to_copy.size();
|
actual_mipmaps = static_cast<f32>(sampler_state->external_subresource_desc.sections_to_copy.size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1856,7 +1856,7 @@ void VKGSRender::on_init_thread()
|
|||||||
type.disable_cancel = true;
|
type.disable_cancel = true;
|
||||||
type.progress_bar_count = 2;
|
type.progress_bar_count = 2;
|
||||||
|
|
||||||
dlg = g_fxo->get<rsx::overlays::display_manager>()->create<rsx::overlays::message_dialog>((bool)g_cfg.video.shader_preloading_dialog.use_custom_background);
|
dlg = g_fxo->get<rsx::overlays::display_manager>()->create<rsx::overlays::message_dialog>(!!g_cfg.video.shader_preloading_dialog.use_custom_background);
|
||||||
dlg->progress_bar_set_taskbar_index(-1);
|
dlg->progress_bar_set_taskbar_index(-1);
|
||||||
dlg->show("Loading precompiled shaders from disk...", type, [](s32 status)
|
dlg->show("Loading precompiled shaders from disk...", type, [](s32 status)
|
||||||
{
|
{
|
||||||
@ -1874,7 +1874,7 @@ void VKGSRender::on_init_thread()
|
|||||||
|
|
||||||
void inc_value(u32 index, u32 value) override
|
void inc_value(u32 index, u32 value) override
|
||||||
{
|
{
|
||||||
dlg->progress_bar_increment(index, (f32)value);
|
dlg->progress_bar_increment(index, static_cast<f32>(value));
|
||||||
owner->flip({});
|
owner->flip({});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1921,7 +1921,7 @@ void VKGSRender::clear_surface(u32 mask)
|
|||||||
u8 ctx = rsx::framebuffer_creation_context::context_draw;
|
u8 ctx = rsx::framebuffer_creation_context::context_draw;
|
||||||
if (mask & 0xF0) ctx |= rsx::framebuffer_creation_context::context_clear_color;
|
if (mask & 0xF0) ctx |= rsx::framebuffer_creation_context::context_clear_color;
|
||||||
if (mask & 0x3) ctx |= rsx::framebuffer_creation_context::context_clear_depth;
|
if (mask & 0x3) ctx |= rsx::framebuffer_creation_context::context_clear_depth;
|
||||||
init_buffers((rsx::framebuffer_creation_context)ctx);
|
init_buffers(rsx::framebuffer_creation_context{ctx});
|
||||||
|
|
||||||
if (!framebuffer_status_valid) return;
|
if (!framebuffer_status_valid) return;
|
||||||
|
|
||||||
@ -1932,10 +1932,10 @@ void VKGSRender::clear_surface(u32 mask)
|
|||||||
std::vector<VkClearAttachment> clear_descriptors;
|
std::vector<VkClearAttachment> clear_descriptors;
|
||||||
VkClearValue depth_stencil_clear_values = {}, color_clear_values = {};
|
VkClearValue depth_stencil_clear_values = {}, color_clear_values = {};
|
||||||
|
|
||||||
u16 scissor_x = (u16)m_scissor.offset.x;
|
u16 scissor_x = static_cast<u16>(m_scissor.offset.x);
|
||||||
u16 scissor_w = (u16)m_scissor.extent.width;
|
u16 scissor_w = static_cast<u16>(m_scissor.extent.width);
|
||||||
u16 scissor_y = (u16)m_scissor.offset.y;
|
u16 scissor_y = static_cast<u16>(m_scissor.offset.y);
|
||||||
u16 scissor_h = (u16)m_scissor.extent.height;
|
u16 scissor_h = static_cast<u16>(m_scissor.extent.height);
|
||||||
|
|
||||||
const u16 fb_width = m_draw_fbo->width();
|
const u16 fb_width = m_draw_fbo->width();
|
||||||
const u16 fb_height = m_draw_fbo->height();
|
const u16 fb_height = m_draw_fbo->height();
|
||||||
@ -1955,7 +1955,7 @@ void VKGSRender::clear_surface(u32 mask)
|
|||||||
u32 max_depth_value = get_max_depth_value(surface_depth_format);
|
u32 max_depth_value = get_max_depth_value(surface_depth_format);
|
||||||
|
|
||||||
u32 clear_depth = rsx::method_registers.z_clear_value(surface_depth_format == rsx::surface_depth_format::z24s8);
|
u32 clear_depth = rsx::method_registers.z_clear_value(surface_depth_format == rsx::surface_depth_format::z24s8);
|
||||||
float depth_clear = (float)clear_depth / max_depth_value;
|
float depth_clear = static_cast<float>(clear_depth) / max_depth_value;
|
||||||
|
|
||||||
depth_stencil_clear_values.depthStencil.depth = depth_clear;
|
depth_stencil_clear_values.depthStencil.depth = depth_clear;
|
||||||
depth_stencil_clear_values.depthStencil.stencil = stencil_clear;
|
depth_stencil_clear_values.depthStencil.stencil = stencil_clear;
|
||||||
@ -2039,10 +2039,10 @@ void VKGSRender::clear_surface(u32 mask)
|
|||||||
u8 clear_g = rsx::method_registers.clear_color_g();
|
u8 clear_g = rsx::method_registers.clear_color_g();
|
||||||
u8 clear_b = rsx::method_registers.clear_color_b();
|
u8 clear_b = rsx::method_registers.clear_color_b();
|
||||||
|
|
||||||
color_clear_values.color.float32[0] = (float)clear_r / 255;
|
color_clear_values.color.float32[0] = static_cast<float>(clear_r) / 255;
|
||||||
color_clear_values.color.float32[1] = (float)clear_g / 255;
|
color_clear_values.color.float32[1] = static_cast<float>(clear_g) / 255;
|
||||||
color_clear_values.color.float32[2] = (float)clear_b / 255;
|
color_clear_values.color.float32[2] = static_cast<float>(clear_b) / 255;
|
||||||
color_clear_values.color.float32[3] = (float)clear_a / 255;
|
color_clear_values.color.float32[3] = static_cast<float>(clear_a) / 255;
|
||||||
|
|
||||||
if (use_fast_clear)
|
if (use_fast_clear)
|
||||||
{
|
{
|
||||||
@ -2109,7 +2109,7 @@ void VKGSRender::clear_surface(u32 mask)
|
|||||||
{
|
{
|
||||||
if (require_mem_load) m_rtts.m_bound_depth_stencil.second->write_barrier(*m_current_command_buffer);
|
if (require_mem_load) m_rtts.m_bound_depth_stencil.second->write_barrier(*m_current_command_buffer);
|
||||||
|
|
||||||
clear_descriptors.push_back({ (VkImageAspectFlags)depth_stencil_mask, 0, depth_stencil_clear_values });
|
clear_descriptors.push_back({ static_cast<VkImageAspectFlags>(depth_stencil_mask), 0, depth_stencil_clear_values });
|
||||||
update_z = true;
|
update_z = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2123,7 +2123,7 @@ void VKGSRender::clear_surface(u32 mask)
|
|||||||
if (!clear_descriptors.empty())
|
if (!clear_descriptors.empty())
|
||||||
{
|
{
|
||||||
begin_render_pass();
|
begin_render_pass();
|
||||||
vkCmdClearAttachments(*m_current_command_buffer, (u32)clear_descriptors.size(), clear_descriptors.data(), 1, ®ion);
|
vkCmdClearAttachments(*m_current_command_buffer, ::size32(clear_descriptors), clear_descriptors.data(), 1, ®ion);
|
||||||
close_render_pass();
|
close_render_pass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2530,7 +2530,7 @@ bool VKGSRender::load_program()
|
|||||||
properties.state.enable_primitive_restart();
|
properties.state.enable_primitive_restart();
|
||||||
|
|
||||||
// Rasterizer state
|
// Rasterizer state
|
||||||
properties.state.set_attachment_count((u32)m_draw_buffers.size());
|
properties.state.set_attachment_count(::size32(m_draw_buffers));
|
||||||
properties.state.set_front_face(vk::get_front_face(rsx::method_registers.front_face_mode()));
|
properties.state.set_front_face(vk::get_front_face(rsx::method_registers.front_face_mode()));
|
||||||
properties.state.enable_depth_clamp(rsx::method_registers.depth_clamp_enabled() || !rsx::method_registers.depth_clip_enabled());
|
properties.state.enable_depth_clamp(rsx::method_registers.depth_clamp_enabled() || !rsx::method_registers.depth_clip_enabled());
|
||||||
properties.state.enable_depth_bias(true);
|
properties.state.enable_depth_bias(true);
|
||||||
@ -2711,7 +2711,7 @@ void VKGSRender::load_program_env()
|
|||||||
|
|
||||||
// Vertex state
|
// Vertex state
|
||||||
const auto mem = m_vertex_env_ring_info.alloc<256>(256);
|
const auto mem = m_vertex_env_ring_info.alloc<256>(256);
|
||||||
auto buf = (u8*)m_vertex_env_ring_info.map(mem, 144);
|
auto buf = static_cast<u8*>(m_vertex_env_ring_info.map(mem, 144));
|
||||||
|
|
||||||
fill_scale_offset_data(buf, false);
|
fill_scale_offset_data(buf, false);
|
||||||
fill_user_clip_data(buf + 64);
|
fill_user_clip_data(buf + 64);
|
||||||
@ -2827,7 +2827,7 @@ void VKGSRender::update_vertex_env(u32 id, const vk::vertex_upload_info& vertex_
|
|||||||
const size_t data_offset = (id * 128) + m_vertex_layout_stream_info.offset;
|
const size_t data_offset = (id * 128) + m_vertex_layout_stream_info.offset;
|
||||||
auto dst = m_vertex_layout_ring_info.map(data_offset, 128);
|
auto dst = m_vertex_layout_ring_info.map(data_offset, 128);
|
||||||
|
|
||||||
fill_vertex_layout_state(m_vertex_layout, vertex_info.first_vertex, vertex_info.allocated_vertex_count, (s32*)dst,
|
fill_vertex_layout_state(m_vertex_layout, vertex_info.first_vertex, vertex_info.allocated_vertex_count, static_cast<s32*>(dst),
|
||||||
vertex_info.persistent_window_offset, vertex_info.volatile_window_offset);
|
vertex_info.persistent_window_offset, vertex_info.volatile_window_offset);
|
||||||
|
|
||||||
m_vertex_layout_ring_info.unmap();
|
m_vertex_layout_ring_info.unmap();
|
||||||
@ -3279,18 +3279,18 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
|||||||
|
|
||||||
if (!g_cfg.video.stretch_to_display_area)
|
if (!g_cfg.video.stretch_to_display_area)
|
||||||
{
|
{
|
||||||
const double aq = (double)buffer_width / buffer_height;
|
const double aq = 1. * buffer_width / buffer_height;
|
||||||
const double rq = (double)new_size.width / new_size.height;
|
const double rq = 1. * new_size.width / new_size.height;
|
||||||
const double q = aq / rq;
|
const double q = aq / rq;
|
||||||
|
|
||||||
if (q > 1.0)
|
if (q > 1.0)
|
||||||
{
|
{
|
||||||
new_size.height = int(new_size.height / q);
|
new_size.height = static_cast<int>(new_size.height / q);
|
||||||
aspect_ratio.y = (csize.height - new_size.height) / 2;
|
aspect_ratio.y = (csize.height - new_size.height) / 2;
|
||||||
}
|
}
|
||||||
else if (q < 1.0)
|
else if (q < 1.0)
|
||||||
{
|
{
|
||||||
new_size.width = int(new_size.width * q);
|
new_size.width = static_cast<int>(new_size.width * q);
|
||||||
aspect_ratio.x = (csize.width - new_size.width) / 2;
|
aspect_ratio.x = (csize.width - new_size.width) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3340,7 +3340,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
|||||||
//Blit contents to screen..
|
//Blit contents to screen..
|
||||||
vk::image* image_to_flip = nullptr;
|
vk::image* image_to_flip = nullptr;
|
||||||
|
|
||||||
if ((u32)info.buffer < display_buffers_count && buffer_width && buffer_height)
|
if (info.buffer < display_buffers_count && buffer_width && buffer_height)
|
||||||
{
|
{
|
||||||
const u32 absolute_address = rsx::get_address(display_buffers[info.buffer].offset, CELL_GCM_LOCATION_LOCAL);
|
const u32 absolute_address = rsx::get_address(display_buffers[info.buffer].offset, CELL_GCM_LOCATION_LOCAL);
|
||||||
|
|
||||||
@ -3442,7 +3442,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
|||||||
if (LIKELY(!calibration_src))
|
if (LIKELY(!calibration_src))
|
||||||
{
|
{
|
||||||
vk::copy_scaled_image(*m_current_command_buffer, image_to_flip->value, target_image, image_to_flip->current_layout, target_layout,
|
vk::copy_scaled_image(*m_current_command_buffer, image_to_flip->value, target_image, image_to_flip->current_layout, target_layout,
|
||||||
{ 0, 0, (s32)buffer_width, (s32)buffer_height }, aspect_ratio, 1, VK_IMAGE_ASPECT_COLOR_BIT, false);
|
{ 0, 0, static_cast<s32>(buffer_width), static_cast<s32>(buffer_height) }, aspect_ratio, 1, VK_IMAGE_ASPECT_COLOR_BIT, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3572,7 +3572,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
|||||||
const auto num_speculate = m_texture_cache.get_num_cache_speculative_writes();
|
const auto num_speculate = m_texture_cache.get_num_cache_speculative_writes();
|
||||||
const auto num_misses = m_texture_cache.get_num_cache_misses();
|
const auto num_misses = m_texture_cache.get_num_cache_misses();
|
||||||
const auto num_unavoidable = m_texture_cache.get_num_unavoidable_hard_faults();
|
const auto num_unavoidable = m_texture_cache.get_num_unavoidable_hard_faults();
|
||||||
const auto cache_miss_ratio = (u32)ceil(m_texture_cache.get_cache_miss_ratio() * 100);
|
const auto cache_miss_ratio = static_cast<u32>(ceil(m_texture_cache.get_cache_miss_ratio() * 100));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 144, direct_fbo->width(), direct_fbo->height(), fmt::format("Unreleased textures: %8d", num_dirty_textures));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 144, direct_fbo->width(), direct_fbo->height(), fmt::format("Unreleased textures: %8d", num_dirty_textures));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 162, direct_fbo->width(), direct_fbo->height(), fmt::format("Texture cache memory: %7dM", texture_memory_size));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 162, direct_fbo->width(), direct_fbo->height(), fmt::format("Texture cache memory: %7dM", texture_memory_size));
|
||||||
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 180, direct_fbo->width(), direct_fbo->height(), fmt::format("Temporary texture memory: %3dM", tmp_texture_memory_size));
|
m_text_writer->print_text(*m_current_command_buffer, *direct_fbo, 0, 180, direct_fbo->width(), direct_fbo->height(), fmt::format("Temporary texture memory: %3dM", tmp_texture_memory_size));
|
||||||
|
@ -311,7 +311,7 @@ namespace vk
|
|||||||
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT, 0);
|
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto &ptr = g_typeless_textures[(u32)format];
|
auto& ptr = g_typeless_textures[+format];
|
||||||
if (!ptr || ptr->width() < requested_width || ptr->height() < requested_height)
|
if (!ptr || ptr->width() < requested_width || ptr->height() < requested_height)
|
||||||
{
|
{
|
||||||
if (ptr)
|
if (ptr)
|
||||||
|
@ -410,24 +410,24 @@ namespace vk
|
|||||||
void free(mem_handle_t mem_handle) override
|
void free(mem_handle_t mem_handle) override
|
||||||
{
|
{
|
||||||
vmm_notify_memory_freed(mem_handle);
|
vmm_notify_memory_freed(mem_handle);
|
||||||
vkFreeMemory(m_device, (VkDeviceMemory)mem_handle, nullptr);
|
vkFreeMemory(m_device, static_cast<VkDeviceMemory>(mem_handle), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *map(mem_handle_t mem_handle, u64 offset, u64 size) override
|
void *map(mem_handle_t mem_handle, u64 offset, u64 size) override
|
||||||
{
|
{
|
||||||
void *data = nullptr;
|
void *data = nullptr;
|
||||||
CHECK_RESULT(vkMapMemory(m_device, (VkDeviceMemory)mem_handle, offset, std::max<u64>(size, 1u), 0, &data));
|
CHECK_RESULT(vkMapMemory(m_device, static_cast<VkDeviceMemory>(mem_handle), offset, std::max<u64>(size, 1u), 0, &data));
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmap(mem_handle_t mem_handle) override
|
void unmap(mem_handle_t mem_handle) override
|
||||||
{
|
{
|
||||||
vkUnmapMemory(m_device, (VkDeviceMemory)mem_handle);
|
vkUnmapMemory(m_device, static_cast<VkDeviceMemory>(mem_handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDeviceMemory get_vk_device_memory(mem_handle_t mem_handle) override
|
VkDeviceMemory get_vk_device_memory(mem_handle_t mem_handle) override
|
||||||
{
|
{
|
||||||
return (VkDeviceMemory)mem_handle;
|
return static_cast<VkDeviceMemory>(mem_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 get_vk_device_memory_offset(mem_handle_t /*mem_handle*/) override
|
u64 get_vk_device_memory_offset(mem_handle_t /*mem_handle*/) override
|
||||||
@ -577,7 +577,7 @@ private:
|
|||||||
features2.pNext = &driver_properties;
|
features2.pNext = &driver_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto getPhysicalDeviceFeatures2KHR = (PFN_vkGetPhysicalDeviceFeatures2KHR)vkGetInstanceProcAddr(parent, "vkGetPhysicalDeviceFeatures2KHR");
|
auto getPhysicalDeviceFeatures2KHR = reinterpret_cast<PFN_vkGetPhysicalDeviceFeatures2KHR>(vkGetInstanceProcAddr(parent, "vkGetPhysicalDeviceFeatures2KHR"));
|
||||||
verify("vkGetInstanceProcAddress failed to find entry point!" HERE), getPhysicalDeviceFeatures2KHR;
|
verify("vkGetInstanceProcAddress failed to find entry point!" HERE), getPhysicalDeviceFeatures2KHR;
|
||||||
getPhysicalDeviceFeatures2KHR(dev, &features2);
|
getPhysicalDeviceFeatures2KHR(dev, &features2);
|
||||||
|
|
||||||
@ -705,7 +705,7 @@ private:
|
|||||||
uint32_t get_queue_count() const
|
uint32_t get_queue_count() const
|
||||||
{
|
{
|
||||||
if (!queue_props.empty())
|
if (!queue_props.empty())
|
||||||
return (u32)queue_props.size();
|
return ::size32(queue_props);
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties(dev, &count, nullptr);
|
vkGetPhysicalDeviceQueueFamilyProperties(dev, &count, nullptr);
|
||||||
@ -852,7 +852,7 @@ private:
|
|||||||
device.pQueueCreateInfos = &queue;
|
device.pQueueCreateInfos = &queue;
|
||||||
device.enabledLayerCount = 0;
|
device.enabledLayerCount = 0;
|
||||||
device.ppEnabledLayerNames = nullptr; // Deprecated
|
device.ppEnabledLayerNames = nullptr; // Deprecated
|
||||||
device.enabledExtensionCount = (u32)requested_extensions.size();
|
device.enabledExtensionCount = ::size32(requested_extensions);
|
||||||
device.ppEnabledExtensionNames = requested_extensions.data();
|
device.ppEnabledExtensionNames = requested_extensions.data();
|
||||||
device.pEnabledFeatures = &enabled_features;
|
device.pEnabledFeatures = &enabled_features;
|
||||||
|
|
||||||
@ -1060,7 +1060,7 @@ private:
|
|||||||
VkCommandBufferAllocateInfo infos = {};
|
VkCommandBufferAllocateInfo infos = {};
|
||||||
infos.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
infos.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||||
infos.commandBufferCount = 1;
|
infos.commandBufferCount = 1;
|
||||||
infos.commandPool = (VkCommandPool)cmd_pool;
|
infos.commandPool = +cmd_pool;
|
||||||
infos.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
|
infos.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
|
||||||
CHECK_RESULT(vkAllocateCommandBuffers(cmd_pool.get_owner(), &infos, &commands));
|
CHECK_RESULT(vkAllocateCommandBuffers(cmd_pool.get_owner(), &infos, &commands));
|
||||||
|
|
||||||
@ -1547,7 +1547,7 @@ private:
|
|||||||
|
|
||||||
u32 size() const
|
u32 size() const
|
||||||
{
|
{
|
||||||
return (u32)info.size;
|
return static_cast<u32>(info.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer(const buffer&) = delete;
|
buffer(const buffer&) = delete;
|
||||||
@ -1586,7 +1586,7 @@ private:
|
|||||||
if (address < info.offset)
|
if (address < info.offset)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const u32 _offset = address - (u32)info.offset;
|
const u32 _offset = address - static_cast<u32>(info.offset);
|
||||||
if (info.range < _offset)
|
if (info.range < _offset)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1937,7 +1937,7 @@ public:
|
|||||||
|
|
||||||
u32 get_swap_image_count() const override
|
u32 get_swap_image_count() const override
|
||||||
{
|
{
|
||||||
return (u32)swapchain_images.size();
|
return ::size32(swapchain_images);
|
||||||
}
|
}
|
||||||
|
|
||||||
using swapchain_base::init;
|
using swapchain_base::init;
|
||||||
@ -2167,7 +2167,7 @@ public:
|
|||||||
auto& src = swapchain_images[index];
|
auto& src = swapchain_images[index];
|
||||||
if (pixmap)
|
if (pixmap)
|
||||||
{
|
{
|
||||||
pixmap->data = (char*)src.second->get_pixels();
|
pixmap->data = static_cast<char*>(src.second->get_pixels());
|
||||||
|
|
||||||
XPutImage(display, window, gc, pixmap, 0, 0, 0, 0, m_width, m_height);
|
XPutImage(display, window, gc, pixmap, 0, 0, 0, 0, m_width, m_height);
|
||||||
XFlush(display);
|
XFlush(display);
|
||||||
@ -2206,7 +2206,7 @@ public:
|
|||||||
|
|
||||||
VkImage& get_image(u32 index) override
|
VkImage& get_image(u32 index) override
|
||||||
{
|
{
|
||||||
return (VkImage&)(*swapchain_images[index].second);
|
return swapchain_images[index].second->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageLayout get_optimal_present_layout() override
|
VkImageLayout get_optimal_present_layout() override
|
||||||
@ -2263,11 +2263,11 @@ public:
|
|||||||
swapchain_WSI(vk::physical_device &gpu, uint32_t _present_queue, uint32_t _graphics_queue, VkFormat format, VkSurfaceKHR surface, VkColorSpaceKHR color_space, bool force_wm_reporting_off)
|
swapchain_WSI(vk::physical_device &gpu, uint32_t _present_queue, uint32_t _graphics_queue, VkFormat format, VkSurfaceKHR surface, VkColorSpaceKHR color_space, bool force_wm_reporting_off)
|
||||||
: WSI_swapchain_base(gpu, _present_queue, _graphics_queue, format)
|
: WSI_swapchain_base(gpu, _present_queue, _graphics_queue, format)
|
||||||
{
|
{
|
||||||
createSwapchainKHR = (PFN_vkCreateSwapchainKHR)vkGetDeviceProcAddr(dev, "vkCreateSwapchainKHR");
|
createSwapchainKHR = reinterpret_cast<PFN_vkCreateSwapchainKHR>(vkGetDeviceProcAddr(dev, "vkCreateSwapchainKHR"));
|
||||||
destroySwapchainKHR = (PFN_vkDestroySwapchainKHR)vkGetDeviceProcAddr(dev, "vkDestroySwapchainKHR");
|
destroySwapchainKHR = reinterpret_cast<PFN_vkDestroySwapchainKHR>(vkGetDeviceProcAddr(dev, "vkDestroySwapchainKHR"));
|
||||||
getSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)vkGetDeviceProcAddr(dev, "vkGetSwapchainImagesKHR");
|
getSwapchainImagesKHR = reinterpret_cast<PFN_vkGetSwapchainImagesKHR>(vkGetDeviceProcAddr(dev, "vkGetSwapchainImagesKHR"));
|
||||||
acquireNextImageKHR = (PFN_vkAcquireNextImageKHR)vkGetDeviceProcAddr(dev, "vkAcquireNextImageKHR");
|
acquireNextImageKHR = reinterpret_cast<PFN_vkAcquireNextImageKHR>(vkGetDeviceProcAddr(dev, "vkAcquireNextImageKHR"));
|
||||||
queuePresentKHR = (PFN_vkQueuePresentKHR)vkGetDeviceProcAddr(dev, "vkQueuePresentKHR");
|
queuePresentKHR = reinterpret_cast<PFN_vkQueuePresentKHR>(vkGetDeviceProcAddr(dev, "vkQueuePresentKHR"));
|
||||||
|
|
||||||
m_surface = surface;
|
m_surface = surface;
|
||||||
m_color_space = color_space;
|
m_color_space = color_space;
|
||||||
@ -2297,9 +2297,9 @@ public:
|
|||||||
void create(display_handle_t&) override
|
void create(display_handle_t&) override
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void destroy(bool=true) override
|
void destroy(bool = true) override
|
||||||
{
|
{
|
||||||
if (VkDevice pdev = (VkDevice)dev)
|
if (VkDevice pdev = dev)
|
||||||
{
|
{
|
||||||
if (m_vk_swapchain)
|
if (m_vk_swapchain)
|
||||||
{
|
{
|
||||||
@ -2338,7 +2338,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
VkExtent2D swapchainExtent;
|
VkExtent2D swapchainExtent;
|
||||||
if (surface_descriptors.currentExtent.width == (uint32_t)-1)
|
if (surface_descriptors.currentExtent.width == UINT32_MAX)
|
||||||
{
|
{
|
||||||
swapchainExtent.width = m_width;
|
swapchainExtent.width = m_width;
|
||||||
swapchainExtent.height = m_height;
|
swapchainExtent.height = m_height;
|
||||||
@ -2481,7 +2481,7 @@ public:
|
|||||||
|
|
||||||
VkImage& get_image(u32 index) override
|
VkImage& get_image(u32 index) override
|
||||||
{
|
{
|
||||||
return (VkImage&)swapchain_images[index];
|
return static_cast<VkImage&>(swapchain_images[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageLayout get_optimal_present_layout() override
|
VkImageLayout get_optimal_present_layout() override
|
||||||
@ -2539,8 +2539,8 @@ public:
|
|||||||
|
|
||||||
PFN_vkDebugReportCallbackEXT callback = vk::dbgFunc;
|
PFN_vkDebugReportCallbackEXT callback = vk::dbgFunc;
|
||||||
|
|
||||||
createDebugReportCallback = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(m_instance, "vkCreateDebugReportCallbackEXT");
|
createDebugReportCallback = reinterpret_cast<PFN_vkCreateDebugReportCallbackEXT>(vkGetInstanceProcAddr(m_instance, "vkCreateDebugReportCallbackEXT"));
|
||||||
destroyDebugReportCallback = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(m_instance, "vkDestroyDebugReportCallbackEXT");
|
destroyDebugReportCallback = reinterpret_cast<PFN_vkDestroyDebugReportCallbackEXT>(vkGetInstanceProcAddr(m_instance, "vkDestroyDebugReportCallbackEXT"));
|
||||||
|
|
||||||
VkDebugReportCallbackCreateInfoEXT dbgCreateInfo = {};
|
VkDebugReportCallbackCreateInfoEXT dbgCreateInfo = {};
|
||||||
dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
|
dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
|
||||||
@ -2940,7 +2940,7 @@ public:
|
|||||||
|
|
||||||
void initialize(vk::command_buffer &cmd)
|
void initialize(vk::command_buffer &cmd)
|
||||||
{
|
{
|
||||||
const u32 count = (u32)query_active_status.size();
|
const u32 count = ::size32(query_active_status);
|
||||||
vkCmdResetQueryPool(cmd, query_pool, 0, count);
|
vkCmdResetQueryPool(cmd, query_pool, 0, count);
|
||||||
|
|
||||||
std::fill(query_active_status.begin(), query_active_status.end(), false);
|
std::fill(query_active_status.begin(), query_active_status.end(), false);
|
||||||
@ -3334,10 +3334,10 @@ public:
|
|||||||
vs_info.codeSize = m_compiled.size() * sizeof(u32);
|
vs_info.codeSize = m_compiled.size() * sizeof(u32);
|
||||||
vs_info.pNext = nullptr;
|
vs_info.pNext = nullptr;
|
||||||
vs_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
vs_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||||
vs_info.pCode = (uint32_t*)m_compiled.data();
|
vs_info.pCode = m_compiled.data();
|
||||||
vs_info.flags = 0;
|
vs_info.flags = 0;
|
||||||
|
|
||||||
VkDevice dev = (VkDevice)*vk::get_current_renderer();
|
VkDevice dev = *vk::get_current_renderer();
|
||||||
vkCreateShaderModule(dev, &vs_info, nullptr, &m_handle);
|
vkCreateShaderModule(dev, &vs_info, nullptr, &m_handle);
|
||||||
|
|
||||||
return m_handle;
|
return m_handle;
|
||||||
@ -3350,7 +3350,7 @@ public:
|
|||||||
|
|
||||||
if (m_handle)
|
if (m_handle)
|
||||||
{
|
{
|
||||||
VkDevice dev = (VkDevice)*vk::get_current_renderer();
|
VkDevice dev = *vk::get_current_renderer();
|
||||||
vkDestroyShaderModule(dev, m_handle, nullptr);
|
vkDestroyShaderModule(dev, m_handle, nullptr);
|
||||||
m_handle = nullptr;
|
m_handle = nullptr;
|
||||||
}
|
}
|
||||||
@ -3445,7 +3445,7 @@ public:
|
|||||||
|
|
||||||
if (!(get_heap_compatible_buffer_types() & usage))
|
if (!(get_heap_compatible_buffer_types() & usage))
|
||||||
{
|
{
|
||||||
LOG_WARNING(RSX, "Buffer usage %u is not heap-compatible using this driver, explicit staging buffer in use", (u32)usage);
|
LOG_WARNING(RSX, "Buffer usage %u is not heap-compatible using this driver, explicit staging buffer in use", usage);
|
||||||
|
|
||||||
shadow = std::make_unique<buffer>(*device, size, memory_index, memory_flags, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, 0);
|
shadow = std::make_unique<buffer>(*device, size, memory_index, memory_flags, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, 0);
|
||||||
usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||||
@ -3488,7 +3488,7 @@ public:
|
|||||||
raise_status_interrupt(runtime_state::heap_dirty);
|
raise_status_interrupt(runtime_state::heap_dirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (u8*)_ptr + offset;
|
return static_cast<u8*>(_ptr) + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmap(bool force = false)
|
void unmap(bool force = false)
|
||||||
@ -3515,7 +3515,7 @@ public:
|
|||||||
if (!dirty_ranges.empty())
|
if (!dirty_ranges.empty())
|
||||||
{
|
{
|
||||||
verify (HERE), shadow, heap;
|
verify (HERE), shadow, heap;
|
||||||
vkCmdCopyBuffer(cmd, shadow->value, heap->value, (u32)dirty_ranges.size(), dirty_ranges.data());
|
vkCmdCopyBuffer(cmd, shadow->value, heap->value, ::size32(dirty_ranges), dirty_ranges.data());
|
||||||
dirty_ranges.clear();
|
dirty_ranges.clear();
|
||||||
|
|
||||||
insert_buffer_memory_barrier(cmd, heap->value, 0, heap->size(),
|
insert_buffer_memory_barrier(cmd, heap->value, 0, heap->size(),
|
||||||
|
@ -1,2 +1,16 @@
|
|||||||
#define VMA_IMPLEMENTATION
|
#define VMA_IMPLEMENTATION
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push, 0)
|
||||||
|
#else
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wall"
|
||||||
|
#pragma GCC diagnostic ignored "-Wextra"
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
|
#endif
|
||||||
#include "3rdparty/GPUOpen/include/vk_mem_alloc.h"
|
#include "3rdparty/GPUOpen/include/vk_mem_alloc.h"
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#else
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
@ -41,7 +41,7 @@ namespace vk
|
|||||||
layout_offset += 3;
|
layout_offset += 3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unsupported image layout 0x%x", (u32)layout);
|
fmt::throw_exception("Unsupported image layout 0x%x", static_cast<u32>(layout));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ namespace vk
|
|||||||
layout_offset += 3;
|
layout_offset += 3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unsupported image layout 0x%x", (u32)layout);
|
fmt::throw_exception("Unsupported image layout 0x%x", static_cast<u32>(layout));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ namespace vk
|
|||||||
subres.height_in_block = subres.height_in_texel = surface_height * samples_y;
|
subres.height_in_block = subres.height_in_texel = surface_height * samples_y;
|
||||||
subres.pitch_in_block = rsx_pitch / get_bpp();
|
subres.pitch_in_block = rsx_pitch / get_bpp();
|
||||||
subres.depth = 1;
|
subres.depth = 1;
|
||||||
subres.data = { (const std::byte*)vm::get_super_ptr(base_addr), static_cast<gsl::span<const std::byte>::index_type>(rsx_pitch * surface_height * samples_y) };
|
subres.data = { vm::get_super_ptr<const std::byte>(base_addr), static_cast<gsl::span<const std::byte>::index_type>(rsx_pitch * surface_height * samples_y) };
|
||||||
|
|
||||||
if (LIKELY(g_cfg.video.resolution_scale_percent == 100 && samples() == 1))
|
if (LIKELY(g_cfg.video.resolution_scale_percent == 100 && samples() == 1))
|
||||||
{
|
{
|
||||||
@ -276,7 +276,7 @@ namespace vk
|
|||||||
if (content != final_dst)
|
if (content != final_dst)
|
||||||
{
|
{
|
||||||
vk::copy_scaled_image(cmd, content->value, final_dst->value, content->current_layout, final_dst->current_layout,
|
vk::copy_scaled_image(cmd, content->value, final_dst->value, content->current_layout, final_dst->current_layout,
|
||||||
{ 0, 0, subres.width_in_block, subres.height_in_block }, { 0, 0, (s32)final_dst->width(), (s32)final_dst->height() },
|
{ 0, 0, subres.width_in_block, subres.height_in_block }, { 0, 0, static_cast<s32>(final_dst->width()), static_cast<s32>(final_dst->height()) },
|
||||||
1, aspect(), true, aspect() == VK_IMAGE_ASPECT_COLOR_BIT ? VK_FILTER_LINEAR : VK_FILTER_NEAREST,
|
1, aspect(), true, aspect() == VK_IMAGE_ASPECT_COLOR_BIT ? VK_FILTER_LINEAR : VK_FILTER_NEAREST,
|
||||||
format(), format());
|
format(), format());
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ namespace vk
|
|||||||
{
|
{
|
||||||
typeless_info.src_is_typeless = true;
|
typeless_info.src_is_typeless = true;
|
||||||
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
|
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
|
||||||
typeless_info.src_native_format_override = (u32)info.format;
|
typeless_info.src_native_format_override = static_cast<u32>(info.format);
|
||||||
typeless_info.src_scaling_hint = f32(src_bpp) / dst_bpp;
|
typeless_info.src_scaling_hint = f32(src_bpp) / dst_bpp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -592,7 +592,7 @@ namespace rsx
|
|||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||||
VK_IMAGE_TYPE_2D,
|
VK_IMAGE_TYPE_2D,
|
||||||
requested_format,
|
requested_format,
|
||||||
static_cast<uint32_t>(rsx::apply_resolution_scale((u16)width, true)), static_cast<uint32_t>(rsx::apply_resolution_scale((u16)height, true)), 1, 1, 1,
|
static_cast<uint32_t>(rsx::apply_resolution_scale(static_cast<u16>(width), true)), static_cast<uint32_t>(rsx::apply_resolution_scale(static_cast<u16>(height), true)), 1, 1, 1,
|
||||||
static_cast<VkSampleCountFlagBits>(samples),
|
static_cast<VkSampleCountFlagBits>(samples),
|
||||||
VK_IMAGE_LAYOUT_UNDEFINED,
|
VK_IMAGE_LAYOUT_UNDEFINED,
|
||||||
VK_IMAGE_TILING_OPTIMAL,
|
VK_IMAGE_TILING_OPTIMAL,
|
||||||
@ -607,10 +607,10 @@ namespace rsx
|
|||||||
rtt->memory_usage_flags = rsx::surface_usage_flags::attachment;
|
rtt->memory_usage_flags = rsx::surface_usage_flags::attachment;
|
||||||
rtt->state_flags = rsx::surface_state_flags::erase_bkgnd;
|
rtt->state_flags = rsx::surface_state_flags::erase_bkgnd;
|
||||||
rtt->native_component_map = fmt.second;
|
rtt->native_component_map = fmt.second;
|
||||||
rtt->rsx_pitch = (u16)pitch;
|
rtt->rsx_pitch = static_cast<u16>(pitch);
|
||||||
rtt->native_pitch = (u16)width * get_format_block_size_in_bytes(format) * rtt->samples_x;
|
rtt->native_pitch = static_cast<u16>(width) * get_format_block_size_in_bytes(format) * rtt->samples_x;
|
||||||
rtt->surface_width = (u16)width;
|
rtt->surface_width = static_cast<u16>(width);
|
||||||
rtt->surface_height = (u16)height;
|
rtt->surface_height = static_cast<u16>(height);
|
||||||
rtt->queue_tag(address);
|
rtt->queue_tag(address);
|
||||||
|
|
||||||
rtt->add_ref();
|
rtt->add_ref();
|
||||||
@ -650,7 +650,7 @@ namespace rsx
|
|||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||||
VK_IMAGE_TYPE_2D,
|
VK_IMAGE_TYPE_2D,
|
||||||
requested_format,
|
requested_format,
|
||||||
static_cast<uint32_t>(rsx::apply_resolution_scale((u16)width, true)), static_cast<uint32_t>(rsx::apply_resolution_scale((u16)height, true)), 1, 1, 1,
|
static_cast<uint32_t>(rsx::apply_resolution_scale(static_cast<u16>(width), true)), static_cast<uint32_t>(rsx::apply_resolution_scale(static_cast<u16>(height), true)), 1, 1, 1,
|
||||||
static_cast<VkSampleCountFlagBits>(samples),
|
static_cast<VkSampleCountFlagBits>(samples),
|
||||||
VK_IMAGE_LAYOUT_UNDEFINED,
|
VK_IMAGE_LAYOUT_UNDEFINED,
|
||||||
VK_IMAGE_TILING_OPTIMAL,
|
VK_IMAGE_TILING_OPTIMAL,
|
||||||
@ -666,13 +666,13 @@ namespace rsx
|
|||||||
ds->state_flags = rsx::surface_state_flags::erase_bkgnd;
|
ds->state_flags = rsx::surface_state_flags::erase_bkgnd;
|
||||||
ds->native_component_map = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R };
|
ds->native_component_map = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_R };
|
||||||
|
|
||||||
ds->native_pitch = (u16)width * 2 * ds->samples_x;
|
ds->native_pitch = static_cast<u16>(width) * 2 * ds->samples_x;
|
||||||
if (format == rsx::surface_depth_format::z24s8)
|
if (format == rsx::surface_depth_format::z24s8)
|
||||||
ds->native_pitch *= 2;
|
ds->native_pitch *= 2;
|
||||||
|
|
||||||
ds->rsx_pitch = (u16)pitch;
|
ds->rsx_pitch = static_cast<u16>(pitch);
|
||||||
ds->surface_width = (u16)width;
|
ds->surface_width = static_cast<u16>(width);
|
||||||
ds->surface_height = (u16)height;
|
ds->surface_height = static_cast<u16>(height);
|
||||||
ds->queue_tag(address);
|
ds->queue_tag(address);
|
||||||
|
|
||||||
ds->add_ref();
|
ds->add_ref();
|
||||||
@ -775,7 +775,7 @@ namespace rsx
|
|||||||
|
|
||||||
static void invalidate_surface_contents(vk::command_buffer& /*cmd*/, vk::render_target *surface, u32 address, size_t pitch)
|
static void invalidate_surface_contents(vk::command_buffer& /*cmd*/, vk::render_target *surface, u32 address, size_t pitch)
|
||||||
{
|
{
|
||||||
surface->rsx_pitch = (u16)pitch;
|
surface->rsx_pitch = static_cast<u16>(pitch);
|
||||||
surface->queue_tag(address);
|
surface->queue_tag(address);
|
||||||
surface->last_use_tag = 0;
|
surface->last_use_tag = 0;
|
||||||
surface->stencil_init_flags = 0;
|
surface->stencil_init_flags = 0;
|
||||||
@ -820,7 +820,7 @@ namespace rsx
|
|||||||
|
|
||||||
return (surface->info.format == format &&
|
return (surface->info.format == format &&
|
||||||
surface->get_spp() == get_format_sample_count(antialias) &&
|
surface->get_spp() == get_format_sample_count(antialias) &&
|
||||||
surface->matches_dimensions((u16)width, (u16)height));
|
surface->matches_dimensions(static_cast<u16>(width), static_cast<u16>(height)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool surface_matches_properties(
|
static bool surface_matches_properties(
|
||||||
|
@ -372,9 +372,9 @@ namespace vk
|
|||||||
VkImageCopy copy_rgn;
|
VkImageCopy copy_rgn;
|
||||||
copy_rgn.srcOffset = { src_rect.x1, src_rect.y1, 0 };
|
copy_rgn.srcOffset = { src_rect.x1, src_rect.y1, 0 };
|
||||||
copy_rgn.dstOffset = { dst_rect.x1, dst_rect.y1, 0 };
|
copy_rgn.dstOffset = { dst_rect.x1, dst_rect.y1, 0 };
|
||||||
copy_rgn.dstSubresource = { (VkImageAspectFlags)aspect, 0, 0, 1 };
|
copy_rgn.dstSubresource = { static_cast<VkImageAspectFlags>(aspect), 0, 0, 1 };
|
||||||
copy_rgn.srcSubresource = { (VkImageAspectFlags)aspect, 0, 0, 1 };
|
copy_rgn.srcSubresource = { static_cast<VkImageAspectFlags>(aspect), 0, 0, 1 };
|
||||||
copy_rgn.extent = { (u32)src_rect.width(), (u32)src_rect.height(), 1 };
|
copy_rgn.extent = { static_cast<u32>(src_rect.width()), static_cast<u32>(src_rect.height()), 1 };
|
||||||
|
|
||||||
vkCmdCopyImage(cmd, src, preferred_src_format, dst, preferred_dst_format, 1, ©_rgn);
|
vkCmdCopyImage(cmd, src, preferred_src_format, dst, preferred_dst_format, 1, ©_rgn);
|
||||||
}
|
}
|
||||||
@ -383,7 +383,7 @@ namespace vk
|
|||||||
//Most depth/stencil formats cannot be scaled using hw blit
|
//Most depth/stencil formats cannot be scaled using hw blit
|
||||||
if (src_format == VK_FORMAT_UNDEFINED)
|
if (src_format == VK_FORMAT_UNDEFINED)
|
||||||
{
|
{
|
||||||
LOG_ERROR(RSX, "Could not blit depth/stencil image. src_fmt=0x%x", (u32)src_format);
|
LOG_ERROR(RSX, "Could not blit depth/stencil image. src_fmt=0x%x", static_cast<u32>(src_format));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -427,7 +427,7 @@ namespace vk
|
|||||||
//1. Copy unscaled to typeless surface
|
//1. Copy unscaled to typeless surface
|
||||||
VkBufferImageCopy info{};
|
VkBufferImageCopy info{};
|
||||||
info.imageOffset = { std::min(src_rect.x1, src_rect.x2), std::min(src_rect.y1, src_rect.y2), 0 };
|
info.imageOffset = { std::min(src_rect.x1, src_rect.x2), std::min(src_rect.y1, src_rect.y2), 0 };
|
||||||
info.imageExtent = { (u32)src_w, (u32)src_h, 1 };
|
info.imageExtent = { static_cast<u32>(src_w), static_cast<u32>(src_h), 1 };
|
||||||
info.imageSubresource = { aspect & transfer_flags, 0, 0, 1 };
|
info.imageSubresource = { aspect & transfer_flags, 0, 0, 1 };
|
||||||
|
|
||||||
vkCmdCopyImageToBuffer(cmd, src, preferred_src_format, scratch_buf->value, 1, &info);
|
vkCmdCopyImageToBuffer(cmd, src, preferred_src_format, scratch_buf->value, 1, &info);
|
||||||
@ -446,7 +446,7 @@ namespace vk
|
|||||||
src_rect2, { 0, src_h, dst_w, (src_h + dst_h) }, 1, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_ASPECT_COLOR_BIT, filter);
|
src_rect2, { 0, src_h, dst_w, (src_h + dst_h) }, 1, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_ASPECT_COLOR_BIT, filter);
|
||||||
|
|
||||||
//3. Copy back the aspect bits
|
//3. Copy back the aspect bits
|
||||||
info.imageExtent = { (u32)dst_w, (u32)dst_h, 1 };
|
info.imageExtent = { static_cast<u32>(dst_w), static_cast<u32>(dst_h), 1 };
|
||||||
info.imageOffset = { 0, src_h, 0 };
|
info.imageOffset = { 0, src_h, 0 };
|
||||||
|
|
||||||
vkCmdCopyImageToBuffer(cmd, typeless, VK_IMAGE_LAYOUT_GENERAL, scratch_buf->value, 1, &info);
|
vkCmdCopyImageToBuffer(cmd, typeless, VK_IMAGE_LAYOUT_GENERAL, scratch_buf->value, 1, &info);
|
||||||
@ -712,7 +712,7 @@ namespace vk
|
|||||||
|
|
||||||
// Map with extra padding bytes in case of realignment
|
// Map with extra padding bytes in case of realignment
|
||||||
size_t offset_in_buffer = upload_heap.alloc<512>(image_linear_size + 8);
|
size_t offset_in_buffer = upload_heap.alloc<512>(image_linear_size + 8);
|
||||||
void *mapped_buffer = upload_heap.map(offset_in_buffer, image_linear_size + 8);
|
void* mapped_buffer = upload_heap.map(offset_in_buffer, image_linear_size + 8);
|
||||||
|
|
||||||
// Only do GPU-side conversion if occupancy is good
|
// Only do GPU-side conversion if occupancy is good
|
||||||
if (check_caps)
|
if (check_caps)
|
||||||
@ -722,7 +722,7 @@ namespace vk
|
|||||||
check_caps = false;
|
check_caps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl::span<std::byte> mapped{ (std::byte*)mapped_buffer, image_linear_size };
|
gsl::span<std::byte> mapped{ static_cast<std::byte*>(mapped_buffer), image_linear_size };
|
||||||
opt = upload_texture_subresource(mapped, layout, format, is_swizzled, caps);
|
opt = upload_texture_subresource(mapped, layout, format, is_swizzled, caps);
|
||||||
upload_heap.unmap();
|
upload_heap.unmap();
|
||||||
|
|
||||||
@ -770,7 +770,7 @@ namespace vk
|
|||||||
if (opt.require_swap || opt.require_deswizzle || dst_image->aspect() & VK_IMAGE_ASPECT_STENCIL_BIT)
|
if (opt.require_swap || opt.require_deswizzle || dst_image->aspect() & VK_IMAGE_ASPECT_STENCIL_BIT)
|
||||||
{
|
{
|
||||||
verify(HERE), scratch_buf;
|
verify(HERE), scratch_buf;
|
||||||
vkCmdCopyBuffer(cmd, upload_heap.heap->value, scratch_buf->value, (u32)buffer_copies.size(), buffer_copies.data());
|
vkCmdCopyBuffer(cmd, upload_heap.heap->value, scratch_buf->value, static_cast<u32>(buffer_copies.size()), buffer_copies.data());
|
||||||
|
|
||||||
insert_buffer_memory_barrier(cmd, scratch_buf->value, 0, scratch_offset, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
insert_buffer_memory_barrier(cmd, scratch_buf->value, 0, scratch_offset, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||||
VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT);
|
VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT);
|
||||||
@ -814,11 +814,11 @@ namespace vk
|
|||||||
insert_buffer_memory_barrier(cmd, scratch_buf->value, block_start, scratch_offset, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
|
insert_buffer_memory_barrier(cmd, scratch_buf->value, block_start, scratch_offset, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||||
VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT);
|
VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT);
|
||||||
|
|
||||||
vkCmdCopyBufferToImage(cmd, scratch_buf->value, dst_image->value, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, (u32)copy_regions.size(), copy_regions.data());
|
vkCmdCopyBufferToImage(cmd, scratch_buf->value, dst_image->value, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, static_cast<u32>(copy_regions.size()), copy_regions.data());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vkCmdCopyBufferToImage(cmd, upload_heap.heap->value, dst_image->value, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, (u32)copy_regions.size(), copy_regions.data());
|
vkCmdCopyBufferToImage(cmd, upload_heap.heap->value, dst_image->value, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, static_cast<u32>(copy_regions.size()), copy_regions.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,14 +864,14 @@ namespace vk
|
|||||||
const auto aspect = vk::get_aspect_flags(format);
|
const auto aspect = vk::get_aspect_flags(format);
|
||||||
|
|
||||||
// Transfer bits from src to typeless src
|
// Transfer bits from src to typeless src
|
||||||
real_src = vk::get_typeless_helper(format, (u32)internal_width, src->height());
|
real_src = vk::get_typeless_helper(format, static_cast<u32>(internal_width), src->height());
|
||||||
vk::change_image_layout(cmd, real_src, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, { aspect, 0, 1, 0, 1 });
|
vk::change_image_layout(cmd, real_src, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, { aspect, 0, 1, 0, 1 });
|
||||||
|
|
||||||
vk::copy_image_typeless(cmd, src, real_src, { 0, 0, (s32)src->width(), (s32)src->height() }, { 0, 0, (s32)internal_width, (s32)src->height() }, 1,
|
vk::copy_image_typeless(cmd, src, real_src, { 0, 0, static_cast<s32>(src->width()), static_cast<s32>(src->height()) }, { 0, 0, static_cast<s32>(internal_width), static_cast<s32>(src->height()) }, 1,
|
||||||
vk::get_aspect_flags(src->info.format), aspect);
|
vk::get_aspect_flags(src->info.format), aspect);
|
||||||
|
|
||||||
src_area.x1 = (u16)(src_area.x1 * xfer_info.src_scaling_hint);
|
src_area.x1 = static_cast<u16>(src_area.x1 * xfer_info.src_scaling_hint);
|
||||||
src_area.x2 = (u16)(src_area.x2 * xfer_info.src_scaling_hint);
|
src_area.x2 = static_cast<u16>(src_area.x2 * xfer_info.src_scaling_hint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -887,14 +887,14 @@ namespace vk
|
|||||||
const auto aspect = vk::get_aspect_flags(format);
|
const auto aspect = vk::get_aspect_flags(format);
|
||||||
|
|
||||||
// Transfer bits from dst to typeless dst
|
// Transfer bits from dst to typeless dst
|
||||||
real_dst = vk::get_typeless_helper(format, (u32)internal_width, dst->height());
|
real_dst = vk::get_typeless_helper(format, static_cast<u32>(internal_width), dst->height());
|
||||||
vk::change_image_layout(cmd, real_dst, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, { aspect, 0, 1, 0, 1 });
|
vk::change_image_layout(cmd, real_dst, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, { aspect, 0, 1, 0, 1 });
|
||||||
|
|
||||||
vk::copy_image_typeless(cmd, dst, real_dst, { 0, 0, (s32)dst->width(), (s32)dst->height() }, { 0, 0, (s32)internal_width, (s32)dst->height() }, 1,
|
vk::copy_image_typeless(cmd, dst, real_dst, { 0, 0, static_cast<s32>(dst->width()), static_cast<s32>(dst->height()) }, { 0, 0, static_cast<s32>(internal_width), static_cast<s32>(dst->height()) }, 1,
|
||||||
vk::get_aspect_flags(dst->info.format), aspect);
|
vk::get_aspect_flags(dst->info.format), aspect);
|
||||||
|
|
||||||
dst_area.x1 = (u16)(dst_area.x1 * xfer_info.dst_scaling_hint);
|
dst_area.x1 = static_cast<u16>(dst_area.x1 * xfer_info.dst_scaling_hint);
|
||||||
dst_area.x2 = (u16)(dst_area.x2 * xfer_info.dst_scaling_hint);
|
dst_area.x2 = static_cast<u16>(dst_area.x2 * xfer_info.dst_scaling_hint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,13 +905,13 @@ namespace vk
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_area.x1 < 0 || src_area.x2 >(s32)real_src->width() || src_area.y1 < 0 || src_area.y2 >(s32)real_src->height())
|
if (src_area.x1 < 0 || src_area.x2 > static_cast<s32>(real_src->width()) || src_area.y1 < 0 || src_area.y2 > static_cast<s32>(real_src->height()))
|
||||||
{
|
{
|
||||||
LOG_ERROR(RSX, "Blit request denied because the source region does not fit!");
|
LOG_ERROR(RSX, "Blit request denied because the source region does not fit!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst_area.x1 < 0 || dst_area.x2 >(s32)real_dst->width() || dst_area.y1 < 0 || dst_area.y2 >(s32)real_dst->height())
|
if (dst_area.x1 < 0 || dst_area.x2 > static_cast<s32>(real_dst->width()) || dst_area.y1 < 0 || dst_area.y2 > static_cast<s32>(real_dst->height()))
|
||||||
{
|
{
|
||||||
LOG_ERROR(RSX, "Blit request denied because the destination region does not fit!");
|
LOG_ERROR(RSX, "Blit request denied because the destination region does not fit!");
|
||||||
return;
|
return;
|
||||||
@ -936,7 +936,7 @@ namespace vk
|
|||||||
if (real_dst != dst)
|
if (real_dst != dst)
|
||||||
{
|
{
|
||||||
auto internal_width = dst->width() * xfer_info.dst_scaling_hint;
|
auto internal_width = dst->width() * xfer_info.dst_scaling_hint;
|
||||||
vk::copy_image_typeless(cmd, real_dst, dst, { 0, 0, (s32)internal_width, (s32)dst->height() }, { 0, 0, (s32)dst->width(), (s32)dst->height() }, 1,
|
vk::copy_image_typeless(cmd, real_dst, dst, { 0, 0, static_cast<s32>(internal_width), static_cast<s32>(dst->height()) }, { 0, 0, static_cast<s32>(dst->width()), static_cast<s32>(dst->height()) }, 1,
|
||||||
vk::get_aspect_flags(real_dst->info.format), vk::get_aspect_flags(dst->info.format));
|
vk::get_aspect_flags(real_dst->info.format), vk::get_aspect_flags(dst->info.format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,8 +185,8 @@ namespace vk
|
|||||||
src->push_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
src->push_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
||||||
|
|
||||||
const auto internal_bpp = vk::get_format_texel_width(src->format());
|
const auto internal_bpp = vk::get_format_texel_width(src->format());
|
||||||
const auto transfer_width = (u32)src_area.width();
|
const auto transfer_width = static_cast<u32>(src_area.width());
|
||||||
const auto transfer_height = (u32)src_area.height();
|
const auto transfer_height = static_cast<u32>(src_area.height());
|
||||||
real_pitch = internal_bpp * transfer_width;
|
real_pitch = internal_bpp * transfer_width;
|
||||||
rsx_pitch = pitch;
|
rsx_pitch = pitch;
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ namespace vk
|
|||||||
const auto filter = (target->aspect() == VK_IMAGE_ASPECT_COLOR_BIT) ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
|
const auto filter = (target->aspect() == VK_IMAGE_ASPECT_COLOR_BIT) ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
|
||||||
|
|
||||||
vk::copy_scaled_image(cmd, locked_resource->value, target->value, locked_resource->current_layout, target->current_layout,
|
vk::copy_scaled_image(cmd, locked_resource->value, target->value, locked_resource->current_layout, target->current_layout,
|
||||||
{ 0, 0, (s32)locked_resource->width(), (s32)locked_resource->height() }, { 0, 0, (s32)transfer_width, (s32)transfer_height },
|
{ 0, 0, static_cast<s32>(locked_resource->width()), static_cast<s32>(locked_resource->height()) }, { 0, 0, static_cast<s32>(transfer_width), static_cast<s32>(transfer_height) },
|
||||||
1, target->aspect(), true, filter, vram_texture->format(), target->format());
|
1, target->aspect(), true, filter, vram_texture->format(), target->format());
|
||||||
|
|
||||||
target->change_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
target->change_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
||||||
@ -374,8 +374,8 @@ namespace vk
|
|||||||
}
|
}
|
||||||
|
|
||||||
areai src_area;
|
areai src_area;
|
||||||
src_area.x1 = (s32)transfer_x;
|
src_area.x1 = static_cast<s32>(transfer_x);
|
||||||
src_area.y1 = (s32)transfer_y;
|
src_area.y1 = static_cast<s32>(transfer_y);
|
||||||
src_area.x2 = s32(transfer_x + transfer_width);
|
src_area.x2 = s32(transfer_x + transfer_width);
|
||||||
src_area.y2 = s32(transfer_y + transfer_height);
|
src_area.y2 = s32(transfer_y + transfer_height);
|
||||||
dma_transfer(cmd, target, src_area, valid_range, rsx_pitch);
|
dma_transfer(cmd, target, src_area, valid_range, rsx_pitch);
|
||||||
@ -709,7 +709,7 @@ namespace vk
|
|||||||
}
|
}
|
||||||
|
|
||||||
vk::copy_scaled_image(cmd, tmp->value, _dst->value, tmp->current_layout, _dst->current_layout,
|
vk::copy_scaled_image(cmd, tmp->value, _dst->value, tmp->current_layout, _dst->current_layout,
|
||||||
areai{ 0, 0, src_w, (s32)src_h },
|
areai{ 0, 0, src_w, static_cast<s32>(src_h) },
|
||||||
coordi{ { dst_x, dst_y }, { section.dst_w, section.dst_h } },
|
coordi{ { dst_x, dst_y }, { section.dst_w, section.dst_h } },
|
||||||
1, new_src_aspect, tmp->info.format == _dst->info.format,
|
1, new_src_aspect, tmp->info.format == _dst->info.format,
|
||||||
VK_FILTER_NEAREST, tmp->info.format, _dst->info.format);
|
VK_FILTER_NEAREST, tmp->info.format, _dst->info.format);
|
||||||
@ -1029,7 +1029,7 @@ namespace vk
|
|||||||
const std::vector<copy_region_descriptor>& sections_to_copy, const rsx::texture_channel_remap_t& remap_vector) override
|
const std::vector<copy_region_descriptor>& sections_to_copy, const rsx::texture_channel_remap_t& remap_vector) override
|
||||||
{
|
{
|
||||||
const auto _template = sections_to_copy.front().src;
|
const auto _template = sections_to_copy.front().src;
|
||||||
const auto mipmaps = (u8)sections_to_copy.size();
|
const auto mipmaps = ::narrow<u8>(sections_to_copy.size());
|
||||||
|
|
||||||
std::unique_ptr<vk::viewable_image> image;
|
std::unique_ptr<vk::viewable_image> image;
|
||||||
if (image = find_temporary_image(_template->format(), width, height, 1, mipmaps); !image)
|
if (image = find_temporary_image(_template->format(), width, height, 1, mipmaps); !image)
|
||||||
@ -1287,7 +1287,7 @@ namespace vk
|
|||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
//TODO
|
//TODO
|
||||||
warn_once("Format incompatibility detected, reporting failure to force data copy (VK_FORMAT=0x%X, GCM_FORMAT=0x%X)", (u32)vk_format, gcm_format);
|
warn_once("Format incompatibility detected, reporting failure to force data copy (VK_FORMAT=0x%X, GCM_FORMAT=0x%X)", static_cast<u32>(vk_format), gcm_format);
|
||||||
return false;
|
return false;
|
||||||
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
|
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
|
||||||
return (vk_format == VK_FORMAT_R16G16B16A16_SFLOAT);
|
return (vk_format == VK_FORMAT_R16G16B16A16_SFLOAT);
|
||||||
@ -1465,14 +1465,14 @@ namespace vk
|
|||||||
void* mem = image->memory->map(0, layout.rowPitch * height);
|
void* mem = image->memory->map(0, layout.rowPitch * height);
|
||||||
|
|
||||||
u32 row_pitch = width * 4;
|
u32 row_pitch = width * 4;
|
||||||
char *src = (char *)vm::base(address);
|
auto src = vm::_ptr<const char>(address);
|
||||||
char *dst = (char *)mem;
|
auto dst = static_cast<char*>(mem);
|
||||||
|
|
||||||
//TODO: SSE optimization
|
//TODO: SSE optimization
|
||||||
for (u32 row = 0; row < height; ++row)
|
for (u32 row = 0; row < height; ++row)
|
||||||
{
|
{
|
||||||
be_t<u32>* casted_src = (be_t<u32>*)src;
|
auto casted_src = reinterpret_cast<const be_t<u32>*>(src);
|
||||||
u32* casted_dst = (u32*)dst;
|
auto casted_dst = reinterpret_cast<u32*>(dst);
|
||||||
|
|
||||||
for (u32 col = 0; col < width; ++col)
|
for (u32 col = 0; col < width; ++col)
|
||||||
casted_dst[col] = casted_src[col];
|
casted_dst[col] = casted_src[col];
|
||||||
@ -1514,7 +1514,7 @@ namespace vk
|
|||||||
|
|
||||||
const u32 get_unreleased_textures_count() const override
|
const u32 get_unreleased_textures_count() const override
|
||||||
{
|
{
|
||||||
return baseclass::get_unreleased_textures_count() + (u32)m_temporary_storage.size();
|
return baseclass::get_unreleased_textures_count() + ::size32(m_temporary_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32 get_temporary_memory_in_use()
|
const u32 get_temporary_memory_in_use()
|
||||||
|
@ -34,7 +34,7 @@ namespace vk
|
|||||||
requires_modification = true;
|
requires_modification = true;
|
||||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unsupported primitive topology 0x%x", (u8)mode);
|
fmt::throw_exception("Unsupported primitive topology 0x%x", static_cast<u8>(mode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,11 +179,11 @@ namespace
|
|||||||
{
|
{
|
||||||
if (index_type == rsx::index_array_type::u16)
|
if (index_type == rsx::index_array_type::u16)
|
||||||
{
|
{
|
||||||
index_count = rsx::remove_restart_index((u16*)buf, (u16*)tmp.data(), index_count, (u16)UINT16_MAX);
|
index_count = rsx::remove_restart_index(static_cast<u16*>(buf), reinterpret_cast<u16*>(tmp.data()), index_count, u16{UINT16_MAX});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
index_count = rsx::remove_restart_index((u32*)buf, (u32*)tmp.data(), index_count, (u32)UINT32_MAX);
|
index_count = rsx::remove_restart_index(static_cast<u32*>(buf), reinterpret_cast<u32*>(tmp.data()), index_count, u32{UINT32_MAX});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,21 +272,21 @@ vk::vertex_upload_info VKGSRender::upload_vertex_data()
|
|||||||
|
|
||||||
if (!in_cache)
|
if (!in_cache)
|
||||||
{
|
{
|
||||||
persistent_offset = (u32)m_attrib_ring_info.alloc<256>(required.first);
|
persistent_offset = static_cast<u32>(m_attrib_ring_info.alloc<256>(required.first));
|
||||||
persistent_range_base = (u32)persistent_offset;
|
persistent_range_base = static_cast<u32>(persistent_offset);
|
||||||
|
|
||||||
if (to_store)
|
if (to_store)
|
||||||
{
|
{
|
||||||
//store ref in vertex cache
|
//store ref in vertex cache
|
||||||
m_vertex_cache->store_range(storage_address, VK_FORMAT_R8_UINT, required.first, (u32)persistent_offset);
|
m_vertex_cache->store_range(storage_address, VK_FORMAT_R8_UINT, required.first, static_cast<u32>(persistent_offset));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (required.second > 0)
|
if (required.second > 0)
|
||||||
{
|
{
|
||||||
volatile_offset = (u32)m_attrib_ring_info.alloc<256>(required.second);
|
volatile_offset = static_cast<u32>(m_attrib_ring_info.alloc<256>(required.second));
|
||||||
volatile_range_base = (u32)volatile_offset;
|
volatile_range_base = static_cast<u32>(volatile_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Write all the data once if possible
|
//Write all the data once if possible
|
||||||
@ -298,7 +298,7 @@ vk::vertex_upload_info VKGSRender::upload_vertex_data()
|
|||||||
const size_t volatile_offset_in_block = volatile_offset - persistent_offset;
|
const size_t volatile_offset_in_block = volatile_offset - persistent_offset;
|
||||||
|
|
||||||
void *block_mapping = m_attrib_ring_info.map(persistent_offset, block_size);
|
void *block_mapping = m_attrib_ring_info.map(persistent_offset, block_size);
|
||||||
write_vertex_data_to_memory(m_vertex_layout, vertex_base, vertex_count, block_mapping, (char*)block_mapping + volatile_offset_in_block);
|
write_vertex_data_to_memory(m_vertex_layout, vertex_base, vertex_count, block_mapping, static_cast<char*>(block_mapping) + volatile_offset_in_block);
|
||||||
m_attrib_ring_info.unmap();
|
m_attrib_ring_info.unmap();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -42,7 +42,7 @@ namespace rsx
|
|||||||
//Don't throw, gather information and ignore broken/garbage commands
|
//Don't throw, gather information and ignore broken/garbage commands
|
||||||
//TODO: Investigate why these commands are executed at all. (Heap corruption? Alignment padding?)
|
//TODO: Investigate why these commands are executed at all. (Heap corruption? Alignment padding?)
|
||||||
const u32 cmd = rsx->get_fifo_cmd();
|
const u32 cmd = rsx->get_fifo_cmd();
|
||||||
LOG_ERROR(RSX, "Invalid RSX method 0x%x (arg=0x%x, start=0x%x, count=0x%x, non-inc=%s)", _reg << 2, arg,
|
LOG_ERROR(RSX, "Invalid RSX method 0x%x (arg=0x%x, start=0x%x, count=0x%x, non-inc=%s)", _reg << 2, arg,
|
||||||
cmd & 0xfffc, (cmd >> 18) & 0x7ff, !!(cmd & RSX_METHOD_NON_INCREMENT_CMD));
|
cmd & 0xfffc, (cmd >> 18) & 0x7ff, !!(cmd & RSX_METHOD_NON_INCREMENT_CMD));
|
||||||
rsx->invalid_command_interrupt_raised = true;
|
rsx->invalid_command_interrupt_raised = true;
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ namespace rsx
|
|||||||
if (Emu.IsStopped())
|
if (Emu.IsStopped())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (const auto tdr = (u64)g_cfg.video.driver_recovery_timeout)
|
if (const auto tdr = static_cast<u64>(g_cfg.video.driver_recovery_timeout))
|
||||||
{
|
{
|
||||||
if (Emu.IsPaused())
|
if (Emu.IsPaused())
|
||||||
{
|
{
|
||||||
@ -834,7 +834,7 @@ namespace rsx
|
|||||||
vm::write32(address, color);
|
vm::write32(address, color);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
vm::write16(address, (u16)(color));
|
vm::write16(address, static_cast<u16>(color));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fmt::throw_exception("Unreachable" HERE);
|
fmt::throw_exception("Unreachable" HERE);
|
||||||
@ -868,8 +868,8 @@ namespace rsx
|
|||||||
|
|
||||||
// NOTE: Do not round these value up!
|
// NOTE: Do not round these value up!
|
||||||
// Sub-pixel offsets are used to signify pixel centers and do not mean to read from the next block (fill convention)
|
// Sub-pixel offsets are used to signify pixel centers and do not mean to read from the next block (fill convention)
|
||||||
auto in_x = (u16)std::floor(method_registers.blit_engine_in_x());
|
auto in_x = static_cast<u16>(std::floor(method_registers.blit_engine_in_x()));
|
||||||
auto in_y = (u16)std::floor(method_registers.blit_engine_in_y());
|
auto in_y = static_cast<u16>(std::floor(method_registers.blit_engine_in_y()));
|
||||||
|
|
||||||
// Clipping
|
// Clipping
|
||||||
// Validate that clipping rect will fit onto both src and dst regions
|
// Validate that clipping rect will fit onto both src and dst regions
|
||||||
@ -904,12 +904,12 @@ namespace rsx
|
|||||||
case blit_engine::transfer_origin::center:
|
case blit_engine::transfer_origin::center:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_WARNING(RSX, "NV3089_IMAGE_IN_SIZE: unknown origin (%d)", (u8)in_origin);
|
LOG_WARNING(RSX, "NV3089_IMAGE_IN_SIZE: unknown origin (%d)", static_cast<u8>(in_origin));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation != rsx::blit_engine::transfer_operation::srccopy)
|
if (operation != rsx::blit_engine::transfer_operation::srccopy)
|
||||||
{
|
{
|
||||||
fmt::throw_exception("NV3089_IMAGE_IN_SIZE: unknown operation (%d)" HERE, (u8)operation);
|
fmt::throw_exception("NV3089_IMAGE_IN_SIZE: unknown operation (%d)" HERE, static_cast<u8>(operation));
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32 src_offset = method_registers.blit_engine_input_offset();
|
const u32 src_offset = method_registers.blit_engine_input_offset();
|
||||||
@ -942,7 +942,7 @@ namespace rsx
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(RSX, "NV3089_IMAGE_IN_SIZE: unknown m_context_surface (0x%x)", (u8)method_registers.blit_engine_context_surface());
|
LOG_ERROR(RSX, "NV3089_IMAGE_IN_SIZE: unknown m_context_surface (0x%x)", static_cast<u8>(method_registers.blit_engine_context_surface()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1008,7 +1008,7 @@ namespace rsx
|
|||||||
if (dst_color_format != rsx::blit_engine::transfer_destination_format::r5g6b5 &&
|
if (dst_color_format != rsx::blit_engine::transfer_destination_format::r5g6b5 &&
|
||||||
dst_color_format != rsx::blit_engine::transfer_destination_format::a8r8g8b8)
|
dst_color_format != rsx::blit_engine::transfer_destination_format::a8r8g8b8)
|
||||||
{
|
{
|
||||||
fmt::throw_exception("NV3089_IMAGE_IN_SIZE: unknown dst_color_format (%d)" HERE, (u8)dst_color_format);
|
fmt::throw_exception("NV3089_IMAGE_IN_SIZE: unknown dst_color_format (%d)" HERE, static_cast<u8>(dst_color_format));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_color_format != rsx::blit_engine::transfer_source_format::r5g6b5 &&
|
if (src_color_format != rsx::blit_engine::transfer_source_format::r5g6b5 &&
|
||||||
@ -1022,12 +1022,12 @@ namespace rsx
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: Support more formats
|
// TODO: Support more formats
|
||||||
fmt::throw_exception("NV3089_IMAGE_IN_SIZE: unknown src_color_format (%d)" HERE, (u8)src_color_format);
|
fmt::throw_exception("NV3089_IMAGE_IN_SIZE: unknown src_color_format (%d)" HERE, static_cast<u8>(src_color_format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 convert_w = (u32)(std::abs(scale_x) * in_w);
|
u32 convert_w = static_cast<u32>(std::abs(scale_x) * in_w);
|
||||||
u32 convert_h = (u32)(std::abs(scale_y) * in_h);
|
u32 convert_h = static_cast<u32>(std::abs(scale_y) * in_h);
|
||||||
|
|
||||||
if (convert_w == 0 || convert_h == 0)
|
if (convert_w == 0 || convert_h == 0)
|
||||||
{
|
{
|
||||||
@ -1078,12 +1078,12 @@ namespace rsx
|
|||||||
const u32 packed_pitch = in_w * in_bpp;
|
const u32 packed_pitch = in_w * in_bpp;
|
||||||
temp1.resize(packed_pitch * in_h);
|
temp1.resize(packed_pitch * in_h);
|
||||||
|
|
||||||
const s32 stride_y = (scale_y < 0 ? -1 : 1) * (s32)in_pitch;
|
const s32 stride_y = (scale_y < 0 ? -1 : 1) * s32{in_pitch};
|
||||||
|
|
||||||
for (u32 y = 0; y < in_h; ++y)
|
for (u32 y = 0; y < in_h; ++y)
|
||||||
{
|
{
|
||||||
u8 *dst = temp1.data() + (packed_pitch * y);
|
u8 *dst = temp1.data() + (packed_pitch * y);
|
||||||
u8 *src = pixels_src + ((s32)y * stride_y);
|
u8 *src = pixels_src + (static_cast<s32>(y) * stride_y);
|
||||||
|
|
||||||
if (scale_x < 0)
|
if (scale_x < 0)
|
||||||
{
|
{
|
||||||
@ -1194,7 +1194,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (need_clip)
|
if (need_clip)
|
||||||
{
|
{
|
||||||
temp2.resize(out_pitch * std::max(convert_h, (u32)clip_h));
|
temp2.resize(out_pitch * std::max<u32>(convert_h, clip_h));
|
||||||
|
|
||||||
convert_scale_image(temp2.data(), out_format, convert_w, convert_h, out_pitch,
|
convert_scale_image(temp2.data(), out_format, convert_w, convert_h, out_pitch,
|
||||||
pixels_src, in_format, in_w, in_h, in_pitch, slice_h, in_inter == blit_engine::transfer_interpolator::foh);
|
pixels_src, in_format, in_w, in_h, in_pitch, slice_h, in_inter == blit_engine::transfer_interpolator::foh);
|
||||||
@ -1218,7 +1218,7 @@ namespace rsx
|
|||||||
|
|
||||||
if (need_convert)
|
if (need_convert)
|
||||||
{
|
{
|
||||||
temp2.resize(out_pitch * std::max(convert_h, (u32)clip_h));
|
temp2.resize(out_pitch * std::max<u32>(convert_h, clip_h));
|
||||||
|
|
||||||
convert_scale_image(temp2.data(), out_format, convert_w, convert_h, out_pitch,
|
convert_scale_image(temp2.data(), out_format, convert_w, convert_h, out_pitch,
|
||||||
pixels_src, in_format, in_w, in_h, in_pitch, slice_h, in_inter == blit_engine::transfer_interpolator::foh);
|
pixels_src, in_format, in_w, in_h, in_pitch, slice_h, in_inter == blit_engine::transfer_interpolator::foh);
|
||||||
|
@ -337,8 +337,8 @@ namespace rsx
|
|||||||
* Restriction: It has mixed results if the height or width is not a power of 2
|
* Restriction: It has mixed results if the height or width is not a power of 2
|
||||||
* Restriction: Only works with 2D surfaces
|
* Restriction: Only works with 2D surfaces
|
||||||
*/
|
*/
|
||||||
template<typename T, bool input_is_swizzled>
|
template <typename T, bool input_is_swizzled>
|
||||||
void convert_linear_swizzle(void* input_pixels, void* output_pixels, u16 width, u16 height, u32 pitch)
|
void convert_linear_swizzle(const void* input_pixels, void* output_pixels, u16 width, u16 height, u32 pitch)
|
||||||
{
|
{
|
||||||
u32 log2width = ceil_log2(width);
|
u32 log2width = ceil_log2(width);
|
||||||
u32 log2height = ceil_log2(height);
|
u32 log2height = ceil_log2(height);
|
||||||
@ -368,8 +368,8 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
for (int y = 0; y < height; ++y)
|
for (int y = 0; y < height; ++y)
|
||||||
{
|
{
|
||||||
T* src = static_cast<T*>(input_pixels) + y * adv;
|
auto src = static_cast<const T*>(input_pixels) + y * adv;
|
||||||
T *dst = static_cast<T*>(output_pixels) + offs_y;
|
auto dst = static_cast<T*>(output_pixels) + offs_y;
|
||||||
offs_x = offs_x0;
|
offs_x = offs_x0;
|
||||||
|
|
||||||
for (int x = 0; x < width; ++x)
|
for (int x = 0; x < width; ++x)
|
||||||
@ -390,8 +390,8 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
for (int y = 0; y < height; ++y)
|
for (int y = 0; y < height; ++y)
|
||||||
{
|
{
|
||||||
T *src = static_cast<T*>(input_pixels) + offs_y;
|
auto src = static_cast<const T*>(input_pixels) + offs_y;
|
||||||
T* dst = static_cast<T*>(output_pixels) + y * adv;
|
auto dst = static_cast<T*>(output_pixels) + y * adv;
|
||||||
offs_x = offs_x0;
|
offs_x = offs_x0;
|
||||||
|
|
||||||
for (int x = 0; x < width; ++x)
|
for (int x = 0; x < width; ++x)
|
||||||
@ -417,7 +417,7 @@ namespace rsx
|
|||||||
* i.e 32 texels per "unit"
|
* i.e 32 texels per "unit"
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void convert_linear_swizzle_3d(void *input_pixels, void *output_pixels, u16 width, u16 height, u16 depth)
|
void convert_linear_swizzle_3d(const void* input_pixels, void* output_pixels, u16 width, u16 height, u16 depth)
|
||||||
{
|
{
|
||||||
if (depth == 1)
|
if (depth == 1)
|
||||||
{
|
{
|
||||||
@ -425,8 +425,8 @@ namespace rsx
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
T *src = static_cast<T*>(input_pixels);
|
auto src = static_cast<const T*>(input_pixels);
|
||||||
T *dst = static_cast<T*>(output_pixels);
|
auto dst = static_cast<T*>(output_pixels);
|
||||||
|
|
||||||
const u32 log2_w = ceil_log2(width);
|
const u32 log2_w = ceil_log2(width);
|
||||||
const u32 log2_h = ceil_log2(height);
|
const u32 log2_h = ceil_log2(height);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user