Add shaderchain support to win32.

This commit is contained in:
BearOso 2023-01-31 17:38:02 -06:00
parent 44a2958c31
commit 89bbf08c74
2 changed files with 19 additions and 0 deletions

View File

@ -22,6 +22,16 @@ bool CVulkan::Initialize(HWND hWnd)
swapchain = context->swapchain.get();
device = context->device;
if (GUI.shaderEnabled && GUI.OGLshaderFileName)
{
shaderchain = std::make_unique<Vulkan::ShaderChain>(context.get());
if (!shaderchain->load_shader_preset(std::string(_tToChar(GUI.OGLshaderFileName))))
{
return false;
}
return true;
}
create_pipeline();
descriptors.clear();
@ -72,6 +82,7 @@ void CVulkan::DeInitialize()
return;
context->wait_idle();
shaderchain.reset();
textures.clear();
descriptors.clear();
device.destroySampler(linear_sampler);
@ -117,6 +128,12 @@ void CVulkan::Render(SSurface Src)
//Get maximum rect respecting AR setting
displayRect = CalculateDisplayRect(Dst.Width, Dst.Height, windowSize.right, windowSize.bottom);
if (shaderchain)
{
shaderchain->do_frame(Dst.Surface, Dst.Width, Dst.Height, Dst.Pitch, vk::Format::eR5G6B5UnormPack16, displayRect.left, displayRect.top, displayRect.right - displayRect.left, displayRect.bottom - displayRect.top);
return;
}
if (!swapchain->begin_frame())
return;

View File

@ -3,6 +3,7 @@
#include "IS9xDisplayOutput.h"
#include "../vulkan/vulkan_context.hpp"
#include "../vulkan/vulkan_texture.hpp"
#include "../vulkan/vulkan_shader_chain.hpp"
class CVulkan : public IS9xDisplayOutput
{
@ -21,6 +22,7 @@ class CVulkan : public IS9xDisplayOutput
std::vector<Vulkan::Texture> textures;
std::vector<vk::UniqueDescriptorSet> descriptors;
std::vector<uint16_t> filtered_image;
std::unique_ptr<Vulkan::ShaderChain> shaderchain;
int current_width;
int current_height;