Skip to content

Commit 81ed82b

Browse files
committed
tests: Add avm2/pixelbender_div test
1 parent f93c893 commit 81ed82b

File tree

6 files changed

+108
-0
lines changed

6 files changed

+108
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package {
2+
import flash.display.*;
3+
import flash.geom.*;
4+
5+
public class Test extends MovieClip {
6+
[Embed(source = "div.pbj", mimeType="application/octet-stream")]
7+
public static var ShaderBytes: Class;
8+
9+
public function Test() {
10+
testParameter(4.0, 4.0);
11+
testParameter(2.0, 8.0);
12+
testParameter(2.0, 16.0);
13+
testParameter(2.0, 8.0);
14+
testParameter(8.0, 1.0);
15+
testParameter(8.0, 2.0);
16+
testParameter(-8.0, -2.0);
17+
testParameter(-2.0, -8.0);
18+
testParameter(0.0, 2.0);
19+
testParameter(2.5, 8.0);
20+
testParameter(2.1, 8.0);
21+
testParameter(2.9, 8.0);
22+
}
23+
24+
private function testParameter(left:Number, right:Number) {
25+
trace("Input: " + left + ", " + right);
26+
var input = new BitmapData(1, 1);
27+
var shaderJob = new ShaderJob(new Shader(new ShaderBytes()), input);
28+
29+
shaderJob.shader.data.inputLeft.value = [left];
30+
shaderJob.shader.data.inputRight.value = [right];
31+
32+
try {
33+
shaderJob.start(true);
34+
trace("Result: " + input.getPixel32(0, 0).toString(16));
35+
} catch (e) {
36+
trace("Error while starting: " + e);
37+
}
38+
trace("=================");
39+
}
40+
}
41+
}
303 Bytes
Binary file not shown.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<languageVersion : 1.0;>
2+
3+
kernel div
4+
< namespace : "Ruffle Tests";
5+
vendor : "Kamil Jarosz";
6+
version : 1;
7+
>
8+
{
9+
input image4 src;
10+
output pixel4 dst;
11+
12+
parameter float inputLeft
13+
<
14+
defaultValue:1.0;
15+
>;
16+
17+
parameter float inputRight
18+
<
19+
defaultValue:1.0;
20+
>;
21+
22+
void
23+
evaluatePixel()
24+
{
25+
dst = pixel4(float(int(inputLeft)/int(inputRight))/256.0, inputLeft/inputRight, inputLeft/2.0, 1);
26+
}
27+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Input: 4, 4
2+
Result: ff01ffff
3+
=================
4+
Input: 2, 8
5+
Result: ff0040ff
6+
=================
7+
Input: 2, 16
8+
Result: ff0020ff
9+
=================
10+
Input: 2, 8
11+
Result: ff0040ff
12+
=================
13+
Input: 8, 1
14+
Result: ff08ffff
15+
=================
16+
Input: 8, 2
17+
Result: ff04ffff
18+
=================
19+
Input: -8, -2
20+
Result: ff04ff00
21+
=================
22+
Input: -2, -8
23+
Result: ff004000
24+
=================
25+
Input: 0, 2
26+
Result: ff000000
27+
=================
28+
Input: 2.5, 8
29+
Result: ff0050ff
30+
=================
31+
Input: 2.1, 8
32+
Result: ff0043ff
33+
=================
34+
Input: 2.9, 8
35+
Result: ff005cff
36+
=================
2.11 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)