Added C# Assets System and Serialization of Script Enabled State #247
|
@ -1,20 +1,16 @@
|
|||
0 1
|
||||
1 2
|
||||
2 3
|
||||
3 4
|
||||
4 5
|
||||
5 6
|
||||
6 7
|
||||
7 8
|
||||
8 9
|
||||
9 10
|
||||
10 11
|
||||
11 12
|
||||
12 13
|
||||
13 14
|
||||
14 15
|
||||
15 16
|
||||
|
||||
note:
|
||||
All collision tags should follow the above format "index<space>tag name".
|
||||
If it fails to follow this, the default tag names will be used.
|
||||
0 1
|
||||
1 2
|
||||
2 3
|
||||
3 4
|
||||
4 5
|
||||
5 6
|
||||
6 7
|
||||
7 8
|
||||
8 9
|
||||
9 10
|
||||
10 11
|
||||
11 12
|
||||
12 13
|
||||
13 14
|
||||
14 15
|
||||
15 16
|
||||
|
|
|
@ -3,17 +3,12 @@
|
|||
#extension GL_ARB_shading_language_420pack : enable
|
||||
#extension GL_EXT_nonuniform_qualifier : require
|
||||
|
||||
layout (input_attachment_index = 0, set = 4, binding = 0) uniform subpassInput vec4 sceneTexture;
|
||||
layout (input_attachment_index = 0, set = 4, binding = 0) uniform subpassInput sceneTexture;
|
||||
|
||||
layout(location = 0) in struct
|
||||
{
|
||||
vec2 uv; // location = 0
|
||||
|
||||
} In;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = vec4 (texture (sceneTexture, In.uv).rgb, 1.0f);
|
||||
fragColor = vec4 (subpassLoad(sceneTexture).rgb, 1.0f);
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: ToSwapchain_FS
|
||||
ID: 36869006
|
||||
Type: 2
|
|
@ -1,11 +1,6 @@
|
|||
#version 450
|
||||
#extension GL_KHR_vulkan_glsl : enable
|
||||
|
||||
layout(location = 0) out struct
|
||||
{
|
||||
vec2 uv; // location = 0
|
||||
|
||||
} Out;
|
||||
|
||||
vec2 CreateQuad(in uint vertexID)
|
||||
{
|
||||
|
@ -15,7 +10,6 @@ vec2 CreateQuad(in uint vertexID)
|
|||
|
||||
void main()
|
||||
{
|
||||
vec2 texCoord = CreateQuad (gl_VertexIndex);
|
||||
vec2 vertexPos = texCoord - vec2(0.5f);
|
||||
vec2 vertexPos = 2 * (CreateQuad(gl_VertexIndex) - vec2(0.5f));
|
||||
gl_Position = vec4 (vertexPos, 0.0f, 1.0f);
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: ToSwapchain_VS
|
||||
ID: 48082949
|
||||
Type: 2
|
|
@ -80,8 +80,8 @@ namespace Sandbox
|
|||
SHSystemManager::CreateSystem<SHCameraSystem>();
|
||||
SHSystemManager::CreateSystem<SHUISystem>();
|
||||
|
||||
std::system("FontCompiler.exe ../../Assets/Fonts/SegoeUI.ttf");
|
||||
std::system("FontCompiler.exe ../../Assets/Fonts/ALGER.ttf");
|
||||
//std::system("FontCompiler.exe ../../Assets/Fonts/SegoeUI.ttf");
|
||||
//std::system("FontCompiler.exe ../../Assets/Fonts/ALGER.ttf");
|
||||
|
||||
SHSystemManager::CreateSystem<SHGraphicsSystem>();
|
||||
SHGraphicsSystem* graphicsSystem = static_cast<SHGraphicsSystem*>(SHSystemManager::GetSystem<SHGraphicsSystem>());
|
||||
|
|
|
@ -43,7 +43,9 @@ namespace SHADE
|
|||
if (!camComponent)
|
||||
{
|
||||
SHLOG_WARNING("Camera Director warning: Entity does not have a camera");
|
||||
return nullptr;
|
||||
}
|
||||
return camComponent;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace SHADE
|
|||
//Call all the children to Destroy themselves first before the parent is destroyed.
|
||||
if (entityVec[eIndex])
|
||||
{
|
||||
auto& children = SHSceneManager::GetCurrentSceneGraph().GetChildren(eID);
|
||||
auto children = SHSceneManager::GetCurrentSceneGraph().GetChildren(eID);
|
||||
for (auto& child : children)
|
||||
{
|
||||
DestroyEntity(child->GetEntityID());
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace SHADE
|
|||
if (width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
PrepareResize(resizeWidth, resizeHeight);
|
||||
PrepareResize(width, height);
|
||||
});
|
||||
|
||||
window->RegisterWindowCloseCallback([&](void)
|
||||
|
@ -125,6 +125,8 @@ namespace SHADE
|
|||
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_VS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Models/Quad.gltf", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/ToSwapchain_VS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/ToSwapchain_FS.glsl", false);
|
||||
|
||||
// Load Built In Shaders
|
||||
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
|
||||
|
@ -136,6 +138,8 @@ namespace SHADE
|
|||
static constexpr AssetID SSAO_BLUR = 39760835; ssaoBlurShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(SSAO_BLUR);
|
||||
static constexpr AssetID TEXT_VS = 39816727; textVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_VS);
|
||||
static constexpr AssetID TEXT_FS = 38024754; textFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_FS);
|
||||
static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_VS);
|
||||
static constexpr AssetID RENDER_SC_FS = 36869006; renderToSwapchainFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_FS);
|
||||
}
|
||||
|
||||
void SHGraphicsSystem::InitSceneRenderGraph(void) noexcept
|
||||
|
@ -299,6 +303,7 @@ namespace SHADE
|
|||
textRenderingSubSystem->Render(cmdBuffer, frameIndex);
|
||||
});
|
||||
|
||||
#ifdef SHEDITOR
|
||||
{
|
||||
// Dummy Node to transition scene render graph resource
|
||||
auto dummyNode = screenRenderGraph->AddNode("Dummy Pass", { "Scene" }, { "Screen Space Pass" }); // no predecessors
|
||||
|
@ -306,7 +311,9 @@ namespace SHADE
|
|||
dummySubpass->AddInput("Scene");
|
||||
}
|
||||
|
||||
//screenRenderGraph->AddRenderToSwapchainNode ("Scene", "Present", )
|
||||
#else
|
||||
screenRenderGraph->AddRenderToSwapchainNode("Scene", "Present", {"Screen Space Pass"}, {renderToSwapchainVS, renderToSwapchainFS});
|
||||
#endif
|
||||
|
||||
screenRenderGraph->Generate();
|
||||
|
||||
|
|
|
@ -444,6 +444,8 @@ namespace SHADE
|
|||
Handle<SHVkShaderModule> ssaoBlurShader;
|
||||
Handle<SHVkShaderModule> textVS;
|
||||
Handle<SHVkShaderModule> textFS;
|
||||
Handle<SHVkShaderModule> renderToSwapchainVS;
|
||||
Handle<SHVkShaderModule> renderToSwapchainFS;
|
||||
|
||||
// Fonts
|
||||
Handle<SHFont> testFont;
|
||||
|
|
|
@ -565,8 +565,10 @@ namespace SHADE
|
|||
{
|
||||
cmdBuffer->BindPipeline(renderToSwapchainImageSystem->GetPipeline());
|
||||
|
||||
newSubpass->BindDescriptorInputDescriptorSets (cmdBuffer, frameIndex);
|
||||
|
||||
// draw a quad.
|
||||
cmdBuffer->DrawIndexed(4, 0, 0);
|
||||
cmdBuffer->DrawArrays(4, 1, 0, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h"
|
||||
#include "Graphics/RenderGraph/SHRenderGraphNode.h"
|
||||
#include "Graphics/RenderGraph/SHSubpass.h"
|
||||
#include "Graphics/SHVkUtil.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -25,14 +27,34 @@ namespace SHADE
|
|||
.globalDescSetLayouts = SHGraphicsGlobalData::GetDescSetLayouts(),
|
||||
});
|
||||
|
||||
auto newPipeline = logicalDevice->CreateGraphicsPipeline(pipelineLayout, nullptr, renderGraphNode->GetRenderpass(), subpass);
|
||||
pipeline = logicalDevice->CreateGraphicsPipeline(pipelineLayout, nullptr, renderGraphNode->GetRenderpass(), subpass);
|
||||
|
||||
SHInputAssemblyState inputAssembly{};
|
||||
inputAssembly.topology = vk::PrimitiveTopology::eTriangleFan;
|
||||
|
||||
newPipeline->GetPipelineState().SetInputAssemblyState(inputAssembly);
|
||||
pipeline->GetPipelineState().SetInputAssemblyState(inputAssembly);
|
||||
|
||||
newPipeline->ConstructPipeline();
|
||||
SHColorBlendState colorBlendState{};
|
||||
colorBlendState.logic_op_enable = VK_FALSE;
|
||||
colorBlendState.logic_op = vk::LogicOp::eCopy;
|
||||
|
||||
auto const& subpassColorReference = subpass->GetColorAttachmentReferences()[0];
|
||||
colorBlendState.attachments.push_back(vk::PipelineColorBlendAttachmentState
|
||||
{
|
||||
.blendEnable = SHVkUtil::IsBlendCompatible(subpass->GetFormatFromAttachmentReference(subpassColorReference.attachment)),
|
||||
.srcColorBlendFactor = vk::BlendFactor::eSrcAlpha,
|
||||
.dstColorBlendFactor = vk::BlendFactor::eOneMinusSrcAlpha,
|
||||
.colorBlendOp = vk::BlendOp::eAdd,
|
||||
.srcAlphaBlendFactor = vk::BlendFactor::eOne,
|
||||
.dstAlphaBlendFactor = vk::BlendFactor::eZero,
|
||||
.alphaBlendOp = vk::BlendOp::eAdd,
|
||||
.colorWriteMask = vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA,
|
||||
}
|
||||
);
|
||||
|
||||
pipeline->GetPipelineState().SetColorBlenState(colorBlendState);
|
||||
|
||||
pipeline->ConstructPipeline();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace SHADE
|
|||
, inputReferences{}
|
||||
, name { name }
|
||||
, graphStorage{ renderGraphStorage }
|
||||
, inputImageDescriptors {SHGraphicsConstants::NUM_FRAME_BUFFERS}
|
||||
, inputImageDescriptorSets{}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace SHADE
|
|||
, exteriorDrawCalls{ std::move(rhs.exteriorDrawCalls) }
|
||||
, graphStorage{ rhs.graphStorage }
|
||||
, inputNames{ std::move(rhs.inputNames) }
|
||||
, inputImageDescriptors{ std::move(rhs.inputImageDescriptors) }
|
||||
, inputImageDescriptorSets{ std::move(rhs.inputImageDescriptorSets) }
|
||||
, inputDescriptorLayout{ rhs.inputDescriptorLayout }
|
||||
, inputSamplers{ rhs.inputSamplers }
|
||||
, name { rhs.name }
|
||||
|
@ -102,7 +102,7 @@ namespace SHADE
|
|||
exteriorDrawCalls = std::move(rhs.exteriorDrawCalls);
|
||||
graphStorage = rhs.graphStorage;
|
||||
inputNames = std::move(rhs.inputNames);
|
||||
inputImageDescriptors = std::move(rhs.inputImageDescriptors);
|
||||
inputImageDescriptorSets = std::move(rhs.inputImageDescriptorSets);
|
||||
inputDescriptorLayout = rhs.inputDescriptorLayout;
|
||||
inputSamplers = rhs.inputSamplers;
|
||||
name = std::move(rhs.name);
|
||||
|
@ -202,6 +202,8 @@ namespace SHADE
|
|||
void SHSubpass::Execute(Handle<SHVkCommandBuffer>& commandBuffer, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept
|
||||
{
|
||||
commandBuffer->BeginLabeledSegment(name);
|
||||
|
||||
|
||||
// Ensure correct transforms are provided
|
||||
superBatch->UpdateBuffers(frameIndex, descPool);
|
||||
|
||||
|
@ -221,6 +223,14 @@ namespace SHADE
|
|||
UpdateWriteDescriptors();
|
||||
}
|
||||
|
||||
void SHSubpass::BindDescriptorInputDescriptorSets(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) const noexcept
|
||||
{
|
||||
if (!inputImageDescriptorSets.empty())
|
||||
{
|
||||
cmdBuffer->BindDescriptorSet(inputImageDescriptorSets[frameIndex], SH_PIPELINE_TYPE::GRAPHICS, SHGraphicsConstants::DescriptorSetIndex::RENDERGRAPH_RESOURCE, { });
|
||||
}
|
||||
}
|
||||
|
||||
void SHSubpass::AddExteriorDrawCalls(std::function<void(Handle<SHVkCommandBuffer>&, uint32_t)> const& newDrawCall) noexcept
|
||||
{
|
||||
exteriorDrawCalls.push_back(newDrawCall);
|
||||
|
@ -237,6 +247,8 @@ namespace SHADE
|
|||
if (inputNames.empty())
|
||||
return;
|
||||
|
||||
inputImageDescriptorSets.resize(SHGraphicsConstants::NUM_FRAME_BUFFERS);
|
||||
|
||||
std::vector<SHVkDescriptorSetLayout::Binding> bindings{};
|
||||
|
||||
for (auto& input : inputReferences)
|
||||
|
@ -280,8 +292,8 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
//// maybe do this in handle resize?
|
||||
//UpdateWriteDescriptors();
|
||||
// maybe do this in handle resize?
|
||||
UpdateWriteDescriptors();
|
||||
}
|
||||
|
||||
void SHSubpass::UpdateWriteDescriptors(void) noexcept
|
||||
|
@ -296,7 +308,7 @@ namespace SHADE
|
|||
|
||||
|
||||
// For every frame's descriptor set
|
||||
for (auto& group : inputImageDescriptors)
|
||||
for (auto& group : inputImageDescriptorSets)
|
||||
{
|
||||
if (group)
|
||||
group.Free();
|
||||
|
|
|
@ -55,8 +55,11 @@ namespace SHADE
|
|||
//! For getting attachment reference indices using handles
|
||||
std::unordered_map<uint64_t, uint32_t> const* resourceAttachmentMapping;
|
||||
|
||||
//! Descriptor set group to hold the images for input
|
||||
std::vector<Handle<SHVkDescriptorSetGroup>> inputImageDescriptors;
|
||||
//! Descriptor set group to hold the images for input. We have 3 here just in case
|
||||
//! one of the images is a swapchain image. Practically speaking its not likely not
|
||||
//! swapchain images will end up being images used in descriptor sets, but this is
|
||||
//! to have the support for it. The cost is not much.
|
||||
std::vector<Handle<SHVkDescriptorSetGroup>> inputImageDescriptorSets;
|
||||
|
||||
//! Descriptor set layout for allocating descriptor set for inputs
|
||||
Handle<SHVkDescriptorSetLayout> inputDescriptorLayout;
|
||||
|
@ -104,6 +107,7 @@ namespace SHADE
|
|||
// Runtime functions
|
||||
void Execute(Handle<SHVkCommandBuffer>& commandBuffer, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
|
||||
void HandleResize (void) noexcept;
|
||||
void BindDescriptorInputDescriptorSets (Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) const noexcept;
|
||||
|
||||
void Init(SHResourceHub& resourceManager) noexcept;
|
||||
|
||||
|
|
Loading…
Reference in New Issue