rpcsx/rpcs3/Emu/RSX/RSXTexture.h

149 lines
3.3 KiB
C
Raw Normal View History

2020-12-05 13:08:24 +01:00
#pragma once
#include "gcm_enums.h"
#include "color_utils.h"
namespace rsx
{
2016-09-19 09:25:49 +08:00
class fragment_texture
{
protected:
const u8 m_index;
2021-04-19 11:11:24 +03:00
std::array<u32, 0x10000 / 4>& registers;
public:
2021-04-19 11:11:24 +03:00
fragment_texture(u8 idx, std::array<u32, 0x10000 / 4>& r)
: m_index(idx)
, registers(r)
{
}
2016-09-19 09:25:49 +08:00
fragment_texture() = delete;
2016-06-26 23:37:02 +02:00
// Offset
u32 offset() const;
// Format
2020-12-24 17:01:15 +02:00
u8 location() const;
bool cubemap() const;
2020-12-24 17:01:15 +02:00
u8 border_type() const;
rsx::texture_dimension dimension() const;
// 2D texture can be either plane or cubemap texture depending on cubemap bit.
// Since cubemap is a format per se in all gfx API this function directly returns
// cubemap as a separate dimension.
rsx::texture_dimension_extended get_extended_texture_dimension() const;
2020-12-24 17:01:15 +02:00
u8 format() const;
bool is_compressed_format() const;
2020-12-24 17:01:15 +02:00
u16 mipmap() const;
// mipmap() returns value from register which can be higher than the actual number of mipmap level.
// This function clamp the result with the mipmap count allowed by texture size.
u16 get_exact_mipmap_count() const;
// Address
rsx::texture_wrap_mode wrap_s() const;
rsx::texture_wrap_mode wrap_t() const;
rsx::texture_wrap_mode wrap_r() const;
rsx::comparison_function zfunc() const;
u8 unsigned_remap() const;
u8 gamma() const;
u8 aniso_bias() const;
u8 signed_remap() const;
// Control0
bool enabled() const;
f32 min_lod() const;
f32 max_lod() const;
2020-12-24 17:01:15 +02:00
rsx::texture_max_anisotropy max_aniso() const;
bool alpha_kill_enabled() const;
// Control1
u32 remap() const;
rsx::texture_channel_remap_t decoded_remap() const;
// Filter
f32 bias() const;
2020-12-24 17:01:15 +02:00
rsx::texture_minify_filter min_filter() const;
rsx::texture_magnify_filter mag_filter() const;
u8 convolution_filter() const;
u8 argb_signed() const;
bool a_signed() const;
bool r_signed() const;
bool g_signed() const;
bool b_signed() const;
// Image Rect
u16 width() const;
u16 height() const;
// Border Color
u32 border_color() const;
color4f remapped_border_color() const;
u16 depth() const;
u32 pitch() const;
};
class vertex_texture
{
protected:
const u8 m_index;
2021-04-19 11:11:24 +03:00
std::array<u32, 0x10000 / 4>& registers;
public:
2021-04-19 11:11:24 +03:00
vertex_texture(u8 idx, std::array<u32, 0x10000 / 4> &r)
: m_index(idx)
, registers(r)
{
}
2016-06-26 23:37:02 +02:00
vertex_texture() = delete;
// Offset
u32 offset() const;
// Format
2016-06-28 12:58:44 +03:00
u8 location() const;
bool cubemap() const;
2016-06-28 12:58:44 +03:00
u8 border_type() const;
rsx::texture_dimension dimension() const;
u8 format() const;
u16 mipmap() const;
// Address
rsx::texture_wrap_mode wrap_s() const;
rsx::texture_wrap_mode wrap_t() const;
rsx::texture_wrap_mode wrap_r() const;
rsx::texture_channel_remap_t decoded_remap() const;
u32 remap() const;
// Control0
bool enabled() const;
f32 min_lod() const;
f32 max_lod() const;
// Filter
f32 bias() const;
2016-06-28 12:58:44 +03:00
rsx::texture_minify_filter min_filter() const;
rsx::texture_magnify_filter mag_filter() const;
// Image Rect
u16 width() const;
u16 height() const;
// Border Color
u32 border_color() const;
color4f remapped_border_color() const;
u16 depth() const;
u32 pitch() const;
2016-06-28 12:58:44 +03:00
rsx::texture_dimension_extended get_extended_texture_dimension() const;
u16 get_exact_mipmap_count() const;
};
template<typename T>
concept Texture = std::is_same_v<T, fragment_texture> || std::is_same_v<T, vertex_texture>;
}