mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 13:53:44 +01:00
that was a nasty crash
os memory exception because memory that was being sent to the gpu was getting modified by another thread
This commit is contained in:
parent
ebd20f5173
commit
59e29ac958
1 changed files with 8 additions and 4 deletions
|
@ -102,7 +102,7 @@ public class LightVolume {
|
||||||
* Completely (re)populate this volume with block and sky lighting data.
|
* Completely (re)populate this volume with block and sky lighting data.
|
||||||
* This is expensive and should be avoided.
|
* This is expensive and should be avoided.
|
||||||
*/
|
*/
|
||||||
public void initialize(ILightReader world) {
|
public synchronized void initialize(ILightReader world) {
|
||||||
BlockPos.Mutable pos = new BlockPos.Mutable();
|
BlockPos.Mutable pos = new BlockPos.Mutable();
|
||||||
|
|
||||||
int shiftX = textureVolume.minX;
|
int shiftX = textureVolume.minX;
|
||||||
|
@ -125,7 +125,7 @@ public class LightVolume {
|
||||||
* Copy block light from the world into this volume.
|
* Copy block light from the world into this volume.
|
||||||
* @param worldVolume the region in the world to copy data from.
|
* @param worldVolume the region in the world to copy data from.
|
||||||
*/
|
*/
|
||||||
public void copyBlock(ILightReader world, GridAlignedBB worldVolume) {
|
public synchronized void copyBlock(ILightReader world, GridAlignedBB worldVolume) {
|
||||||
BlockPos.Mutable pos = new BlockPos.Mutable();
|
BlockPos.Mutable pos = new BlockPos.Mutable();
|
||||||
|
|
||||||
int xShift = textureVolume.minX;
|
int xShift = textureVolume.minX;
|
||||||
|
@ -147,7 +147,7 @@ public class LightVolume {
|
||||||
* Copy sky light from the world into this volume.
|
* Copy sky light from the world into this volume.
|
||||||
* @param worldVolume the region in the world to copy data from.
|
* @param worldVolume the region in the world to copy data from.
|
||||||
*/
|
*/
|
||||||
public void copySky(ILightReader world, GridAlignedBB worldVolume) {
|
public synchronized void copySky(ILightReader world, GridAlignedBB worldVolume) {
|
||||||
BlockPos.Mutable pos = new BlockPos.Mutable();
|
BlockPos.Mutable pos = new BlockPos.Mutable();
|
||||||
|
|
||||||
int xShift = textureVolume.minX;
|
int xShift = textureVolume.minX;
|
||||||
|
@ -177,11 +177,15 @@ public class LightVolume {
|
||||||
GL11.glTexParameteri(GL13.GL_TEXTURE_3D, GL13.GL_TEXTURE_WRAP_R, GL20.GL_MIRRORED_REPEAT);
|
GL11.glTexParameteri(GL13.GL_TEXTURE_3D, GL13.GL_TEXTURE_WRAP_R, GL20.GL_MIRRORED_REPEAT);
|
||||||
GL11.glTexParameteri(GL13.GL_TEXTURE_3D, GL13.GL_TEXTURE_WRAP_T, GL20.GL_MIRRORED_REPEAT);
|
GL11.glTexParameteri(GL13.GL_TEXTURE_3D, GL13.GL_TEXTURE_WRAP_T, GL20.GL_MIRRORED_REPEAT);
|
||||||
if (bufferDirty) {
|
if (bufferDirty) {
|
||||||
GL12.glTexImage3D(GL12.GL_TEXTURE_3D, 0, GL40.GL_RG8, textureVolume.sizeX(), textureVolume.sizeY(), textureVolume.sizeZ(), 0, GL40.GL_RG, GL40.GL_UNSIGNED_BYTE, lightData);
|
uploadTexture();
|
||||||
bufferDirty = false;
|
bufferDirty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized void uploadTexture() {
|
||||||
|
GL12.glTexImage3D(GL12.GL_TEXTURE_3D, 0, GL40.GL_RG8, textureVolume.sizeX(), textureVolume.sizeY(), textureVolume.sizeZ(), 0, GL40.GL_RG, GL40.GL_UNSIGNED_BYTE, lightData);
|
||||||
|
}
|
||||||
|
|
||||||
public void release() {
|
public void release() {
|
||||||
GL12.glBindTexture(GL12.GL_TEXTURE_3D, 0);
|
GL12.glBindTexture(GL12.GL_TEXTURE_3D, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue