Skip to content

Commit 687c214

Browse files
committed
tests: Add avm2/pixelbender_param_qualifier test
1 parent d45f328 commit 687c214

File tree

8 files changed

+588
-0
lines changed

8 files changed

+588
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package {
2+
import flash.display.*;
3+
import flash.geom.*;
4+
5+
public class Test extends MovieClip {
6+
[Embed(source = "param_qualifier.pbj", mimeType="application/octet-stream")]
7+
public static var ShaderBytes: Class;
8+
[Embed(source = "param_qualifier2.pbj", mimeType="application/octet-stream")]
9+
public static var ShaderBytes2: Class;
10+
11+
public function Test() {
12+
var i = 0;
13+
while (i < 256) {
14+
var bytes = new ShaderBytes();
15+
16+
// Change the value at 0x18, if the shader fails to compile, the param
17+
// has qualifier "in" (because FP fails on missing out param).
18+
bytes.position = 0x18;
19+
bytes.writeByte(i);
20+
testShader(bytes, i);
21+
22+
i += 1;
23+
}
24+
25+
var i = 0;
26+
while (i < 256) {
27+
var bytes = new ShaderBytes2();
28+
29+
// Also, make sure we can use those input parameters.
30+
bytes.position = 0x23;
31+
bytes.writeByte(i);
32+
testShader2(bytes, i);
33+
34+
i += 1;
35+
}
36+
}
37+
38+
private function testShader(bytes:*, i:Number) {
39+
try {
40+
new Shader(bytes);
41+
trace(i + ": out");
42+
} catch (e) {
43+
trace(i + ": in (" + e + ")");
44+
}
45+
}
46+
47+
private function testShader2(bytes:*, i:Number) {
48+
var input = new BitmapData(1, 1);
49+
var shaderJob = new ShaderJob(new Shader(bytes), input);
50+
51+
try {
52+
shaderJob.shader.data.src.value = [1];
53+
trace(i + ": passed");
54+
} catch (e) {
55+
trace(i + ": failed");
56+
}
57+
}
58+
}
59+
}

tests/tests/swfs/avm2/pixelbender_param_qualifier/output.txt

Lines changed: 512 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version 1i
2+
name "param_qualifier"
3+
4+
param.out "dst", float4, f0.rgba
5+
6+
ld f0.a, 1f
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version 1i
2+
name "param_qualifier2"
3+
4+
param.out "dst", float4, f0.rgba
5+
param.in "src", float4, f1.rgba
6+
7+
ld f0.a, 1f
Binary file not shown.
1.44 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
num_ticks = 1
2+
3+
[player_options]
4+
with_renderer = { optional = false, sample_count = 4 }

0 commit comments

Comments
 (0)