mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-07-10 01:54:46 -06:00
rsx: Minor refactor to prep for surface cache access to texture cache helpers
This commit is contained in:
parent
5c90bf5865
commit
93dfd3a8ca
@ -1703,6 +1703,48 @@ namespace rsx
|
||||
}
|
||||
}
|
||||
|
||||
rsx::surface_color_format get_compatible_surface_color_format(u32 gcm_format)
|
||||
{
|
||||
switch (gcm_format)
|
||||
{
|
||||
case CELL_GCM_TEXTURE_R5G6B5:
|
||||
return rsx::surface_color_format::r5g6b5;
|
||||
case CELL_GCM_TEXTURE_A8R8G8B8:
|
||||
return rsx::surface_color_format::a8b8g8r8;
|
||||
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
|
||||
return rsx::surface_color_format::w16z16y16x16;
|
||||
case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
|
||||
return rsx::surface_color_format::w32z32y32x32;
|
||||
case CELL_GCM_TEXTURE_A1R5G5B5:
|
||||
return rsx::surface_color_format::x1r5g5b5_o1r5g5b5;
|
||||
case CELL_GCM_TEXTURE_B8:
|
||||
return rsx::surface_color_format::b8;
|
||||
case CELL_GCM_TEXTURE_G8B8:
|
||||
return rsx::surface_color_format::g8b8;
|
||||
case CELL_GCM_TEXTURE_X32_FLOAT:
|
||||
return rsx::surface_color_format::x32;
|
||||
default:
|
||||
fmt::throw_exception("Unhandled surface format 0x%x", gcm_format);
|
||||
}
|
||||
}
|
||||
|
||||
rsx::surface_depth_format2 get_compatible_surface_depth_format(u32 gcm_format)
|
||||
{
|
||||
switch (gcm_format)
|
||||
{
|
||||
case RSX_FORMAT_CLASS_DEPTH16_UNORM:
|
||||
return rsx::surface_depth_format2::z16_uint;
|
||||
case RSX_FORMAT_CLASS_DEPTH24_UNORM_X8_PACK32:
|
||||
return rsx::surface_depth_format2::z24s8_uint;
|
||||
case RSX_FORMAT_CLASS_DEPTH16_FLOAT:
|
||||
return rsx::surface_depth_format2::z16_float;
|
||||
case RSX_FORMAT_CLASS_DEPTH24_FLOAT_X8_PACK32:
|
||||
return rsx::surface_depth_format2::z24s8_float;
|
||||
default:
|
||||
fmt::throw_exception("Invalid depth format 0x%x", gcm_format);
|
||||
}
|
||||
}
|
||||
|
||||
u32 get_max_depth_value(rsx::surface_depth_format2 format)
|
||||
{
|
||||
return get_format_block_size_in_bytes(format) == 2 ? 0xFFFF : 0xFFFFFF;
|
||||
|
||||
@ -284,6 +284,21 @@ namespace rsx
|
||||
usz alignment;
|
||||
};
|
||||
|
||||
struct image_section_attributes_t
|
||||
{
|
||||
u32 address;
|
||||
u32 gcm_format;
|
||||
u32 pitch;
|
||||
u16 width;
|
||||
u16 height;
|
||||
u16 depth;
|
||||
u16 mipmaps;
|
||||
u16 slice_h;
|
||||
u8 bpp;
|
||||
bool swizzled;
|
||||
bool edge_clamped;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get size to store texture in a linear fashion.
|
||||
* Storage is assumed to use a rowPitchAlignment boundary for every row of texture.
|
||||
@ -350,6 +365,9 @@ namespace rsx
|
||||
std::pair<u32, bool> get_compatible_gcm_format(rsx::surface_color_format format);
|
||||
std::pair<u32, bool> get_compatible_gcm_format(rsx::surface_depth_format2 format);
|
||||
|
||||
rsx::surface_color_format get_compatible_surface_color_format(u32 gcm_format);
|
||||
rsx::surface_depth_format2 get_compatible_surface_depth_format(u32 gcm_format);
|
||||
|
||||
format_class classify_format(rsx::surface_depth_format2 format);
|
||||
format_class classify_format(u32 gcm_format);
|
||||
|
||||
|
||||
@ -46,21 +46,6 @@ namespace rsx
|
||||
blit_image_static, // Variant of the copy command that does scaling instead of copying
|
||||
};
|
||||
|
||||
struct image_section_attributes_t
|
||||
{
|
||||
u32 address;
|
||||
u32 gcm_format;
|
||||
u32 pitch;
|
||||
u16 width;
|
||||
u16 height;
|
||||
u16 depth;
|
||||
u16 mipmaps;
|
||||
u16 slice_h;
|
||||
u8 bpp;
|
||||
bool swizzled;
|
||||
bool edge_clamped;
|
||||
};
|
||||
|
||||
struct blit_op_result
|
||||
{
|
||||
bool succeeded = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user