|
@@ -20,8 +20,6 @@ private extern class GL2 extends js.html.webgl.GL {
|
|
function framebufferTextureLayer( target : Int, attach : Int, t : js.html.webgl.Texture, level : Int, layer : Int ) : Void;
|
|
function framebufferTextureLayer( target : Int, attach : Int, t : js.html.webgl.Texture, level : Int, layer : Int ) : Void;
|
|
function texImage3D(target : Int, level : Int, internalformat : Int, width : Int, height : Int, depth : Int, border : Int, format : Int, type : Int, source : Dynamic) : Void;
|
|
function texImage3D(target : Int, level : Int, internalformat : Int, width : Int, height : Int, depth : Int, border : Int, format : Int, type : Int, source : Dynamic) : Void;
|
|
function compressedTexImage3D(target : Int, level : Int, internalformat : Int, width : Int, height : Int, depth : Int, border : Int, source : Dynamic) : Void;
|
|
function compressedTexImage3D(target : Int, level : Int, internalformat : Int, width : Int, height : Int, depth : Int, border : Int, source : Dynamic) : Void;
|
|
- function texSubImage3D( target : Int, level : Int, xoffset : Int, yoffset : Int, zoffset : Int, width : Int, height : Int, depth : Int, format : Int, type : Int, image : Dynamic ) : Void;
|
|
|
|
- function compressedTexSubImage3D( target : Int, level : Int, xoffset : Int, yoffset : Int, zoffset : Int, width : Int, height : Int, depth : Int, format : Int, image : Dynamic ) : Void;
|
|
|
|
static inline var RGBA16F = 0x881A;
|
|
static inline var RGBA16F = 0x881A;
|
|
static inline var RGBA32F = 0x8814;
|
|
static inline var RGBA32F = 0x8814;
|
|
static inline var RED = 0x1903;
|
|
static inline var RED = 0x1903;
|
|
@@ -1183,8 +1181,8 @@ class GlDriver extends Driver {
|
|
|
|
|
|
override function uploadTexturePixels( t : h3d.mat.Texture, pixels : hxd.Pixels, mipLevel : Int, side : Int ) {
|
|
override function uploadTexturePixels( t : h3d.mat.Texture, pixels : hxd.Pixels, mipLevel : Int, side : Int ) {
|
|
var cubic = t.flags.has(Cube);
|
|
var cubic = t.flags.has(Cube);
|
|
- var face = cubic ? CUBE_FACES[side] : t.flags.has(IsArray) ? GL2.TEXTURE_2D_ARRAY : GL.TEXTURE_2D;
|
|
|
|
var bind = getBindType(t);
|
|
var bind = getBindType(t);
|
|
|
|
+ var face = cubic ? CUBE_FACES[side] : GL.TEXTURE_2D;
|
|
gl.bindTexture(bind, t.t.t);
|
|
gl.bindTexture(bind, t.t.t);
|
|
pixels.convert(t.format);
|
|
pixels.convert(t.format);
|
|
pixels.setFlip(false);
|
|
pixels.setFlip(false);
|
|
@@ -1196,13 +1194,13 @@ class GlDriver extends Driver {
|
|
throw "Compressed textures require hlsdl 1.10+";
|
|
throw "Compressed textures require hlsdl 1.10+";
|
|
#else
|
|
#else
|
|
if( t.flags.has(IsArray) )
|
|
if( t.flags.has(IsArray) )
|
|
- gl.compressedTexSubImage3D(face, mipLevel, 0, 0, side, pixels.width, pixels.height, 1, t.t.internalFmt, dataLen, stream);
|
|
|
|
|
|
+ gl.compressedTexImage3D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, side, 0, dataLen, stream);
|
|
else
|
|
else
|
|
gl.compressedTexImage2D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, 0, dataLen, stream);
|
|
gl.compressedTexImage2D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, 0, dataLen, stream);
|
|
#end
|
|
#end
|
|
} else {
|
|
} else {
|
|
if( t.flags.has(IsArray) )
|
|
if( t.flags.has(IsArray) )
|
|
- gl.texSubImage3D(face, mipLevel, 0, 0, side, pixels.width, pixels.height, 1, getChannels(t.t), t.t.pixelFmt, stream);
|
|
|
|
|
|
+ gl.texImage3D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, side, 0, getChannels(t.t), t.t.pixelFmt, stream);
|
|
else
|
|
else
|
|
gl.texImage2D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, 0, getChannels(t.t), t.t.pixelFmt, stream);
|
|
gl.texImage2D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, 0, getChannels(t.t), t.t.pixelFmt, stream);
|
|
}
|
|
}
|
|
@@ -1215,6 +1213,7 @@ class GlDriver extends Driver {
|
|
pixels = pixels.clone();
|
|
pixels = pixels.clone();
|
|
}
|
|
}
|
|
#end
|
|
#end
|
|
|
|
+ if( t.flags.has(IsArray) ) throw "TODO:texImage3D";
|
|
var buffer : ArrayBufferView = switch( t.format ) {
|
|
var buffer : ArrayBufferView = switch( t.format ) {
|
|
case RGBA32F, R32F, RG32F, RGB32F: new Float32Array(@:privateAccess pixels.bytes.b.buffer, pixels.offset, dataLen>>2);
|
|
case RGBA32F, R32F, RG32F, RGB32F: new Float32Array(@:privateAccess pixels.bytes.b.buffer, pixels.offset, dataLen>>2);
|
|
case RGBA16F, R16F, RG16F, RGB16F: new Uint16Array(@:privateAccess pixels.bytes.b.buffer, pixels.offset, dataLen>>1);
|
|
case RGBA16F, R16F, RG16F, RGB16F: new Uint16Array(@:privateAccess pixels.bytes.b.buffer, pixels.offset, dataLen>>1);
|
|
@@ -1223,12 +1222,12 @@ class GlDriver extends Driver {
|
|
}
|
|
}
|
|
if( t.format.match(S3TC(_)) ) {
|
|
if( t.format.match(S3TC(_)) ) {
|
|
if( t.flags.has(IsArray) )
|
|
if( t.flags.has(IsArray) )
|
|
- gl.compressedTexSubImage3D(face, mipLevel, 0, 0, side, pixels.width, pixels.height, 1, t.t.internalFmt, buffer);
|
|
|
|
|
|
+ gl.compressedTexImage3D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, side, 0, buffer);
|
|
else
|
|
else
|
|
gl.compressedTexImage2D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, 0, buffer);
|
|
gl.compressedTexImage2D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, 0, buffer);
|
|
} else {
|
|
} else {
|
|
if( t.flags.has(IsArray) )
|
|
if( t.flags.has(IsArray) )
|
|
- gl.texSubImage3D(face, mipLevel, 0, 0, side, pixels.width, pixels.height, 1, getChannels(t.t), t.t.pixelFmt, buffer);
|
|
|
|
|
|
+ gl.texImage3D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, side, 0, getChannels(t.t), t.t.pixelFmt, buffer);
|
|
else
|
|
else
|
|
gl.texImage2D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, 0, getChannels(t.t), t.t.pixelFmt, buffer);
|
|
gl.texImage2D(face, mipLevel, t.t.internalFmt, pixels.width, pixels.height, 0, getChannels(t.t), t.t.pixelFmt, buffer);
|
|
}
|
|
}
|
|
@@ -1778,20 +1777,6 @@ class GlDriver extends Driver {
|
|
return GL.queryResult(q.q);
|
|
return GL.queryResult(q.q);
|
|
}
|
|
}
|
|
|
|
|
|
- inline function debugCheckError() {
|
|
|
|
- if(!debug) return;
|
|
|
|
- var err = gl.getError();
|
|
|
|
- if(err != GL.NO_ERROR) {
|
|
|
|
- switch(err) {
|
|
|
|
- case GL.INVALID_ENUM: throw "INVALID_ENUM";
|
|
|
|
- case GL.INVALID_VALUE: throw "INVALID_VALUE";
|
|
|
|
- case GL.INVALID_OPERATION: throw "INVALID_OPERATION";
|
|
|
|
- case 1286: throw "INVALID_FRAMEBUFFER_OPERATION";
|
|
|
|
- default: throw "Error: " + err;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
#end
|
|
#end
|
|
|
|
|
|
static var TFILTERS = [
|
|
static var TFILTERS = [
|