diff options
| author | Stenzek <stenzek@gmail.com> | 2016-08-13 22:57:50 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2016-10-01 02:40:01 +1000 |
| commit | 77a128ab8707659a531029a21a2e874108eedf38 (patch) | |
| tree | 7b4a52ee61208eec2bf44a7745f3dac3bed1bafb /Source/Core/VideoBackends/Vulkan/TextureEncoder.h | |
| parent | fdd954e7e757b4601eb6d2636e12623aef63c9b4 (diff) | |
Implement experimental Vulkan backend
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/TextureEncoder.h')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/TextureEncoder.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/TextureEncoder.h b/Source/Core/VideoBackends/Vulkan/TextureEncoder.h new file mode 100644 index 0000000000..30c9413a14 --- /dev/null +++ b/Source/Core/VideoBackends/Vulkan/TextureEncoder.h @@ -0,0 +1,57 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include <memory> + +#include "VideoBackends/Vulkan/StreamBuffer.h" + +#include "VideoCommon/VideoCommon.h" + +namespace Vulkan +{ +class StagingTexture2D; +class StateTracker; +class Texture2D; + +class TextureEncoder +{ +public: + TextureEncoder(); + ~TextureEncoder(); + + bool Initialize(); + + // Uses an encoding shader to copy src_texture to dest_ptr. + // Assumes that no render pass is currently in progress. + // WARNING: Executes the current command buffer. + void EncodeTextureToRam(StateTracker* state_tracker, VkImageView src_texture, u8* dest_ptr, + u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y, + u32 memory_stride, PEControl::PixelFormat src_format, bool is_intensity, + int scale_by_half, const EFBRectangle& source); + +private: + // From OGL. + static const u32 NUM_TEXTURE_ENCODING_SHADERS = 64; + static const u32 ENCODING_TEXTURE_WIDTH = EFB_WIDTH * 4; + static const u32 ENCODING_TEXTURE_HEIGHT = 1024; + static const VkFormat ENCODING_TEXTURE_FORMAT = VK_FORMAT_B8G8R8A8_UNORM; + + bool CompileShaders(); + bool CreateEncodingRenderPass(); + bool CreateEncodingTexture(); + bool CreateDownloadTexture(); + + std::array<VkShaderModule, NUM_TEXTURE_ENCODING_SHADERS> m_texture_encoding_shaders = {}; + + VkRenderPass m_encoding_render_pass = VK_NULL_HANDLE; + + std::unique_ptr<Texture2D> m_encoding_texture; + VkFramebuffer m_encoding_texture_framebuffer = VK_NULL_HANDLE; + + std::unique_ptr<StagingTexture2D> m_download_texture; +}; + +} // namespace Vulkan |
