Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Nov 20, 2023
1 parent 1e7ab5d commit f4212e6
Show file tree
Hide file tree
Showing 28 changed files with 653 additions and 4,198 deletions.
15 changes: 4 additions & 11 deletions Plugins/CodeGenerator/src/Editor/UBOEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,15 +673,13 @@ std::string UBOEditor::Get_Create_Header(const std::string& vRendererType, const
m_@UBO_NAME@_BufferInfos.buffer = m_@UBO_NAME@_Ptr->buffer;
m_@UBO_NAME@_BufferInfos.range = sizeof(@UBO_NAME@);
m_@UBO_NAME@_BufferInfos.offset = 0;
}
)";
})";
ct::replaceString(res, "@UBO_NAME@", "UBO_" + (vUboIndex < 0 ? "" : ct::toStr(vUboIndex) + "_") + m_Stage);
return res;
}

std::string UBOEditor::Get_Upload_Header(const std::string& vRendererType, const int32_t& vUboIndex) {
m_Stage = UBOEditors::m_StageArray[vRendererType][m_InputStageIndex];

std::string res =
u8R"(
VulkanRessource::upload(m_VulkanCorePtr, m_@UBO_NAME@_Ptr, &m_@UBO_NAME@, sizeof(@UBO_NAME@));)";
Expand All @@ -691,12 +689,10 @@ std::string UBOEditor::Get_Upload_Header(const std::string& vRendererType, const

std::string UBOEditor::Get_Destroy_Header(const std::string& vRendererType, const int32_t& vUboIndex) {
m_Stage = UBOEditors::m_StageArray[vRendererType][m_InputStageIndex];

std::string res =
u8R"(
m_@UBO_NAME@_Ptr.reset();
m_@UBO_NAME@_BufferInfos = vk::DescriptorBufferInfo{ VK_NULL_HANDLE, 0, VK_WHOLE_SIZE };
)";
m_@UBO_NAME@_BufferInfos = vk::DescriptorBufferInfo{ VK_NULL_HANDLE, 0, VK_WHOLE_SIZE };)";
ct::replaceString(res, "@UBO_NAME@", "UBO_" + (vUboIndex < 0 ? "" : ct::toStr(vUboIndex) + "_") + m_Stage);
return res;
}
Expand Down Expand Up @@ -905,7 +901,6 @@ std::string UBOEditors::Get_Widgets_Header() {
if (!res.empty()) {
res +=
u8R"(
if (change) {
NeedNewUBOUpload();
})";
Expand Down Expand Up @@ -947,8 +942,7 @@ std::string UBOEditors::Get_Cpp_Functions_Imp(const bool& vIsAnEffect) {
u8R"(
bool PASS_CLASS_NAME::CreateUBO() {
ZoneScoped;
)";
ZoneScoped;)";

res += Get_Create_Header();

Expand Down Expand Up @@ -980,8 +974,7 @@ void PASS_CLASS_NAME::UploadUBO() {
res +=
u8R"(
void PASS_CLASS_NAME::DestroyUBO() {
ZoneScoped;
)";
ZoneScoped;)";

res += Get_Destroy_Header();

Expand Down
4 changes: 2 additions & 2 deletions Plugins/CodeGenerator/src/Headers/CodeGeneratorBuild.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define CodeGenerator_Prefix "CodeGenerator"
#define CodeGenerator_BuildNumber 634
#define CodeGenerator_BuildNumber 644
#define CodeGenerator_MinorNumber 0
#define CodeGenerator_MajorNumber 0
#define CodeGenerator_BuildId "0.0.634"
#define CodeGenerator_BuildId "0.0.644"
29 changes: 13 additions & 16 deletions Plugins/CodeGenerator/src/Modules/GeneratorNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,8 @@ void PASS_CLASS_NAME::DrawModel(vk::CommandBuffer * vCmdBufferPtr, const int& vI
if (vCmdBufferPtr) {
auto modelPtr = m_SceneModel.lock();
if (!modelPtr || modelPtr->empty()) return;
vCmdBufferPtr->bindPipeline(vk::PipelineBindPoint::eGraphics, m_Pipelines[0].m_Pipeline);
{
//VKFPScoped(*vCmdBufferPtr, "MODULE_DISPLAY_NAME", "DrawModel");
VKFPScoped(*vCmdBufferPtr, "MODULE_DISPLAY_NAME", "DrawModel");
vCmdBufferPtr->bindPipeline(vk::PipelineBindPoint::eGraphics, m_Pipelines[0].m_Pipeline);
vCmdBufferPtr->bindDescriptorSets(vk::PipelineBindPoint::eGraphics, m_Pipelines[0].m_PipelineLayout, 0, m_DescriptorSets[0].m_DescriptorSet, nullptr);
for (auto meshPtr : *modelPtr) {
if (meshPtr != nullptr) {
Expand All @@ -783,7 +782,6 @@ void PASS_CLASS_NAME::DrawModel(vk::CommandBuffer * vCmdBufferPtr, const int& vI
}
}
}
}
}
}
)";
Expand All @@ -796,13 +794,11 @@ void PASS_CLASS_NAME::DrawModel(vk::CommandBuffer * vCmdBufferPtr, const int& vI
u8R"(
void PASS_CLASS_NAME::Compute(vk::CommandBuffer* vCmdBufferPtr, const int& vIterationNumber) {
if (vCmdBufferPtr) {
VKFPScoped(*vCmdBufferPtr, "MODULE_DISPLAY_NAME", "Compute");
vCmdBufferPtr->bindPipeline(vk::PipelineBindPoint::eCompute, m_Pipelines[0].m_Pipeline);
{
//VKFPScoped(*vCmdBufferPtr, "MODULE_DISPLAY_NAME", "Compute");
vCmdBufferPtr->bindDescriptorSets(vk::PipelineBindPoint::eCompute, m_Pipelines[0].m_PipelineLayout, 0, m_DescriptorSets[0].m_DescriptorSet, nullptr);
for (uint32_t iter = 0; iter < m_CountIterations.w; iter++) {
Dispatch(vCmdBufferPtr);
}
vCmdBufferPtr->bindDescriptorSets(vk::PipelineBindPoint::eCompute, m_Pipelines[0].m_PipelineLayout, 0, m_DescriptorSets[0].m_DescriptorSet, nullptr);
for (uint32_t iter = 0; iter < m_CountIterations.w; iter++) {
Dispatch(vCmdBufferPtr);
}
}
}
Expand Down Expand Up @@ -962,19 +958,17 @@ std::string GeneratorNode::GetGlslHeader(const std::string& vStage, const bool&
res += CommonSystem::GetBufferObjectStructureHeader(bindingStartIndex++);
}
res += m_UBOEditors.Get_Glsl_Header("Comp", m_IsAnEffect, bindingStartIndex);
res += "\n";
for (const auto& input : m_Inputs) {
if (input.second != nullptr) {
if (input.second->slotType == "TEXTURE_2D") {
std::string _name = ct::toLower(input.second->name);
ct::replaceString(_name, " ", "_");
res += ct::toStr("layout(binding = %u) uniform sampler2D input_%s_map;\n", bindingStartIndex++, _name.c_str());
res += ct::toStr("\nlayout(binding = %u) uniform sampler2D input_%s_map;", bindingStartIndex++, _name.c_str());
}
}
}
res += "\n";
if (vStage == "Comp" && m_RendererType == RENDERER_TYPE_COMPUTE_2D) {
res += ct::toStr("layout(binding = %u, rgba32f) uniform image2D outColor; // output\n", bindingStartIndex++);
res += ct::toStr("\nlayout(binding = %u, rgba32f) uniform image2D outColor; // output", bindingStartIndex++);
}
return res;
}
Expand Down Expand Up @@ -1368,19 +1362,22 @@ std::string PASS_CLASS_NAME::GetComputeShaderCode(std::string& vOutShaderName) {
#extension GL_ARB_separate_shader_objects : enable
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1 ) in;
)";
res += GetGlslHeader("Comp", m_IsAnEffect);

