Fixed UI Rendering #326

Merged
Xenosas1337 merged 13 commits from SP3-1-Rendering into main 2023-01-31 22:53:04 +08:00
10 changed files with 31 additions and 33 deletions
Showing only changes of commit e9452093f0 - Show all commits

View File

@ -1,4 +1,4 @@
Start in Fullscreen: false
Starting Scene ID: 87244611
Starting Scene ID: 97158628
Window Size: {x: 1920, y: 1080}
Window Title: SHADE Engine

View File

@ -1,6 +1,6 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: G-Buffer Write
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 54324293

View File

@ -1,6 +1,6 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: G-Buffer Write
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 54429632

View File

@ -1,6 +1,6 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: G-Buffer Write
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 57302694

View File

@ -33,18 +33,11 @@ layout (std430, set = 2, binding = 0) buffer MaterialProperties // For mater
MatPropData data[];
} MatProp;
layout(location = 0) out vec4 position;
layout(location = 0) out vec4 fragColor;
layout(location = 1) out uint outEntityID;
layout(location = 2) out uint lightLayerIndices;
layout(location = 3) out vec4 normals;
layout(location = 4) out vec4 albedo;
void main()
{
position = In.vertPos;
normals = In.normal;
albedo = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
outEntityID = In2.eid;
lightLayerIndices = In2.lightLayerIndex;
}

Binary file not shown.

View File

@ -314,7 +314,7 @@ namespace SHADE
camera.orthoProjMatrix(3, 3) = 1.0f;
//camera.perspProjMatrix = SHMatrix::OrthographicLH(9.0f, 9.0f, 0.1f, 20.0f);
camera.orthoProjMatrix = SHMatrix::OrthographicRH(camera.GetWidth(), camera.GetHeight(), camera.GetNear(), camera.GetFar());
//camera.orthoProjMatrix = SHMatrix::OrthographicLH(camera.GetWidth(), camera.GetHeight(), camera.GetNear(), camera.GetFar());
//camera.perspProjMatrix = SHMatrix::OrthographicLH(5.0f, 5.0f, 0.1f, 20.0f);
//camera.projMatrix.Transpose();

View File

@ -127,12 +127,15 @@ namespace SHADE
SHFreetypeInstance::Init();
SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false);
SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_VS.glsl", false);
SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_VS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_VS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/Text_VS.glsl", false);
// Load Built In Shaders
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
@ -418,7 +421,7 @@ namespace SHADE
.addressMode = vk::SamplerAddressMode::eClampToBorder,
})
);
textRenderingSubSystem = resourceManager.Create<SHTextRenderingSubSystem>();
// initialize the text renderer
@ -567,7 +570,7 @@ namespace SHADE
else
renderer->UpdateData(frameIndex);
#else
renderers[renIndex]->UpdateDataAndBind(frameIndex);
renderer->UpdateData(frameIndex);
#endif
}
@ -583,16 +586,8 @@ namespace SHADE
renderGraph->Begin(frameIndex);
auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex);
// Bind all the buffers required for meshes
for (auto& [buffer, bindingPoint] : MESH_DATA)
{
if (buffer->GetUsageBits() & vk::BufferUsageFlagBits::eVertexBuffer)
cmdBuffer->BindVertexBuffer(bindingPoint, buffer, 0);
else if (buffer->GetUsageBits() & vk::BufferUsageFlagBits::eIndexBuffer)
cmdBuffer->BindIndexBuffer(buffer, 0);
}
renderGraph->Execute(frameIndex, descPool);
renderGraph->Execute(frameIndex, descPool, MESH_DATA);
renderGraph->End(frameIndex);
graphicsQueue->SubmitCommandBuffer

View File

@ -565,7 +565,7 @@ namespace SHADE
// TODO: The graph scope buffers were meant to bind vertex buffers and index buffers for meshes. Find a
// better way to manage these
void SHRenderGraph::Execute(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool) noexcept
void SHRenderGraph::Execute(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool, const std::initializer_list<std::pair<Handle<SHVkBuffer>, uint32_t>> MESH_DATA) noexcept
{
auto cmdBuffer = commandBuffers[frameIndex];
cmdBuffer->BeginLabeledSegment(name);
@ -577,6 +577,7 @@ namespace SHADE
cmdBuffer->ForceSetPipelineLayout(batchingSystemData.dummyPipelineLayout, SH_PIPELINE_TYPE::COMPUTE);
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
for (auto& node : nodes)
{
@ -585,6 +586,15 @@ namespace SHADE
// bind static global data
SHGlobalDescriptorSets::BindStaticGlobalData(cmdBuffer, SH_PIPELINE_TYPE::GRAPHICS, descMappings.at(SHPredefinedDescriptorTypes::STATIC_DATA));
// Bind all the buffers required for meshes
for (auto& [buffer, bindingPoint] : MESH_DATA)
{
if (buffer->GetUsageBits() & vk::BufferUsageFlagBits::eVertexBuffer)
cmdBuffer->BindVertexBuffer(bindingPoint, buffer, 0);
else if (buffer->GetUsageBits() & vk::BufferUsageFlagBits::eIndexBuffer)
cmdBuffer->BindIndexBuffer(buffer, 0);
}
node->Execute(cmdBuffer, descPool, frameIndex);
}
}

View File

@ -143,7 +143,7 @@ namespace SHADE
void Generate (void) noexcept;
void CheckForNodeComputes (void) noexcept;
void Execute (uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool) noexcept;
void Execute (uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool, const std::initializer_list<std::pair<Handle<SHVkBuffer>, uint32_t>> MESH_DATA) noexcept;
void Begin (uint32_t frameIndex) noexcept;
void End (uint32_t frameIndex) noexcept;
void FinaliseBatch (uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);