mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Vulkan: Uber shader support
This commit is contained in:
@ -16,6 +16,8 @@
|
||||
#include "VideoCommon/NativeVertexFormat.h"
|
||||
#include "VideoCommon/PixelShaderGen.h"
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/UberShaderPixel.h"
|
||||
#include "VideoCommon/UberShaderVertex.h"
|
||||
#include "VideoCommon/VertexShaderGen.h"
|
||||
|
||||
namespace Vulkan
|
||||
@ -60,6 +62,7 @@ public:
|
||||
void SetBlendState(const BlendingState& state);
|
||||
|
||||
bool CheckForShaderChanges(u32 gx_primitive_type);
|
||||
void ClearShaders();
|
||||
|
||||
void UpdateVertexShaderConstants();
|
||||
void UpdateGeometryShaderConstants();
|
||||
@ -159,8 +162,8 @@ private:
|
||||
DIRTY_FLAG_DESCRIPTOR_SET_BINDING = (1 << 11),
|
||||
DIRTY_FLAG_PIPELINE_BINDING = (1 << 12),
|
||||
|
||||
DIRTY_FLAG_ALL_DESCRIPTOR_SETS =
|
||||
DIRTY_FLAG_VS_UBO | DIRTY_FLAG_GS_UBO | DIRTY_FLAG_PS_SAMPLERS | DIRTY_FLAG_PS_SSBO
|
||||
DIRTY_FLAG_ALL_DESCRIPTOR_SETS = DIRTY_FLAG_VS_UBO | DIRTY_FLAG_GS_UBO | DIRTY_FLAG_PS_UBO |
|
||||
DIRTY_FLAG_PS_SAMPLERS | DIRTY_FLAG_PS_SSBO
|
||||
};
|
||||
|
||||
bool Initialize();
|
||||
@ -178,9 +181,15 @@ private:
|
||||
|
||||
// Obtains a Vulkan pipeline object for the specified pipeline configuration.
|
||||
// Also adds this pipeline configuration to the UID cache if it is not present already.
|
||||
VkPipeline GetPipelineAndCacheUID(const PipelineInfo& info);
|
||||
VkPipeline GetPipelineAndCacheUID();
|
||||
|
||||
// Are bounding box ubershaders enabled? If so, we need to ensure the SSBO is set up,
|
||||
// since the bbox writes are determined by a uniform.
|
||||
bool IsSSBODescriptorRequired() const;
|
||||
|
||||
bool UpdatePipeline();
|
||||
void UpdatePipelineLayout();
|
||||
void UpdatePipelineVertexFormat();
|
||||
bool UpdateDescriptorSet();
|
||||
|
||||
// Allocates storage in the uniform buffer of the specified size. If this storage cannot be
|
||||
@ -203,10 +212,14 @@ private:
|
||||
VertexShaderUid m_vs_uid = {};
|
||||
GeometryShaderUid m_gs_uid = {};
|
||||
PixelShaderUid m_ps_uid = {};
|
||||
UberShader::VertexShaderUid m_uber_vs_uid = {};
|
||||
UberShader::PixelShaderUid m_uber_ps_uid = {};
|
||||
bool m_using_ubershaders = false;
|
||||
|
||||
// pipeline state
|
||||
PipelineInfo m_pipeline_state = {};
|
||||
VkPipeline m_pipeline_object = VK_NULL_HANDLE;
|
||||
const VertexFormat* m_vertex_format = nullptr;
|
||||
|
||||
// shader bindings
|
||||
std::array<VkDescriptorSet, NUM_DESCRIPTOR_SET_BIND_POINTS> m_descriptor_sets = {};
|
||||
|
Reference in New Issue
Block a user