Skip to content

Conversation

@FalseIlyu
Copy link
Contributor

@FalseIlyu FalseIlyu commented Oct 26, 2024

The motive of this PR is to break the big DrawPass function of the renderer, for this i decided to bring part of the function for instance

if (desc.drawWater)
{
	const auto& ocean = Locator::oceanSystem::value();
	const auto& mesh = ocean.GetMesh();
	mesh.GetIndexBuffer().Bind(mesh.GetIndexBuffer().GetCount(), 0);
	mesh.GetVertexBuffer().Bind();
	bgfx::setState(k_BgfxDefaultStateInvertedZ);
	auto diffuse = Locator::resources::value().GetTextures().Handle(ocean.GetDiffuseTexture());
	auto alpha = Locator::resources::value().GetTextures().Handle(ocean.GetAlphaTexture());
	waterShader->SetTextureSampler("s_diffuse", 0, *diffuse);
	waterShader->SetTextureSampler("s_alpha", 1, *alpha);
	waterShader->SetTextureSampler("s_reflection", 2, ocean.GetReflectionFramebuffer().GetColorAttachment());
	const glm::vec4 u_sky = {skyType, 0.0f, 0.0f, 0.0f};
	waterShader->SetUniformValue("u_sky", &u_sky); // fs
	bgfx::submit(static_cast<bgfx::ViewId>(desc.viewId), waterShader->GetRawHandle());
	k_TechniqueMap.at(Technique::Water)(desc);
}

into its own function.
To organise all this i would have all subtask of a pass be declared in a enumeration (i call Technique, you have one to draw the sky, one to draw entities, etc...) that would be mapped to variation of a templated function (named renderTechnique) in a way not to dissimilar with how we handle shader you would have to declare the Technique in the manage, and add the mapping to the function. Right now you also need to declare the instanciation but i hope to find a better way.

The long term objective would be :

  • Have all part of Draw pass put into its own technique
    • At minimum getting rid of Mesh and transform stored inside the renderer (so sprites and debugCross can be separated)
    • Getting rid of DrawMesh and of dependency of Techniques from the renderer altogether
  • Have drawdesc declare a set of techniques instead of having many boolean to tell if we draw entities or not
    • Have the renderer iterate through the set of techniques of the desc
  • Adapt this to different pass as this doesn't fit well with how Footprint Pass are handled

@FalseIlyu FalseIlyu force-pushed the RendererMajorRefactor branch from 862a618 to 68e830c Compare October 26, 2024 19:42
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@github-actions
Copy link
Contributor

github-actions bot commented Oct 26, 2024

Uploaded images

Map Debug Release Vanilla
Land1.txt Land1 Debug Land1 Release Land1 Vanilla
Land2.txt Land2 Debug Land2 Release Land2 Vanilla
Land3.txt Land3 Debug Land3 Release Land3 Vanilla
Land4.txt Land4 Debug Land4 Release Land4 Vanilla
Land5.txt Land5 Debug Land5 Release Land5 Vanilla
LandT.txt LandT Debug LandT Release LandT Vanilla
TwoGods.txt TwoGods Debug TwoGods Release TwoGods Vanilla
ThreeGods.txt ThreeGods Debug ThreeGods Release ThreeGods Vanilla
FourGods.txt FourGods Debug FourGods Release FourGods Vanilla
construct.txt Construct Debug Construct Release construct Vanilla

@FalseIlyu FalseIlyu force-pushed the RendererMajorRefactor branch 3 times, most recently from 2581a77 to 5b685be Compare October 26, 2024 20:35
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@FalseIlyu FalseIlyu force-pushed the RendererMajorRefactor branch 6 times, most recently from a9be85f to 2e5478e Compare October 27, 2024 19:55
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@FalseIlyu FalseIlyu force-pushed the RendererMajorRefactor branch 3 times, most recently from 376bcbd to aefff02 Compare October 28, 2024 17:38
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@FalseIlyu FalseIlyu force-pushed the RendererMajorRefactor branch 2 times, most recently from a1f4b42 to 2625649 Compare October 29, 2024 17:56
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@FalseIlyu FalseIlyu force-pushed the RendererMajorRefactor branch from 2625649 to c6d53bd Compare October 29, 2024 18:51
Comment on lines 16 to 17
uint32_t count;
/* data */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
uint32_t count;
/* data */
uint32_t count;
/* data */

src/Game.cpp Outdated
{
auto section = profiler.BeginScoped(Profiler::Stage::SceneDraw);

std::set<graphics::Technique> drawPass{};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
std::set<graphics::Technique> drawPass{};
std::set<graphics::Technique> drawPass {};

@FalseIlyu FalseIlyu force-pushed the RendererMajorRefactor branch from 6a8ca3a to a414b28 Compare April 5, 2025 19:45
@furudbat furudbat mentioned this pull request Jun 1, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant