diff --git a/code/render/coregraphics/vk/vkshader.cc b/code/render/coregraphics/vk/vkshader.cc index 121ba3131..a9cef31f5 100644 --- a/code/render/coregraphics/vk/vkshader.cc +++ b/code/render/coregraphics/vk/vkshader.cc @@ -123,6 +123,10 @@ ShaderSetup( cbo.num = binding.descriptorCount; cbo.visibility = AllVisibility; uint32_t slotsUsed = 0; + if (block->HasAnnotation("Visibility")) + { + cbo.visibility = ShaderVisibilityFromString(block->GetAnnotationString("Visibility").c_str()); + } if (binding.binding != 0xFFFFFFFF) { @@ -131,16 +135,7 @@ ShaderSetup( if (occupiesNewBinding) { - if (block->HasAnnotation("Visibility")) - { - cbo.visibility = ShaderVisibilityFromString(block->GetAnnotationString("Visibility").c_str()); - UpdateOccupancy(numPerStageUniformBuffers, slotsUsed, cbo.visibility); - } - else - { - for (IndexT i = 0; i < NumShaders; i++) - numPerStageUniformBuffers[i]++; - } + UpdateOccupancy(numPerStageUniformBuffers, slotsUsed, cbo.visibility); } } @@ -213,21 +208,17 @@ ShaderSetup( ResourceTableLayoutCreateInfo& rinfo = layoutCreateInfos.Emplace(buffer->set); numsets = Math::max(numsets, buffer->set + 1); + if (buffer->HasAnnotation("Visibility")) + { + rwbo.visibility = ShaderVisibilityFromString(buffer->GetAnnotationString("Visibility").c_str()); + } + bool occupiesNewBinding = !bindingTable[binding.binding]; bindingTable[binding.binding] = true; if (occupiesNewBinding) { - if (buffer->HasAnnotation("Visibility")) - { - rwbo.visibility = ShaderVisibilityFromString(buffer->GetAnnotationString("Visibility").c_str()); - UpdateOccupancy(numPerStageStorageBuffers, slotsUsed, rwbo.visibility); - } - else - { - for (IndexT i = 0; i < NumShaders; i++) - numPerStageStorageBuffers[i]++; - } + UpdateOccupancy(numPerStageStorageBuffers, slotsUsed, rwbo.visibility); } if (buffer->set == NEBULA_DYNAMIC_OFFSET_GROUP || buffer->set == NEBULA_INSTANCE_GROUP) diff --git a/code/render/coregraphics/vk/vktypes.cc b/code/render/coregraphics/vk/vktypes.cc index a17a90bbf..393d82177 100644 --- a/code/render/coregraphics/vk/vktypes.cc +++ b/code/render/coregraphics/vk/vktypes.cc @@ -312,7 +312,7 @@ VkTypes::AsVkSampleFlags(const SizeT samples) //------------------------------------------------------------------------------ /** */ -VkImageType +VkImageType VkTypes::AsVkImageType(CoreGraphics::TextureType type) { switch (type) @@ -340,7 +340,7 @@ VkTypes::AsVkImageType(CoreGraphics::TextureType type) //------------------------------------------------------------------------------ /** */ -VkImageViewType +VkImageViewType VkTypes::AsVkImageViewType(CoreGraphics::TextureType type) { switch (type) @@ -371,7 +371,7 @@ VkTypes::AsVkImageViewType(CoreGraphics::TextureType type) CoreGraphics::PixelFormat::Code VkTypes::AsNebulaPixelFormat(VkFormat f) { - + switch (f) { case VK_FORMAT_R8G8B8A8_UINT: return PixelFormat::R8G8B8A8; @@ -469,6 +469,8 @@ VkShaderStageFlags VkTypes::AsVkShaderVisibility(const CoreGraphics::ShaderVisibility vis) { VkShaderStageFlags ret = 0; + if (vis == AllVisibility) return VK_SHADER_STAGE_ALL; + else if (vis == AllGraphicsVisibility) return VK_SHADER_STAGE_ALL_GRAPHICS; if (AllBits(vis, VertexShaderVisibility)) ret |= VK_SHADER_STAGE_VERTEX_BIT; if (AllBits(vis, HullShaderVisibility)) ret |= VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; if (AllBits(vis, DomainShaderVisibility)) ret |= VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT; diff --git a/code/render/frame/default.json b/code/render/frame/default.json index 1ce9ea7d1..5d5f4bfaa 100644 --- a/code/render/frame/default.json +++ b/code/render/frame/default.json @@ -418,18 +418,6 @@ { "name": "SunShadowDepth", "stage": "PixelShaderRead" - }, - { - "name": "ClusterLightIndexLists", - "stage": "PixelShaderRead" - }, - { - "name": "ClusterFogIndexLists", - "stage": "PixelShaderRead" - }, - { - "name": "ClusterDecalIndexLists", - "stage": "PixelShaderRead" } ], @@ -481,18 +469,6 @@ { "name": "SunShadowDepth", "stage": "PixelShaderRead" - }, - { - "name": "ClusterLightIndexLists", - "stage": "PixelShaderRead" - }, - { - "name": "ClusterFogIndexLists", - "stage": "PixelShaderRead" - }, - { - "name": "ClusterDecalIndexLists", - "stage": "PixelShaderRead" } ], diff --git a/code/render/models/modelcontext.cc b/code/render/models/modelcontext.cc index 7bf1e4b13..e951c5622 100644 --- a/code/render/models/modelcontext.cc +++ b/code/render/models/modelcontext.cc @@ -82,12 +82,11 @@ ModelContext::Create() void ModelContext::Setup(const Graphics::GraphicsEntityId gfxId, const Resources::ResourceName& name, const Util::StringAtom& tag, std::function finishedCallback) { - const ContextEntityId cid = GetContextId(gfxId); - - auto successCallback = [cid, finishedCallback](Resources::ResourceId mid) + auto successCallback = [gfxId, finishedCallback](Resources::ResourceId mid) { // Go through model nodes and setup instance data const Util::Array& nodes = Models::ModelGetNodes(mid); + const ContextEntityId cid = GetContextId(gfxId); // Run through nodes and collect transform and renderable nodes NodeInstanceRange& transformRange = modelContextAllocator.Get(cid.id); @@ -124,7 +123,7 @@ ModelContext::Setup(const Graphics::GraphicsEntityId gfxId, const Resources::Res NodeInstances.transformable.origTransforms.Extend(transformRange.end); NodeInstances.transformable.nodeTransforms.Extend(transformRange.end); } - + for (SizeT i = 0; i < transformNodes.Size(); i++) { const uint index = transformRange.allocation.offset + i; @@ -348,7 +347,7 @@ ModelContext::ChangeModel(const Graphics::GraphicsEntityId gfxId, const Resource { modelContextAllocator.Get(cid.id) = mid; const Math::mat4& pending = modelContextAllocator.Get(cid.id); - + if (finishedCallback != nullptr) setupCompleteQueue.Enqueue(finishedCallback); }; @@ -360,7 +359,7 @@ ModelContext::ChangeModel(const Graphics::GraphicsEntityId gfxId, const Resource //------------------------------------------------------------------------------ /** */ -const Models::ModelId +const Models::ModelId ModelContext::GetModel(const Graphics::GraphicsEntityId id) { const ContextEntityId cid = GetContextId(id); @@ -370,7 +369,7 @@ ModelContext::GetModel(const Graphics::GraphicsEntityId id) //------------------------------------------------------------------------------ /** */ -const Models::ModelId +const Models::ModelId ModelContext::GetModel(const Graphics::ContextEntityId id) { return modelContextAllocator.Get(id.id); @@ -518,7 +517,7 @@ ModelContext::SetAlwaysVisible(const Graphics::GraphicsEntityId id) for (IndexT i = nodes.begin; i < nodes.end; i++) { NodeInstances.renderable.nodeFlags[i] = SetBits(NodeInstances.renderable.nodeFlags[i], NodeInstanceFlags::NodeInstance_AlwaysVisible); - } + } } //------------------------------------------------------------------------------ @@ -807,7 +806,7 @@ ModelContext::WaitForWork(const Graphics::FrameContext& ctx) void ModelContext::OnRenderDebug(uint32_t flags) { - //const Util::Array& instances = modelContextAllocator.GetArray(); + //const Util::Array& instances = modelContextAllocator.GetArray(); //Util::Array& instanceBoxes = Models::modelPool->modelInstanceAllocator.GetArray(); //const Util::Array& transforms = Models::modelPool->modelInstanceAllocator.GetArray(); //const Util::Array& modelBoxes = Models::modelPool->modelAllocator.GetArray(); diff --git a/fips-files/generators/framescriptc.py b/fips-files/generators/framescriptc.py index 6bfdb3c89..5d6779d4d 100644 --- a/fips-files/generators/framescriptc.py +++ b/fips-files/generators/framescriptc.py @@ -491,7 +491,12 @@ def __init__(self, parser, node): Error(self.name, "Texture source must define image bits") self.destTex = dest['tex'] - self.destBits = dest['bits'] + self.destBits = dest['bits'] + + self.resourceDependencies = [ + ResourceDependencyDefinition.raw(name = self.sourceTex, stage = "TransferRead", parser = parser), + ResourceDependencyDefinition.raw(name = self.destTex, stage = "TransferWrite", parser = parser) + ] def FormatHeader(self, file): file.WriteLine("void Copy_{}(const CoreGraphics::CmdBufferId cmdBuf);".format(self.name)) @@ -500,6 +505,8 @@ def FormatExtern(self, file, parser): file.WriteLine("//------------------------------------------------------------------------------") file.WriteLine("/**") file.WriteLine("*/") + DeclareResourceDependencies("Copy_{}".format(self.name), parser, self.resourceDependencies, file) + file.WriteLine("") file.WriteLine("void") file.WriteLine("Copy_{}(const CoreGraphics::CmdBufferId cmdBuf)".format(self.name)) file.WriteLine("{") @@ -513,6 +520,7 @@ def FormatExtern(self, file, parser): file.WriteLine("}") def FormatSource(self, file): + SyncResourceDependencies("Copy_{}".format(self.name), self.resourceDependencies, file) file.WriteLine("Copy_{}(cmdBuf);".format(self.name)) def FormatSetup(self, file): @@ -566,13 +574,8 @@ def FormatExtern(self, file, parser): file.WriteLine("//------------------------------------------------------------------------------") file.WriteLine("/**") file.WriteLine("*/") - DeclareResourceDependencies("Blit_{}".format(self.name), parser, self.resourceDependencies, file) - file.WriteLine("") - file.WriteLine("//------------------------------------------------------------------------------") - file.WriteLine("/**") - file.WriteLine("*/") file.WriteLine("void") file.WriteLine("Blit_{}(const CoreGraphics::CmdBufferId cmdBuf)".format(self.name)) file.WriteLine("{") @@ -670,7 +673,7 @@ def FormatExtern(self, file, parser): file.WriteLine("/**") file.WriteLine("*/") - DeclareResourceDependencies("Swap_{}".format(self.name), parser, self.resourceDependencies, file) + DeclareResourceDependencies("Swap_{}".format(self.name), parser, self.resourceDependencies, file) def FormatSource(self, file): file.WriteLine('CoreGraphics::QueueBeginMarker(CoreGraphics::GraphicsQueueType, NEBULA_MARKER_GRAPHICS, "Swap");')