You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: projs/shadow/shadow-engine/renderer/base/inc/renderer/interfaces/VulkanInterface.h
+68-14Lines changed: 68 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,6 @@
4
4
#include<vulkan/vulkan.h>
5
5
#include"vk_mem_alloc.h"
6
6
#include"shadow/util/Synchronization.h"
7
-
#include<atomic>
8
7
#include<deque>
9
8
#include<mutex>
10
9
@@ -48,6 +47,8 @@ namespace rx {
48
47
VkPhysicalDeviceMeshShaderPropertiesEXT meshShaderProps = {}; // Properties of the physical device's support for mesh shaders.
49
48
VkPhysicalDeviceMemoryProperties2 memoryProps = {}; // Properties of the physical device's graphics memory
50
49
VkPhysicalDeviceDepthStencilResolveProperties depthStencilResolveProps = {}; // Properties of the physical device's support for depth stenciling.
50
+
VkPhysicalDeviceConservativeRasterizationPropertiesEXT conservativeRasterProps = {}; // Properties of the physical device's support for conservative
51
+
bool useConservativeRasterization = false; // Whether Conservative Rasterization is used in the currently active physical device.
51
52
VkPhysicalDeviceFeatures2 deviceFeatures2 = {}; // Optional Vulkan features that the physical device supports.
52
53
VkPhysicalDeviceVulkan11Features deviceFeatures11 = {}; // Optional Vulkan 1.1 features that the physical device supports.
53
54
VkPhysicalDeviceVulkan12Features deviceFeatures12 = {}; // Optional Vulkan 1.2 features that the physical device supports.
@@ -301,12 +302,13 @@ namespace rx {
301
302
DescriptorPool bindPools[frameBuffers]; // The DescriptorBindPools for this thread, for each frame
302
303
GPULinearAllocator frameAllocators[frameBuffers]; // The linear allocators for each frame
303
304
304
-
std::vector<std::pair<size_t, VkPipeline>> pipelines; // A vectorized map of pipeline hash to PSO
305
+
306
+
std::vector<std::pair<PipelineHash, VkPipeline>> pipelines; // A vectorized map of pipeline hash to PSO
305
307
const PipelineState* activePSO = nullptr; // The active PSO
306
308
const Shader* activeShader = nullptr; // The active (bound) shader - render or compute.
307
309
const RaytracingPipeline* activeRT = nullptr; // The active RayTracing acceleration structure (bounding volume hierarchy)
308
310
309
-
size_t prevPipelineHash = 0; // The hash of the pipeline that was previously bound to the current thread - for use with the vectorized map
311
+
PipelineHash prevPipelineHash = {};// The hash of the pipeline that was previously bound to the current thread - for use with the vectorized map
310
312
ShadingRate prevShadeRate = {}; // The Shading Rate that was previously bound to the current thread - for easy comparison
311
313
std::vector<SwapChain> prevSwapchains; // All Swap-Chains that were previously bound to the current thread.
312
314
bool PSODirty = false; // Whether the Pipeline State Object has changed in a way that requires some form of re-initialization
@@ -334,7 +336,7 @@ namespace rx {
334
336
bindPools[bufIdx].Reset();
335
337
binds.Reset();
336
338
frameAllocators[bufIdx].Reset();
337
-
prevPipelineHash = 0;
339
+
prevPipelineHash = {};
338
340
activePSO = nullptr;
339
341
activeShader = nullptr;
340
342
activeRT = nullptr;
@@ -361,8 +363,8 @@ namespace rx {
361
363
}
362
364
};
363
365
364
-
std::vector<std::unique_ptr<VulkanThreadCommands>> cmds; // A list of all active and inactive Thread Commands, for all threads managed by the engine.
365
-
uint32_t cmdCount = 0; // The number of active Thread Commands. Should always be == cmds.size(), unless a thread is currently initializing one.
366
+
std::vector<std::unique_ptr<VulkanThreadCommands>> cmds; // A list of all active and inactive Thread Commands, for all threads managed by the engine.
367
+
uint32_t cmdCount = 0; // The number of active Thread Commands. Should always be == cmds.size(), unless a thread is currently initializing one.
366
368
SH::SpinLock cmdLock; // A lock to prevent more than one thread submitting the commands at a time.
367
369
368
370
/**
@@ -384,11 +386,11 @@ namespace rx {
384
386
uint32_t firstBindless = 0;
385
387
};
386
388
387
-
mutable std::unordered_map<size_t, PSOLayout> PSOcache;// A cache of all created Pipeline State Objects indexed by hash, for easy switching.
389
+
mutable std::unordered_map<PipelineHash, PSOLayout> PSOcache; // A cache of all created Pipeline State Objects indexed by hash, for easy switching.
388
390
mutable std::mutex PSOcacheMutex; // A lock to prevent the PSO cache being modified during access.
389
391
390
392
VkPipelineCache pipelineCache = VK_NULL_HANDLE; // A Vulkan Pipeline Cache. Saves to disk for reuse, preventing long initialization times every startup.
391
-
std::unordered_map<size_t, VkPipeline> pipelines;// A cache of VkPipeline objects (not Pipeline State Objects, see PSOcache for that)
393
+
std::unordered_map<PipelineHash, VkPipeline> pipelines; // A cache of VkPipeline objects (not Pipeline State Objects, see PSOcache for that)
392
394
393
395
/**
394
396
* @brief Verify that all PSOs in the cache are valid.
Copy file name to clipboardExpand all lines: projs/shadow/shadow-engine/renderer/base/src/renderer/Renderer.cpp
+10-13Lines changed: 10 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -123,34 +123,31 @@ namespace rx::internal {
123
123
124
124
std::vector<uint8_t> debugTexts; // A buffer of texts used to send data to the console from the renderer.
125
125
126
-
SH::SpinLock mipperLock; // A lock used by the dynamic mipmap generator.
126
+
SH::SpinLock mipperLock; // A lock used by the dynamic mipmap generator.
127
127
std::vector<std::pair<Texture, bool>> mipperList; // A list of textures for the dynamic mipmap generator to process. pair<Texture, whether it has been processed yet>
128
128
std::vector<std::pair<Texture, Texture>> decompressorList; // A list of textures for the decompressor to work on. pair<compressed texture, decompressed texture>
129
129
130
-
GPUBuffer luminanceBuffer; // A buffer for dynamic luminance compensation. Required by some shaders to exist. NVIDIA 10xx GPUs will error without such.
131
-
132
-
SH::Jobs::ExecutionContext pipelineJobContext[ENUMSIZE(defs::RenderPass)]; // Job contexts for processing PSOs.
130
+
SH::Jobs::ExecutionContext pipelineJobContext[ENUMSIZE(defs::RenderPass)]; // Job contexts for processing PSOs.
133
131
134
132
PipelineState PSOOcclusion; // PSO for Occlusion Queries
135
-
PipelineState PSOBillboard[ENUMSIZE(defs::RenderPass)]; // PSO for billboard rendering, per render pass
133
+
PipelineState PSOBillboard[ENUMSIZE(defs::RenderPass)]; // PSO for billboard rendering, per render pass
136
134
PipelineState PSOBillboardWire; // PSO for billboard rendering of wires and lines.
137
135
PipelineState PSOGatherBillboard; // PSO for capturing billboard-rendered pixels into a buffer
138
-
PipelineState PSOLightVisual[ENUMSIZE(defs::LightType)]; // PSO for visualizing light-affected pixels into a buffer
139
-
PipelineState PSOLightVolumetric[ENUMSIZE(defs::LightType)]; // PSO for rendering volumetric lights
136
+
PipelineState PSOLightVisual[ENUMSIZE(defs::LightType)]; // PSO for visualizing light-affected pixels into a buffer
137
+
PipelineState PSOLightVolumetric[ENUMSIZE(defs::LightType)]; // PSO for rendering volumetric lights
140
138
PipelineState PSOLightmap; // PSO for rendering light maps
141
139
PipelineState PSOLensFlare; // PSO for rendering lens flares
142
140
PipelineState PSODownsampleDepth; // PSO for downsampling depth buffers
143
141
PipelineState PSOUpsample; // PSO for bilateral upsampling
144
142
PipelineState PSOUpsampleClouds; // PSO for upsampling volumetric clouds
145
143
PipelineState PSOOutline; // PSO for rendering outlines of objects
146
-
PipelineState PSOSky[ENUMSIZE(defs::SkyRenderType)]; // PSO for sky rendering, per type
147
-
PipelineState PSODebug[ENUMSIZE(defs::DebugRenderType)]; // PSO for debug rendering, per mode
144
+
PipelineState PSOSky[ENUMSIZE(defs::SkyRenderType)]; // PSO for sky rendering, per type
145
+
PipelineState PSODebug[ENUMSIZE(defs::DebugRenderType)]; // PSO for debug rendering, per mode
148
146
PipelineState PSOWire; // PSO for wire (thin strips of pixels) rendering
149
147
PipelineState PSOWireTess; // PSO for wire (thin strips of pixels) rendering, with tesselation
150
148
151
149
RaytracingPipeline PSORTReflect; // PSO for ray-traced reflections
152
150
153
-
154
151
/**
155
152
* An instance of a mesh, with associated distance to the camera.
156
153
* Can be sorted back-to-front or front-to-back depending on need.
@@ -247,13 +244,13 @@ namespace rx::internal {
247
244
* Use as an index into the array of pipeline state objects.
0 commit comments