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
{
u32 flip_idx = -1u;
u32 flip_idx = ~0u;
// high bit signifys grabbing a queued buffer
// 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;
}
}
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);
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)
continue;
dst[dst_idx++] = -1u;
dst[dst_idx++] = ~0u;
}
else
{
@ -571,7 +571,7 @@ std::tuple<u32, u32, u32> upload_untouched(gsl::span<to_be_t<const T>> src, gsl:
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)
{
const u32 invalid_index = -1u;
const u32 invalid_index = ~0u;
u32 min_index = invalid_index;
u32 max_index = 0;

View File

@ -557,7 +557,7 @@ void GLGSRender::end()
{
firsts[dst_index] = first;
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))
{
@ -572,7 +572,7 @@ void GLGSRender::end()
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
for (int n = 0; n < draw_count; ++n)
for (u32 n = 0; n < draw_count; ++n)
{
glDrawArrays(draw_mode, firsts[n], counts[n]);
}

View File

@ -194,7 +194,7 @@ namespace rsx
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;
}
@ -279,7 +279,7 @@ namespace rsx
flatten_op flattening_helper::test(register_pair& command)
{
u32 flush_cmd = -1u;
u32 flush_cmd = ~0u;
switch (const u32 reg = (command.reg >> 2))
{
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;
draw_count = 0;

View File

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

View File

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

View File

@ -53,7 +53,7 @@ namespace rsx
bool operator < (const barrier_t& other) const
{
if (address != -1u)
if (address != ~0u)
{
return address < other.address;
}
@ -91,7 +91,7 @@ namespace rsx
}
// 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();
while (index--)
@ -160,7 +160,7 @@ namespace rsx
append_draw_command({});
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;
}
}
@ -206,7 +206,7 @@ namespace rsx
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 &&
draw_command_ranges[index].count == count)
@ -262,7 +262,7 @@ namespace rsx
return true;
}
verify(HERE), current_range_index != -1u;
verify(HERE), current_range_index != ~0u;
for (const auto &barrier : draw_command_barriers)
{
if (barrier.draw_id != current_range_index)
@ -301,7 +301,7 @@ namespace rsx
void reset(rsx::primitive_type type)
{
current_range_index = -1u;
current_range_index = ~0u;
last_execution_barrier_index = 0;
command = draw_command::none;

View File

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