Skip to content

Commit e28e616

Browse files
committed
Fix some merge errors
1 parent 9fb809e commit e28e616

3 files changed

Lines changed: 18 additions & 10 deletions

File tree

common/src/main/java/org/vivecraft/client/extensions/GlDeviceExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ public interface GlDeviceExtension {
1414
@Nullable Supplier<String> labelSup, int usageFlags, TextureFormat textureFormat, int width,
1515
int height, int depthLayers, int mipmapLevels, int texId);
1616
GpuTexture vivecraft$precreatedFixedIdTexture(
17-
@Nullable Supplier<String> supplier, TextureFormat textureFormat, int width, int height, int mipmapLevels,
18-
int texId);
17+
@Nullable Supplier<String> labelSup, int usageFlags, TextureFormat textureFormat, int width,
18+
int height, int depthLayers, int mipmapLevels, int texId);
1919
}

common/src/main/java/org/vivecraft/client_vr/VRTextureTarget.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,19 @@ public VRTextureTarget(
4747
if (texId >= 0) {
4848
// hardcoded opengl here
4949
if (RenderSystem.getDevice() instanceof GlDevice glDevice) {
50-
this.colorTexture = ((GlDeviceExtension) glDevice).vivecraft$createFixedIdTexture(
51-
() -> this.label + " / Color",
52-
GpuTexture.USAGE_COPY_DST | GpuTexture.USAGE_COPY_SRC | GpuTexture.USAGE_TEXTURE_BINDING |
53-
GpuTexture.USAGE_RENDER_ATTACHMENT, TextureFormat.RGBA8, width, height, 1,
54-
mipmaps ? Math.max(Mth.log2(width), Mth.log2(height)) : 1, texId);
50+
if(!prePopulated) {
51+
this.colorTexture = ((GlDeviceExtension) glDevice).vivecraft$createFixedIdTexture(
52+
() -> this.label + " / Color",
53+
GpuTexture.USAGE_COPY_DST | GpuTexture.USAGE_COPY_SRC | GpuTexture.USAGE_TEXTURE_BINDING |
54+
GpuTexture.USAGE_RENDER_ATTACHMENT, TextureFormat.RGBA8, width, height, 1,
55+
mipmaps ? Math.max(Mth.log2(width), Mth.log2(height)) : 1, texId);
56+
} else {
57+
this.colorTexture = ((GlDeviceExtension) glDevice).vivecraft$precreatedFixedIdTexture(
58+
() -> this.label + " / Color",
59+
GpuTexture.USAGE_COPY_DST | GpuTexture.USAGE_COPY_SRC | GpuTexture.USAGE_TEXTURE_BINDING |
60+
GpuTexture.USAGE_RENDER_ATTACHMENT, TextureFormat.RGBA8, width, height, 1,
61+
mipmaps ? Math.max(Mth.log2(width), Mth.log2(height)) : 1, texId);
62+
}
5563
this.colorTextureView = glDevice.createTextureView(this.colorTexture);
5664
this.colorTexture.setAddressMode(AddressMode.CLAMP_TO_EDGE);
5765
this.setFilterMode(linearFilter ? FilterMode.LINEAR : FilterMode.NEAREST);

common/src/main/java/org/vivecraft/mixin/client/blaze3d/opengl/GlDeviceMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public class GlDeviceMixin implements GlDeviceExtension {
7474

7575
@Override
7676
public GpuTexture vivecraft$precreatedFixedIdTexture(
77-
@Nullable Supplier<String> labelSup, TextureFormat textureFormat, int width,
78-
int height, int mipmapLevels, int texId)
77+
@Nullable Supplier<String> labelSup, int usageFlags, TextureFormat textureFormat, int width,
78+
int height, int depthLayers, int mipmapLevels, int texId)
7979
{
8080
if (mipmapLevels < 1) {
8181
throw new IllegalArgumentException("mipLevels must be at least 1");
@@ -86,7 +86,7 @@ public class GlDeviceMixin implements GlDeviceExtension {
8686
label = String.valueOf(texId);
8787
}
8888

89-
GlTexture glTexture = new GlTexture(label, textureFormat, width, height, mipmapLevels, texId);
89+
GlTexture glTexture = new GlTexture(usageFlags, label, textureFormat, width, height, depthLayers, mipmapLevels, texId);
9090
this.debugLabels.applyLabel(glTexture);
9191
return glTexture;
9292
}

0 commit comments

Comments
 (0)