Vulkan: Use correct source format to determine palette size

Fixes blur in fortune street fifologs.
This commit is contained in:
Stenzek 2016-10-06 21:51:11 +10:00
parent 3c822f2c55
commit 010514bd39
3 changed files with 5 additions and 5 deletions

View File

@ -67,7 +67,7 @@ void PaletteTextureConverter::ConvertTexture(StateTracker* state_tracker,
VkRenderPass render_pass, VkRenderPass render_pass,
VkFramebuffer dst_framebuffer, Texture2D* src_texture, VkFramebuffer dst_framebuffer, Texture2D* src_texture,
u32 width, u32 height, void* palette, u32 width, u32 height, void* palette,
TlutFormat format) TlutFormat format, u32 src_format)
{ {
struct PSUniformBlock struct PSUniformBlock
{ {
@ -78,7 +78,7 @@ void PaletteTextureConverter::ConvertTexture(StateTracker* state_tracker,
_assert_(static_cast<size_t>(format) < NUM_PALETTE_CONVERSION_SHADERS); _assert_(static_cast<size_t>(format) < NUM_PALETTE_CONVERSION_SHADERS);
size_t palette_size = ((format & 0xF) == GX_TF_I4) ? 32 : 512; size_t palette_size = (src_format & 0xF) == GX_TF_I4 ? 32 : 512;
VkDescriptorSet texel_buffer_descriptor_set; VkDescriptorSet texel_buffer_descriptor_set;
// Allocate memory for the palette, and descriptor sets for the buffer. // Allocate memory for the palette, and descriptor sets for the buffer.
@ -134,7 +134,7 @@ void PaletteTextureConverter::ConvertTexture(StateTracker* state_tracker,
// PS Uniforms/Samplers // PS Uniforms/Samplers
PSUniformBlock uniforms = {}; PSUniformBlock uniforms = {};
uniforms.multiplier = ((format & 0xF)) == GX_TF_I4 ? 15.0f : 255.0f; uniforms.multiplier = (src_format & 0xF) == GX_TF_I4 ? 15.0f : 255.0f;
uniforms.texel_buffer_offset = static_cast<int>(palette_offset / sizeof(u16)); uniforms.texel_buffer_offset = static_cast<int>(palette_offset / sizeof(u16));
draw.SetPushConstants(&uniforms, sizeof(uniforms)); draw.SetPushConstants(&uniforms, sizeof(uniforms));
draw.SetPSSampler(0, src_texture->GetView(), g_object_cache->GetPointSampler()); draw.SetPSSampler(0, src_texture->GetView(), g_object_cache->GetPointSampler());

View File

@ -29,7 +29,7 @@ public:
void ConvertTexture(StateTracker* state_tracker, VkCommandBuffer command_buffer, void ConvertTexture(StateTracker* state_tracker, VkCommandBuffer command_buffer,
VkRenderPass render_pass, VkFramebuffer dst_framebuffer, VkRenderPass render_pass, VkFramebuffer dst_framebuffer,
Texture2D* src_texture, u32 width, u32 height, void* palette, Texture2D* src_texture, u32 width, u32 height, void* palette,
TlutFormat format); TlutFormat format, u32 src_format);
private: private:
static const size_t NUM_PALETTE_CONVERSION_SHADERS = 3; static const size_t NUM_PALETTE_CONVERSION_SHADERS = 3;

View File

@ -111,7 +111,7 @@ void TextureCache::ConvertTexture(TCacheEntryBase* base_entry, TCacheEntryBase*
m_palette_texture_converter->ConvertTexture( m_palette_texture_converter->ConvertTexture(
m_state_tracker, command_buffer, GetRenderPassForTextureUpdate(entry->GetTexture()), m_state_tracker, command_buffer, GetRenderPassForTextureUpdate(entry->GetTexture()),
entry->GetFramebuffer(), unconverted->GetTexture(), entry->config.width, entry->config.height, entry->GetFramebuffer(), unconverted->GetTexture(), entry->config.width, entry->config.height,
palette, format); palette, format, unconverted->format);
// Render pass transitions to SHADER_READ_ONLY. // Render pass transitions to SHADER_READ_ONLY.
entry->GetTexture()->OverrideImageLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); entry->GetTexture()->OverrideImageLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);