-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
1,027 additions
and
727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 44 additions & 12 deletions
56
...src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/ChunkSortOutput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,57 @@ | ||
package net.caffeinemc.mods.sodium.client.render.chunk.compile; | ||
|
||
import net.caffeinemc.mods.sodium.client.render.chunk.RenderSection; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.translucent_sorting.data.DynamicData; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.translucent_sorting.data.PresentTranslucentData; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.translucent_sorting.data.DynamicTopoData; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.translucent_sorting.data.SortData; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.translucent_sorting.data.Sorter; | ||
import net.caffeinemc.mods.sodium.client.util.NativeBuffer; | ||
|
||
public class ChunkSortOutput extends BuilderTaskOutput implements OutputWithIndexData { | ||
public final DynamicData dynamicData; | ||
public class ChunkSortOutput extends BuilderTaskOutput implements SortData { | ||
private NativeBuffer indexBuffer; | ||
private boolean reuseUploadedIndexData; | ||
private DynamicTopoData.DynamicTopoSorter topoSorter; | ||
|
||
public ChunkSortOutput(RenderSection render, int buildTime, DynamicData dynamicData) { | ||
public ChunkSortOutput(RenderSection render, int buildTime) { | ||
super(render, buildTime); | ||
} | ||
|
||
public ChunkSortOutput(RenderSection render, int buildTime, Sorter data) { | ||
this(render, buildTime); | ||
this.copyResultFrom(data); | ||
} | ||
|
||
this.dynamicData = dynamicData; | ||
public void copyResultFrom(Sorter sorter) { | ||
this.indexBuffer = sorter.getIndexBuffer(); | ||
this.reuseUploadedIndexData = false; | ||
if (sorter instanceof DynamicTopoData.DynamicTopoSorter topoSorterInstance) { | ||
this.topoSorter = topoSorterInstance; | ||
} | ||
} | ||
|
||
public void markAsReusingUploadedData() { | ||
this.reuseUploadedIndexData = true; | ||
} | ||
|
||
@Override | ||
public PresentTranslucentData getTranslucentData() { | ||
return this.dynamicData; | ||
public NativeBuffer getIndexBuffer() { | ||
return this.indexBuffer; | ||
} | ||
|
||
// doesn't implement deletion because the task doesn't allocate any new buffers. | ||
// the buffers used belong to the section and are deleted when it is deleted. | ||
// buffers created during section building are deleted at section deletion or | ||
// when the rebuild is cancelled. | ||
@Override | ||
public boolean isReusingUploadedIndexData() { | ||
return this.reuseUploadedIndexData; | ||
} | ||
|
||
public DynamicTopoData.DynamicTopoSorter getTopoSorter() { | ||
return this.topoSorter; | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
super.destroy(); | ||
|
||
if (this.indexBuffer != null) { | ||
this.indexBuffer.free(); | ||
} | ||
} | ||
} |
7 changes: 0 additions & 7 deletions
7
...main/java/net/caffeinemc/mods/sodium/client/render/chunk/compile/OutputWithIndexData.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.