if (m_IsAnEffect) {
res +=
u8R"(
vec4 effect(ivec2 vCoords) {
return vec4(0.0);
}
void main() {
const ivec2 coords = ivec2(gl_GlobalInvocationID.xy);
vec4 res = texelFetch(input_color_map, coords, 0);
if (u_enabled > 0.5) {
// do effect code
res = effect(coords);
}
imageStore(outColor, coords, res);
}
Expand Down
10 changes: 5 additions & 5 deletions Plugins/CodeGenerator/src/Modules/GeneratorPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ using namespace GaiApi;
#ifndef ZoneScoped
#define ZoneScoped
#endif
#ifndef VKFPScoped
#define VKFPScoped
#endif
//////////////////////////////////////////////////////////////
///// STATIC /////////////////////////////////////////////////
Expand Down Expand Up @@ -284,13 +287,11 @@ bool PASS_CLASS_NAME::DrawWidgets(const uint32_t& vCurrentFrame, ImGuiContext* v
if (m_IsAnEffect) {
cpp_pass_file_code +=
u8R"(
//change |= DrawResizeWidget();
)";
//change |= DrawResizeWidget();)";
} else {
cpp_pass_file_code +=
u8R"(
change |= DrawResizeWidget();
)";
change |= DrawResizeWidget();)";
}

if (m_IsAnEffect) {
Expand Down Expand Up @@ -674,7 +675,6 @@ protected:)";
bool UpdateBufferInfoInRessourceDescriptor() override;
)";


h_pass_file_code += GetPassShaderHeader();

h_pass_file_code += u8R"(
Expand Down
4 changes: 2 additions & 2 deletions Plugins/Lighting/src/Headers/LightingBuild.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define Lighting_Prefix "Lighting"
#define Lighting_BuildNumber 592
#define Lighting_BuildNumber 594
#define Lighting_MinorNumber 0
#define Lighting_MajorNumber 0
#define Lighting_BuildId "0.0.592"
#define Lighting_BuildId "0.0.594"
Original file line number Diff line number Diff line change
Expand Up @@ -251,38 +251,28 @@ layout(location = 0) in vec2 v_uv;
)"
+ CommonSystem::GetBufferObjectStructureHeader(0U) +
u8R"(
layout (std140, binding = 1) uniform UBO_Vert
{
layout (std140, binding = 1) uniform UBO_Vert {
float use_sampler_pos;
};
layout(binding = 2) uniform sampler2D pos_map_sampler;
vec3 getRayOrigin()
{
vec3 getRayOrigin() {
vec3 ro = view[3].xyz + model[3].xyz;
ro *= mat3(view * model);
return -ro;
}
void main()
{
void main() {
vec3 pos = texture(pos_map_sampler, v_uv).xyz;
if (use_sampler_pos > 0.5)
{
if (dot(pos, pos) > 0.0)
{
if (use_sampler_pos > 0.5) {
if (dot(pos, pos) > 0.0) {
vec3 ro = getRayOrigin();
float dep = length(ro - pos) / cam_far;
fragColor = vec4(vec3(dep), 1.0);
}
else
{
} else {
fragColor = vec4(0.0);
}
}
else
{
} else {
fragColor = vec4(0.0);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Plugins/MeshGen/src/Headers/MeshGenBuild.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define MeshGen_Prefix "MeshGen"
#define MeshGen_BuildNumber 350
#define MeshGen_BuildNumber 351
#define MeshGen_MinorNumber 0
#define MeshGen_MajorNumber 0
#define MeshGen_BuildId "0.0.350"
#define MeshGen_BuildId "0.0.351"
4 changes: 2 additions & 2 deletions Plugins/Misc/src/Headers/MiscBuild.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define Misc_Prefix "Misc"
#define Misc_BuildNumber 142
#define Misc_BuildNumber 143
#define Misc_MinorNumber 1
#define Misc_MajorNumber 0
#define Misc_BuildId "0.1.142"
#define Misc_BuildId "0.1.143"
4 changes: 2 additions & 2 deletions Plugins/PostProcessing/src/Headers/PostProcessingBuild.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define PostProcessing_Prefix "PostProcessing"
#define PostProcessing_BuildNumber 540
#define PostProcessing_BuildNumber 576
#define PostProcessing_MinorNumber 1
#define PostProcessing_MajorNumber 0
#define PostProcessing_BuildId "0.1.540"
#define PostProcessing_BuildId "0.1.576"
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,9 @@ void main() {
for (int j = 0; j < iterations; ++j) {
vec2 c1 = reflect(vec[j], rand) * u_ao_radius;
vec2 c2 = vec2(c1.x - c1.y, c1.x + c1.y) * 0.707;
occ += getAO(uv, c1 * 0.25, p, n);
occ += getAO(uv, c2 * 0.50, p, n);
occ += getAO(uv, c1 * 0.75, p, n);
occ += getAO(uv, c2 * 1.00, p, n);
occ += getAO(uv, c1, p, n);
}
occ /= float(iterations) * 4.0;
occ /= float(iterations);
res = vec4(1.0 - occ);
if (use_sampler_color > 0.5) {
res *= getColor(uv);
Expand Down
Loading

0 comments on commit f4212e6

Please sign in to comment.