Aggressively optimize multidraw command emission #32
No files matched your search
+1
-1
@@ -22,7 +22,7 @@ public class SectionRenderDataStorage {
|
|||||||
|
|
||||||
public SectionRenderDataStorage(ChunkPrimitiveType primitiveType, boolean sorted) {
|
public SectionRenderDataStorage(ChunkPrimitiveType primitiveType, boolean sorted) {
|
||||||
this.storageStrategy = sorted ? SectionRenderDataUnsafe.Strategy.FULL : SectionRenderDataUnsafe.Strategy.COMPACT;
|
this.storageStrategy = sorted ? SectionRenderDataUnsafe.Strategy.FULL : SectionRenderDataUnsafe.Strategy.COMPACT;
|
||||||
this.pMeshDataArray = this.storageStrategy.allocateHeap(RenderRegion.REGION_SIZE);
|
this.pMeshDataArray = this.storageStrategy.allocateHeap();
|
||||||
if (this.pMeshDataArray == 0) {
|
if (this.pMeshDataArray == 0) {
|
||||||
throw new OutOfMemoryError("Failed to allocate mesh data array");
|
throw new OutOfMemoryError("Failed to allocate mesh data array");
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-7
@@ -318,8 +318,8 @@ public class SectionRenderDataUnsafe {
|
|||||||
return heap + this.getHeaderSize();
|
return heap + this.getHeaderSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final long allocateHeap(int count) {
|
public final long allocateHeap() {
|
||||||
long size = this.getHeaderSize() + (count * this.getStride());
|
long size = this.getHeaderSize() + (RenderRegion.REGION_SIZE * this.getStride());
|
||||||
long pointer = LWJGL.nmemAlignedAlloc(64, size);
|
long pointer = LWJGL.nmemAlignedAlloc(64, size);
|
||||||
|
|
||||||
if (pointer != 0) {
|
if (pointer != 0) {
|
||||||
@@ -333,10 +333,6 @@ public class SectionRenderDataUnsafe {
|
|||||||
LWJGL.nmemAlignedFree(pointer);
|
LWJGL.nmemAlignedFree(pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void clear(long pointer) {
|
|
||||||
LWJGL.memSet(pointer, 0x0, this.getStride());
|
|
||||||
}
|
|
||||||
|
|
||||||
public final long heapPointer(long ptr, int index) {
|
public final long heapPointer(long ptr, int index) {
|
||||||
return this.getRowBasePointer(ptr) + (index * this.getStride());
|
return this.getRowBasePointer(ptr) + (index * this.getStride());
|
||||||
}
|
}
|
||||||
@@ -362,7 +358,7 @@ public class SectionRenderDataUnsafe {
|
|||||||
*/
|
*/
|
||||||
public final void clearRow(long heap, int index) {
|
public final void clearRow(long heap, int index) {
|
||||||
this.setSliceMask(heap, index, 0);
|
this.setSliceMask(heap, index, 0);
|
||||||
this.clear(this.heapPointer(heap, index));
|
LWJGL.memSet(this.heapPointer(heap, index), 0x0, this.getStride());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int vertexCountOf(Map<ModelQuadFacing, VertexRange> ranges, int facing) {
|
private static int vertexCountOf(Map<ModelQuadFacing, VertexRange> ranges, int facing) {
|
||||||
|
|||||||
Reference in new issue
Block a user