Пример #1
0
        public void TestUniform2ui()
        {
            if (!HasVersion(3, 0) && !HasEsVersion(3, 0) && !IsGlExtensionSupported("GL_EXT_gpu_shader4"))
            {
                Assert.Inconclusive("required features not implemented");
            }

            using (Device device = new Device())
                using (new GLContext(device))
                {
                    uint program = CreateProgramUniform2ui();

                    try {
                        Vertex2ui uniformStruct;
                        uint[]    uniformValue;

                        int uniformLoc = Gl.GetUniformLocation(program, "uVec");
                        if (uniformLoc < 0)
                        {
                            throw new InvalidOperationException("no uniform variable");
                        }

                        // glGetUniformuiv
                        uniformValue = Array2(1u);
                        Gl.GetUniform(program, uniformLoc, uniformValue);
                        CollectionAssert.AreEqual(Array2(0u), uniformValue);

                        // glGetUniformuiv (ref)
                        uniformStruct = new Vertex2ui(1u);
                        Gl.GetUniformui(program, uniformLoc, ref uniformStruct);
                        Assert.AreEqual(Vertex2ui.Zero, uniformStruct);

                        // glUniform2ui
                        uniformValue = Array2(0u);
                        Gl.Uniform2(uniformLoc, Array2(1u));
                        Gl.GetUniform(program, uniformLoc, uniformValue);
                        CollectionAssert.AreEqual(Array2(1u), uniformValue);

                        // glUniform2uiv
                        uniformValue = Array2(0u);
                        Gl.Uniform2(uniformLoc, Array2(9u));
                        Gl.GetUniform(program, uniformLoc, uniformValue);
                        CollectionAssert.AreEqual(Array2(9u), uniformValue);

                        // glUniform2uiv (ref)
                        uniformValue  = Array2(0u);
                        uniformStruct = new Vertex2ui(5u);
                        Gl.Uniform2ui(uniformLoc, 1, ref uniformStruct);
                        Gl.GetUniform(program, uniformLoc, uniformValue);
                        CollectionAssert.AreEqual(Array2(5u), uniformValue);
                    } finally {
                        Gl.DeleteProgram(program);
                    }
                }
        }
Пример #2
0
 void IShaderUniformContainer.SetUniform(GraphicsContext ctx, string uniformName, Vertex2ui v)
 {
     throw new NotImplementedException();
 }