Skip to content

Commit d642e77

Browse files
committed
Fix bug on texture binding
1 parent cd0f2e6 commit d642e77

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

src/main/java/net/vulkanmod/render/engine/VkCommandEncoder.java

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -809,39 +809,24 @@ public void setupUniforms(VkRenderPass renderPass) {
809809

810810
for (ImageDescriptor imageDescriptor : pipeline.getImageDescriptors()) {
811811
String uniformName = imageDescriptor.name;
812-
813-
int samplerIndex;
814-
switch (glProgram.getUniform(uniformName)) {
815-
case Uniform.Sampler(int location, int samplerIndex1):
816-
samplerIndex = samplerIndex1;
817-
break;
818-
case Uniform.Utb(
819-
int location, int samplerIndex1, com.mojang.blaze3d.textures.TextureFormat format, int texture
820-
):
821-
samplerIndex = samplerIndex1;
822-
break;
823-
case null:
824-
continue;
825-
default:
826-
throw new IllegalStateException("Unexpected value: " + glProgram.getUniform(uniformName));
827-
}
812+
int samplerIndex = imageDescriptor.imageIdx;
828813

829814
VkTextureView textureView = (VkTextureView) renderPass.samplers.get(uniformName);
830815
if (textureView == null) {
831-
break;
816+
continue;
832817
}
833818

834819
VkGpuTexture gpuTexture = textureView.texture();
835820
if (gpuTexture.isClosed()) {
836-
break;
821+
continue;
837822
}
838823

839824
GlStateManager._activeTexture(33984 + samplerIndex);
840825
GlStateManager._bindTexture(gpuTexture.id);
841826

842827
GlStateManager._texParameter(GL11.GL_TEXTURE_2D, 33084, textureView.baseMipLevel());
843828
GlStateManager._texParameter(GL11.GL_TEXTURE_2D, 33085, textureView.baseMipLevel() + textureView.mipLevels() - 1);
844-
gpuTexture.flushModeChanges(GL11.GL_TEXTURE_2D);
829+
gpuTexture.flushModeChanges();
845830
}
846831

847832
}

0 commit comments

Comments
 (0)