Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ announcements on the StageXL forum or use one of the support links below:
* StageXL GitHub <https://github.com/bp74/StageXL/issues>
* StageXL StackOverflow: <https://stackoverflow.com/questions/ask?tags=stagexl>

### 2.3.1-wip
### 2.3.1
* Fixed JavaScript type casting problems that affected WebAssembly.
* Fixed links in `pubspec.yaml`.

### 2.3.0
Expand Down
28 changes: 17 additions & 11 deletions lib/src/engine/render_program.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)!);
Expand All @@ -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)!);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down