Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0feb6ee

Browse files
committed
Do the material system frame preparation in StartFrame()
This was broken before, but now it works, so...
1 parent 705d6e1 commit 0feb6ee

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/engine/renderer/Material.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,9 +1604,11 @@ void MaterialSystem::UpdateDynamicSurfaces() {
16041604

16051605
void MaterialSystem::UpdateFrameData() {
16061606
atomicCommandCountersBuffer.BindBufferBase( GL_SHADER_STORAGE_BUFFER, Util::ordinal( BufferBind::COMMAND_COUNTERS_STORAGE ) );
1607+
16071608
gl_clearSurfacesShader->BindProgram( 0 );
16081609
gl_clearSurfacesShader->SetUniform_Frame( nextFrame );
16091610
gl_clearSurfacesShader->DispatchCompute( MAX_VIEWS, 1, 1 );
1611+
16101612
atomicCommandCountersBuffer.UnBindBufferBase( GL_SHADER_STORAGE_BUFFER, Util::ordinal( BufferBind::COMMAND_COUNTERS_STORAGE ) );
16111613

16121614
GL_CheckErrors();
@@ -1774,11 +1776,12 @@ void MaterialSystem::StartFrame() {
17741776
if ( !generatedWorldCommandBuffer ) {
17751777
return;
17761778
}
1779+
17771780
frames[nextFrame].viewCount = 0;
17781781

1779-
// renderedMaterials.clear();
1780-
// UpdateDynamicSurfaces();
1781-
// UpdateFrameData();
1782+
renderedMaterials.clear();
1783+
UpdateDynamicSurfaces();
1784+
UpdateFrameData();
17821785
}
17831786

17841787
void MaterialSystem::EndFrame() {
@@ -2056,11 +2059,6 @@ void MaterialSystem::RenderMaterials( const shaderSort_t fromSort, const shaderS
20562059
}
20572060

20582061
if ( frameStart ) {
2059-
renderedMaterials.clear();
2060-
UpdateDynamicSurfaces();
2061-
UpdateFrameData();
2062-
// StartFrame();
2063-
20642062
// Make sure compute dispatches from the last frame finished writing to memory
20652063
glMemoryBarrier( GL_COMMAND_BARRIER_BIT );
20662064
frameStart = false;

0 commit comments

Comments
 (0)