summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKosyrev Serge <_deepfire@feelingofgreen.ru>2018-09-21 20:58:50 +0300
committerKosyrev Serge <_deepfire@feelingofgreen.ru>2018-09-21 21:00:46 +0300
commitab493cfe403295c1579901fe7b54dff1d0a9da4d (patch)
tree5c4d9b27a11d87dba812816eea991f7d112da1e2
parenteef90e5765cbeb5d41b3db9f170ead03c5fd10bd (diff)
tests: add pickInt.lc -- integer pipeline targeting TextureOut
-rw-r--r--testdata/pickInt.lc25
-rw-r--r--testdata/pickInt.ppl110
2 files changed, 135 insertions, 0 deletions
diff --git a/testdata/pickInt.lc b/testdata/pickInt.lc
new file mode 100644
index 00000000..3c2dba84
--- /dev/null
+++ b/testdata/pickInt.lc
@@ -0,0 +1,25 @@
1-- Tests:
2-- 1. Pipeline targeting a render texture (TextureOut), instead of a Screenout.
3-- 2. Integer color components for the output
4
5type FB = FrameBuffer 1 '[ 'Color (Vec 4 Int)]
6
7scene :: String -> FB -> FB
8scene name prevFB =
9 Accumulate ((ColorOp NoBlending (one :: Vec 4 Bool)))
10 (mapFragments (\(uv, rgba) -> ((rgba)))
11 $ rasterizePrimitives (TriangleCtx CullFront PolygonFill NoOffset LastVertex) (Flat, Flat)
12 $ mapPrimitives
13 (\(pos, color, id)->
14 ( (Uniform "viewProj" :: Mat 4 4 Float) *. (V4 pos%x pos%y 0 1)
15 , V2 0.0 0.0
16 , V4 0 0 0 id))
17 $ fetch name ( Attribute "position" :: Vec 3 Float
18 , Attribute "color" :: Vec 4 Float
19 , Attribute "id" :: Int))
20 prevFB
21
22main :: Output
23main = TextureOut (V2 800 600) $
24 scene "objects" $
25 FrameBuffer ((colorImage1 (V4 0 0 0 0)))
diff --git a/testdata/pickInt.ppl b/testdata/pickInt.ppl
new file mode 100644
index 00000000..742549a3
--- /dev/null
+++ b/testdata/pickInt.ppl
@@ -0,0 +1,110 @@
1Pipeline
2 { info = "generated by lambdacube-compiler 0.6.1.0"
3 , backend = OpenGL33
4 , textures =
5 [ TextureDescriptor
6 { textureType = Texture2D (IntT RGBA) 1
7 , textureSize = VV2U (V2 800 600)
8 , textureSemantic = Color
9 , textureSampler =
10 SamplerDescriptor
11 { samplerWrapS = Repeat
12 , samplerWrapT = Just Repeat
13 , samplerWrapR = Nothing
14 , samplerMinFilter = Nearest
15 , samplerMagFilter = Nearest
16 , samplerBorderColor = VV4F (V4 0.0 0.0 0.0 1.0)
17 , samplerMinLod = Nothing
18 , samplerMaxLod = Nothing
19 , samplerLodBias = 0.0
20 , samplerCompareFunc = Nothing
21 }
22 , textureBaseLevel = 0
23 , textureMaxLevel = 0
24 }
25 ]
26 , samplers = []
27 , targets =
28 [ RenderTarget
29 { renderTargets =
30 [ TargetItem
31 { targetSemantic = Color
32 , targetRef = Just (TextureImage 0 0 Nothing)
33 }
34 ]
35 }
36 ]
37 , programs =
38 [ Program
39 { programUniforms = fromList [ ( "viewProj" , M44F ) ]
40 , programStreams =
41 fromList
42 [ ( "vi1" , Parameter { name = "position" , ty = V3F } )
43 , ( "vi2" , Parameter { name = "uv" , ty = V2F } )
44 , ( "vi3" , Parameter { name = "id" , ty = Int } )
45 ]
46 , programInTextures = fromList []
47 , programOutput = [ Parameter { name = "f0" , ty = V4I } ]
48 , vertexShader =
49 """
50 #version 330 core
51 vec4 texture2D(sampler2D s,vec2 uv) {
52 return texture(s,uv);
53 }
54 uniform mat4 viewProj;
55 in vec3 vi1;
56 in vec2 vi2;
57 in int vi3;
58 flat out vec2 vo1;
59 flat out ivec4 vo2;
60 void main() {
61 gl_Position = (viewProj) * (vec4 ((vi1).x,(vi1).y,0.0,1.0));
62 vo1 = vi2;
63 vo2 = ivec4 (0,0,0,vi3);
64 }
65 """
66 , geometryShader = Nothing
67 , fragmentShader =
68 """
69 #version 330 core
70 vec4 texture2D(sampler2D s,vec2 uv) {
71 return texture(s,uv);
72 }
73 flat in vec2 vo1;
74 flat in ivec4 vo2;
75 out ivec4 f0;
76 void main() {
77 f0 = vo2;
78 }
79 """
80 }
81 ]
82 , slots =
83 [ Slot
84 { slotName = "stream"
85 , slotStreams =
86 fromList [ ( "id" , Int ) , ( "position" , V3F ) , ( "uv" , V2F ) ]
87 , slotUniforms = fromList [ ( "viewProj" , M44F ) ]
88 , slotPrimitive = Triangles
89 , slotPrograms = [ 0 ]
90 }
91 ]
92 , streams = []
93 , commands =
94 [ SetRenderTarget 0
95 , ClearRenderTarget
96 [ ClearImage
97 { imageSemantic = Color , clearValue = VV4I (V4 0 0 0 0) }
98 ]
99 , SetProgram 0
100 , SetRasterContext
101 (TriangleCtx (CullFront CCW) PolygonFill NoOffset LastVertex)
102 , SetAccumulationContext
103 AccumulationContext
104 { accViewportName = Nothing
105 , accOperations =
106 [ ColorOp NoBlending (VV4B (V4 True True True True)) ]
107 }
108 , RenderSlot 0
109 ]
110 } \ No newline at end of file