1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00

rsx: Minor cleanup to silence stupid compiler warnings

This commit is contained in:
kd-11 2018-12-02 16:22:05 +03:00 committed by kd-11
parent f4c28eceef
commit 504ab5a6d4
8 changed files with 28 additions and 29 deletions

View File

@ -271,7 +271,7 @@ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u6
case 0x102: // Display flip case 0x102: // Display flip
{ {
u32 flip_idx = -1u; u32 flip_idx = ~0u;
// high bit signifys grabbing a queued buffer // high bit signifys grabbing a queued buffer
// otherwise it contains a display buffer offset // otherwise it contains a display buffer offset
@ -301,7 +301,7 @@ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u6
break; break;
} }
} }
if (flip_idx == -1u) if (flip_idx == ~0u)
{ {
LOG_ERROR(RSX, "Display Flip: Couldn't find display buffer offset, flipping 0. Offset: 0x%x", a4); LOG_ERROR(RSX, "Display Flip: Couldn't find display buffer offset, flipping 0. Offset: 0x%x", a4);
flip_idx = 0; flip_idx = 0;

View File

@ -555,7 +555,7 @@ std::tuple<u32, u32, u32> upload_untouched(gsl::span<to_be_t<const T>> src, gsl:
if (rsx::method_registers.current_draw_clause.is_disjoint_primitive) if (rsx::method_registers.current_draw_clause.is_disjoint_primitive)
continue; continue;
dst[dst_idx++] = -1u; dst[dst_idx++] = ~0u;
} }
else else
{ {
@ -571,7 +571,7 @@ std::tuple<u32, u32, u32> upload_untouched(gsl::span<to_be_t<const T>> src, gsl:
template<typename T> template<typename T>
std::tuple<u32, u32, u32> expand_indexed_triangle_fan(gsl::span<to_be_t<const T>> src, gsl::span<u32> dst, bool is_primitive_restart_enabled, u32 primitive_restart_index, u32 base_index) std::tuple<u32, u32, u32> expand_indexed_triangle_fan(gsl::span<to_be_t<const T>> src, gsl::span<u32> dst, bool is_primitive_restart_enabled, u32 primitive_restart_index, u32 base_index)
{ {
const u32 invalid_index = -1u; const u32 invalid_index = ~0u;
u32 min_index = invalid_index; u32 min_index = invalid_index;
u32 max_index = 0; u32 max_index = 0;

View File

@ -557,7 +557,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*)(first << 2); offsets[dst_index++] = (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))
{ {
@ -572,7 +572,7 @@ void GLGSRender::end()
if (use_draw_arrays_fallback) if (use_draw_arrays_fallback)
{ {
//MultiDrawArrays is broken on some primitive types using AMD. One known type is GL_TRIANGLE_STRIP but there could be more //MultiDrawArrays is broken on some primitive types using AMD. One known type is GL_TRIANGLE_STRIP but there could be more
for (int n = 0; n < draw_count; ++n) for (u32 n = 0; n < draw_count; ++n)
{ {
glDrawArrays(draw_mode, firsts[n], counts[n]); glDrawArrays(draw_mode, firsts[n], counts[n]);
} }

View File

@ -194,7 +194,7 @@ namespace rsx
for (const auto &method : ignorable_ranges) for (const auto &method : ignorable_ranges)
{ {
for (int i = 0; i < method.second; ++i) for (u32 i = 0; i < method.second; ++i)
{ {
m_register_properties[method.first + i] |= register_props::always_ignore; m_register_properties[method.first + i] |= register_props::always_ignore;
} }
@ -279,7 +279,7 @@ namespace rsx
flatten_op flattening_helper::test(register_pair& command) flatten_op flattening_helper::test(register_pair& command)
{ {
u32 flush_cmd = -1u; u32 flush_cmd = ~0u;
switch (const u32 reg = (command.reg >> 2)) switch (const u32 reg = (command.reg >> 2))
{ {
case NV4097_SET_BEGIN_END: case NV4097_SET_BEGIN_END:
@ -352,7 +352,7 @@ namespace rsx
} }
} }
if (flush_cmd != -1u) if (flush_cmd != ~0u)
{ {
num_collapsed += draw_count? (draw_count - 1) : 0; num_collapsed += draw_count? (draw_count - 1) : 0;
draw_count = 0; draw_count = 0;

View File

@ -105,7 +105,7 @@ namespace rsx
invalidate_pipeline_bits = fragment_program_dirty | vertex_program_dirty, invalidate_pipeline_bits = fragment_program_dirty | vertex_program_dirty,
memory_barrier_bits = framebuffer_reads_dirty, memory_barrier_bits = framebuffer_reads_dirty,
all_dirty = -1u all_dirty = ~0u
}; };
enum FIFO_state : u8 enum FIFO_state : u8

View File

@ -2530,7 +2530,7 @@ public:
{ {
if (available_slots.empty()) if (available_slots.empty())
{ {
return -1u; return ~0u;
} }
u32 result = available_slots.front(); u32 result = available_slots.front();

View File

@ -53,7 +53,7 @@ namespace rsx
bool operator < (const barrier_t& other) const bool operator < (const barrier_t& other) const
{ {
if (address != -1u) if (address != ~0u)
{ {
return address < other.address; return address < other.address;
} }
@ -91,7 +91,7 @@ namespace rsx
} }
// Insert a new draw command within the others // Insert a new draw command within the others
void insert_draw_command(int index, const draw_range_t& range) void insert_draw_command(u32 index, const draw_range_t& range)
{ {
auto range_It = draw_command_ranges.begin(); auto range_It = draw_command_ranges.begin();
while (index--) while (index--)
@ -160,7 +160,7 @@ namespace rsx
append_draw_command({}); append_draw_command({});
const auto command_index = draw_command_ranges.size() - 1; const auto command_index = draw_command_ranges.size() - 1;
_do_barrier_insert({ command_index, get_system_time(), -1u, arg, 0, type }); _do_barrier_insert({ command_index, get_system_time(), ~0u, arg, 0, type });
last_execution_barrier_index = command_index; last_execution_barrier_index = command_index;
} }
} }
@ -206,7 +206,7 @@ namespace rsx
return; return;
} }
for (int index = last_execution_barrier_index; index < draw_command_ranges.size(); ++index) for (auto index = last_execution_barrier_index; index < draw_command_ranges.size(); ++index)
{ {
if (draw_command_ranges[index].first == first && if (draw_command_ranges[index].first == first &&
draw_command_ranges[index].count == count) draw_command_ranges[index].count == count)
@ -262,7 +262,7 @@ namespace rsx
return true; return true;
} }
verify(HERE), current_range_index != -1u; verify(HERE), current_range_index != ~0u;
for (const auto &barrier : draw_command_barriers) for (const auto &barrier : draw_command_barriers)
{ {
if (barrier.draw_id != current_range_index) if (barrier.draw_id != current_range_index)
@ -301,7 +301,7 @@ namespace rsx
void reset(rsx::primitive_type type) void reset(rsx::primitive_type type)
{ {
current_range_index = -1u; current_range_index = ~0u;
last_execution_barrier_index = 0; last_execution_barrier_index = 0;
command = draw_command::none; command = draw_command::none;

View File

@ -676,9 +676,9 @@ namespace rsx
u32 _size = 0; u32 _size = 0;
Ty* _data = nullptr; Ty* _data = nullptr;
inline u32 offset(const_iterator pos) inline u64 offset(const_iterator pos)
{ {
return (_data) ? (pos - _data) : 0; return (_data) ? u64(pos - _data) : 0ull;
} }
public: public:
@ -727,17 +727,16 @@ namespace rsx
if (_capacity > size) if (_capacity > size)
return; return;
auto old_data = _data; if (_data)
auto old_size = _size;
_data = (Ty*)malloc(sizeof(Ty) * size);
_capacity = size;
if (old_data)
{ {
memcpy(_data, old_data, sizeof(Ty) * old_size); _data = (Ty*)realloc(_data, sizeof(Ty) * size);
free(old_data);
} }
else
{
_data = (Ty*)malloc(sizeof(Ty) * size);
}
_capacity = size;
} }
void push_back(const Ty& val) void push_back(const Ty& val)
@ -779,7 +778,7 @@ namespace rsx
verify(HERE), _loc < _size; verify(HERE), _loc < _size;
const u32 remaining = (_size - _loc); const auto remaining = (_size - _loc);
memmove(pos + 1, pos, remaining * sizeof(Ty)); memmove(pos + 1, pos, remaining * sizeof(Ty));
*pos = val; *pos = val;