mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
VideoCommon: Rename TextureConversionShader namespace.
This commit is contained in:
parent
e8febd0cef
commit
e2a9ee384f
@ -143,7 +143,7 @@ ID3D11PixelShader* PSTextureEncoder::GetEncodingPixelShader(const EFBCopyParams&
|
||||
return iter->second;
|
||||
|
||||
D3DBlob* bytecode = nullptr;
|
||||
const char* shader = TextureConversionShader::GenerateEncodingShader(params, APIType::D3D);
|
||||
const char* shader = TextureConversionShaderTiled::GenerateEncodingShader(params, APIType::D3D);
|
||||
if (!D3D::CompilePixelShader(shader, &bytecode))
|
||||
{
|
||||
PanicAlert("Failed to compile texture encoding shader.");
|
||||
|
@ -337,16 +337,16 @@ void main()
|
||||
|
||||
void TextureCache::CreateTextureDecodingResources()
|
||||
{
|
||||
static const GLenum gl_view_types[TextureConversionShader::BUFFER_FORMAT_COUNT] = {
|
||||
static const GLenum gl_view_types[TextureConversionShaderTiled::BUFFER_FORMAT_COUNT] = {
|
||||
GL_R8UI, // BUFFER_FORMAT_R8_UINT
|
||||
GL_R16UI, // BUFFER_FORMAT_R16_UINT
|
||||
GL_RG32UI, // BUFFER_FORMAT_R32G32_UINT
|
||||
GL_RGBA8UI, // BUFFER_FORMAT_RGBA8_UINT
|
||||
};
|
||||
|
||||
glGenTextures(TextureConversionShader::BUFFER_FORMAT_COUNT,
|
||||
glGenTextures(TextureConversionShaderTiled::BUFFER_FORMAT_COUNT,
|
||||
m_texture_decoding_buffer_views.data());
|
||||
for (size_t i = 0; i < TextureConversionShader::BUFFER_FORMAT_COUNT; i++)
|
||||
for (size_t i = 0; i < TextureConversionShaderTiled::BUFFER_FORMAT_COUNT; i++)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_BUFFER, m_texture_decoding_buffer_views[i]);
|
||||
glTexBuffer(GL_TEXTURE_BUFFER, gl_view_types[i], m_palette_stream_buffer->m_buffer);
|
||||
@ -355,7 +355,7 @@ void TextureCache::CreateTextureDecodingResources()
|
||||
|
||||
void TextureCache::DestroyTextureDecodingResources()
|
||||
{
|
||||
glDeleteTextures(TextureConversionShader::BUFFER_FORMAT_COUNT,
|
||||
glDeleteTextures(TextureConversionShaderTiled::BUFFER_FORMAT_COUNT,
|
||||
m_texture_decoding_buffer_views.data());
|
||||
m_texture_decoding_buffer_views.fill(0);
|
||||
m_texture_decoding_program_info.clear();
|
||||
@ -369,7 +369,7 @@ bool TextureCache::SupportsGPUTextureDecode(TextureFormat format, TLUTFormat pal
|
||||
return iter->second.valid;
|
||||
|
||||
TextureDecodingProgramInfo info;
|
||||
info.base_info = TextureConversionShader::GetDecodingShaderInfo(format);
|
||||
info.base_info = TextureConversionShaderTiled::GetDecodingShaderInfo(format);
|
||||
if (!info.base_info)
|
||||
{
|
||||
m_texture_decoding_program_info.emplace(key, info);
|
||||
@ -377,7 +377,7 @@ bool TextureCache::SupportsGPUTextureDecode(TextureFormat format, TLUTFormat pal
|
||||
}
|
||||
|
||||
std::string shader_source =
|
||||
TextureConversionShader::GenerateDecodingShader(format, palette_format, APIType::OpenGL);
|
||||
TextureConversionShaderTiled::GenerateDecodingShader(format, palette_format, APIType::OpenGL);
|
||||
if (shader_source.empty())
|
||||
{
|
||||
m_texture_decoding_program_info.emplace(key, info);
|
||||
@ -417,7 +417,7 @@ void TextureCache::DecodeTextureOnGPU(TCacheEntry* entry, u32 dst_level, const u
|
||||
// Copy to GPU-visible buffer, aligned to the data type.
|
||||
auto info = iter->second;
|
||||
u32 bytes_per_buffer_elem =
|
||||
TextureConversionShader::GetBytesPerBufferElement(info.base_info->buffer_format);
|
||||
TextureConversionShaderTiled::GetBytesPerBufferElement(info.base_info->buffer_format);
|
||||
|
||||
// Only copy palette if it is required.
|
||||
bool has_palette = info.base_info->palette_size > 0;
|
||||
@ -470,7 +470,7 @@ void TextureCache::DecodeTextureOnGPU(TCacheEntry* entry, u32 dst_level, const u
|
||||
}
|
||||
|
||||
auto dispatch_groups =
|
||||
TextureConversionShader::GetDispatchCount(info.base_info, aligned_width, aligned_height);
|
||||
TextureConversionShaderTiled::GetDispatchCount(info.base_info, aligned_width, aligned_height);
|
||||
glBindImageTexture(0, static_cast<OGLTexture*>(entry->texture.get())->GetRawTexIdentifier(),
|
||||
dst_level, GL_TRUE, 0, GL_WRITE_ONLY, GL_RGBA8);
|
||||
glDispatchCompute(dispatch_groups.first, dispatch_groups.second, 1);
|
||||
|
@ -50,7 +50,7 @@ private:
|
||||
|
||||
struct TextureDecodingProgramInfo
|
||||
{
|
||||
const TextureConversionShader::DecodingShaderInfo* base_info = nullptr;
|
||||
const TextureConversionShaderTiled::DecodingShaderInfo* base_info = nullptr;
|
||||
SHADER program;
|
||||
GLint uniform_dst_size = -1;
|
||||
GLint uniform_src_size = -1;
|
||||
@ -96,6 +96,7 @@ private:
|
||||
GLuint m_palette_resolv_texture = 0;
|
||||
|
||||
std::map<std::pair<u32, u32>, TextureDecodingProgramInfo> m_texture_decoding_program_info;
|
||||
std::array<GLuint, TextureConversionShader::BUFFER_FORMAT_COUNT> m_texture_decoding_buffer_views;
|
||||
std::array<GLuint, TextureConversionShaderTiled::BUFFER_FORMAT_COUNT>
|
||||
m_texture_decoding_buffer_views;
|
||||
};
|
||||
}
|
||||
|
@ -54,7 +54,8 @@ static EncodingProgram& GetOrCreateEncodingShader(const EFBCopyParams& params)
|
||||
if (iter != s_encoding_programs.end())
|
||||
return iter->second;
|
||||
|
||||
const char* shader = TextureConversionShader::GenerateEncodingShader(params, APIType::OpenGL);
|
||||
const char* shader =
|
||||
TextureConversionShaderTiled::GenerateEncodingShader(params, APIType::OpenGL);
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && shader)
|
||||
|
@ -389,7 +389,7 @@ bool TextureConverter::SupportsTextureDecoding(TextureFormat format, TLUTFormat
|
||||
return iter->second.valid;
|
||||
|
||||
TextureDecodingPipeline pipeline;
|
||||
pipeline.base_info = TextureConversionShader::GetDecodingShaderInfo(format);
|
||||
pipeline.base_info = TextureConversionShaderTiled::GetDecodingShaderInfo(format);
|
||||
pipeline.compute_shader = VK_NULL_HANDLE;
|
||||
pipeline.valid = false;
|
||||
|
||||
@ -400,7 +400,7 @@ bool TextureConverter::SupportsTextureDecoding(TextureFormat format, TLUTFormat
|
||||
}
|
||||
|
||||
std::string shader_source =
|
||||
TextureConversionShader::GenerateDecodingShader(format, palette_format, APIType::Vulkan);
|
||||
TextureConversionShaderTiled::GenerateDecodingShader(format, palette_format, APIType::Vulkan);
|
||||
|
||||
pipeline.compute_shader = Util::CompileAndCreateComputeShader(shader_source);
|
||||
if (pipeline.compute_shader == VK_NULL_HANDLE)
|
||||
@ -438,7 +438,7 @@ void TextureConverter::DecodeTexture(VkCommandBuffer command_buffer,
|
||||
// Copy to GPU-visible buffer, aligned to the data type
|
||||
auto info = iter->second;
|
||||
u32 bytes_per_buffer_elem =
|
||||
TextureConversionShader::GetBytesPerBufferElement(info.base_info->buffer_format);
|
||||
TextureConversionShaderTiled::GetBytesPerBufferElement(info.base_info->buffer_format);
|
||||
|
||||
// Calculate total data size, including palette.
|
||||
// Only copy palette if it is required.
|
||||
@ -496,16 +496,16 @@ void TextureConverter::DecodeTexture(VkCommandBuffer command_buffer,
|
||||
VkBufferView data_view = VK_NULL_HANDLE;
|
||||
switch (iter->second.base_info->buffer_format)
|
||||
{
|
||||
case TextureConversionShader::BUFFER_FORMAT_R8_UINT:
|
||||
case TextureConversionShaderTiled::BUFFER_FORMAT_R8_UINT:
|
||||
data_view = m_texel_buffer_view_r8_uint;
|
||||
break;
|
||||
case TextureConversionShader::BUFFER_FORMAT_R16_UINT:
|
||||
case TextureConversionShaderTiled::BUFFER_FORMAT_R16_UINT:
|
||||
data_view = m_texel_buffer_view_r16_uint;
|
||||
break;
|
||||
case TextureConversionShader::BUFFER_FORMAT_R32G32_UINT:
|
||||
case TextureConversionShaderTiled::BUFFER_FORMAT_R32G32_UINT:
|
||||
data_view = m_texel_buffer_view_r32g32_uint;
|
||||
break;
|
||||
case TextureConversionShader::BUFFER_FORMAT_RGBA8_UINT:
|
||||
case TextureConversionShaderTiled::BUFFER_FORMAT_RGBA8_UINT:
|
||||
data_view = m_texel_buffer_view_rgba8_uint;
|
||||
break;
|
||||
default:
|
||||
@ -522,8 +522,8 @@ void TextureConverter::DecodeTexture(VkCommandBuffer command_buffer,
|
||||
dispatcher.SetTexelBuffer(0, data_view);
|
||||
if (has_palette)
|
||||
dispatcher.SetTexelBuffer(1, m_texel_buffer_view_r16_uint);
|
||||
auto groups = TextureConversionShader::GetDispatchCount(iter->second.base_info, aligned_width,
|
||||
aligned_height);
|
||||
auto groups = TextureConversionShaderTiled::GetDispatchCount(iter->second.base_info,
|
||||
aligned_width, aligned_height);
|
||||
dispatcher.Dispatch(groups.first, groups.second, 1);
|
||||
|
||||
// Copy from temporary texture to final destination.
|
||||
@ -691,7 +691,8 @@ bool TextureConverter::CompilePaletteConversionShaders()
|
||||
|
||||
VkShaderModule TextureConverter::CompileEncodingShader(const EFBCopyParams& params)
|
||||
{
|
||||
const char* shader = TextureConversionShader::GenerateEncodingShader(params, APIType::Vulkan);
|
||||
const char* shader =
|
||||
TextureConversionShaderTiled::GenerateEncodingShader(params, APIType::Vulkan);
|
||||
VkShaderModule module = Util::CompileAndCreateFragmentShader(shader);
|
||||
if (module == VK_NULL_HANDLE)
|
||||
PanicAlert("Failed to compile texture encoding shader.");
|
||||
|
@ -114,7 +114,7 @@ private:
|
||||
// Texture decoding - GX format in memory->RGBA8
|
||||
struct TextureDecodingPipeline
|
||||
{
|
||||
const TextureConversionShader::DecodingShaderInfo* base_info;
|
||||
const TextureConversionShaderTiled::DecodingShaderInfo* base_info;
|
||||
VkShaderModule compute_shader;
|
||||
bool valid;
|
||||
};
|
||||
|
@ -22,7 +22,7 @@
|
||||
static char text[16384];
|
||||
static bool IntensityConstantAdded = false;
|
||||
|
||||
namespace TextureConversionShader
|
||||
namespace TextureConversionShaderTiled
|
||||
{
|
||||
u16 GetEncodedSampleCount(EFBCopyFormat format)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ enum class EFBCopyFormat;
|
||||
enum class TLUTFormat;
|
||||
struct EFBCopyParams;
|
||||
|
||||
namespace TextureConversionShader
|
||||
namespace TextureConversionShaderTiled
|
||||
{
|
||||
u16 GetEncodedSampleCount(EFBCopyFormat format);
|
||||
|
||||
@ -58,4 +58,4 @@ std::pair<u32, u32> GetDispatchCount(const DecodingShaderInfo* info, u32 width,
|
||||
std::string GenerateDecodingShader(TextureFormat format, TLUTFormat palette_format,
|
||||
APIType api_type);
|
||||
|
||||
} // namespace TextureConversionShader
|
||||
} // namespace TextureConversionShaderTiled
|
||||
|
Loading…
x
Reference in New Issue
Block a user