public void PassThroughWithGeometryShader()
        {
            using (GraphicsWindow window = Device.CreateWindow(1, 1))
                using (ShaderProgram sp = Device.CreateShaderProgram(
                           ShaderSources.PassThroughVertexShader(),
                           ShaderSources.PassThroughGeometryShader(),
                           ShaderSources.PassThroughFragmentShader()))
                {
                    Assert.IsFalse(sp.Log.Contains("warning"));
                    Assert.IsEmpty(sp.Uniforms);
                    Assert.IsEmpty(sp.UniformBlocks);

                    Assert.AreEqual(1, sp.VertexAttributes.Count);
                    Assert.IsTrue(sp.VertexAttributes.Contains("position"));

                    ShaderVertexAttribute attribute = sp.VertexAttributes["position"];
                    Assert.AreEqual("position", attribute.Name);
                    Assert.AreEqual(ShaderVertexAttributeType.FloatVector4, attribute.Datatype);
                    Assert.AreEqual(1, attribute.Length);
                }
        }
Beispiel #2
0
        public void FindOrAddGS()
        {
            using (GraphicsWindow window = Device.CreateWindow(1, 1))
            {
                ShaderCache cache = new ShaderCache();

                ShaderProgram sp = cache.FindOrAdd("PassThrough",
                                                   ShaderSources.PassThroughVertexShader(),
                                                   ShaderSources.PassThroughGeometryShader(),
                                                   ShaderSources.PassThroughFragmentShader());
                ShaderProgram sp2 = cache.FindOrAdd("PassThrough",
                                                    ShaderSources.PassThroughVertexShader(),
                                                    ShaderSources.PassThroughGeometryShader(),
                                                    ShaderSources.PassThroughFragmentShader());

                Assert.AreEqual(sp, sp2);

                cache.Release("PassThrough");
                cache.Release("PassThrough");
            }
        }