mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +00:00
- create pipeline images
- fix some minor typos
This commit is contained in:
parent
108ea066f3
commit
40c14bcd67
4 changed files with 33 additions and 3 deletions
|
@ -237,7 +237,7 @@ void VkPostprocess::RenderEffect(const FString &name)
|
|||
VkPPRenderPassKey key;
|
||||
key.BlendMode = step.BlendMode;
|
||||
key.InputTextures = step.Textures.Size();
|
||||
key.Uniforms = step.Uniforms.Data.Size() != 0;
|
||||
key.Uniforms = step.Uniforms.Data.Size();
|
||||
key.Shader = mShaders[step.ShaderName].get();
|
||||
key.OutputFormat = (step.Output.Type == PPTextureType::PPTexture) ? mTextures[step.Output.Texture]->Format : VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ private:
|
|||
std::map<PPShaderName, std::unique_ptr<VkPPShader>> mShaders;
|
||||
std::array<std::unique_ptr<VulkanSampler>, 16> mSamplers;
|
||||
std::map<VkPPRenderPassKey, std::unique_ptr<VkPPRenderPassSetup>> mRenderPassSetup;
|
||||
int mCurrentPipelineImage = 0;
|
||||
};
|
||||
|
||||
class VkPPShader
|
||||
|
|
|
@ -41,6 +41,31 @@ void VkRenderBuffers::BeginFrame(int width, int height, int sceneWidth, int scen
|
|||
|
||||
void VkRenderBuffers::CreatePipeline(int width, int height)
|
||||
{
|
||||
auto fb = GetVulkanFrameBuffer();
|
||||
|
||||
for (int i = 0; i < NumPipelineImages; i++)
|
||||
{
|
||||
PipelineImage[i].reset();
|
||||
PipelineView[i].reset();
|
||||
}
|
||||
|
||||
PipelineBarrier barrier;
|
||||
for (int i = 0; i < NumPipelineImages; i++)
|
||||
{
|
||||
ImageBuilder builder;
|
||||
builder.setSize(width, height);
|
||||
builder.setFormat(VK_FORMAT_R16G16B16A16_SFLOAT);
|
||||
builder.setUsage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
|
||||
PipelineImage[i] = builder.create(fb->device);
|
||||
|
||||
ImageViewBuilder viewbuilder;
|
||||
viewbuilder.setImage(PipelineImage[i].get(), VK_FORMAT_R16G16B16A16_SFLOAT);
|
||||
PipelineView[i] = viewbuilder.create(fb->device);
|
||||
|
||||
barrier.addImage(PipelineImage[i].get(), VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, 0, VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
|
||||
PipelineLayout[i] = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
}
|
||||
barrier.execute(fb->GetDrawCommands(), VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT);
|
||||
}
|
||||
|
||||
void VkRenderBuffers::CreateScene(int width, int height, int samples)
|
||||
|
@ -54,7 +79,7 @@ void VkRenderBuffers::CreateScene(int width, int height, int samples)
|
|||
SceneDepthStencil.reset();
|
||||
|
||||
ImageBuilder builder;
|
||||
builder.setSize(SCREENWIDTH, SCREENHEIGHT);
|
||||
builder.setSize(width, height);
|
||||
builder.setFormat(VK_FORMAT_R16G16B16A16_SFLOAT);
|
||||
builder.setUsage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
|
||||
SceneColor = builder.create(fb->device);
|
||||
|
|
|
@ -21,9 +21,13 @@ public:
|
|||
std::unique_ptr<VulkanImageView> SceneColorView;
|
||||
std::unique_ptr<VulkanImageView> SceneDepthStencilView;
|
||||
std::unique_ptr<VulkanImageView> SceneDepthView;
|
||||
|
||||
VkFormat SceneDepthStencilFormat = VK_FORMAT_D24_UNORM_S8_UINT;
|
||||
|
||||
static const int NumPipelineImages = 2;
|
||||
std::unique_ptr<VulkanImage> PipelineImage[NumPipelineImages];
|
||||
std::unique_ptr<VulkanImageView> PipelineView[NumPipelineImages];
|
||||
VkImageLayout PipelineLayout[NumPipelineImages];
|
||||
|
||||
private:
|
||||
void CreatePipeline(int width, int height);
|
||||
void CreateScene(int width, int height, int samples);
|
||||
|
|
Loading…
Reference in a new issue