Просмотр исходного кода

Fix incorrect RW Texture binding with OpenGL.

borisrp 2 месяцев назад
Родитель
Сommit
989339b1e3
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      h3d/impl/GlDriver.hx

+ 3 - 3
h3d/impl/GlDriver.hx

@@ -638,7 +638,7 @@ class GlDriver extends Driver {
 					}
 					}
 			}
 			}
 		case Textures:
 		case Textures:
-			var tcount = s.textures.length;
+			var imageBindingIdx = 0;
 			for( i in 0...s.textures.length ) {
 			for( i in 0...s.textures.length ) {
 				var t = buf.tex[i];
 				var t = buf.tex[i];
 				var pt = s.textures[i];
 				var pt = s.textures[i];
@@ -698,7 +698,7 @@ class GlDriver extends Driver {
 					#if (hlsdl < version("1.15.0"))
 					#if (hlsdl < version("1.15.0"))
 					throw "RWTextures support requires hlsdl 1.15+";
 					throw "RWTextures support requires hlsdl 1.15+";
 					#else
 					#else
-					gl.bindImageTexture(i, cast t.t.t, 0, false, 0, GL.READ_WRITE, fmt);
+					gl.bindImageTexture(imageBindingIdx++, cast t.t.t, 0, false, 0, GL.READ_WRITE, fmt);
 					#end
 					#end
 					boundTextures[i] = null;
 					boundTextures[i] = null;
 					continue;
 					continue;
@@ -2039,7 +2039,7 @@ class GlDriver extends Driver {
 
 
 	override function computeDispatch(x:Int = 1, y:Int = 1, z:Int = 1) {
 	override function computeDispatch(x:Int = 1, y:Int = 1, z:Int = 1) {
 		GL.dispatchCompute(x,y,z);
 		GL.dispatchCompute(x,y,z);
-		GL.memoryBarrier(GL.BUFFER_UPDATE_BARRIER_BIT);
+		GL.memoryBarrier(GL.BUFFER_UPDATE_BARRIER_BIT);// | GL.TEXTURE_UPDATE_BARRIER_BIT | GL.ALL_BARRIER_BITS);
 	}
 	}
 
 
 	override function allocQuery(kind:QueryKind) {
 	override function allocQuery(kind:QueryKind) {