Lines Matching refs:uniform
643 //uniform value
967 ret << "uniform ";
979 //add a "zero" uniform;
980 ret << "uniform float zero;" << std::endl;
1002 //layout(location = X) subroutine uniform stX uX[...];
1004 ret << "subroutine uniform " << subroutineUniforms[i].functions.getTypeName() << " "
1012 static void streamUniformValidator(std::ostringstream& ret, const Uniform& uniform, GLenum shader,
1015 if (uniform.declOccurence.occurs(shader) && uniform.usageOccurence.occurs(shader))
1017 if (uniform.type.isStruct())
1019 for (size_t child = 0; child < uniform.childUniforms.size(); child++)
1021 streamUniformValidator(ret, uniform.childUniforms[child], shader, outTemporary);
1026 for (int arrayElement = 0; arrayElement < uniform.type.arraySize; arrayElement++)
1028 for (int column = 0; column < uniform.type.getSize().second; column++)
1031 if (uniform.type.getSize().second > 1)
1038 if (uniform.type.isSigned())
1043 if (uniform.type.getBaseType() == GL_SAMPLER)
1045 ret << NL " if (any(greaterThan(" << absoluteF << "(texture(" << uniform.getName();
1046 uniform.type.streamArrayStr(ret, arrayElement);
1048 uniform.value.streamValue(ret, arrayElement, column);
1049 ret << " ), " << uniform.type.refStr() << "(" << uniform.type.abs() << ")))) {";
1051 else if (uniform.type.getSize().first > 1)
1053 ret << NL " if (any(greaterThan(" << absoluteF << "(" << uniform.getName();
1054 uniform.type.streamArrayStr(ret, arrayElement);
1056 uniform.value.streamValue(ret, arrayElement, column);
1057 ret << "), " << uniform.type.refStr() << "(" << uniform.type.abs() << ")))) {";
1061 ret << NL " if (" << absoluteF << "(" << uniform.getName();
1062 uniform.type.streamArrayStr(ret, arrayElement);
1064 uniform.value.streamValue(ret, arrayElement);
1065 ret << ") >" << uniform.type.refStr() << "(" << uniform.type.abs() << ")) {";
1410 void setUniform(const Uniform& uniform, const CompiledProgram& program)
1416 used |= uniform.declOccurence.occurs(program.stages[i]) && uniform.usageOccurence.occurs(program.stages[i]);
1421 if (uniform.type.isStruct())
1423 for (size_t j = 0; j < uniform.childUniforms.size(); j++)
1425 setUniform(uniform.childUniforms[j], program);
1431 if (uniform.location.isImplicit(program.stages))
1434 name << uniform.getName();
1435 uniform.type.streamArrayStr(name, 0);
1440 loc = uniform.location.val;
1443 for (int arrayElem = 0; arrayElem < uniform.type.arraySize; arrayElem++)
1445 switch (uniform.type.enumType)
1448 glUniform1f(loc, *(GLfloat*)uniform.value.getPtr(arrayElem));
1451 glUniform2fv(loc, 1, (GLfloat*)uniform.value.getPtr(arrayElem));
1454 glUniform3fv(loc, 1, (GLfloat*)uniform.value.getPtr(arrayElem));
1457 glUniform4fv(loc, 1, (GLfloat*)uniform.value.getPtr(arrayElem));
1460 glUniformMatrix2fv(loc, 1, GL_FALSE, (GLfloat*)uniform.value.getPtr(arrayElem));
1463 glUniformMatrix3fv(loc, 1, GL_FALSE, (GLfloat*)uniform.value.getPtr(arrayElem));
1466 glUniformMatrix4fv(loc, 1, GL_FALSE, (GLfloat*)uniform.value.getPtr(arrayElem));
1469 glUniformMatrix2x3fv(loc, 1, GL_FALSE, (GLfloat*)uniform.value.getPtr(arrayElem));
1472 glUniformMatrix4x3fv(loc, 1, GL_FALSE, (GLfloat*)uniform.value.getPtr(arrayElem));
1475 glUniformMatrix2x4fv(loc, 1, GL_FALSE, (GLfloat*)uniform.value.getPtr(arrayElem));
1478 glUniformMatrix3x4fv(loc, 1, GL_FALSE, (GLfloat*)uniform.value.getPtr(arrayElem));
1481 glUniformMatrix3x2fv(loc, 1, GL_FALSE, (GLfloat*)uniform.value.getPtr(arrayElem));
1484 glUniformMatrix4x2fv(loc, 1, GL_FALSE, (GLfloat*)uniform.value.getPtr(arrayElem));
1488 glUniform1i(loc, *(GLint*)uniform.value.getPtr(arrayElem));
1491 glUniform2iv(loc, 1, (GLint*)uniform.value.getPtr(arrayElem));
1494 glUniform3iv(loc, 1, (GLint*)uniform.value.getPtr(arrayElem));
1497 glUniform4iv(loc, 1, (GLint*)uniform.value.getPtr(arrayElem));
1500 glUniform1ui(loc, *(GLuint*)uniform.value.getPtr(arrayElem));
1644 long runQueryUniform(const CompiledProgram& program, const Uniform& uniform, std::set<GLuint>& usedLocations,
1660 if (uniform.type.isStruct())
1662 for (size_t i = 0; i < uniform.childUniforms.size(); i++)
1664 ret |= runQueryUniform(program, uniform.childUniforms[i], usedLocations, max);
1669 for (int arrayElem = 0; arrayElem < uniform.type.arraySize; arrayElem++)
1672 /* Location that is taken by this uniform (even if not used).*/
1674 if (!uniform.location.isImplicit(program.stages))
1676 reservedLocation = uniform.location.val + arrayElem;
1680 bool runQueries = uniform.location.isImplicit(program.stages) ||
1681 (arrayElem < 1000 || arrayElem > uniform.type.arraySize - 1000);
1686 name << uniform.getName();
1687 uniform.type.streamArrayStr(name, arrayElem);
1696 << "Locations of uniform \"" << name.str()
1704 used |= uniform.declOccurence.occurs(program.stages[i]) &&
1705 uniform.usageOccurence.occurs(program.stages[i]);
1708 if (!uniform.location.isImplicit(program.stages))
1710 //Validate uniform location against explicit value
1715 Logger() << "Unexpected uniform \"" << name.str() << "\" location: expected " << expected
1727 Logger() << "Unexpected uniform \"" << name.str()
1813 Logger() << "Locations of subrutine uniform \"" << name.str()
1824 //Validate uniform location against explicit value
1829 Logger() << "Unexpected subroutine uniform \"" << name.str() << "\" location: expected " << expected
1843 Logger() << "Unexpected subroutine uniform \"" << name.str()
1859 Logger() << "Subroutine uniform \"" << name.str() << "\" location (" << reservedLocation
1872 Logger() << "Subroutine uniform \"" << name.str() << "\" returned location (" << returned
1931 //Validate uniform location against explicit value
2135 //layout (location = 2) uniform vec4 u0;
2146 //layout (location = 0x0a) uniform vec4 u0;
2147 //layout (location = 010) uniform vec4 u1;
2161 //layout (location = 2) uniform vec4 u0;
2172 //layout (location = 2) uniform vec4 u0;
2173 //layout (location = 3) uniform vec4 u1;
2174 //layout (location = 5) uniform vec4 u2;
2187 //layout (location = 2) uniform float u0;
2188 //layout (location = 3) uniform vec3 u1;
2189 //layout (location = 0) uniform uint u2;
2190 //layout (location = 1) uniform ivec3 u3;
2191 //layout (location = 4) uniform mat2 u4;
2192 //layout (location = 7) uniform mat2 u5;
2193 //layout (location = 5) uniform mat2 u6;
2194 //layout (location = 6) uniform mat3 u7;
2213 //layout (location = 1) uniform mat2x3 u0;
2214 //layout (location = 2) uniform mat3x2 u1;
2215 //layout (location = 0) uniform mat2 u2;
2216 //layout (location = 3) uniform imat3x4 u3;
2229 //layout (location = 1) uniform sampler2D s0[3];
2230 //layout (location = 13) uniform sampler2D s1;
2278 * This test case uses following uniform declarations:
2285 * layout (location = 1) uniform S s0[3];
2286 * layout (location = 13) uniform S s1;
2304 //layout (location = 2) uniform float[3] u0;
2305 //layout (location = 5) uniform vec3[2] u1;
2306 //layout (location = 7) uniform int[3] u2;
2307 //layout (location = 10) uniform ivec4 u3;
2321 //layout (location = 2) uniform float u0;
2322 //layout (location = 5) uniform vec3[2] u1;
2323 //layout (location = 8) uniform int[3] u2;
2324 //layout (location = 12) uniform ivec4[1] u3;
2338 //layout (location = 2) uniform float[2][3] u0;
2339 //layout (location = 8) uniform vec3[2][2] u1;
2340 //layout (location = 12) uniform float u2;
2363 //layout (location = 0) uniform float u0;
2364 //layout (location = 2) uniform vec3 u1;
2365 //layout (location = 3) uniform int u2;
2367 //uniform float u0;
2368 //uniform vec3 u1;
2369 //uniform int u2;
2382 //uniform float[3] u0;
2383 //layout (location = 3) uniform vec3[2] u1;
2384 //uniform int[3] u2;
2385 //layout (location = 8) uniform ivec4 u3;
2399 //layout (location = 0) uniform float u0; //unused
2400 //layout (location = 2) uniform vec3 u1; //unused
2401 //layout (location = 3) uniform int u2; //unused
2403 //uniform float u3;
2404 //uniform vec3 u4;
2405 //uniform int u5;
2511 //One shader: uniform float u0;
2512 //Another shader: layout (location = 3) uniform float u0;
2523 //One shader: uniform float u0;
2524 //Another shader: layout (location = 3) uniform float u0; //not used!
2573 std::string def = "layout (location = x) uniform float u0;";
2582 std::string def = NL "const int i = 1;" NL "layout (location = i) uniform float u0;";
2591 //layout (location = 2) uniform float u0;
2592 //layout (location = 2) uniform float u1;
2604 ///layout (location = 2) uniform float u0;
2605 //layout (location = 2) uniform float u1;
2617 //layout (location = X) uniform float u0;
2658 //layout(location = 2) subroutine uniform st0 u0;
2677 //layout(location = 0x0a) subroutine uniform st0 u0;
2680 //layout(location = 010 ) subroutine uniform st0 u1;
2698 //layout(location = 2) subroutine uniform st0 u0;
2716 //layout(location = 1) subroutine uniform st0 u0[2];
2738 //layout(location = 1) subroutine uniform st0 u0[2];
2741 ////layout(location = 3) subroutine uniform st0 u1[2][3];
2748 //layout(location = 9) subroutine uniform st1 u2;
2765 //subroutine uniform st0 u0;
2767 //layout(location = 1 ) subroutine uniform st0 u1;
2769 //layout(location = 0 ) subroutine uniform st0 u2;
2783 "layout(location = x ) subroutine uniform st0 u0;";
2795 "layout(location = i ) subroutine uniform st0 u0;";
2804 //layout(location = 1) subroutine uniform st0 u0;
2805 //layout(location = 1) subroutine uniform st0 u0;
2820 //layout(location = N) subroutine uniform st0 u0;
2865 //subroutine uniform st0 u0;
2887 //subroutine uniform st0 u0;
2911 //layout(location = 3) subroutine uniform st0 u0;
2933 //layout(location = 2) subroutine uniform st0 u0;
2962 //layout(location = 1) subroutine uniform st0 u0;
2965 //layout(location = 9) subroutine uniform st1 u1;
2987 //subroutine uniform st0 u0;
3010 //layout(location = 2) subroutine uniform st0 u0;
3050 //subroutine uniform st0 u0;
3072 //subroutine uniform st0 u0;
3098 //subroutine uniform st0 u0;
3120 addChild(new TestSubcase(m_context, "uniform-loc", TestSubcase::Create<UniformLoc>));
3121 addChild(new TestSubcase(m_context, "uniform-loc-nondecimal", TestSubcase::Create<UniformLocNonDec>));
3122 addChild(new TestSubcase(m_context, "uniform-loc-all-stages", TestSubcase::Create<UniformLocMultipleStages>));
3124 new TestSubcase(m_context, "uniform-loc-multiple-uniforms", TestSubcase::Create<UniformLocMultipleUniforms>));
3125 addChild(new TestSubcase(m_context, "uniform-loc-types-mix", TestSubcase::Create<UniformLocTypesMix>));
3126 addChild(new TestSubcase(m_context, "uniform-loc-types-mat", TestSubcase::Create<UniformLocTypesMat>));
3127 addChild(new TestSubcase(m_context, "uniform-loc-types-structs", TestSubcase::Create<UniformLocTypesStructs>));
3128 addChild(new TestSubcase(m_context, "uniform-loc-types-samplers", TestSubcase::Create<UniformLocTypesSamplers>));
3130 new TestSubcase(m_context, "uniform-loc-arrays-nonspaced", TestSubcase::Create<UniformLocArraysNonSpaced>));
3131 addChild(new TestSubcase(m_context, "uniform-loc-arrays-spaced", TestSubcase::Create<UniformLocArraySpaced>));
3133 addChild(new TestSubcase(m_context, "uniform-loc-arrays-of-arrays", TestSubcase::Create<UniformLocArrayofArrays>));
3136 new TestSubcase(m_context, "uniform-loc-mix-with-implicit", TestSubcase::Create<UniformLocMixWithImplicit>));
3138 new TestSubcase(m_context, "uniform-loc-mix-with-implicit2", TestSubcase::Create<UniformLocMixWithImplicit2>));
3140 new TestSubcase(m_context, "uniform-loc-mix-with-implicit3", TestSubcase::Create<UniformLocMixWithImplicit3>));
3141 addChild(new TestSubcase(m_context, "uniform-loc-mix-with-implicit-max",
3143 addChild(new TestSubcase(m_context, "uniform-loc-mix-with-implicit-max-array",
3146 addChild(new TestSubcase(m_context, "uniform-loc-implicit-in-some-stages",
3148 addChild(new TestSubcase(m_context, "uniform-loc-implicit-in-some-stages2",
3150 addChild(new TestSubcase(m_context, "uniform-loc-implicit-in-some-stages3",
3153 addChild(new TestSubcase(m_context, "uniform-loc-negative-compile-non-number-literal",
3155 addChild(new TestSubcase(m_context, "uniform-loc-negative-compile-nonconst-loc",
3157 addChild(new TestSubcase(m_context, "uniform-loc-negative-link-location-reused1",
3159 addChild(new TestSubcase(m_context, "uniform-loc-negative-link-location-reused2",
3161 addChild(new TestSubcase(m_context, "uniform-loc-negative-link-max-location",
3163 addChild(new TestSubcase(m_context, "uniform-loc-negative-link-max-num-of-locations",
3218 addChild(new TestSubcase(m_context, "uniform-loc", TestSubcase::Create<UniformLoc>));
3219 addChild(new TestSubcase(m_context, "uniform-loc-nondecimal", TestSubcase::Create<UniformLocNonDec>));
3220 addChild(new TestSubcase(m_context, "uniform-loc-all-stages", TestSubcase::Create<UniformLocMultipleStages>));
3222 new TestSubcase(m_context, "uniform-loc-multiple-uniforms", TestSubcase::Create<UniformLocMultipleUniforms>));
3223 addChild(new TestSubcase(m_context, "uniform-loc-types-mix", TestSubcase::Create<UniformLocTypesMix>));
3224 addChild(new TestSubcase(m_context, "uniform-loc-types-mat", TestSubcase::Create<UniformLocTypesMat>));
3225 addChild(new TestSubcase(m_context, "uniform-loc-types-structs", TestSubcase::Create<UniformLocTypesStructs>));
3226 addChild(new TestSubcase(m_context, "uniform-loc-types-samplers", TestSubcase::Create<UniformLocTypesSamplers>));
3228 new TestSubcase(m_context, "uniform-loc-arrays-nonspaced", TestSubcase::Create<UniformLocArraysNonSpaced>));
3229 addChild(new TestSubcase(m_context, "uniform-loc-arrays-spaced", TestSubcase::Create<UniformLocArraySpaced>));
3230 addChild(new TestSubcase(m_context, "uniform-loc-arrays-of-arrays", TestSubcase::Create<UniformLocArrayofArrays>));
3232 new TestSubcase(m_context, "uniform-loc-mix-with-implicit", TestSubcase::Create<UniformLocMixWithImplicit>));
3234 new TestSubcase(m_context, "uniform-loc-mix-with-implicit2", TestSubcase::Create<UniformLocMixWithImplicit2>));
3236 new TestSubcase(m_context, "uniform-loc-mix-with-implicit3", TestSubcase::Create<UniformLocMixWithImplicit3>));
3237 addChild(new TestSubcase(m_context, "uniform-loc-mix-with-implicit-max",
3239 addChild(new TestSubcase(m_context, "uniform-loc-mix-with-implicit-max-array",
3241 addChild(new TestSubcase(m_context, "uniform-loc-implicit-in-some-stages",
3243 addChild(new TestSubcase(m_context, "uniform-loc-implicit-in-some-stages2",
3245 addChild(new TestSubcase(m_context, "uniform-loc-implicit-in-some-stages3",
3247 addChild(new TestSubcase(m_context, "uniform-loc-negative-compile-non-number-literal",
3249 addChild(new TestSubcase(m_context, "uniform-loc-negative-compile-nonconst-loc",
3251 addChild(new TestSubcase(m_context, "uniform-loc-negative-link-location-reused1",
3253 addChild(new TestSubcase(m_context, "uniform-loc-negative-link-location-reused2",
3255 addChild(new TestSubcase(m_context, "uniform-loc-negative-link-max-location",
3257 addChild(new TestSubcase(m_context, "uniform-loc-negative-link-max-num-of-locations",