diff --git a/CHANGELOG.md b/CHANGELOG.md index c0bca941..83646de0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ announcements on the StageXL forum or use one of the support links below: * StageXL GitHub * StageXL StackOverflow: -### 2.3.1-wip +### 2.3.1 +* Fixed JavaScript type casting problems that affected WebAssembly. * Fixed links in `pubspec.yaml`. ### 2.3.0 diff --git a/lib/src/engine/render_program.dart b/lib/src/engine/render_program.dart index aa1be8f1..2b5407b0 100644 --- a/lib/src/engine/render_program.dart +++ b/lib/src/engine/render_program.dart @@ -92,9 +92,11 @@ abstract class RenderProgram { rc.attachShader(program, fShader); rc.linkProgram(program); - final status = - rc.getProgramParameter(program, web.WebGLRenderingContext.LINK_STATUS); - if (identical(status, true)) return program; + if ((rc.getProgramParameter(program, web.WebGLRenderingContext.LINK_STATUS) + as JSBoolean) + .toDart) { + return program; + } final cl = rc.isContextLost(); throw StateError(cl ? 'ContextLost' : rc.getProgramInfoLog(program)!); @@ -106,14 +108,16 @@ abstract class RenderProgram { web.WebGLRenderingContext rc, String source, int type) { final shader = rc.createShader(type); if (shader == null) { - throw StateError('Failed to create shader'); + throw StateError('Failed to create shader (type $type)'); } rc.shaderSource(shader, source); rc.compileShader(shader); - final status = - rc.getShaderParameter(shader, web.WebGLRenderingContext.COMPILE_STATUS); - if (identical(status, true)) return shader; + if ((rc.getShaderParameter(shader, web.WebGLRenderingContext.COMPILE_STATUS) + as JSBoolean) + .toDart) { + return shader; + } final cl = rc.isContextLost(); throw StateError(cl ? 'ContextLost' : rc.getShaderInfoLog(shader)!); @@ -124,8 +128,9 @@ abstract class RenderProgram { void _updateAttributes( web.WebGLRenderingContext rc, web.WebGLProgram program) { _attributes.clear(); - final count = rc.getProgramParameter( - program, web.WebGLRenderingContext.ACTIVE_ATTRIBUTES) as int; + final count = (rc.getProgramParameter( + program, web.WebGLRenderingContext.ACTIVE_ATTRIBUTES) as JSNumber) + .toDartInt; for (var i = 0; i < count; i++) { final activeInfo = rc.getActiveAttrib(program, i); @@ -142,8 +147,9 @@ abstract class RenderProgram { void _updateUniforms(web.WebGLRenderingContext rc, web.WebGLProgram program) { _uniforms.clear(); - final count = rc.getProgramParameter( - program, web.WebGLRenderingContext.ACTIVE_UNIFORMS) as int; + final count = (rc.getProgramParameter( + program, web.WebGLRenderingContext.ACTIVE_UNIFORMS) as JSNumber) + .toDartInt; for (var i = 0; i < count; i++) { final activeInfo = rc.getActiveUniform(program, i); diff --git a/pubspec.yaml b/pubspec.yaml index 03a8f4a3..449c59be 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: stagexl -version: 2.3.1-wip +version: 2.3.1 description: A fast and universal 2D rendering engine for HTML5 and Dart. homepage: http://www.stagexl.org repository: https://github.com/bp74/StageXL