GPU: Fix sprite texture filtering with TC enabled
This commit is contained in:
parent
89f11095bc
commit
b8fa97e1a7
|
@ -58,8 +58,8 @@ static constexpr const std::array s_transparency_modes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr const std::array s_batch_texture_modes = {
|
static constexpr const std::array s_batch_texture_modes = {
|
||||||
"Palette4Bit", "Palette8Bit", "Direct16Bit", "PageTexture",
|
"Palette4Bit", "Palette8Bit", "Direct16Bit", "PageTexture", "Disabled",
|
||||||
"Disabled", "SpritePalette4Bit", "SpritePalette8Bit", "SpriteDirect16Bit",
|
"SpritePalette4Bit", "SpritePalette8Bit", "SpriteDirect16Bit", "SpritePageTexture",
|
||||||
};
|
};
|
||||||
static_assert(s_batch_texture_modes.size() == static_cast<size_t>(GPU_HW::BatchTextureMode::MaxCount));
|
static_assert(s_batch_texture_modes.size() == static_cast<size_t>(GPU_HW::BatchTextureMode::MaxCount));
|
||||||
|
|
||||||
|
@ -1123,8 +1123,10 @@ bool GPU_HW::CompilePipelines(Error* error)
|
||||||
const u32 max_active_texture_modes =
|
const u32 max_active_texture_modes =
|
||||||
(m_allow_sprite_mode ? NUM_TEXTURE_MODES :
|
(m_allow_sprite_mode ? NUM_TEXTURE_MODES :
|
||||||
(NUM_TEXTURE_MODES - (NUM_TEXTURE_MODES - static_cast<u32>(BatchTextureMode::SpriteStart))));
|
(NUM_TEXTURE_MODES - (NUM_TEXTURE_MODES - static_cast<u32>(BatchTextureMode::SpriteStart))));
|
||||||
const u32 num_active_texture_modes = (max_active_texture_modes - BoolToUInt32(!needs_page_texture));
|
const u32 num_active_texture_modes =
|
||||||
const u32 total_vertex_shaders = ((m_allow_sprite_mode ? 7 : 4) - BoolToUInt32(!needs_page_texture));
|
(max_active_texture_modes - (BoolToUInt32(!needs_page_texture) * (BoolToUInt32(m_allow_sprite_mode) + 1)));
|
||||||
|
const u32 total_vertex_shaders =
|
||||||
|
((m_allow_sprite_mode ? 7 : 4) - (BoolToUInt32(!needs_page_texture) * (BoolToUInt32(m_allow_sprite_mode) + 1)));
|
||||||
const u32 total_fragment_shaders = ((1 + BoolToUInt32(needs_rov_depth)) * 5 * 5 * num_active_texture_modes * 2 *
|
const u32 total_fragment_shaders = ((1 + BoolToUInt32(needs_rov_depth)) * 5 * 5 * num_active_texture_modes * 2 *
|
||||||
(1 + BoolToUInt32(!true_color)) * (1 + BoolToUInt32(!force_progressive_scan)));
|
(1 + BoolToUInt32(!true_color)) * (1 + BoolToUInt32(!force_progressive_scan)));
|
||||||
const u32 total_items =
|
const u32 total_items =
|
||||||
|
@ -1232,8 +1234,11 @@ bool GPU_HW::CompilePipelines(Error* error)
|
||||||
|
|
||||||
for (u8 texture_mode = 0; texture_mode < max_active_texture_modes; texture_mode++)
|
for (u8 texture_mode = 0; texture_mode < max_active_texture_modes; texture_mode++)
|
||||||
{
|
{
|
||||||
if (texture_mode == static_cast<u8>(BatchTextureMode::PageTexture) && !needs_page_texture)
|
if (!needs_page_texture && (texture_mode == static_cast<u8>(BatchTextureMode::PageTexture) ||
|
||||||
|
texture_mode == static_cast<u8>(BatchTextureMode::SpritePageTexture)))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (u8 check_mask = 0; check_mask < 2; check_mask++)
|
for (u8 check_mask = 0; check_mask < 2; check_mask++)
|
||||||
{
|
{
|
||||||
|
@ -1353,8 +1358,11 @@ bool GPU_HW::CompilePipelines(Error* error)
|
||||||
|
|
||||||
for (u8 texture_mode = 0; texture_mode < max_active_texture_modes; texture_mode++)
|
for (u8 texture_mode = 0; texture_mode < max_active_texture_modes; texture_mode++)
|
||||||
{
|
{
|
||||||
if (texture_mode == static_cast<u8>(BatchTextureMode::PageTexture) && !needs_page_texture)
|
if (!needs_page_texture && (texture_mode == static_cast<u8>(BatchTextureMode::PageTexture) ||
|
||||||
|
texture_mode == static_cast<u8>(BatchTextureMode::SpritePageTexture)))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (u8 dithering = 0; dithering < 2; dithering++)
|
for (u8 dithering = 0; dithering < 2; dithering++)
|
||||||
{
|
{
|
||||||
|
@ -1377,7 +1385,8 @@ bool GPU_HW::CompilePipelines(Error* error)
|
||||||
static_cast<BatchTextureMode>(texture_mode) == BatchTextureMode::SpritePalette4Bit ||
|
static_cast<BatchTextureMode>(texture_mode) == BatchTextureMode::SpritePalette4Bit ||
|
||||||
static_cast<BatchTextureMode>(texture_mode) == BatchTextureMode::SpritePalette8Bit);
|
static_cast<BatchTextureMode>(texture_mode) == BatchTextureMode::SpritePalette8Bit);
|
||||||
const bool page_texture =
|
const bool page_texture =
|
||||||
(static_cast<BatchTextureMode>(texture_mode) == BatchTextureMode::PageTexture);
|
(static_cast<BatchTextureMode>(texture_mode) == BatchTextureMode::PageTexture ||
|
||||||
|
static_cast<BatchTextureMode>(texture_mode) == BatchTextureMode::SpritePageTexture);
|
||||||
const bool sprite = (static_cast<BatchTextureMode>(texture_mode) >= BatchTextureMode::SpriteStart);
|
const bool sprite = (static_cast<BatchTextureMode>(texture_mode) >= BatchTextureMode::SpriteStart);
|
||||||
const bool uv_limits = ShouldClampUVs(sprite ? m_sprite_texture_filtering : m_texture_filtering);
|
const bool uv_limits = ShouldClampUVs(sprite ? m_sprite_texture_filtering : m_texture_filtering);
|
||||||
const bool use_shader_blending = (render_mode == static_cast<u8>(BatchRenderMode::ShaderBlend));
|
const bool use_shader_blending = (render_mode == static_cast<u8>(BatchRenderMode::ShaderBlend));
|
||||||
|
@ -2044,9 +2053,8 @@ ALWAYS_INLINE_RELEASE void GPU_HW::DrawBatchVertices(BatchRenderMode render_mode
|
||||||
u32 base_vertex, const GPUTextureCache::Source* texture)
|
u32 base_vertex, const GPUTextureCache::Source* texture)
|
||||||
{
|
{
|
||||||
// [depth_test][transparency_mode][render_mode][texture_mode][dithering][interlacing][check_mask]
|
// [depth_test][transparency_mode][render_mode][texture_mode][dithering][interlacing][check_mask]
|
||||||
const u8 texture_mode = texture ? static_cast<u8>(BatchTextureMode::PageTexture) :
|
const u8 texture_mode = (static_cast<u8>(m_batch.texture_mode) +
|
||||||
(static_cast<u8>(m_batch.texture_mode) +
|
((m_batch.texture_mode < BatchTextureMode::Disabled && m_batch.sprite_mode) ?
|
||||||
((m_batch.texture_mode < BatchTextureMode::PageTexture && m_batch.sprite_mode) ?
|
|
||||||
static_cast<u8>(BatchTextureMode::SpriteStart) :
|
static_cast<u8>(BatchTextureMode::SpriteStart) :
|
||||||
0));
|
0));
|
||||||
const u8 depth_test = BoolToUInt8(m_batch.use_depth_buffer);
|
const u8 depth_test = BoolToUInt8(m_batch.use_depth_buffer);
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
SpritePalette4Bit,
|
SpritePalette4Bit,
|
||||||
SpritePalette8Bit,
|
SpritePalette8Bit,
|
||||||
SpriteDirect16Bit,
|
SpriteDirect16Bit,
|
||||||
|
SpritePageTexture,
|
||||||
|
|
||||||
MaxCount,
|
MaxCount,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue