Refactored Graphics #297
|
@ -11,7 +11,7 @@ layout(location = 0) out struct
|
|||
vec4 Color;
|
||||
} Out;
|
||||
|
||||
layout(set = 2, binding = 0) uniform CameraData
|
||||
layout(set = 1, binding = 0) uniform CameraData
|
||||
{
|
||||
vec4 position;
|
||||
mat4 vpMat;
|
||||
|
|
Binary file not shown.
|
@ -10,7 +10,7 @@ layout(location = 0) out struct
|
|||
vec4 vertColor; // location 0
|
||||
} Out;
|
||||
|
||||
layout(set = 2, binding = 0) uniform CameraData
|
||||
layout(set = 1, binding = 0) uniform CameraData
|
||||
{
|
||||
vec4 position;
|
||||
mat4 vpMat;
|
||||
|
|
Binary file not shown.
|
@ -17,12 +17,12 @@ struct AmbientLightStruct
|
|||
};
|
||||
|
||||
layout(local_size_x = 16, local_size_y = 16) in;
|
||||
layout(set = 4, binding = 0, rgba32f) uniform image2D positions;
|
||||
layout(set = 4, binding = 1, rgba32f) uniform image2D normals;
|
||||
layout(set = 4, binding = 2, rgba8) uniform image2D albedo;
|
||||
layout(set = 4, binding = 3, r32ui) uniform uimage2D lightLayerData;
|
||||
layout(set = 4, binding = 4, r8) uniform image2D ssaoBlurredImage;
|
||||
layout(set = 4, binding = 5, rgba8) uniform image2D targetImage;
|
||||
layout(set = 3, binding = 0, rgba32f) uniform image2D positions;
|
||||
layout(set = 3, binding = 1, rgba32f) uniform image2D normals;
|
||||
layout(set = 3, binding = 2, rgba8) uniform image2D albedo;
|
||||
layout(set = 3, binding = 3, r32ui) uniform uimage2D lightLayerData;
|
||||
layout(set = 3, binding = 4, r8) uniform image2D ssaoBlurredImage;
|
||||
layout(set = 3, binding = 5, rgba8) uniform image2D targetImage;
|
||||
|
||||
layout(set = 1, binding = 0) uniform LightCounts
|
||||
{
|
||||
|
|
Binary file not shown.
|
@ -50,8 +50,8 @@
|
|||
#define NUM_MASKS 8
|
||||
|
||||
layout(local_size_x = 16, local_size_y = 16) in;
|
||||
layout(set = 4, binding = 0, rgba8) uniform image2D inputImage;
|
||||
layout(set = 4, binding = 1, rgba8) uniform image2D resultImage;
|
||||
layout(set = 3, binding = 0, rgba8) uniform image2D inputImage;
|
||||
layout(set = 3, binding = 1, rgba8) uniform image2D resultImage;
|
||||
|
||||
const float kirsch[8][3][3] = {
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ layout(location = 3) flat in struct
|
|||
} In2;
|
||||
|
||||
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
|
||||
layout (std430, set = 3, binding = 0) buffer MaterialProperties // For materials
|
||||
layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials
|
||||
{
|
||||
MatPropData data[];
|
||||
} MatProp;
|
||||
|
|
Binary file not shown.
|
@ -46,8 +46,8 @@
|
|||
|
||||
|
||||
layout(local_size_x = 16, local_size_y = 16) in;
|
||||
layout(set = 4, binding = 0, rgba8) uniform image2D inputImage;
|
||||
layout(set = 4, binding = 1, rgba8) uniform image2D targetImage;
|
||||
layout(set = 3, binding = 0, rgba8) uniform image2D inputImage;
|
||||
layout(set = 3, binding = 1, rgba8) uniform image2D targetImage;
|
||||
|
||||
|
||||
void main()
|
||||
|
|
Binary file not shown.
|
@ -5,8 +5,8 @@
|
|||
#define SHM_WIDTH BLUR_WIDTH + 16 - 1
|
||||
|
||||
layout(local_size_x = 16, local_size_y = 16) in;
|
||||
layout(set = 4, binding = 0, r8) uniform image2D ssaoImage;
|
||||
layout(set = 4, binding = 1, r8) uniform image2D ssaoBlurImage;
|
||||
layout(set = 3, binding = 0, r8) uniform image2D ssaoImage;
|
||||
layout(set = 3, binding = 1, r8) uniform image2D ssaoBlurImage;
|
||||
|
||||
|
||||
float GetSSAOValue(ivec2 uv, ivec2 imageSize)
|
||||
|
|
Binary file not shown.
|
@ -1,5 +1,7 @@
|
|||
#version 450
|
||||
|
||||
#pragma vscode_glsllint_stage : comp
|
||||
|
||||
const uint NUM_SAMPLES = 64;
|
||||
const uint NUM_ROTATIONS = 16;
|
||||
const int ROTATION_KERNEL_W = 4;
|
||||
|
@ -10,19 +12,19 @@ const float RADIUS = 0.2f;
|
|||
const float BIAS = 0.0025f;
|
||||
|
||||
layout(local_size_x = 16, local_size_y = 16) in;
|
||||
layout(set = 4, binding = 0, rgba32f) uniform image2D positions;
|
||||
layout(set = 4, binding = 1, rgba32f) uniform image2D normals;
|
||||
layout(set = 4, binding = 2, rgba32f) uniform image2D outputImage;
|
||||
layout(set = 3, binding = 0, rgba32f) uniform image2D positions;
|
||||
layout(set = 3, binding = 1, rgba32f) uniform image2D normals;
|
||||
layout(set = 3, binding = 2, rgba32f) uniform image2D outputImage;
|
||||
|
||||
|
||||
// SSAO data
|
||||
layout(std430, set = 5, binding = 0) buffer SSAOData
|
||||
layout(std430, set = 4, binding = 0) buffer SSAOData
|
||||
{
|
||||
vec4 samples[NUM_SAMPLES];
|
||||
|
||||
} ssaoData;
|
||||
|
||||
layout (set = 5, binding = 1) uniform sampler2D noiseTexture;
|
||||
layout (set = 4, binding = 1) uniform sampler2D noiseTexture;
|
||||
|
||||
layout(set = 2, binding = 0) uniform CameraData
|
||||
{
|
||||
|
|
Binary file not shown.
|
@ -28,7 +28,7 @@ layout(location = 3) flat in struct
|
|||
} In2;
|
||||
|
||||
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
|
||||
layout (std430, set = 3, binding = 0) buffer MaterialProperties // For materials
|
||||
layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials
|
||||
{
|
||||
MatPropData data[];
|
||||
} MatProp;
|
||||
|
|
Binary file not shown.
|
@ -26,7 +26,7 @@ layout(location = 3) flat in struct
|
|||
} In2;
|
||||
|
||||
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
|
||||
layout (std430, set = 3, binding = 0) buffer MaterialProperties // For materials
|
||||
layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials
|
||||
{
|
||||
MatPropData data[];
|
||||
} MatProp;
|
||||
|
|
Binary file not shown.
|
@ -34,7 +34,7 @@ layout(location = 3) out struct
|
|||
|
||||
} Out2;
|
||||
|
||||
layout(set = 2, binding = 0) uniform CameraData
|
||||
layout(set = 1, binding = 0) uniform CameraData
|
||||
{
|
||||
vec4 position;
|
||||
mat4 vpMat;
|
||||
|
@ -42,7 +42,7 @@ layout(set = 2, binding = 0) uniform CameraData
|
|||
mat4 projMat;
|
||||
} cameraData;
|
||||
|
||||
layout (std430, set = 3, binding = 0) buffer MaterialProperties // For materials
|
||||
layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials
|
||||
{
|
||||
MatPropData data[];
|
||||
} MatProp;
|
||||
|
|
Binary file not shown.
|
@ -29,7 +29,7 @@ layout(location = 3) out struct
|
|||
|
||||
} Out2;
|
||||
|
||||
layout(set = 2, binding = 0) uniform CameraData
|
||||
layout(set = 1, binding = 0) uniform CameraData
|
||||
{
|
||||
vec4 position;
|
||||
mat4 vpMat;
|
||||
|
|
Binary file not shown.
|
@ -28,7 +28,7 @@ layout(location = 3) flat in struct
|
|||
|
||||
|
||||
|
||||
layout(set = 4, binding = 0) uniform sampler2D fontBitmap;
|
||||
layout(set = 2, binding = 0) uniform sampler2D fontBitmap;
|
||||
|
||||
layout(location = 0) out vec4 color;
|
||||
layout(location = 1) out uint outEntityID;
|
||||
|
|
Binary file not shown.
|
@ -25,7 +25,7 @@ layout(location = 3) out struct
|
|||
} Out2;
|
||||
|
||||
// Camera data
|
||||
layout(set = 2, binding = 0) uniform CameraData
|
||||
layout(set = 1, binding = 0) uniform CameraData
|
||||
{
|
||||
vec4 position;
|
||||
mat4 vpMat;
|
||||
|
@ -43,7 +43,7 @@ layout(std140, push_constant) uniform TestPushConstant
|
|||
} testPushConstant;
|
||||
|
||||
// Descriptor sets
|
||||
layout(std430, set = 4, binding = 1) buffer GlyphTransforms
|
||||
layout(std430, set = 2, binding = 1) buffer GlyphTransforms
|
||||
{
|
||||
mat4 matrices[];
|
||||
} glyphTransforms;
|
||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@
|
|||
#extension GL_ARB_shading_language_420pack : enable
|
||||
#extension GL_EXT_nonuniform_qualifier : require
|
||||
|
||||
layout (input_attachment_index = 0, set = 4, binding = 0) uniform subpassInput sceneTexture;
|
||||
layout (input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput sceneTexture;
|
||||
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
|
Binary file not shown.
|
@ -28,7 +28,7 @@ layout(location = 3) flat in struct
|
|||
} In2;
|
||||
|
||||
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
|
||||
layout (std430, set = 3, binding = 0) buffer MaterialProperties // For materials
|
||||
layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials
|
||||
{
|
||||
MatPropData data[];
|
||||
} MatProp;
|
||||
|
|
Binary file not shown.
|
@ -29,7 +29,7 @@ layout(location = 3) out struct
|
|||
|
||||
} Out2;
|
||||
|
||||
layout(set = 2, binding = 0) uniform CameraData
|
||||
layout(set = 1, binding = 0) uniform CameraData
|
||||
{
|
||||
vec4 position;
|
||||
mat4 vpMat;
|
||||
|
|
Binary file not shown.
|
@ -196,10 +196,12 @@ namespace SHADE
|
|||
if (!fragShader)
|
||||
return;
|
||||
|
||||
auto const& mappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||
|
||||
// Get interface for the shader combination
|
||||
auto interface = fragShader->GetReflectedData().GetDescriptorBindingInfo().GetShaderBlockInterface
|
||||
(
|
||||
SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
|
||||
mappings.at(SHGraphicsConstants::DescriptorSetTypes::MATERIALS),
|
||||
SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA
|
||||
);
|
||||
if (!interface)
|
||||
|
|
|
@ -25,7 +25,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
||||
#include "ECS_Base/Managers/SHComponentManager.h"
|
||||
#include "Math/Transform/SHTransformComponent.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
||||
#include "Scene/SHSceneManager.h"
|
||||
#include "UI/SHUIComponent.h"
|
||||
|
@ -411,12 +411,12 @@ namespace SHADE
|
|||
instancedIntegerData.reserve(numTotalElements);
|
||||
instancedIntegerData.clear();
|
||||
|
||||
auto const& descMappings = SHPredefinedData::GetBatchingSystemData().descMappings;
|
||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||
|
||||
// - Material Properties Data
|
||||
const Handle<SHShaderBlockInterface> SHADER_INFO = pipeline->GetPipelineLayout()->GetShaderBlockInterface
|
||||
(
|
||||
descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::MATERIALS),
|
||||
descMappings.at(SHGraphicsConstants::DescriptorSetTypes::MATERIALS),
|
||||
SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA,
|
||||
vk::ShaderStageFlagBits::eFragment
|
||||
);
|
||||
|
@ -571,14 +571,14 @@ namespace SHADE
|
|||
cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::INTEGER_DATA, instancedIntegerBuffer[frameIndex], 0);
|
||||
if (matPropsDescSet[frameIndex])
|
||||
{
|
||||
auto const& descMappings = SHPredefinedData::GetBatchingSystemData().descMappings;
|
||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||
|
||||
cmdBuffer->BindDescriptorSet
|
||||
(
|
||||
matPropsDescSet[frameIndex],
|
||||
SH_PIPELINE_TYPE::GRAPHICS,
|
||||
//SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
|
||||
descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::MATERIALS),
|
||||
descMappings.at(SHGraphicsConstants::DescriptorSetTypes::MATERIALS),
|
||||
dynamicOffset
|
||||
);
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ namespace SHADE
|
|||
{
|
||||
matPropsDescSet[frameIndex] = descPool->Allocate
|
||||
(
|
||||
SHPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::MATERIALS),
|
||||
SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::MATERIALS),
|
||||
{ 0 }
|
||||
);
|
||||
#ifdef _DEBUG
|
||||
|
@ -623,8 +623,7 @@ namespace SHADE
|
|||
#endif
|
||||
}
|
||||
|
||||
auto const& descMappings = SHPredefinedData::GetBatchingSystemData().descMappings;
|
||||
uint32_t const MATERIAL_DESC_SET_INDEX = descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::MATERIALS);
|
||||
static constexpr uint32_t MATERIAL_DESC_SET_INDEX = 0;
|
||||
|
||||
std::array<Handle<SHVkBuffer>, 1> bufferList = { matPropsBuffer[frameIndex] };
|
||||
matPropsDescSet[frameIndex]->ModifyWriteDescBuffer
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace SHADE
|
|||
void SHGlobalDescriptorSets::BindStaticGlobalData(Handle<SHVkCommandBuffer> cmdBuffer, SH_PIPELINE_TYPE pipelineType, uint32_t setIndex) noexcept
|
||||
{
|
||||
// Bind descriptor set for static global data
|
||||
static constexpr std::array<uint32_t, 1> TEX_DYNAMIC_OFFSET{ 0 };
|
||||
cmdBuffer->BindDescriptorSet(staticGlobalDataDescriptorSet, pipelineType, setIndex, const std::span{ TEX_DYNAMIC_OFFSET.data(), 1 });
|
||||
static std::array<uint32_t, 1> TEX_DYNAMIC_OFFSET{ 0 };
|
||||
cmdBuffer->BindDescriptorSet(staticGlobalDataDescriptorSet, pipelineType, setIndex, std::span{ TEX_DYNAMIC_OFFSET.data(), 1 });
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SHpch.h"
|
||||
#include "SHPredefinedData.h"
|
||||
#include "SHGraphicsPredefinedData.h"
|
||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||
#include "Graphics/Pipeline/SHPipelineState.h"
|
||||
#include "Graphics/Pipeline/SHVkPipelineLayout.h"
|
||||
|
@ -11,29 +11,32 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Static Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> SHPredefinedData::predefinedLayouts;
|
||||
SHVertexInputState SHPredefinedData::defaultVertexInputState;
|
||||
SHPredefinedData::PerSystem SHPredefinedData::batchingSystemData;
|
||||
SHPredefinedData::PerSystem SHPredefinedData::textSystemData;
|
||||
SHPredefinedData::PerSystem SHPredefinedData::renderGraphNodeComputeData;
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsPredefinedData::predefinedLayouts;
|
||||
SHVertexInputState SHGraphicsPredefinedData::defaultVertexInputState;
|
||||
std::vector<SHGraphicsPredefinedData::PerSystem> SHGraphicsPredefinedData::perSystemData;
|
||||
|
||||
void SHPredefinedData::InitDescMappings(void) noexcept
|
||||
//SHGraphicsPredefinedData::PerSystem SHGraphicsPredefinedData::batchingSystemData;
|
||||
//SHGraphicsPredefinedData::PerSystem SHGraphicsPredefinedData::textSystemData;
|
||||
//SHGraphicsPredefinedData::PerSystem SHGraphicsPredefinedData::renderGraphNodeComputeData;
|
||||
|
||||
void SHGraphicsPredefinedData::InitDescMappings(void) noexcept
|
||||
{
|
||||
batchingSystemData.descMappings.AddMappings
|
||||
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::BATCHING)].descMappings.AddMappings
|
||||
({
|
||||
{SHGraphicsConstants::DescriptorSetTypes::STATIC_DATA, 0},
|
||||
{SHGraphicsConstants::DescriptorSetTypes::CAMERA, 1},
|
||||
{SHGraphicsConstants::DescriptorSetTypes::MATERIALS, 2},
|
||||
});
|
||||
|
||||
textSystemData.descMappings.AddMappings
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].descMappings.AddMappings
|
||||
({
|
||||
{SHGraphicsConstants::DescriptorSetTypes::STATIC_DATA, 0},
|
||||
{SHGraphicsConstants::DescriptorSetTypes::CAMERA, 1},
|
||||
{SHGraphicsConstants::DescriptorSetTypes::FONT, 2},
|
||||
});
|
||||
|
||||
renderGraphNodeComputeData.descMappings.AddMappings
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::RENDER_GRAPH_NODE_COMPUTE)].descMappings.AddMappings
|
||||
({
|
||||
{SHGraphicsConstants::DescriptorSetTypes::STATIC_DATA, 0},
|
||||
{SHGraphicsConstants::DescriptorSetTypes::LIGHTS, 1},
|
||||
|
@ -43,16 +46,17 @@ namespace SHADE
|
|||
});
|
||||
}
|
||||
|
||||
void SHPredefinedData::InitDummyPipelineLayouts(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||
void SHGraphicsPredefinedData::InitDummyPipelineLayouts(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||
{
|
||||
batchingSystemData.dummyPipelineLayout = logicalDevice->CreatePipelineLayoutDummy(SHPipelineLayoutParamsDummy{ batchingSystemData.descSetLayouts });
|
||||
textSystemData.dummyPipelineLayout = logicalDevice->CreatePipelineLayoutDummy(SHPipelineLayoutParamsDummy{ textSystemData.descSetLayouts });
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::BATCHING)].dummyPipelineLayout = logicalDevice->CreatePipelineLayoutDummy(SHPipelineLayoutParamsDummy{ perSystemData[SHUtilities::ConvertEnum(SystemType::BATCHING)].descSetLayouts });
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].dummyPipelineLayout = logicalDevice->CreatePipelineLayoutDummy(SHPipelineLayoutParamsDummy{ perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].descSetLayouts });
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::RENDER_GRAPH_NODE_COMPUTE)].dummyPipelineLayout = logicalDevice->CreatePipelineLayoutDummy(SHPipelineLayoutParamsDummy{ perSystemData[SHUtilities::ConvertEnum(SystemType::RENDER_GRAPH_NODE_COMPUTE)].descSetLayouts });
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Function Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void SHPredefinedData::InitDescSetLayouts(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||
void SHGraphicsPredefinedData::InitDescSetLayouts(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||
{
|
||||
SHVkDescriptorSetLayout::Binding genericDataBinding
|
||||
{
|
||||
|
@ -153,22 +157,29 @@ namespace SHADE
|
|||
predefinedLayouts.push_back(materialDataPerInstanceLayout);
|
||||
predefinedLayouts.push_back(fontDataDescSetLayout);
|
||||
|
||||
batchingSystemData.descSetLayouts = GetPredefinedDescSetLayouts
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::BATCHING)].descSetLayouts = GetPredefinedDescSetLayouts
|
||||
(
|
||||
SHGraphicsConstants::PredefinedDescSetLayoutTypes::STATIC_DATA |
|
||||
SHGraphicsConstants::PredefinedDescSetLayoutTypes::CAMERA |
|
||||
SHGraphicsConstants::PredefinedDescSetLayoutTypes::MATERIALS
|
||||
);
|
||||
|
||||
textSystemData.descSetLayouts = GetPredefinedDescSetLayouts
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].descSetLayouts = GetPredefinedDescSetLayouts
|
||||
(
|
||||
SHGraphicsConstants::PredefinedDescSetLayoutTypes::STATIC_DATA |
|
||||
SHGraphicsConstants::PredefinedDescSetLayoutTypes::CAMERA |
|
||||
SHGraphicsConstants::PredefinedDescSetLayoutTypes::FONT
|
||||
);
|
||||
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::RENDER_GRAPH_NODE_COMPUTE)].descSetLayouts = GetPredefinedDescSetLayouts
|
||||
(
|
||||
SHGraphicsConstants::PredefinedDescSetLayoutTypes::STATIC_DATA |
|
||||
SHGraphicsConstants::PredefinedDescSetLayoutTypes::CAMERA |
|
||||
SHGraphicsConstants::PredefinedDescSetLayoutTypes::LIGHTS
|
||||
);
|
||||
}
|
||||
|
||||
void SHPredefinedData::InitDefaultVertexInputState(void) noexcept
|
||||
void SHGraphicsPredefinedData::InitDefaultVertexInputState(void) noexcept
|
||||
{
|
||||
defaultVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D) }); // positions at binding 0
|
||||
defaultVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_2D) }); // UVs at binding 1
|
||||
|
@ -178,15 +189,16 @@ namespace SHADE
|
|||
defaultVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::UINT32_2D) }); // Instanced integer data at index 8
|
||||
}
|
||||
|
||||
void SHPredefinedData::Init(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||
void SHGraphicsPredefinedData::Init(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||
{
|
||||
perSystemData.resize(SHUtilities::ConvertEnum(SystemType::NUM_TYPES));
|
||||
InitDescSetLayouts(logicalDevice);
|
||||
InitDefaultVertexInputState();
|
||||
InitDescMappings();
|
||||
InitDummyPipelineLayouts (logicalDevice);
|
||||
}
|
||||
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> SHPredefinedData::GetPredefinedDescSetLayouts(SHEnumWrapper<SHGraphicsConstants::PredefinedDescSetLayoutTypes> types) noexcept
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHEnumWrapper<SHGraphicsConstants::PredefinedDescSetLayoutTypes> types) noexcept
|
||||
{
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> layoutsFound;
|
||||
for (uint8_t i = 0; i < SHGraphicsConstants::numPredefinedDescSetLayoutTypes; ++i)
|
||||
|
@ -198,26 +210,35 @@ namespace SHADE
|
|||
return layoutsFound;
|
||||
}
|
||||
|
||||
|
||||
SHVertexInputState const& SHPredefinedData::GetDefaultViState(void) noexcept
|
||||
SHVertexInputState const& SHGraphicsPredefinedData::GetDefaultViState(void) noexcept
|
||||
{
|
||||
return defaultVertexInputState;
|
||||
}
|
||||
|
||||
|
||||
SHPredefinedData::PerSystem const& SHPredefinedData::GetBatchingSystemData(void) noexcept
|
||||
SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetSystemData(SystemType systemType) noexcept
|
||||
{
|
||||
return batchingSystemData;
|
||||
return perSystemData[static_cast<uint32_t>(systemType)];
|
||||
}
|
||||
|
||||
SHPredefinedData::PerSystem const& SHPredefinedData::GetTextSystemData(void) noexcept
|
||||
SHDescriptorMappings::MapType const& SHGraphicsPredefinedData::GetMappings(SystemType systemType) noexcept
|
||||
{
|
||||
return textSystemData;
|
||||
return perSystemData[static_cast<uint32_t>(systemType)].descMappings.GetMappings();
|
||||
}
|
||||
|
||||
SHPredefinedData::PerSystem const& SHPredefinedData::GetRenderGraphNodeComputeData(void) noexcept
|
||||
{
|
||||
return renderGraphNodeComputeData;
|
||||
}
|
||||
//SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetBatchingSystemData(void) noexcept
|
||||
//{
|
||||
// return batchingSystemData;
|
||||
//}
|
||||
|
||||
//SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetTextSystemData(void) noexcept
|
||||
//{
|
||||
// return textSystemData;
|
||||
//}
|
||||
|
||||
//SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetRenderGraphNodeComputeData(void) noexcept
|
||||
//{
|
||||
// return renderGraphNodeComputeData;
|
||||
//}
|
||||
|
||||
}
|
|
@ -5,6 +5,8 @@
|
|||
#include "Graphics/MiddleEnd/Interface/SHGraphicsConstants.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHDescriptorMappings.h"
|
||||
#include "Tools/Utilities/SHUtilities.h"
|
||||
#include "Tools/SHEnumWrapper.h"
|
||||
#include <unordered_map>
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -13,17 +15,24 @@ namespace SHADE
|
|||
class SHVkDescriptorSetGroup;
|
||||
class SHVkPipelineLayout;
|
||||
|
||||
|
||||
class SH_API SHPredefinedData
|
||||
class SH_API SHGraphicsPredefinedData
|
||||
{
|
||||
public:
|
||||
enum class SystemType
|
||||
{
|
||||
BATCHING = 0,
|
||||
TEXT_RENDERING,
|
||||
RENDER_GRAPH_NODE_COMPUTE,
|
||||
NUM_TYPES
|
||||
};
|
||||
|
||||
struct PerSystem
|
||||
{
|
||||
//! vector of descriptor set layouts used by a system
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> descSetLayouts;
|
||||
|
||||
//! pipeline layout used for binding descriptor sets in the system
|
||||
static Handle<SHVkPipelineLayout> dummyPipelineLayout;
|
||||
Handle<SHVkPipelineLayout> dummyPipelineLayout;
|
||||
|
||||
//! Descriptor type mappings for the system
|
||||
SHDescriptorMappings descMappings;
|
||||
|
@ -36,14 +45,17 @@ namespace SHADE
|
|||
//! Default vertex input state (used by everything).
|
||||
static SHVertexInputState defaultVertexInputState;
|
||||
|
||||
//! predefined data for the batching system
|
||||
static PerSystem batchingSystemData;
|
||||
//! Predefined data for each type of system
|
||||
static std::vector<PerSystem> perSystemData;
|
||||
|
||||
//! predefined data for the text system
|
||||
static PerSystem textSystemData;
|
||||
////! predefined data for the batching system
|
||||
//static PerSystem batchingSystemData;
|
||||
|
||||
//! predefined data for the render graph node computes
|
||||
static PerSystem renderGraphNodeComputeData;
|
||||
////! predefined data for the text system
|
||||
//static PerSystem textSystemData;
|
||||
|
||||
////! predefined data for the render graph node computes
|
||||
//static PerSystem renderGraphNodeComputeData;
|
||||
|
||||
static void InitDescMappings (void) noexcept;
|
||||
static void InitDummyPipelineLayouts (Handle<SHVkLogicalDevice> logicalDevice) noexcept;
|
||||
|
@ -54,7 +66,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------*/
|
||||
/* Constructors */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
SHPredefinedData() = delete;
|
||||
SHGraphicsPredefinedData() = delete;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* PUBLIC MEMBER FUNCTIONS */
|
||||
|
@ -66,8 +78,10 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------*/
|
||||
static std::vector<Handle<SHVkDescriptorSetLayout>> GetPredefinedDescSetLayouts (SHEnumWrapper<SHGraphicsConstants::PredefinedDescSetLayoutTypes> types) noexcept;
|
||||
static SHVertexInputState const& GetDefaultViState (void) noexcept;
|
||||
static PerSystem const& GetBatchingSystemData(void) noexcept;
|
||||
static PerSystem const& GetTextSystemData(void) noexcept;
|
||||
static PerSystem const& GetRenderGraphNodeComputeData(void) noexcept;
|
||||
static PerSystem const& GetSystemData (SystemType systemType) noexcept;
|
||||
static SHDescriptorMappings::MapType const& GetMappings (SystemType systemType) noexcept;
|
||||
//static PerSystem const& GetBatchingSystemData(void) noexcept;
|
||||
//static PerSystem const& GetTextSystemData(void) noexcept;
|
||||
//static PerSystem const& GetRenderGraphNodeComputeData(void) noexcept;
|
||||
};
|
||||
}
|
|
@ -58,68 +58,68 @@ namespace SHADE
|
|||
static constexpr uint32_t EDITOR = 0;
|
||||
};
|
||||
|
||||
struct DescriptorSetIndex
|
||||
{
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
DescriptorSet Index for static global values like generic data, and
|
||||
texture samplers
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t STATIC_GLOBALS = 0;
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
DescriptorSet Index for dynamic global values like lights.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t DYNAMIC_GLOBALS = 1;
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
DescriptorSet Index for high frequency changing global values like
|
||||
camera matrices.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t HIGH_FREQUENCY_GLOBALS = 2;
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
DescriptorSet Index for per-instance/material changing values.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t PER_INSTANCE = 3;
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
DescriptorSet Index for render graph resources. Unlike the sets from
|
||||
1 to 3 and 6, this set index does not have hard coded bindings and is
|
||||
NOT part of the layouts included in the global data.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t RENDERGRAPH_RESOURCE = 4;
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
DescriptorSet Index for render graph node compute resources. For data
|
||||
that we wish to pass to compute shaders in the render graph, this is
|
||||
the set to use. Unlike the sets from 1 to 3 and 6, this set index does not have
|
||||
hard coded bindings and is NOT part of the layouts included in the global
|
||||
data.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t RENDERGRAPH_NODE_COMPUTE_RESOURCE = 5;
|
||||
//struct DescriptorSetIndex
|
||||
//{
|
||||
// /***************************************************************************/
|
||||
// /*!
|
||||
// \brief
|
||||
// DescriptorSet Index for static global values like generic data, and
|
||||
// texture samplers
|
||||
// */
|
||||
// /***************************************************************************/
|
||||
// static constexpr uint32_t STATIC_GLOBALS = 0;
|
||||
// /***************************************************************************/
|
||||
// /*!
|
||||
// \brief
|
||||
// DescriptorSet Index for dynamic global values like lights.
|
||||
// */
|
||||
// /***************************************************************************/
|
||||
// static constexpr uint32_t DYNAMIC_GLOBALS = 1;
|
||||
// /***************************************************************************/
|
||||
// /*!
|
||||
// \brief
|
||||
// DescriptorSet Index for high frequency changing global values like
|
||||
// camera matrices.
|
||||
// */
|
||||
// /***************************************************************************/
|
||||
// static constexpr uint32_t HIGH_FREQUENCY_GLOBALS = 2;
|
||||
// /***************************************************************************/
|
||||
// /*!
|
||||
// \brief
|
||||
// DescriptorSet Index for per-instance/material changing values.
|
||||
// */
|
||||
// /***************************************************************************/
|
||||
// static constexpr uint32_t PER_INSTANCE = 3;
|
||||
// /***************************************************************************/
|
||||
// /*!
|
||||
// \brief
|
||||
// DescriptorSet Index for render graph resources. Unlike the sets from
|
||||
// 1 to 3 and 6, this set index does not have hard coded bindings and is
|
||||
// NOT part of the layouts included in the global data.
|
||||
// */
|
||||
// /***************************************************************************/
|
||||
// static constexpr uint32_t RENDERGRAPH_RESOURCE = 4;
|
||||
// /***************************************************************************/
|
||||
// /*!
|
||||
// \brief
|
||||
// DescriptorSet Index for render graph node compute resources. For data
|
||||
// that we wish to pass to compute shaders in the render graph, this is
|
||||
// the set to use. Unlike the sets from 1 to 3 and 6, this set index does not have
|
||||
// hard coded bindings and is NOT part of the layouts included in the global
|
||||
// data.
|
||||
// */
|
||||
// /***************************************************************************/
|
||||
// static constexpr uint32_t RENDERGRAPH_NODE_COMPUTE_RESOURCE = 5;
|
||||
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
To store font data.
|
||||
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t FONT_DATA = 4;
|
||||
};
|
||||
// /***************************************************************************/
|
||||
// /*!
|
||||
// \brief
|
||||
// To store font data.
|
||||
//
|
||||
// */
|
||||
// /***************************************************************************/
|
||||
// static constexpr uint32_t FONT_DATA = 4;
|
||||
//};
|
||||
|
||||
struct DescriptorSetBindings
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
||||
#include "Graphics/MiddleEnd/Batching/SHSuperBatch.h"
|
||||
#include "SHGraphicsConstants.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||
#include "Graphics/Images/SHVkSampler.h"
|
||||
#include "Assets/Asset Types/SHTextureAsset.h"
|
||||
|
@ -127,6 +127,22 @@ namespace SHADE
|
|||
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/DebugDraw_VS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/DebugDraw_FS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/DebugDrawMesh_VS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/Normals_FS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_FS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_Tile_FS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_Tile_VS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_VS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/Text_FS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/Text_VS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/ToSwapchain_FS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/ToSwapchain_VS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false);
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/UI_VS.glsl", false);
|
||||
|
||||
// Load Built In Shaders
|
||||
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
|
||||
|
@ -207,7 +223,7 @@ namespace SHADE
|
|||
renderGraph->AddResource("Scene", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE, SH_RENDER_GRAPH_RESOURCE_FLAGS::SHARED }, windowDims.first, windowDims.second);
|
||||
renderGraph->AddResource("SSAO", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, windowDims.first, windowDims.second, vk::Format::eR8Unorm);
|
||||
renderGraph->AddResource("SSAO Blur", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, windowDims.first, windowDims.second, vk::Format::eR8Unorm);
|
||||
renderGraph->AddResource("Present", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR_PRESENT }, windowDims.first, windowDims.second, vk::Format::eR8Unorm);
|
||||
renderGraph->AddResource("Present", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR_PRESENT }, windowDims.first, windowDims.second);
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
@ -261,10 +277,10 @@ namespace SHADE
|
|||
// Add the pass to generate an image with just SSAO data
|
||||
Handle<SHRenderGraphNodeCompute> ssaoPass = gBufferNode->AddNodeCompute("SSAO", ssaoShader, { "Position", "Normals", "SSAO" });
|
||||
auto ssaoDataBuffer = ssaoStorage->GetBuffer();
|
||||
ssaoPass->ModifyWriteDescBufferComputeResource(SHGraphicsConstants::DescriptorSetIndex::RENDERGRAPH_NODE_COMPUTE_RESOURCE, SHSSAO::DESC_SET_BUFFER_BINDING, { &ssaoDataBuffer, 1 }, 0, ssaoStorage->GetBuffer()->GetSizeStored());
|
||||
ssaoPass->ModifyWriteDescBufferComputeResource(SHSSAO::DESC_SET_BUFFER_BINDING, { &ssaoDataBuffer, 1 }, 0, ssaoStorage->GetBuffer()->GetSizeStored());
|
||||
auto viewSamplerLayout = ssaoStorage->GetViewSamplerLayout();
|
||||
|
||||
ssaoPass->ModifyWriteDescImageComputeResource(SHGraphicsConstants::DescriptorSetIndex::RENDERGRAPH_NODE_COMPUTE_RESOURCE, SHSSAO::DESC_SET_IMAGE_BINDING, { &viewSamplerLayout, 1 });
|
||||
ssaoPass->ModifyWriteDescImageComputeResource(SHSSAO::DESC_SET_IMAGE_BINDING, { &viewSamplerLayout, 1 });
|
||||
ssaoPass->SetRenderer (worldRenderer);
|
||||
|
||||
// Add another pass to blur SSAO
|
||||
|
@ -392,7 +408,7 @@ namespace SHADE
|
|||
|
||||
void SHGraphicsSystem::InitMiddleEnd(void) noexcept
|
||||
{
|
||||
SHPredefinedData::Init(device);
|
||||
SHGraphicsPredefinedData::Init(device);
|
||||
|
||||
InitRenderGraph();
|
||||
|
||||
|
@ -435,7 +451,6 @@ namespace SHADE
|
|||
auto uiNode = renderGraph->GetNode("Screen Space Pass");
|
||||
textRenderingSubSystem->Init(device, uiNode->GetRenderpass(), uiNode->GetSubpass("UI"), descPool, textVS, textFS);
|
||||
|
||||
SHGlobalDescriptorSets::SetStaticGlobalDataDescriptorSet(texLibrary.GetTextureDescriptorSetGroup());
|
||||
SHGlobalDescriptorSets::SetLightingSubSystem(lightingSubSystem);
|
||||
|
||||
}
|
||||
|
@ -844,7 +859,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// Create the renderer
|
||||
auto renderer = resourceManager.Create<SHRenderer>(device, swapchain->GetNumImages(), renderContextCmdPools, descPool);
|
||||
auto renderer = resourceManager.Create<SHRenderer>(device, swapchain->GetNumImages(), descPool, projectionType);
|
||||
|
||||
// Store
|
||||
renderers.emplace_back(renderer);
|
||||
|
@ -989,6 +1004,8 @@ namespace SHADE
|
|||
);
|
||||
device->WaitIdle();
|
||||
graphicsTexCmdBuffer.Free(); graphicsTexCmdBuffer = {};
|
||||
SHGlobalDescriptorSets::SetStaticGlobalDataDescriptorSet(texLibrary.GetTextureDescriptorSetGroup());
|
||||
|
||||
}
|
||||
|
||||
Handle<SHTexture> SHGraphicsSystem::GetTextureHandle(SHTexture::Index textureId) const
|
||||
|
@ -1006,7 +1023,7 @@ namespace SHADE
|
|||
|
||||
void SHGraphicsSystem::BuildFonts(void) noexcept
|
||||
{
|
||||
fontLibrary.BuildFonts(device, graphicsQueue, graphicsCmdPool, descPool, SHPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::FONT)[0], resourceManager);
|
||||
fontLibrary.BuildFonts(device, graphicsQueue, graphicsCmdPool, descPool, SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::FONT)[0], resourceManager);
|
||||
}
|
||||
|
||||
#pragma endregion ADD_REMOVE
|
||||
|
@ -1245,7 +1262,7 @@ namespace SHADE
|
|||
device, SHPipelineLayoutParams
|
||||
{
|
||||
.shaderModules = { (instanced ? debugMeshVertShader : debugVertShader) , debugFragShader },
|
||||
.predefinedDescSetLayouts = SHPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::CAMERA)
|
||||
.predefinedDescSetLayouts = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING).descSetLayouts
|
||||
}
|
||||
);
|
||||
auto pipeline = resourceManager.Create<SHVkPipeline>(device, pipelineLayout, nullptr, renderPass, subpass);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||
#include "SHGraphicsSystem.h"
|
||||
#include "SHMaterialInstance.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -95,9 +97,11 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
Handle<SHShaderBlockInterface> SHMaterial::GetShaderBlockInterface() const noexcept
|
||||
{
|
||||
auto const& mappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||
return pipeline->GetPipelineLayout()->GetShaderBlockInterface
|
||||
(
|
||||
SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
|
||||
mappings.at (SHGraphicsConstants::DescriptorSetTypes::MATERIALS),
|
||||
//SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
|
||||
SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA,
|
||||
vk::ShaderStageFlagBits::eFragment
|
||||
);
|
||||
|
|
|
@ -16,6 +16,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "SHMaterial.h"
|
||||
#include "Graphics/Pipeline/SHVkPipeline.h"
|
||||
#include "Tools/Logger/SHLogger.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -80,7 +81,8 @@ namespace SHADE
|
|||
{
|
||||
return baseMaterial->GetPipeline()->GetPipelineLayout()->GetShaderBlockInterface
|
||||
(
|
||||
SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
|
||||
SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING).at(SHGraphicsConstants::DescriptorSetTypes::MATERIALS),
|
||||
//SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
|
||||
SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA,
|
||||
vk::ShaderStageFlagBits::eFragment
|
||||
);
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace SHADE
|
|||
};
|
||||
|
||||
// Create descriptor set layout
|
||||
offscreenRenderDescSetLayout = logicalDevice->CreateDescriptorSetLayout(0, { imageBinding }, false);
|
||||
offscreenRenderDescSetLayout = logicalDevice->CreateDescriptorSetLayout({ imageBinding }, false);
|
||||
|
||||
// Create descriptor set
|
||||
offscreenRenderDescSet = descriptorPool->Allocate({ offscreenRenderDescSetLayout }, { 1 });
|
||||
|
|
|
@ -21,7 +21,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||
#include "Camera/SHCameraDirector.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ namespace SHADE
|
|||
//for (uint32_t i = 0; i < commandBuffers.size(); ++i)
|
||||
// commandBuffers[i] = cmdPools[i]->RequestCommandBuffer(SH_CMD_BUFFER_TYPE::PRIMARY);
|
||||
|
||||
cameraDescriptorSet = descriptorPool->Allocate(SHPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::CAMERA), { 1 });
|
||||
cameraDescriptorSet = descriptorPool->Allocate(SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::CAMERA), { 1 });
|
||||
|
||||
#ifdef _DEBUG
|
||||
const auto& CAM_DESC_SETS = cameraDescriptorSet->GetVkHandle();
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace SHADE
|
|||
class SHVkCommandBuffer;
|
||||
class SHCamera;
|
||||
class SHVkDescriptorSetGroup;
|
||||
class SHPredefinedData;
|
||||
class SHGraphicsPredefinedData;
|
||||
class SHVkDescriptorPool;
|
||||
class SHVkBuffer;
|
||||
class SHCameraDirector;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "SHpch.h"
|
||||
#include "SHLightingSubSystem.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "Tools/Utilities/SHUtilities.h"
|
||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||
|
@ -320,15 +320,16 @@ namespace SHADE
|
|||
void SHLightingSubSystem::UpdateDescSet(uint32_t binding) noexcept
|
||||
{
|
||||
auto buffer = perTypeData[binding].GetDataBuffer();
|
||||
static constexpr uint32_t LIGHTING_DATA_SET_INDEX = 0;
|
||||
|
||||
// We bind the buffer with the correct desc set binding
|
||||
lightingDataDescSet->ModifyWriteDescBuffer(SHGraphicsConstants::DescriptorSetIndex::DYNAMIC_GLOBALS,
|
||||
lightingDataDescSet->ModifyWriteDescBuffer(LIGHTING_DATA_SET_INDEX,
|
||||
binding + 1, // we want to +1 here because the first binding is reserved for count
|
||||
{ &buffer, 1 },
|
||||
0,
|
||||
perTypeData[binding].GetDataSize() * perTypeData[binding].GetMaxLights());
|
||||
|
||||
lightingDataDescSet->UpdateDescriptorSetBuffer(SHGraphicsConstants::DescriptorSetIndex::DYNAMIC_GLOBALS, binding + 1); // +1 here, same reason. see above
|
||||
lightingDataDescSet->UpdateDescriptorSetBuffer(LIGHTING_DATA_SET_INDEX, binding + 1); // +1 here, same reason. see above
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -385,7 +386,7 @@ namespace SHADE
|
|||
std::fill (variableSizes.begin(), variableSizes.end(), 1);
|
||||
|
||||
// Create the descriptor set
|
||||
lightingDataDescSet = descPool->Allocate({ SHPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::LIGHTS) }, variableSizes);
|
||||
lightingDataDescSet = descPool->Allocate({ SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::LIGHTS) }, variableSizes);
|
||||
#ifdef _DEBUG
|
||||
const auto& CAM_DESC_SETS = lightingDataDescSet->GetVkHandle();
|
||||
for (int i = 0; i < static_cast<int>(CAM_DESC_SETS.size()); ++i)
|
||||
|
@ -408,8 +409,9 @@ namespace SHADE
|
|||
// Create the GPU buffer to hold light count
|
||||
lightCountsBuffer = logicalDevice->CreateBuffer(lightCountsAlignedSize * SHGraphicsConstants::NUM_FRAME_BUFFERS, nullptr, lightCountsAlignedSize * SHGraphicsConstants::NUM_FRAME_BUFFERS, vk::BufferUsageFlagBits::eUniformBuffer, VMA_MEMORY_USAGE_AUTO, VMA_ALLOCATION_CREATE_MAPPED_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT, "Light Count Data");
|
||||
|
||||
lightingDataDescSet->ModifyWriteDescBuffer(SHGraphicsConstants::DescriptorSetIndex::DYNAMIC_GLOBALS, SHGraphicsConstants::DescriptorSetBindings::LIGHTING_COUNT, {&lightCountsBuffer, 1}, 0, sizeof (uint32_t) * NUM_LIGHT_TYPES);
|
||||
lightingDataDescSet->UpdateDescriptorSetBuffer(SHGraphicsConstants::DescriptorSetIndex::DYNAMIC_GLOBALS, SHGraphicsConstants::DescriptorSetBindings::LIGHTING_COUNT);
|
||||
static constexpr uint32_t LIGHTING_DATA_SET_INDEX = 0;
|
||||
lightingDataDescSet->ModifyWriteDescBuffer(LIGHTING_DATA_SET_INDEX, SHGraphicsConstants::DescriptorSetBindings::LIGHTING_COUNT, { &lightCountsBuffer, 1 }, 0, sizeof(uint32_t) * NUM_LIGHT_TYPES);
|
||||
lightingDataDescSet->UpdateDescriptorSetBuffer(LIGHTING_DATA_SET_INDEX, SHGraphicsConstants::DescriptorSetBindings::LIGHTING_COUNT);
|
||||
|
||||
for (uint32_t i = 0; i < SHGraphicsConstants::NUM_FRAME_BUFFERS; ++i)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "SHpch.h"
|
||||
#include "SHPipelineLibrary.h"
|
||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "Graphics/RenderGraph/SHSubpass.h"
|
||||
#include "Graphics/SHVkUtil.h"
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace SHADE
|
|||
SHPipelineLayoutParams params
|
||||
{
|
||||
.shaderModules = {vsFsPair.first, vsFsPair.second},
|
||||
.globalDescSetLayouts = SHPredefinedData::GetBatchingSystemData().descSetLayouts
|
||||
.predefinedDescSetLayouts = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING).descSetLayouts
|
||||
};
|
||||
|
||||
// Create the pipeline layout
|
||||
|
@ -21,7 +21,7 @@ namespace SHADE
|
|||
|
||||
// Create the pipeline and configure the default vertex input state
|
||||
auto newPipeline = logicalDevice->CreateGraphicsPipeline(pipelineLayout, nullptr, renderpass, subpass);
|
||||
newPipeline->GetPipelineState().SetVertexInputState(SHPredefinedData::GetDefaultViState());
|
||||
newPipeline->GetPipelineState().SetVertexInputState(SHGraphicsPredefinedData::GetDefaultViState());
|
||||
|
||||
SHColorBlendState colorBlendState{};
|
||||
colorBlendState.logic_op_enable = VK_FALSE;
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace SHADE
|
|||
class SHVkDescriptorSetLayouts;
|
||||
class SHVkPipeline;
|
||||
class SHSubpass;
|
||||
class SHPredefinedData;
|
||||
class SHGraphicsPredefinedData;
|
||||
|
||||
// Pipeline library is a PURELY MIDDLE END SYSTEM. It is responsible for only creating pipelines from shaders and caching
|
||||
// them so that they don't need to be recreated again.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "SHpch.h"
|
||||
#include "SHFont.h"
|
||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||
#include "Graphics/Images/SHVkSampler.h"
|
||||
|
@ -121,14 +121,15 @@ namespace SHADE
|
|||
descSet = descPool->Allocate({ layout }, { 1 });
|
||||
|
||||
auto viewLayoutSampler = std::make_tuple(bitmapDataImageView, sampler, vk::ImageLayout::eShaderReadOnlyOptimal);
|
||||
descSet->ModifyWriteDescImage(SHGraphicsConstants::DescriptorSetIndex::FONT_DATA, SHGraphicsConstants::DescriptorSetBindings::FONT_BITMAP_DATA, {&viewLayoutSampler, 1});
|
||||
static constexpr uint32_t FONT_DATA_SET_INDEX = 0;
|
||||
descSet->ModifyWriteDescImage(FONT_DATA_SET_INDEX, SHGraphicsConstants::DescriptorSetBindings::FONT_BITMAP_DATA, {&viewLayoutSampler, 1});
|
||||
|
||||
descSet->ModifyWriteDescBuffer(SHGraphicsConstants::DescriptorSetIndex::FONT_DATA,
|
||||
descSet->ModifyWriteDescBuffer(FONT_DATA_SET_INDEX,
|
||||
SHGraphicsConstants::DescriptorSetBindings::FONT_MATRIX_DATA, { &matrixDataBuffer, 1 }, 0, fontAsset.glyphTransformations.size() * sizeof(SHMatrix));
|
||||
|
||||
// Bind image and buffer to desc set.
|
||||
descSet->UpdateDescriptorSetImages(SHGraphicsConstants::DescriptorSetIndex::FONT_DATA, SHGraphicsConstants::DescriptorSetBindings::FONT_BITMAP_DATA);
|
||||
descSet->UpdateDescriptorSetBuffer(SHGraphicsConstants::DescriptorSetIndex::FONT_DATA, SHGraphicsConstants::DescriptorSetBindings::FONT_MATRIX_DATA);
|
||||
descSet->UpdateDescriptorSetImages(FONT_DATA_SET_INDEX, SHGraphicsConstants::DescriptorSetBindings::FONT_BITMAP_DATA);
|
||||
descSet->UpdateDescriptorSetBuffer(FONT_DATA_SET_INDEX, SHGraphicsConstants::DescriptorSetBindings::FONT_MATRIX_DATA);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "Resource/SHHandle.h"
|
||||
#include "msdf-atlas-gen/msdf-atlas-gen.h"
|
||||
#include "Assets/Asset Types/SHFontAsset.h"
|
||||
#include "Graphics/Pipeline/SHPipelineType.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||
#include "Graphics/MiddleEnd/TextRendering/SHFont.h"
|
||||
#include "Graphics/Buffers/SHVkBuffer.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "Graphics/Pipeline/SHVkPipeline.h"
|
||||
#include "Graphics/SHVkUtil.h"
|
||||
#include "Graphics/RenderGraph/SHSubpass.h"
|
||||
|
@ -103,7 +103,7 @@ namespace SHADE
|
|||
SHPipelineLayoutParams plParams
|
||||
{
|
||||
.shaderModules = {textVS, textFS},
|
||||
.predefinedDescSetLayouts = SHPredefinedData::GetTextSystemData().descSetLayouts
|
||||
.predefinedDescSetLayouts = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::TEXT_RENDERING).descSetLayouts
|
||||
};
|
||||
|
||||
pipelineLayout = logicalDevice->CreatePipelineLayout(plParams);
|
||||
|
@ -177,10 +177,10 @@ namespace SHADE
|
|||
void SHTextRenderingSubSystem::Render(Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHRenderer> renderer, uint32_t frameIndex) noexcept
|
||||
{
|
||||
auto& textRendererComps = SHComponentManager::GetDense<SHTextRenderableComponent>();
|
||||
auto const& mappings = SHPredefinedData::GetTextSystemData().descMappings;
|
||||
uint32_t fontSetIndex = mappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::FONT);
|
||||
uint32_t staticGlobalSetIndex = mappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::STATIC_DATA);
|
||||
uint32_t cameraSetIndex = mappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::CAMERA);
|
||||
auto const& mappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::TEXT_RENDERING);
|
||||
uint32_t fontSetIndex = mappings.at(SHGraphicsConstants::DescriptorSetTypes::FONT);
|
||||
uint32_t staticGlobalSetIndex = mappings.at(SHGraphicsConstants::DescriptorSetTypes::STATIC_DATA);
|
||||
uint32_t cameraSetIndex = mappings.at(SHGraphicsConstants::DescriptorSetTypes::CAMERA);
|
||||
|
||||
for (auto& comp : textRendererComps)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace SHADE
|
|||
class SHVkRenderpass;
|
||||
class SHSubpass;
|
||||
class SHVkShaderModule;
|
||||
class SHRenderer;
|
||||
|
||||
class SHTextRenderingSubSystem
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
||||
#include "Graphics/Images/SHVkImage.h"
|
||||
#include "Graphics/Images/SHVkImageView.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "Assets/Asset Types/SHTextureAsset.h"
|
||||
|
||||
namespace SHADE
|
||||
|
@ -168,22 +168,23 @@ namespace SHADE
|
|||
}
|
||||
texDescriptors = descPool->Allocate
|
||||
(
|
||||
{ SHPredefinedData::GetPredefinedDescSetLayouts()[SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS] },
|
||||
{ SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsConstants::PredefinedDescSetLayoutTypes::STATIC_DATA) },
|
||||
{ static_cast<uint32_t>(texOrder.size()) }
|
||||
);
|
||||
#ifdef _DEBUG
|
||||
for (auto set : texDescriptors->GetVkHandle())
|
||||
SET_VK_OBJ_NAME(device, vk::ObjectType::eDescriptorSet, set, "[Descriptor Set] Static Globals");
|
||||
#endif
|
||||
static constexpr uint32_t TEX_DESCRIPTOR_SET_INDEX = 0;
|
||||
texDescriptors->ModifyWriteDescImage
|
||||
(
|
||||
SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS,
|
||||
TEX_DESCRIPTOR_SET_INDEX,
|
||||
SHGraphicsConstants::DescriptorSetBindings::IMAGE_AND_SAMPLERS_DATA,
|
||||
combinedImageSamplers
|
||||
);
|
||||
texDescriptors->UpdateDescriptorSetImages
|
||||
(
|
||||
SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS,
|
||||
TEX_DESCRIPTOR_SET_INDEX,
|
||||
SHGraphicsConstants::DescriptorSetBindings::IMAGE_AND_SAMPLERS_DATA
|
||||
);
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ namespace SHADE
|
|||
// 1 descriptor set layout for every descriptor set detected.
|
||||
for (auto const& set : setsWithBindings)
|
||||
{
|
||||
auto newDescriptorSetLayout = logicalDeviceHdl->CreateDescriptorSetLayout(set.first, set.second);
|
||||
auto newDescriptorSetLayout = logicalDeviceHdl->CreateDescriptorSetLayout(set.second);
|
||||
descriptorSetLayoutsAllocate.push_back(newDescriptorSetLayout);
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ namespace SHADE
|
|||
, logicalDeviceHdl {inLogicalDeviceHdl}
|
||||
, pushConstantInterface{}
|
||||
, vkPcRanges{}
|
||||
, descriptorSetLayoutsGlobal{pipelineLayoutParams.globalDescSetLayouts } // do a copy, some other pipeline layout might need this
|
||||
, descriptorSetLayoutsGlobal{pipelineLayoutParams.predefinedDescSetLayouts } // do a copy, some other pipeline layout might need this
|
||||
, descriptorSetLayoutsAllocate{}
|
||||
, vkDescriptorSetLayoutsAllocate{}
|
||||
, descriptorSetLayoutsPipeline{}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "SHRenderGraphStorage.h"
|
||||
#include "Graphics/RenderGraph/SHRenderGraphNodeCompute.h"
|
||||
#include "Tools/Utilities/SHUtilities.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "Graphics/RenderGraph/SHRenderToSwapchainImageSystem.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGlobalDescriptorSets.h"
|
||||
|
||||
|
@ -578,7 +578,8 @@ namespace SHADE
|
|||
uint32_t h = static_cast<uint32_t>(resource->GetHeight());
|
||||
cmdBuffer->SetViewportScissor(static_cast<float>(w), static_cast<float>(h), w, h);
|
||||
|
||||
newSubpass->BindDescriptorInputDescriptorSets (cmdBuffer, frameIndex);
|
||||
static constexpr uint32_t INPUT_IMAGE_SET_INDEX = 0;
|
||||
newSubpass->BindInputDescriptorSets (cmdBuffer, INPUT_IMAGE_SET_INDEX, frameIndex);
|
||||
|
||||
// draw a quad.
|
||||
cmdBuffer->DrawArrays(4, 1, 0, 0);
|
||||
|
@ -634,16 +635,18 @@ namespace SHADE
|
|||
auto cmdBuffer = commandBuffers[frameIndex];
|
||||
cmdBuffer->BeginLabeledSegment(name);
|
||||
|
||||
// Force bind pipeline layout
|
||||
cmdBuffer->ForceSetPipelineLayout(SHPredefinedData::GetBatchingSystemData().dummyPipelineLayout, SH_PIPELINE_TYPE::GRAPHICS);
|
||||
cmdBuffer->ForceSetPipelineLayout(SHPredefinedData::GetBatchingSystemData().dummyPipelineLayout, SH_PIPELINE_TYPE::COMPUTE);
|
||||
auto batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||
|
||||
auto const& descMappings = SHPredefinedData::GetBatchingSystemData().descMappings;
|
||||
// Force bind pipeline layout
|
||||
cmdBuffer->ForceSetPipelineLayout(batchingSystemData.dummyPipelineLayout, SH_PIPELINE_TYPE::GRAPHICS);
|
||||
cmdBuffer->ForceSetPipelineLayout(batchingSystemData.dummyPipelineLayout, SH_PIPELINE_TYPE::COMPUTE);
|
||||
|
||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||
|
||||
for (auto& node : nodes)
|
||||
{
|
||||
// bind static global data
|
||||
SHGlobalDescriptorSets::BindStaticGlobalData(cmdBuffer, SH_PIPELINE_TYPE::GRAPHICS, descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::STATIC_DATA));
|
||||
SHGlobalDescriptorSets::BindStaticGlobalData(cmdBuffer, SH_PIPELINE_TYPE::GRAPHICS, descMappings.at(SHGraphicsConstants::DescriptorSetTypes::STATIC_DATA));
|
||||
|
||||
node->Execute(cmdBuffer, descPool, frameIndex);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace SHADE
|
|||
class SHVkCommandPool;
|
||||
class SHVkCommandBuffer;
|
||||
class SHRenderGraphNode;
|
||||
class SHPredefinedData;
|
||||
class SHGraphicsPredefinedData;
|
||||
class SHVkDescriptorPool;
|
||||
class SHRenderGraphStorage;
|
||||
class SHRenderToSwapchainImageSystem;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "Graphics/RenderGraph/SHRenderGraphNodeCompute.h"
|
||||
#include "Graphics/SHVkUtil.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGlobalDescriptorSets.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -351,16 +351,18 @@ namespace SHADE
|
|||
|
||||
commandBuffer->EndRenderpass();
|
||||
|
||||
auto const& descMappings = SHPredefinedData::GetBatchingSystemData().descMappings;
|
||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::RENDER_GRAPH_NODE_COMPUTE);
|
||||
|
||||
// We bind these 2 descriptor sets here because they apply to all node computes
|
||||
if (!nodeComputes.empty())
|
||||
{
|
||||
commandBuffer->ForceSetPipelineLayout(SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::RENDER_GRAPH_NODE_COMPUTE).dummyPipelineLayout, SH_PIPELINE_TYPE::COMPUTE);
|
||||
|
||||
// bind static global data
|
||||
SHGlobalDescriptorSets::BindStaticGlobalData(commandBuffer, SH_PIPELINE_TYPE::COMPUTE, descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::STATIC_DATA));
|
||||
SHGlobalDescriptorSets::BindStaticGlobalData(commandBuffer, SH_PIPELINE_TYPE::COMPUTE, descMappings.at(SHGraphicsConstants::DescriptorSetTypes::STATIC_DATA));
|
||||
|
||||
// bind lighting data
|
||||
SHGlobalDescriptorSets::BindLightingData(commandBuffer, SH_PIPELINE_TYPE::COMPUTE, descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::LIGHTS), frameIndex);
|
||||
SHGlobalDescriptorSets::BindLightingData(commandBuffer, SH_PIPELINE_TYPE::COMPUTE, descMappings.at(SHGraphicsConstants::DescriptorSetTypes::LIGHTS), frameIndex);
|
||||
}
|
||||
|
||||
// Execute all subpass computes
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace SHADE
|
|||
class SHVkLogicalDevice;
|
||||
class SHVkRenderpass;
|
||||
class SHVkDescriptorPool;
|
||||
class SHPredefinedData;
|
||||
class SHGraphicsPredefinedData;
|
||||
class SHRenderGraphStorage;
|
||||
class SHRenderGraphNodeCompute;
|
||||
class SHRenderer;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "Graphics/Descriptors/SHVkDescriptorSetLayout.h"
|
||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||
#include "Graphics/Pipeline/SHVkPipelineLayout.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "SHRenderGraphStorage.h"
|
||||
#include "SHRenderGraphResource.h"
|
||||
#include "Graphics/Commands/SHVkCommandBuffer.h"
|
||||
|
@ -29,7 +29,7 @@ namespace SHADE
|
|||
SHPipelineLayoutParams pipelineLayoutParams
|
||||
{
|
||||
.shaderModules = {computeShaderModule},
|
||||
.predefinedDescSetLayouts = SHPredefinedData::GetRenderGraphNodeComputeData().descSetLayouts,
|
||||
.predefinedDescSetLayouts = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::RENDER_GRAPH_NODE_COMPUTE).descSetLayouts,
|
||||
.dynamicBufferBindings = std::move(dynamicBufferBindings),
|
||||
};
|
||||
|
||||
|
@ -47,13 +47,13 @@ namespace SHADE
|
|||
// save the resources
|
||||
resources = std::move (subpassComputeResources);
|
||||
|
||||
auto const& descMappings = SHPredefinedData::GetRenderGraphNodeComputeData().descMappings;
|
||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::RENDER_GRAPH_NODE_COMPUTE);
|
||||
auto const& layouts = computePipeline->GetPipelineLayout()->GetDescriptorSetLayoutsPipeline();
|
||||
|
||||
|
||||
//Get the descriptor set layouts required to allocate. We only want the ones for allocate because
|
||||
//global descriptors are already bound in the main system.
|
||||
auto const& graphResourceLayout = layouts[descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_RESOURCE)];
|
||||
auto const& graphResourceLayout = layouts[descMappings.at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_RESOURCE)];
|
||||
|
||||
// Allocate descriptor sets to hold the images for reading (STORAGE_IMAGE)
|
||||
for (uint32_t i = 0; i < SHGraphicsConstants::NUM_FRAME_BUFFERS; ++i)
|
||||
|
@ -66,11 +66,11 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// check if all layouts are there
|
||||
if (layouts.size() == descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE) + 1)
|
||||
if (layouts.size() == descMappings.at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE) + 1)
|
||||
{
|
||||
// create compute resources
|
||||
computeResource = graphStorage->resourceHub->Create<ComputeResource>();
|
||||
auto computeResourceLayout = layouts[descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE)];
|
||||
auto computeResourceLayout = layouts[descMappings.at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE)];
|
||||
computeResource->descSet = graphStorage->descriptorPool->Allocate({ computeResourceLayout }, { 1 });
|
||||
#ifdef _DEBUG
|
||||
for (auto set : computeResource->descSet->GetVkHandle())
|
||||
|
@ -94,21 +94,21 @@ namespace SHADE
|
|||
// bind the compute pipeline
|
||||
cmdBuffer->BindPipeline(computePipeline);
|
||||
|
||||
auto const& descMappings = SHPredefinedData::GetRenderGraphNodeComputeData().descMappings;
|
||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::RENDER_GRAPH_NODE_COMPUTE);
|
||||
|
||||
|
||||
// bind render graph resource
|
||||
cmdBuffer->BindDescriptorSet(graphResourceDescSets[frameIndex], SH_PIPELINE_TYPE::COMPUTE, descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_RESOURCE), {});
|
||||
cmdBuffer->BindDescriptorSet(graphResourceDescSets[frameIndex], SH_PIPELINE_TYPE::COMPUTE, descMappings.at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_RESOURCE), {});
|
||||
|
||||
// bind compute resource
|
||||
if (computeResource)
|
||||
{
|
||||
cmdBuffer->BindDescriptorSet(computeResource->descSet, SH_PIPELINE_TYPE::COMPUTE, descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE), computeResource->dynamicOffsets[frameIndex]);
|
||||
cmdBuffer->BindDescriptorSet(computeResource->descSet, SH_PIPELINE_TYPE::COMPUTE, descMappings.at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_NODE_COMPUTE_RESOURCE), computeResource->dynamicOffsets[frameIndex]);
|
||||
}
|
||||
|
||||
// bind camera data
|
||||
if (renderer)
|
||||
renderer->BindDescriptorSet (cmdBuffer, SH_PIPELINE_TYPE::COMPUTE, descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::CAMERA), frameIndex);
|
||||
renderer->BindDescriptorSet (cmdBuffer, SH_PIPELINE_TYPE::COMPUTE, descMappings.at(SHGraphicsConstants::DescriptorSetTypes::CAMERA), frameIndex);
|
||||
|
||||
// dispatch compute
|
||||
cmdBuffer->ComputeDispatch(groupSizeX, groupSizeY, 1);
|
||||
|
@ -120,11 +120,14 @@ namespace SHADE
|
|||
|
||||
void SHRenderGraphNodeCompute::HandleResize(void) noexcept
|
||||
{
|
||||
auto const& descMappings = SHPredefinedData::GetRenderGraphNodeComputeData().descMappings;
|
||||
uint32_t renderGraphResourceSetIndex = descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_RESOURCE);
|
||||
// We need to get from mappings because we want the introspected layout from the vector of layouts (of which the first few are predefined)
|
||||
uint32_t RENDER_GRAPH_RESOURCE_SET_INDEX = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::RENDER_GRAPH_NODE_COMPUTE).at (SHGraphicsConstants::DescriptorSetTypes::RENDER_GRAPH_RESOURCE);
|
||||
|
||||
// Since the descriptor set is standalone, the index we want to use is not the one in the shaders, it should always be 0.
|
||||
uint32_t RENDER_GRAPH_RESOURCE_UPDATE_SET_INDEX = 0;
|
||||
|
||||
// Get the layout for the render graph resource. We can index it this way because the container returned is a container of layouts that includes the global ones
|
||||
auto pipelineDescSetLayouts = computePipeline->GetPipelineLayout()->GetDescriptorSetLayoutsPipeline()[renderGraphResourceSetIndex];
|
||||
auto pipelineDescSetLayouts = computePipeline->GetPipelineLayout()->GetDescriptorSetLayoutsPipeline()[RENDER_GRAPH_RESOURCE_SET_INDEX];
|
||||
|
||||
// everything below here needs resizing
|
||||
for (uint32_t frameIndex = 0; frameIndex < SHGraphicsConstants::NUM_FRAME_BUFFERS; ++frameIndex)
|
||||
|
@ -137,8 +140,8 @@ namespace SHADE
|
|||
uint32_t imageIndex = (resources[i]->resourceTypeFlags & static_cast<uint32_t>(SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR_PRESENT)) ? frameIndex : 0;
|
||||
|
||||
SHVkDescriptorSetGroup::viewSamplerLayout vsl = std::make_tuple(resources[i]->GetImageView(imageIndex), Handle<SHVkSampler>{}, vk::ImageLayout::eGeneral);
|
||||
graphResourceDescSets[frameIndex]->ModifyWriteDescImage(renderGraphResourceSetIndex, binding.BindPoint, { &vsl, 1 });
|
||||
graphResourceDescSets[frameIndex]->UpdateDescriptorSetImages(renderGraphResourceSetIndex, binding.BindPoint);
|
||||
graphResourceDescSets[frameIndex]->ModifyWriteDescImage(RENDER_GRAPH_RESOURCE_UPDATE_SET_INDEX, binding.BindPoint, { &vsl, 1 });
|
||||
graphResourceDescSets[frameIndex]->UpdateDescriptorSetImages(RENDER_GRAPH_RESOURCE_UPDATE_SET_INDEX, binding.BindPoint);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
@ -200,16 +203,19 @@ namespace SHADE
|
|||
renderer = inRenderer;
|
||||
}
|
||||
|
||||
void SHRenderGraphNodeCompute::ModifyWriteDescBufferComputeResource(uint32_t set, uint32_t binding, std::span<Handle<SHVkBuffer>> const& buffers, uint32_t offset, uint32_t range) noexcept
|
||||
void SHRenderGraphNodeCompute::ModifyWriteDescBufferComputeResource(uint32_t binding, std::span<Handle<SHVkBuffer>> const& buffers, uint32_t offset, uint32_t range) noexcept
|
||||
{
|
||||
computeResource->descSet->ModifyWriteDescBuffer(set, binding, buffers, offset, range);
|
||||
computeResource->descSet->UpdateDescriptorSetBuffer(set, binding);
|
||||
static constexpr uint32_t COMPUTE_RESOURCE_SET_INDEX = 0;
|
||||
|
||||
computeResource->descSet->ModifyWriteDescBuffer(COMPUTE_RESOURCE_SET_INDEX, binding, buffers, offset, range);
|
||||
computeResource->descSet->UpdateDescriptorSetBuffer(COMPUTE_RESOURCE_SET_INDEX, binding);
|
||||
}
|
||||
|
||||
void SHRenderGraphNodeCompute::ModifyWriteDescImageComputeResource(uint32_t set, uint32_t binding, std::span<SHVkDescriptorSetGroup::viewSamplerLayout> const& viewSamplerLayouts) noexcept
|
||||
void SHRenderGraphNodeCompute::ModifyWriteDescImageComputeResource(uint32_t binding, std::span<SHVkDescriptorSetGroup::viewSamplerLayout> const& viewSamplerLayouts) noexcept
|
||||
{
|
||||
computeResource->descSet->ModifyWriteDescImage(set, binding, viewSamplerLayouts);
|
||||
computeResource->descSet->UpdateDescriptorSetImages(set, binding);
|
||||
static constexpr uint32_t COMPUTE_RESOURCE_SET_INDEX = 0;
|
||||
computeResource->descSet->ModifyWriteDescImage(COMPUTE_RESOURCE_SET_INDEX, binding, viewSamplerLayouts);
|
||||
computeResource->descSet->UpdateDescriptorSetImages(COMPUTE_RESOURCE_SET_INDEX, binding);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -82,8 +82,8 @@ namespace SHADE
|
|||
void SetDynamicOffsets (std::span<uint32_t> perFrameSizes) noexcept;
|
||||
void SetRenderer (Handle<SHRenderer> inRenderer) noexcept;
|
||||
|
||||
void ModifyWriteDescBufferComputeResource (uint32_t set, uint32_t binding, std::span<Handle<SHVkBuffer>> const& buffers, uint32_t offset, uint32_t range) noexcept;
|
||||
void ModifyWriteDescImageComputeResource(uint32_t set, uint32_t binding, std::span<SHVkDescriptorSetGroup::viewSamplerLayout> const& viewSamplerLayouts) noexcept;
|
||||
void ModifyWriteDescBufferComputeResource (uint32_t binding, std::span<Handle<SHVkBuffer>> const& buffers, uint32_t offset, uint32_t range) noexcept;
|
||||
void ModifyWriteDescImageComputeResource(uint32_t binding, std::span<SHVkDescriptorSetGroup::viewSamplerLayout> const& viewSamplerLayouts) noexcept;
|
||||
|
||||
|
||||
friend class SHRenderGraph;
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace SHADE
|
|||
{
|
||||
class SHVkLogicalDevice;
|
||||
class SHVkSwapchain;
|
||||
class SHPredefinedData;
|
||||
class SHGraphicsPredefinedData;
|
||||
class SHVkDescriptorPool;
|
||||
class SHRenderGraphResource;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "SHpch.h"
|
||||
#include "SHRenderToSwapchainImageSystem.h"
|
||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
#include "Graphics/RenderGraph/SHRenderGraphNode.h"
|
||||
#include "Graphics/RenderGraph/SHSubpass.h"
|
||||
#include "Graphics/SHVkUtil.h"
|
||||
|
@ -24,7 +24,7 @@ namespace SHADE
|
|||
auto pipelineLayout = logicalDevice->CreatePipelineLayout(SHPipelineLayoutParams
|
||||
{
|
||||
.shaderModules = {shaderModules.first, shaderModules.second},
|
||||
.predefinedDescSetLayouts = SHPredefinedData::GetBatchingSystemData().descSetLayouts
|
||||
.predefinedDescSetLayouts = {}
|
||||
});
|
||||
|
||||
pipeline = logicalDevice->CreateGraphicsPipeline(pipelineLayout, nullptr, renderGraphNode->GetRenderpass(), subpass);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "SHRenderGraphResource.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHViewport.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHRenderer.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHPredefinedData.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -224,10 +224,10 @@ namespace SHADE
|
|||
commandBuffer->SetViewportScissor(static_cast<float>(w), static_cast<float>(h), w, h);
|
||||
}
|
||||
|
||||
auto const& descMappings = SHPredefinedData::GetBatchingSystemData().descMappings;
|
||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||
|
||||
if (renderer)
|
||||
renderer->BindDescriptorSet(commandBuffer, SH_PIPELINE_TYPE::GRAPHICS, descMappings.GetMappings().at(SHGraphicsConstants::DescriptorSetTypes::CAMERA), frameIndex);
|
||||
renderer->BindDescriptorSet(commandBuffer, SH_PIPELINE_TYPE::GRAPHICS, descMappings.at(SHGraphicsConstants::DescriptorSetTypes::CAMERA), frameIndex);
|
||||
|
||||
// Draw all the batches
|
||||
superBatch->Draw(commandBuffer, frameIndex);
|
||||
|
@ -245,11 +245,11 @@ namespace SHADE
|
|||
UpdateWriteDescriptors();
|
||||
}
|
||||
|
||||
void SHSubpass::BindDescriptorInputDescriptorSets(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) const noexcept
|
||||
void SHSubpass::BindInputDescriptorSets(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t setIndex, uint32_t frameIndex) const noexcept
|
||||
{
|
||||
if (!inputImageDescriptorSets.empty())
|
||||
{
|
||||
cmdBuffer->BindDescriptorSet(inputImageDescriptorSets[frameIndex], SH_PIPELINE_TYPE::GRAPHICS, SHGraphicsConstants::DescriptorSetIndex::RENDERGRAPH_RESOURCE, { });
|
||||
cmdBuffer->BindDescriptorSet(inputImageDescriptorSets[frameIndex], SH_PIPELINE_TYPE::GRAPHICS, setIndex, { });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,8 +356,13 @@ namespace SHADE
|
|||
|
||||
// Update descriptor sets
|
||||
auto args = std::make_tuple(resource->GetImageView(viewIndex), inputSamplers[i], descriptorLayout);
|
||||
group->ModifyWriteDescImage(SHGraphicsConstants::DescriptorSetIndex::RENDERGRAPH_RESOURCE, binding.BindPoint, std::span{&args, 1});
|
||||
group->UpdateDescriptorSetImages(SHGraphicsConstants::DescriptorSetIndex::RENDERGRAPH_RESOURCE, binding.BindPoint);
|
||||
|
||||
|
||||
// Since the descriptor set is standalone, the index we want to use is not the one in the shaders, it should always be 0.
|
||||
uint32_t RENDER_GRAPH_RESOURCE_SET_INDEX = 0;
|
||||
|
||||
group->ModifyWriteDescImage(RENDER_GRAPH_RESOURCE_SET_INDEX, binding.BindPoint, std::span{&args, 1});
|
||||
group->UpdateDescriptorSetImages(RENDER_GRAPH_RESOURCE_SET_INDEX, binding.BindPoint);
|
||||
}
|
||||
|
||||
++i;
|
||||
|
|
|
@ -121,7 +121,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 BindInputDescriptorSets (Handle<SHVkCommandBuffer> cmdBuffer, uint32_t setIndex, uint32_t frameIndex) const noexcept;
|
||||
|
||||
void Init(SHResourceHub& resourceManager) noexcept;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "ECS_Base/Managers/SHComponentManager.h"
|
||||
#include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h"
|
||||
#include "Tools/Logger/SHLog.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsPredefinedData.h"
|
||||
|
||||
|
||||
namespace SHADE
|
||||
|
@ -264,7 +265,8 @@ namespace SHADE
|
|||
if(spec.properties.IsDefined())
|
||||
{
|
||||
auto fragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(spec.fragShader);
|
||||
auto interface = fragShader->GetReflectedData().GetDescriptorBindingInfo().GetShaderBlockInterface(SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE, SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA);
|
||||
auto const& mappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||
auto interface = fragShader->GetReflectedData().GetDescriptorBindingInfo().GetShaderBlockInterface(mappings.at(SHGraphicsConstants::DescriptorSetTypes::MATERIALS), SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA);
|
||||
int const varCount = static_cast<int>(interface->GetVariableCount());
|
||||
|
||||
for (int i = 0; i < varCount; ++i)
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
template<typename BitType>
|
||||
class SHEnumWrapper
|
||||
{
|
||||
public:
|
||||
using UnderlyingType = typename std::underlying_type_t<BitType>;
|
||||
|
||||
private:
|
||||
UnderlyingType mask;
|
||||
|
||||
public:
|
||||
|
||||
constexpr SHEnumWrapper(void) noexcept
|
||||
: mask{ 0 }
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
constexpr SHEnumWrapper(BitType bit) noexcept
|
||||
: mask{ static_cast<UnderlyingType>(bit) }
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
constexpr SHEnumWrapper(SHEnumWrapper<BitType> const& rhs) noexcept = default;
|
||||
constexpr SHEnumWrapper& operator= (SHEnumWrapper<BitType> const& rhs) noexcept = default;
|
||||
|
||||
constexpr explicit SHEnumWrapper(UnderlyingType flags) noexcept
|
||||
: mask{ flags }
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
constexpr SHEnumWrapper<BitType> operator| (SHEnumWrapper<BitType> const& rhs) const noexcept
|
||||
{
|
||||
return static_cast<SHEnumWrapper<BitType>> (mask | rhs.mask);
|
||||
};
|
||||
|
||||
constexpr SHEnumWrapper<BitType> operator& (SHEnumWrapper<BitType> const& rhs) const noexcept
|
||||
{
|
||||
return static_cast<SHEnumWrapper<BitType>> (mask & rhs.mask);
|
||||
};
|
||||
|
||||
constexpr operator UnderlyingType() const noexcept
|
||||
{
|
||||
return mask;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>>
|
||||
inline BitType operator|(const BitType& left, const BitType& right)
|
||||
{
|
||||
return static_cast<BitType>(static_cast<int>(left) | static_cast<int>(right));
|
||||
}
|
||||
|
||||
template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>>
|
||||
inline BitType operator&(const BitType& left, const BitType& right)
|
||||
{
|
||||
return static_cast<BitType>(static_cast<int>(left) & static_cast<int>(right));
|
||||
}
|
||||
|
||||
}
|
|
@ -43,73 +43,6 @@ namespace SHADE
|
|||
static constexpr OutputType ConvertEnum(InputType enumClassMember) noexcept;
|
||||
};
|
||||
|
||||
template<typename BitType>
|
||||
class SHEnumWrapper
|
||||
{
|
||||
public:
|
||||
using UnderlyingType = typename std::underlying_type_t<BitType>;
|
||||
|
||||
private:
|
||||
UnderlyingType mask;
|
||||
|
||||
public:
|
||||
|
||||
constexpr SHEnumWrapper(void) noexcept
|
||||
: mask{ 0 }
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
constexpr SHEnumWrapper(BitType bit) noexcept
|
||||
: mask{ static_cast<UnderlyingType>(bit) }
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
constexpr SHEnumWrapper(SHEnumWrapper<BitType> const& rhs) noexcept = default;
|
||||
constexpr SHEnumWrapper& operator= (SHEnumWrapper<BitType> const& rhs) noexcept = default;
|
||||
|
||||
constexpr explicit SHEnumWrapper(UnderlyingType flags) noexcept
|
||||
: mask{ flags }
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
constexpr SHEnumWrapper<BitType> operator| (SHEnumWrapper<BitType> const& rhs) const noexcept
|
||||
{
|
||||
return static_cast<SHEnumWrapper<BitType>> (mask | rhs.mask);
|
||||
};
|
||||
|
||||
constexpr SHEnumWrapper<BitType> operator& (SHEnumWrapper<BitType> const& rhs) const noexcept
|
||||
{
|
||||
return static_cast<SHEnumWrapper<BitType>> (mask & rhs.mask);
|
||||
};
|
||||
|
||||
constexpr operator UnderlyingType() const noexcept
|
||||
{
|
||||
return mask;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>>
|
||||
inline BitType operator|(const BitType& left, const BitType& right)
|
||||
{
|
||||
return static_cast<BitType>(static_cast<int>(left) | static_cast<int>(right));
|
||||
}
|
||||
|
||||
template<typename BitType, typename = std::enable_if_t<std::is_enum_v<BitType>>>
|
||||
inline BitType operator&(const BitType& left, const BitType& right)
|
||||
{
|
||||
return static_cast<BitType>(static_cast<int>(left) & static_cast<int>(right));
|
||||
}
|
||||
|
||||
template <typename EnumType>
|
||||
std::ostream& operator<<(std::ostream& os, EnumType const& type)
|
||||
{
|
||||
os << static_cast<EnumType::UnderlyingType>(type);
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace SHADE
|
||||
|
||||
#include "SHUtilities.hpp"
|
||||
|
|
Loading…
Reference in New Issue