mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-23 03:02:53 +01:00
rsx/common: Use typed enum for max anisotropy.
This commit is contained in:
parent
7f25720bd3
commit
d971c4e0f6
@ -172,18 +172,18 @@ DXGI_FORMAT get_texture_format(u8 format)
|
|||||||
throw EXCEPTION("Invalid or unsupported texture format (0x%x)", format);
|
throw EXCEPTION("Invalid or unsupported texture format (0x%x)", format);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT get_texture_max_aniso(u8 aniso)
|
UINT get_texture_max_aniso(rsx::texture_max_anisotropy aniso)
|
||||||
{
|
{
|
||||||
switch (aniso)
|
switch (aniso)
|
||||||
{
|
{
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_1: return 1;
|
case rsx::texture_max_anisotropy::x1: return 1;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_2: return 2;
|
case rsx::texture_max_anisotropy::x2: return 2;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_4: return 4;
|
case rsx::texture_max_anisotropy::x4: return 4;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_6: return 6;
|
case rsx::texture_max_anisotropy::x6: return 6;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_8: return 8;
|
case rsx::texture_max_anisotropy::x8: return 8;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_10: return 10;
|
case rsx::texture_max_anisotropy::x10: return 10;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_12: return 12;
|
case rsx::texture_max_anisotropy::x12: return 12;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_16: return 16;
|
case rsx::texture_max_anisotropy::x16: return 16;
|
||||||
}
|
}
|
||||||
throw EXCEPTION("Invalid texture max aniso (0x%x)", aniso);
|
throw EXCEPTION("Invalid texture max aniso (0x%x)", aniso);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ DXGI_FORMAT get_texture_format(u8 format);
|
|||||||
/**
|
/**
|
||||||
* Convert texture aniso value to UINT.
|
* Convert texture aniso value to UINT.
|
||||||
*/
|
*/
|
||||||
UINT get_texture_max_aniso(u8 aniso);
|
UINT get_texture_max_aniso(rsx::texture_max_anisotropy aniso);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert texture wrap mode to D3D12_TEXTURE_ADDRESS_MODE
|
* Convert texture wrap mode to D3D12_TEXTURE_ADDRESS_MODE
|
||||||
|
@ -886,6 +886,16 @@ enum
|
|||||||
CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP_TO_EDGE = 6,
|
CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP_TO_EDGE = 6,
|
||||||
CELL_GCM_TEXTURE_MIRROR_ONCE_BORDER = 7,
|
CELL_GCM_TEXTURE_MIRROR_ONCE_BORDER = 7,
|
||||||
CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP = 8,
|
CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP = 8,
|
||||||
|
|
||||||
|
// Max Anisotropy
|
||||||
|
CELL_GCM_TEXTURE_MAX_ANISO_1 = 0,
|
||||||
|
CELL_GCM_TEXTURE_MAX_ANISO_2 = 1,
|
||||||
|
CELL_GCM_TEXTURE_MAX_ANISO_4 = 2,
|
||||||
|
CELL_GCM_TEXTURE_MAX_ANISO_6 = 3,
|
||||||
|
CELL_GCM_TEXTURE_MAX_ANISO_8 = 4,
|
||||||
|
CELL_GCM_TEXTURE_MAX_ANISO_10 = 5,
|
||||||
|
CELL_GCM_TEXTURE_MAX_ANISO_12 = 6,
|
||||||
|
CELL_GCM_TEXTURE_MAX_ANISO_16 = 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
rsx::texture_wrap_mode rsx::to_texture_wrap_mode(u8 in)
|
rsx::texture_wrap_mode rsx::to_texture_wrap_mode(u8 in)
|
||||||
@ -904,6 +914,22 @@ rsx::texture_wrap_mode rsx::to_texture_wrap_mode(u8 in)
|
|||||||
throw EXCEPTION("Unknow wrap mode %x", in);
|
throw EXCEPTION("Unknow wrap mode %x", in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rsx::texture_max_anisotropy rsx::to_texture_max_anisotropy(u8 in)
|
||||||
|
{
|
||||||
|
switch (in)
|
||||||
|
{
|
||||||
|
case CELL_GCM_TEXTURE_MAX_ANISO_1: return rsx::texture_max_anisotropy::x1;
|
||||||
|
case CELL_GCM_TEXTURE_MAX_ANISO_2: return rsx::texture_max_anisotropy::x2;
|
||||||
|
case CELL_GCM_TEXTURE_MAX_ANISO_4: return rsx::texture_max_anisotropy::x4;
|
||||||
|
case CELL_GCM_TEXTURE_MAX_ANISO_6: return rsx::texture_max_anisotropy::x6;
|
||||||
|
case CELL_GCM_TEXTURE_MAX_ANISO_8: return rsx::texture_max_anisotropy::x8;
|
||||||
|
case CELL_GCM_TEXTURE_MAX_ANISO_10: return rsx::texture_max_anisotropy::x10;
|
||||||
|
case CELL_GCM_TEXTURE_MAX_ANISO_12: return rsx::texture_max_anisotropy::x12;
|
||||||
|
case CELL_GCM_TEXTURE_MAX_ANISO_16: return rsx::texture_max_anisotropy::x16;
|
||||||
|
}
|
||||||
|
throw EXCEPTION("Unknow anisotropy max mode %x", in);
|
||||||
|
}
|
||||||
|
|
||||||
rsx::surface_target rsx::to_surface_target(u8 in)
|
rsx::surface_target rsx::to_surface_target(u8 in)
|
||||||
{
|
{
|
||||||
switch (in)
|
switch (in)
|
||||||
@ -1335,16 +1361,16 @@ namespace
|
|||||||
|
|
||||||
std::string get_texture_max_aniso_name(u8 aniso)
|
std::string get_texture_max_aniso_name(u8 aniso)
|
||||||
{
|
{
|
||||||
switch (aniso)
|
switch (rsx::to_texture_max_anisotropy(aniso))
|
||||||
{
|
{
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_1: return "1";
|
case rsx::texture_max_anisotropy::x1 : return "1";
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_2: return "2";
|
case rsx::texture_max_anisotropy::x2: return "2";
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_4: return "4";
|
case rsx::texture_max_anisotropy::x4: return "4";
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_6: return "6";
|
case rsx::texture_max_anisotropy::x6: return "6";
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_8: return "8";
|
case rsx::texture_max_anisotropy::x8: return "8";
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_10: return "10";
|
case rsx::texture_max_anisotropy::x10: return "10";
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_12: return "12";
|
case rsx::texture_max_anisotropy::x12: return "12";
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_16: return "16";
|
case rsx::texture_max_anisotropy::x16: return "16";
|
||||||
}
|
}
|
||||||
return "Error";
|
return "Error";
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,20 @@ namespace rsx
|
|||||||
};
|
};
|
||||||
|
|
||||||
texture_wrap_mode to_texture_wrap_mode(u8 in);
|
texture_wrap_mode to_texture_wrap_mode(u8 in);
|
||||||
|
|
||||||
|
enum class texture_max_anisotropy : u8
|
||||||
|
{
|
||||||
|
x1,
|
||||||
|
x2,
|
||||||
|
x4,
|
||||||
|
x6,
|
||||||
|
x8,
|
||||||
|
x10,
|
||||||
|
x12,
|
||||||
|
x16,
|
||||||
|
};
|
||||||
|
|
||||||
|
texture_max_anisotropy to_texture_max_anisotropy(u8 in);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -252,16 +266,6 @@ enum
|
|||||||
// Normalization Flag
|
// Normalization Flag
|
||||||
CELL_GCM_TEXTURE_NR = 0x00,
|
CELL_GCM_TEXTURE_NR = 0x00,
|
||||||
CELL_GCM_TEXTURE_UN = 0x40,
|
CELL_GCM_TEXTURE_UN = 0x40,
|
||||||
|
|
||||||
// Max Anisotropy
|
|
||||||
CELL_GCM_TEXTURE_MAX_ANISO_1 = 0,
|
|
||||||
CELL_GCM_TEXTURE_MAX_ANISO_2 = 1,
|
|
||||||
CELL_GCM_TEXTURE_MAX_ANISO_4 = 2,
|
|
||||||
CELL_GCM_TEXTURE_MAX_ANISO_6 = 3,
|
|
||||||
CELL_GCM_TEXTURE_MAX_ANISO_8 = 4,
|
|
||||||
CELL_GCM_TEXTURE_MAX_ANISO_10 = 5,
|
|
||||||
CELL_GCM_TEXTURE_MAX_ANISO_12 = 6,
|
|
||||||
CELL_GCM_TEXTURE_MAX_ANISO_16 = 7,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// GCM Surface
|
// GCM Surface
|
||||||
|
@ -218,18 +218,18 @@ namespace rsx
|
|||||||
return GL_REPEAT;
|
return GL_REPEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
float texture::max_aniso(int aniso)
|
float texture::max_aniso(rsx::texture_max_anisotropy aniso)
|
||||||
{
|
{
|
||||||
switch (aniso)
|
switch (aniso)
|
||||||
{
|
{
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_1: return 1.0f;
|
case rsx::texture_max_anisotropy::x1: return 1.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_2: return 2.0f;
|
case rsx::texture_max_anisotropy::x2: return 2.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_4: return 4.0f;
|
case rsx::texture_max_anisotropy::x4: return 4.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_6: return 6.0f;
|
case rsx::texture_max_anisotropy::x6: return 6.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_8: return 8.0f;
|
case rsx::texture_max_anisotropy::x8: return 8.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_10: return 10.0f;
|
case rsx::texture_max_anisotropy::x10: return 10.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_12: return 12.0f;
|
case rsx::texture_max_anisotropy::x12: return 12.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_16: return 16.0f;
|
case rsx::texture_max_anisotropy::x16: return 16.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ERROR(RSX, "Texture anisotropy error: bad max aniso (%d).", aniso);
|
LOG_ERROR(RSX, "Texture anisotropy error: bad max aniso (%d).", aniso);
|
||||||
|
@ -17,7 +17,7 @@ namespace rsx
|
|||||||
|
|
||||||
int gl_wrap(rsx::texture_wrap_mode in);
|
int gl_wrap(rsx::texture_wrap_mode in);
|
||||||
|
|
||||||
float max_aniso(int aniso);
|
float max_aniso(rsx::texture_max_anisotropy aniso);
|
||||||
|
|
||||||
inline static u8 convert_4_to_8(u8 v)
|
inline static u8 convert_4_to_8(u8 v)
|
||||||
{
|
{
|
||||||
|
@ -136,9 +136,9 @@ namespace rsx
|
|||||||
return ((method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 7) & 0xfff);
|
return ((method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 7) & 0xfff);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 texture::max_aniso() const
|
rsx::texture_max_anisotropy texture::max_aniso() const
|
||||||
{
|
{
|
||||||
return ((method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 4) & 0x7);
|
return rsx::to_texture_max_anisotropy((method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 4) & 0x7);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool texture::alpha_kill_enabled() const
|
bool texture::alpha_kill_enabled() const
|
||||||
|
@ -42,7 +42,7 @@ namespace rsx
|
|||||||
bool enabled() const;
|
bool enabled() const;
|
||||||
u16 min_lod() const;
|
u16 min_lod() const;
|
||||||
u16 max_lod() const;
|
u16 max_lod() const;
|
||||||
u8 max_aniso() const;
|
rsx::texture_max_anisotropy max_aniso() const;
|
||||||
bool alpha_kill_enabled() const;
|
bool alpha_kill_enabled() const;
|
||||||
|
|
||||||
// Control1
|
// Control1
|
||||||
|
@ -81,18 +81,18 @@ VkSamplerAddressMode vk_wrap_mode(rsx::texture_wrap_mode gcm_wrap)
|
|||||||
throw EXCEPTION("unhandled texture clamp mode");
|
throw EXCEPTION("unhandled texture clamp mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
float max_aniso(u32 gcm_aniso)
|
float max_aniso(rsx::texture_max_anisotropy gcm_aniso)
|
||||||
{
|
{
|
||||||
switch (gcm_aniso)
|
switch (gcm_aniso)
|
||||||
{
|
{
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_1: return 1.0f;
|
case rsx::texture_max_anisotropy::x1: return 1.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_2: return 2.0f;
|
case rsx::texture_max_anisotropy::x2: return 2.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_4: return 4.0f;
|
case rsx::texture_max_anisotropy::x4: return 4.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_6: return 6.0f;
|
case rsx::texture_max_anisotropy::x6: return 6.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_8: return 8.0f;
|
case rsx::texture_max_anisotropy::x8: return 8.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_10: return 10.0f;
|
case rsx::texture_max_anisotropy::x10: return 10.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_12: return 12.0f;
|
case rsx::texture_max_anisotropy::x12: return 12.0f;
|
||||||
case CELL_GCM_TEXTURE_MAX_ANISO_16: return 16.0f;
|
case rsx::texture_max_anisotropy::x16: return 16.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw EXCEPTION("Texture anisotropy error: bad max aniso (%d).", gcm_aniso);
|
throw EXCEPTION("Texture anisotropy error: bad max aniso (%d).", gcm_aniso);
|
||||||
|
@ -16,7 +16,7 @@ namespace vk
|
|||||||
std::tuple<VkFilter, VkSamplerMipmapMode> get_min_filter_and_mip(u8 min_filter);
|
std::tuple<VkFilter, VkSamplerMipmapMode> get_min_filter_and_mip(u8 min_filter);
|
||||||
VkFilter get_mag_filter(u8 mag_filter);
|
VkFilter get_mag_filter(u8 mag_filter);
|
||||||
VkSamplerAddressMode vk_wrap_mode(rsx::texture_wrap_mode gcm_wrap);
|
VkSamplerAddressMode vk_wrap_mode(rsx::texture_wrap_mode gcm_wrap);
|
||||||
float max_aniso(u32 gcm_aniso);
|
float max_aniso(rsx::texture_max_anisotropy gcm_aniso);
|
||||||
VkComponentMapping get_component_mapping(u32 format, u8 swizzle_mask);
|
VkComponentMapping get_component_mapping(u32 format, u8 swizzle_mask);
|
||||||
VkPrimitiveTopology get_appropriate_topology(rsx::primitive_type& mode, bool &requires_modification);
|
VkPrimitiveTopology get_appropriate_topology(rsx::primitive_type& mode, bool &requires_modification);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user