diff --git a/.gitignore b/.gitignore index 070094f9..03c3e8dc 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,5 @@ npm-debug.log # Misc deploy_key -deploy_key.pub \ No newline at end of file +deploy_key.pub +.vscode/settings.json diff --git a/lib/aglsl/AGALTokenizer.ts b/lib/aglsl/AGALTokenizer.ts index 52c1f2a4..1f9e0a5d 100644 --- a/lib/aglsl/AGALTokenizer.ts +++ b/lib/aglsl/AGALTokenizer.ts @@ -12,17 +12,16 @@ export class AGALTokenizer { } public decribeAGALPart(array: ByteArray | Part): Description { - if (array instanceof ByteArray) { + if (array instanceof Part) { + const desc = this.decribeAGALByteArray(array.data); + desc.native = array.native; + return desc; + } else return this.decribeAGALByteArray(array); - } - - const desc = this.decribeAGALByteArray(array.data); - desc.native = array.native; - - return desc; } public decribeAGALByteArray(bytes: ByteArray): Description { + bytes.position = 0; const header: Header = new Header(); if (bytes.readUnsignedByte() != 0xa0) { diff --git a/lib/base/ContextGLProfile.ts b/lib/base/ContextGLProfile.ts index 776ee8b0..593e4b87 100644 --- a/lib/base/ContextGLProfile.ts +++ b/lib/base/ContextGLProfile.ts @@ -2,5 +2,9 @@ export enum ContextGLProfile { BASELINE, BASELINE_CONSTRAINED, - BASELINE_EXTENDED + BASELINE_EXTENDED, + STANDARD, + STANDARD_CONSTRAINED, + STANDARD_EXTENDED, + ENHANCED } \ No newline at end of file diff --git a/lib/filters/tasks/TaskBase.ts b/lib/filters/tasks/TaskBase.ts index 6c70d3b9..fe13a44f 100644 --- a/lib/filters/tasks/TaskBase.ts +++ b/lib/filters/tasks/TaskBase.ts @@ -10,7 +10,7 @@ import { ContextGLProgramType } from '../../base/ContextGLProgramType'; import { _Stage_ImageBase, Image2D } from '../../image'; export class TaskBase { - protected _vertexConstantData = new Float32Array([ + protected _vertexConstantData:Float32Array = new Float32Array([ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]); diff --git a/lib/webgl/ContextWebGL.ts b/lib/webgl/ContextWebGL.ts index 51e240e9..9bdb2786 100644 --- a/lib/webgl/ContextWebGL.ts +++ b/lib/webgl/ContextWebGL.ts @@ -25,6 +25,7 @@ import { Settings } from '../Settings'; import { FenceContextWebGL } from './FenceContextWebGL'; import * as GL_MAP from './ConstantsWebGL'; import { StatsWebGL } from './StatsWebGL'; +import { IVertexBuffer } from '../base/IVertexBuffer'; let _DEBUG_renderMode: '' | 'line' = ''; diff --git a/lib/webgl/ProgramWebGL.ts b/lib/webgl/ProgramWebGL.ts index 292cead9..b274ea06 100644 --- a/lib/webgl/ProgramWebGL.ts +++ b/lib/webgl/ProgramWebGL.ts @@ -243,10 +243,10 @@ export class ProgramWebGL implements IProgram { : indexOrName; const info = this._program.uniforms[name]; - + if (!info) return null; - + return info.location; } @@ -300,7 +300,7 @@ export class ProgramWebGL implements IProgram { const arr: ArrayLike = data; - if (arr.length !== info.size * size) { + if (arr.length !== info.size * size && arr.length !== info.size * size * 2) { throw ( `[ProgramWebGL] Invalid data length for ${name}, expected ${info.size * size}, actual ${arr.length}` @@ -373,6 +373,6 @@ export class ProgramWebGL implements IProgram { } public get glProgram(): WebGLProgram { - return this._program; + return this._program.program; } -} \ No newline at end of file +} diff --git a/lib/webgl/TextureContextWebGL.ts b/lib/webgl/TextureContextWebGL.ts index 2dde5796..09463ce0 100644 --- a/lib/webgl/TextureContextWebGL.ts +++ b/lib/webgl/TextureContextWebGL.ts @@ -109,7 +109,6 @@ export class TextureContextWebGL { public setTextureAt(sampler: number, texture: TextureWebGL): number { const gl = this._context._gl; const samplerState = this._samplerStates[sampler]; - const textureType = GL_MAP.TEXTURE[texture.textureType]; if ((texture || samplerState.type)) { gl.activeTexture(gl.TEXTURE0 + sampler); @@ -132,6 +131,8 @@ export class TextureContextWebGL { return -1; } + const textureType = GL_MAP.TEXTURE[texture.textureType]; + texture._state.id = sampler; this.bindTexture(texture, false, textureType);