mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 10:42:36 +01:00
rsx/common: Remove MIN2/MAX2 macro.
This commit is contained in:
parent
960f4ceefc
commit
cbe119b457
@ -2,9 +2,6 @@
|
||||
#include "BufferUtils.h"
|
||||
#include "../rsx_methods.h"
|
||||
|
||||
#define MIN2(x, y) ((x) < (y)) ? (x) : (y)
|
||||
#define MAX2(x, y) ((x) > (y)) ? (x) : (y)
|
||||
|
||||
namespace
|
||||
{
|
||||
// FIXME: GSL as_span break build if template parameter is non const with current revision.
|
||||
@ -114,8 +111,8 @@ std::tuple<T, T> upload_untouched(gsl::span<to_be_t<const T>> src, gsl::span<T>
|
||||
}
|
||||
else
|
||||
{
|
||||
max_index = MAX2(max_index, index);
|
||||
min_index = MIN2(min_index, index);
|
||||
max_index = std::max(max_index, index);
|
||||
min_index = std::min(min_index, index);
|
||||
}
|
||||
dst[dst_idx++] = index;
|
||||
}
|
||||
@ -134,8 +131,8 @@ std::tuple<T, T> expand_indexed_triangle_fan(gsl::span<to_be_t<const T>> src, gs
|
||||
const T index0 = src[0];
|
||||
if (!is_primitive_restart_enabled || index0 != -1) // Cut
|
||||
{
|
||||
min_index = MIN2(min_index, index0);
|
||||
max_index = MAX2(max_index, index0);
|
||||
min_index = std::min(min_index, index0);
|
||||
max_index = std::max(max_index, index0);
|
||||
}
|
||||
|
||||
size_t dst_idx = 0;
|
||||
@ -149,8 +146,8 @@ std::tuple<T, T> expand_indexed_triangle_fan(gsl::span<to_be_t<const T>> src, gs
|
||||
}
|
||||
else
|
||||
{
|
||||
min_index = MIN2(min_index, index1);
|
||||
max_index = MAX2(max_index, index1);
|
||||
min_index = std::min(min_index, index1);
|
||||
max_index = std::max(max_index, index1);
|
||||
}
|
||||
T index2 = tri_indexes[1];
|
||||
if (is_primitive_restart_enabled && index2 == primitive_restart_index)
|
||||
@ -159,8 +156,8 @@ std::tuple<T, T> expand_indexed_triangle_fan(gsl::span<to_be_t<const T>> src, gs
|
||||
}
|
||||
else
|
||||
{
|
||||
min_index = MIN2(min_index, index2);
|
||||
max_index = MAX2(max_index, index2);
|
||||
min_index = std::min(min_index, index2);
|
||||
max_index = std::max(max_index, index2);
|
||||
}
|
||||
|
||||
dst[dst_idx++] = index0;
|
||||
@ -192,8 +189,8 @@ std::tuple<T, T> expand_indexed_quads(gsl::span<to_be_t<const T>> src, gsl::span
|
||||
}
|
||||
else
|
||||
{
|
||||
min_index = MIN2(min_index, index0);
|
||||
max_index = MAX2(max_index, index0);
|
||||
min_index = std::min(min_index, index0);
|
||||
max_index = std::max(max_index, index0);
|
||||
}
|
||||
T index1 = quad_indexes[1];
|
||||
if (is_primitive_restart_enabled && index1 == primitive_restart_index)
|
||||
@ -202,8 +199,8 @@ std::tuple<T, T> expand_indexed_quads(gsl::span<to_be_t<const T>> src, gsl::span
|
||||
}
|
||||
else
|
||||
{
|
||||
min_index = MIN2(min_index, index1);
|
||||
max_index = MAX2(max_index, index1);
|
||||
min_index = std::min(min_index, index1);
|
||||
max_index = std::max(max_index, index1);
|
||||
}
|
||||
T index2 = quad_indexes[2];
|
||||
if (is_primitive_restart_enabled && index2 == primitive_restart_index)
|
||||
@ -212,8 +209,8 @@ std::tuple<T, T> expand_indexed_quads(gsl::span<to_be_t<const T>> src, gsl::span
|
||||
}
|
||||
else
|
||||
{
|
||||
min_index = MIN2(min_index, index2);
|
||||
max_index = MAX2(max_index, index2);
|
||||
min_index = std::min(min_index, index2);
|
||||
max_index = std::max(max_index, index2);
|
||||
}
|
||||
T index3 = quad_indexes[3];
|
||||
if (is_primitive_restart_enabled &&index3 == primitive_restart_index)
|
||||
@ -222,8 +219,8 @@ std::tuple<T, T> expand_indexed_quads(gsl::span<to_be_t<const T>> src, gsl::span
|
||||
}
|
||||
else
|
||||
{
|
||||
min_index = MIN2(min_index, index3);
|
||||
max_index = MAX2(max_index, index3);
|
||||
min_index = std::min(min_index, index3);
|
||||
max_index = std::max(max_index, index3);
|
||||
}
|
||||
|
||||
// First triangle
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "../rsx_utils.h"
|
||||
|
||||
|
||||
#define MAX2(a, b) ((a) > (b)) ? (a) : (b)
|
||||
namespace
|
||||
{
|
||||
// FIXME: GSL as_span break build if template parameter is non const with current revision.
|
||||
@ -101,8 +100,8 @@ namespace
|
||||
|
||||
result.push_back(current_subresource_layout);
|
||||
offset_in_src += miplevel_height_in_block * src_pitch_in_block * block_size_in_bytes * depth;
|
||||
miplevel_height_in_block = MAX2(miplevel_height_in_block / 2, 1);
|
||||
miplevel_width_in_block = MAX2(miplevel_width_in_block / 2, 1);
|
||||
miplevel_height_in_block = std::max(miplevel_height_in_block / 2, 1);
|
||||
miplevel_width_in_block = std::max(miplevel_width_in_block / 2, 1);
|
||||
}
|
||||
offset_in_src = align(offset_in_src, 128);
|
||||
}
|
||||
@ -343,7 +342,7 @@ u8 get_format_block_size_in_texel(int format)
|
||||
|
||||
size_t get_placed_texture_storage_size(const rsx::texture &texture, size_t rowPitchAlignement, size_t mipmapAlignment)
|
||||
{
|
||||
size_t w = texture.width(), h = texture.height(), d = MAX2(texture.depth(), 1);
|
||||
size_t w = texture.width(), h = texture.height(), d = std::max<u16>(texture.depth(), 1);
|
||||
|
||||
int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
|
||||
size_t blockEdge = get_format_block_size_in_texel(format);
|
||||
@ -352,14 +351,13 @@ size_t get_placed_texture_storage_size(const rsx::texture &texture, size_t rowPi
|
||||
size_t heightInBlocks = (h + blockEdge - 1) / blockEdge;
|
||||
size_t widthInBlocks = (w + blockEdge - 1) / blockEdge;
|
||||
|
||||
|
||||
size_t result = 0;
|
||||
for (unsigned mipmap = 0; mipmap < texture.mipmap(); ++mipmap)
|
||||
{
|
||||
size_t rowPitch = align(blockSizeInByte * widthInBlocks, rowPitchAlignement);
|
||||
result += align(rowPitch * heightInBlocks * d, mipmapAlignment);
|
||||
heightInBlocks = MAX2(heightInBlocks / 2, 1);
|
||||
widthInBlocks = MAX2(widthInBlocks / 2, 1);
|
||||
heightInBlocks = std::max<size_t>(heightInBlocks / 2, 1);
|
||||
widthInBlocks = std::max<size_t>(widthInBlocks / 2, 1);
|
||||
}
|
||||
|
||||
return result * (texture.cubemap() ? 6 : 1);
|
||||
|
Loading…
Reference in New Issue
Block a user