-
Notifications
You must be signed in to change notification settings - Fork 812
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some issues with Uint32 representation
This increases the maximum size of vertex and index buffers to 4 billion elements, since the Uint32 types stored in memory are now safely represented with Int64. For vertex buffers, this increases their maximum size to 80 GiB, and index buffers have a maximum size of 16 GiB, whereas both were limited to 2 GiB prior.
- Loading branch information
1 parent
267f84d
commit a864415
Showing
7 changed files
with
136 additions
and
103 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
35 changes: 28 additions & 7 deletions
35
...on/src/main/java/net/caffeinemc/mods/sodium/client/gl/arena/PendingBufferCopyCommand.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,14 +1,35 @@ | ||
package net.caffeinemc.mods.sodium.client.gl.arena; | ||
|
||
import net.caffeinemc.mods.sodium.client.util.UInt32; | ||
|
||
class PendingBufferCopyCommand { | ||
public final int readOffset; | ||
public final int writeOffset; | ||
private final int readOffset; /* Uint32 */ | ||
private final int writeOffset; /* Uint32 */ | ||
|
||
private int length; | ||
|
||
public int length; | ||
PendingBufferCopyCommand(long readOffset, long writeOffset, long length) { | ||
this.readOffset = UInt32.downcast(readOffset); | ||
this.writeOffset = UInt32.downcast(writeOffset); | ||
this.length = UInt32.downcast(length); | ||
} | ||
|
||
/* Uint32 */ | ||
public long getReadOffset() { | ||
return UInt32.upcast(this.readOffset); | ||
} | ||
|
||
/* Uint32 */ | ||
public long getWriteOffset() { | ||
return UInt32.upcast(this.writeOffset); | ||
} | ||
|
||
/* Uint32 */ | ||
public long getLength() { | ||
return UInt32.upcast(this.length); | ||
} | ||
|
||
PendingBufferCopyCommand(int readOffset, int writeOffset, int length) { | ||
this.readOffset = readOffset; | ||
this.writeOffset = writeOffset; | ||
this.length = length; | ||
public void setLength(long length /* Uint32 */) { | ||
this.length = UInt32.downcast(length); | ||
} | ||
} |
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
Oops, something went wrong.