From a153afd1ed674c0a0b8b520b9e5c2b1449f84fb0 Mon Sep 17 00:00:00 2001 From: Kosyrev Serge <_deepfire@feelingofgreen.ru> Date: Sat, 22 Sep 2018 00:30:20 +0300 Subject: test | pickInt: move to proper place, add .out file --- testdata/graphics-features/pickInt.lc | 25 ++++++++ testdata/graphics-features/pickInt.out | 111 +++++++++++++++++++++++++++++++++ testdata/graphics-features/pickInt.ppl | 110 ++++++++++++++++++++++++++++++++ testdata/pickInt.lc | 25 -------- testdata/pickInt.ppl | 110 -------------------------------- 5 files changed, 246 insertions(+), 135 deletions(-) create mode 100644 testdata/graphics-features/pickInt.lc create mode 100644 testdata/graphics-features/pickInt.out create mode 100644 testdata/graphics-features/pickInt.ppl delete mode 100644 testdata/pickInt.lc delete mode 100644 testdata/pickInt.ppl diff --git a/testdata/graphics-features/pickInt.lc b/testdata/graphics-features/pickInt.lc new file mode 100644 index 00000000..3c2dba84 --- /dev/null +++ b/testdata/graphics-features/pickInt.lc @@ -0,0 +1,25 @@ +-- Tests: +-- 1. Pipeline targeting a render texture (TextureOut), instead of a Screenout. +-- 2. Integer color components for the output + +type FB = FrameBuffer 1 '[ 'Color (Vec 4 Int)] + +scene :: String -> FB -> FB +scene name prevFB = + Accumulate ((ColorOp NoBlending (one :: Vec 4 Bool))) + (mapFragments (\(uv, rgba) -> ((rgba))) + $ rasterizePrimitives (TriangleCtx CullFront PolygonFill NoOffset LastVertex) (Flat, Flat) + $ mapPrimitives + (\(pos, color, id)-> + ( (Uniform "viewProj" :: Mat 4 4 Float) *. (V4 pos%x pos%y 0 1) + , V2 0.0 0.0 + , V4 0 0 0 id)) + $ fetch name ( Attribute "position" :: Vec 3 Float + , Attribute "color" :: Vec 4 Float + , Attribute "id" :: Int)) + prevFB + +main :: Output +main = TextureOut (V2 800 600) $ + scene "objects" $ + FrameBuffer ((colorImage1 (V4 0 0 0 0))) diff --git a/testdata/graphics-features/pickInt.out b/testdata/graphics-features/pickInt.out new file mode 100644 index 00000000..8812744e --- /dev/null +++ b/testdata/graphics-features/pickInt.out @@ -0,0 +1,111 @@ +Pipeline + { info = "" + , backend = OpenGL33 + , textures = + [ TextureDescriptor + { textureType = Texture2D (IntT RGBA) 1 + , textureSize = VV2U (V2 800 600) + , textureSemantic = Color + , textureSampler = + SamplerDescriptor + { samplerWrapS = Repeat + , samplerWrapT = Just Repeat + , samplerWrapR = Nothing + , samplerMinFilter = Nearest + , samplerMagFilter = Nearest + , samplerBorderColor = VV4F (V4 0.0 0.0 0.0 1.0) + , samplerMinLod = Nothing + , samplerMaxLod = Nothing + , samplerLodBias = 0.0 + , samplerCompareFunc = Nothing + } + , textureBaseLevel = 0 + , textureMaxLevel = 0 + } + ] + , samplers = [] + , targets = + [ RenderTarget + { renderTargets = + [ TargetItem + { targetSemantic = Color + , targetRef = Just (TextureImage 0 0 Nothing) + } + ] + } + ] + , programs = + [ Program + { programUniforms = fromList [ ( "viewProj" , M44F ) ] + , programStreams = + fromList + [ ( "vi1" , Parameter { name = "position" , ty = V3F } ) + , ( "vi2" , Parameter { name = "color" , ty = V4F } ) + , ( "vi3" , Parameter { name = "id" , ty = Int } ) + ] + , programInTextures = fromList [] + , programOutput = [ Parameter { name = "f0" , ty = V4I } ] + , vertexShader = + """ + #version 330 core + vec4 texture2D(sampler2D s,vec2 uv) { + return texture(s,uv); + } + uniform mat4 viewProj; + in vec3 vi1; + in vec4 vi2; + in int vi3; + flat out vec2 vo1; + flat out ivec4 vo2; + void main() { + gl_Position = (viewProj) * (vec4 ((vi1).x,(vi1).y,0.0,1.0)); + vo1 = vec2 (0.0,0.0); + vo2 = ivec4 (0,0,0,vi3); + } + """ + , geometryShader = Nothing + , fragmentShader = + """ + #version 330 core + vec4 texture2D(sampler2D s,vec2 uv) { + return texture(s,uv); + } + flat in vec2 vo1; + flat in ivec4 vo2; + out ivec4 f0; + void main() { + f0 = vo2; + } + """ + } + ] + , slots = + [ Slot + { slotName = "objects" + , slotStreams = + fromList + [ ( "color" , V4F ) , ( "id" , Int ) , ( "position" , V3F ) ] + , slotUniforms = fromList [ ( "viewProj" , M44F ) ] + , slotPrimitive = Triangles + , slotPrograms = [ 0 ] + } + ] + , streams = [] + , commands = + [ SetRenderTarget 0 + , ClearRenderTarget + [ ClearImage + { imageSemantic = Color , clearValue = VV4I (V4 0 0 0 0) } + ] + , SetProgram 0 + , SetRasterContext + (TriangleCtx (CullFront CCW) PolygonFill NoOffset LastVertex) + , SetAccumulationContext + AccumulationContext + { accViewportName = Nothing + , accOperations = + [ ColorOp NoBlending (VV4B (V4 True True True True)) ] + } + , RenderSlot 0 + ] + } \ No newline at end of file diff --git a/testdata/graphics-features/pickInt.ppl b/testdata/graphics-features/pickInt.ppl new file mode 100644 index 00000000..742549a3 --- /dev/null +++ b/testdata/graphics-features/pickInt.ppl @@ -0,0 +1,110 @@ +Pipeline + { info = "generated by lambdacube-compiler 0.6.1.0" + , backend = OpenGL33 + , textures = + [ TextureDescriptor + { textureType = Texture2D (IntT RGBA) 1 + , textureSize = VV2U (V2 800 600) + , textureSemantic = Color + , textureSampler = + SamplerDescriptor + { samplerWrapS = Repeat + , samplerWrapT = Just Repeat + , samplerWrapR = Nothing + , samplerMinFilter = Nearest + , samplerMagFilter = Nearest + , samplerBorderColor = VV4F (V4 0.0 0.0 0.0 1.0) + , samplerMinLod = Nothing + , samplerMaxLod = Nothing + , samplerLodBias = 0.0 + , samplerCompareFunc = Nothing + } + , textureBaseLevel = 0 + , textureMaxLevel = 0 + } + ] + , samplers = [] + , targets = + [ RenderTarget + { renderTargets = + [ TargetItem + { targetSemantic = Color + , targetRef = Just (TextureImage 0 0 Nothing) + } + ] + } + ] + , programs = + [ Program + { programUniforms = fromList [ ( "viewProj" , M44F ) ] + , programStreams = + fromList + [ ( "vi1" , Parameter { name = "position" , ty = V3F } ) + , ( "vi2" , Parameter { name = "uv" , ty = V2F } ) + , ( "vi3" , Parameter { name = "id" , ty = Int } ) + ] + , programInTextures = fromList [] + , programOutput = [ Parameter { name = "f0" , ty = V4I } ] + , vertexShader = + """ + #version 330 core + vec4 texture2D(sampler2D s,vec2 uv) { + return texture(s,uv); + } + uniform mat4 viewProj; + in vec3 vi1; + in vec2 vi2; + in int vi3; + flat out vec2 vo1; + flat out ivec4 vo2; + void main() { + gl_Position = (viewProj) * (vec4 ((vi1).x,(vi1).y,0.0,1.0)); + vo1 = vi2; + vo2 = ivec4 (0,0,0,vi3); + } + """ + , geometryShader = Nothing + , fragmentShader = + """ + #version 330 core + vec4 texture2D(sampler2D s,vec2 uv) { + return texture(s,uv); + } + flat in vec2 vo1; + flat in ivec4 vo2; + out ivec4 f0; + void main() { + f0 = vo2; + } + """ + } + ] + , slots = + [ Slot + { slotName = "stream" + , slotStreams = + fromList [ ( "id" , Int ) , ( "position" , V3F ) , ( "uv" , V2F ) ] + , slotUniforms = fromList [ ( "viewProj" , M44F ) ] + , slotPrimitive = Triangles + , slotPrograms = [ 0 ] + } + ] + , streams = [] + , commands = + [ SetRenderTarget 0 + , ClearRenderTarget + [ ClearImage + { imageSemantic = Color , clearValue = VV4I (V4 0 0 0 0) } + ] + , SetProgram 0 + , SetRasterContext + (TriangleCtx (CullFront CCW) PolygonFill NoOffset LastVertex) + , SetAccumulationContext + AccumulationContext + { accViewportName = Nothing + , accOperations = + [ ColorOp NoBlending (VV4B (V4 True True True True)) ] + } + , RenderSlot 0 + ] + } \ No newline at end of file diff --git a/testdata/pickInt.lc b/testdata/pickInt.lc deleted file mode 100644 index 3c2dba84..00000000 --- a/testdata/pickInt.lc +++ /dev/null @@ -1,25 +0,0 @@ --- Tests: --- 1. Pipeline targeting a render texture (TextureOut), instead of a Screenout. --- 2. Integer color components for the output - -type FB = FrameBuffer 1 '[ 'Color (Vec 4 Int)] - -scene :: String -> FB -> FB -scene name prevFB = - Accumulate ((ColorOp NoBlending (one :: Vec 4 Bool))) - (mapFragments (\(uv, rgba) -> ((rgba))) - $ rasterizePrimitives (TriangleCtx CullFront PolygonFill NoOffset LastVertex) (Flat, Flat) - $ mapPrimitives - (\(pos, color, id)-> - ( (Uniform "viewProj" :: Mat 4 4 Float) *. (V4 pos%x pos%y 0 1) - , V2 0.0 0.0 - , V4 0 0 0 id)) - $ fetch name ( Attribute "position" :: Vec 3 Float - , Attribute "color" :: Vec 4 Float - , Attribute "id" :: Int)) - prevFB - -main :: Output -main = TextureOut (V2 800 600) $ - scene "objects" $ - FrameBuffer ((colorImage1 (V4 0 0 0 0))) diff --git a/testdata/pickInt.ppl b/testdata/pickInt.ppl deleted file mode 100644 index 742549a3..00000000 --- a/testdata/pickInt.ppl +++ /dev/null @@ -1,110 +0,0 @@ -Pipeline - { info = "generated by lambdacube-compiler 0.6.1.0" - , backend = OpenGL33 - , textures = - [ TextureDescriptor - { textureType = Texture2D (IntT RGBA) 1 - , textureSize = VV2U (V2 800 600) - , textureSemantic = Color - , textureSampler = - SamplerDescriptor - { samplerWrapS = Repeat - , samplerWrapT = Just Repeat - , samplerWrapR = Nothing - , samplerMinFilter = Nearest - , samplerMagFilter = Nearest - , samplerBorderColor = VV4F (V4 0.0 0.0 0.0 1.0) - , samplerMinLod = Nothing - , samplerMaxLod = Nothing - , samplerLodBias = 0.0 - , samplerCompareFunc = Nothing - } - , textureBaseLevel = 0 - , textureMaxLevel = 0 - } - ] - , samplers = [] - , targets = - [ RenderTarget - { renderTargets = - [ TargetItem - { targetSemantic = Color - , targetRef = Just (TextureImage 0 0 Nothing) - } - ] - } - ] - , programs = - [ Program - { programUniforms = fromList [ ( "viewProj" , M44F ) ] - , programStreams = - fromList - [ ( "vi1" , Parameter { name = "position" , ty = V3F } ) - , ( "vi2" , Parameter { name = "uv" , ty = V2F } ) - , ( "vi3" , Parameter { name = "id" , ty = Int } ) - ] - , programInTextures = fromList [] - , programOutput = [ Parameter { name = "f0" , ty = V4I } ] - , vertexShader = - """ - #version 330 core - vec4 texture2D(sampler2D s,vec2 uv) { - return texture(s,uv); - } - uniform mat4 viewProj; - in vec3 vi1; - in vec2 vi2; - in int vi3; - flat out vec2 vo1; - flat out ivec4 vo2; - void main() { - gl_Position = (viewProj) * (vec4 ((vi1).x,(vi1).y,0.0,1.0)); - vo1 = vi2; - vo2 = ivec4 (0,0,0,vi3); - } - """ - , geometryShader = Nothing - , fragmentShader = - """ - #version 330 core - vec4 texture2D(sampler2D s,vec2 uv) { - return texture(s,uv); - } - flat in vec2 vo1; - flat in ivec4 vo2; - out ivec4 f0; - void main() { - f0 = vo2; - } - """ - } - ] - , slots = - [ Slot - { slotName = "stream" - , slotStreams = - fromList [ ( "id" , Int ) , ( "position" , V3F ) , ( "uv" , V2F ) ] - , slotUniforms = fromList [ ( "viewProj" , M44F ) ] - , slotPrimitive = Triangles - , slotPrograms = [ 0 ] - } - ] - , streams = [] - , commands = - [ SetRenderTarget 0 - , ClearRenderTarget - [ ClearImage - { imageSemantic = Color , clearValue = VV4I (V4 0 0 0 0) } - ] - , SetProgram 0 - , SetRasterContext - (TriangleCtx (CullFront CCW) PolygonFill NoOffset LastVertex) - , SetAccumulationContext - AccumulationContext - { accViewportName = Nothing - , accOperations = - [ ColorOp NoBlending (VV4B (V4 True True True True)) ] - } - , RenderSlot 0 - ] - } \ No newline at end of file -- cgit v1.2.3