Lines Matching full:uniform
21 * \brief Uniform API tests.
326 struct Uniform
331 Uniform (const char* const name_, const glu::VarType& type_) : name(name_), type(type_) {}
340 Uniform& getUniform (const int ndx) { return m_uniforms[ndx]; }
341 const Uniform& getUniform (const int ndx) const { return m_uniforms[ndx]; }
343 void addUniform (const Uniform& uniform) { m_uniforms.push_back(uniform); }
399 res->m_uniforms.push_back(Uniform((string("u_var") + nameSuffix).c_str(), glu::VarType(type, prec)));
407 res->m_uniforms.push_back(Uniform((string("u_var") + nameSuffix).c_str(), glu::VarType(glu::VarType(type, prec), 3)));
427 res->addUniform(Uniform((string("u_var") + nameSuffix).c_str(), glu::VarType(structType)));
463 res->addUniform(Uniform((string("u_var") + nameSuffix).c_str(), glu::VarType(structType)));
526 Uniform uniform(("u_var" + de::toString(i)).c_str(), glu::VarType());
534 uniform.type = (("u_var" + de::toString(i)).c_str(), generateRandomType(3, structIdx, structTypes, rnd));
535 } while (res->getNumSamplers() + getNumSamplersInType(uniform.type) > MAX_NUM_SAMPLER_UNIFORMS);
537 res->addUniform(uniform);
552 vector<Uniform> m_uniforms;
917 // UNIFORMFUNC_VALUE: use pass-by-value versions of uniform assignment funcs, e.g. glUniform1f(), where possible. If not given, use pass-by-pointer versions.
934 // UNIFORMVALUE_ZERO: use zero-valued uniforms. If not given, use random uniform values.
952 // A basic uniform is a uniform (possibly struct or array member) whose type is a basic type (e.g. float, ivec4, sampler2d).
958 VarValue finalValue; //!< The value we ultimately want to set for this uniform.
1038 // Get uniform values with glGetUniform*() and put to valuesDst. Uniforms that get -1 from glGetUniformLocation() get glu::TYPE_INVALID.
1040 // Check that every uniform has the default (zero) value.
1044 // Compare the uniform values given in values (obtained with glGetUniform*()) with the basicUniform.finalValue values.
1046 // Render and check that all pixels are white (i.e. all uniform comparisons passed).
1057 // Generates the basic uniforms, based on the uniform with name varName and type varType, in the same manner as are expected
1068 void writeUniformCompareExpr (std::ostringstream& dst, const BasicUniform& uniform) const;
1254 dst << "uniform " << glu::declare(m_uniformCollection->getUniform(i).type, m_uniformCollection->getUniform(i).name.c_str()) << ";\n";
1318 void UniformCase::writeUniformCompareExpr (std::ostringstream& dst, const BasicUniform& uniform) const
1320 if (glu::isDataTypeSampler(uniform.type))
1321 dst << "compare_" << glu::getDataTypeName(getSamplerLookupReturnType(uniform.type)) << "(texture(" << uniform.name << ", vec" << getSamplerNumLookupDimensions(uniform.type) << "(0.0))";
1323 dst << "compare_" << glu::getDataTypeName(uniform.type) << "(" << uniform.name;
1325 dst << ", " << shaderVarValueStr(uniform.finalValue) << ")";
1469 log << TestLog::Message << "// Maximum uniform name length reported: " << uniformMaxNameLength << TestLog::EndMessage;
1483 TCU_CHECK_MSG(reportedType != glu::TYPE_LAST, "Invalid uniform type");
1504 log << TestLog::Message << "// FAILURE: invalid non-built-in uniform name reported" << TestLog::EndMessage;
1517 log << TestLog::Message << "// FAILURE: same uniform name reported twice" << TestLog::EndMessage;
1546 log << TestLog::Message << "// FAILURE: uniform with name " << expected.name << " was not reported by GL" << TestLog::EndMessage;
1580 log << TestLog::Message << "// FAILURE: uniform with name " << basicUniformReportsRef[i].name << " received GL_INVALID_INDEX" << TestLog::EndMessage;
1611 TCU_CHECK_MSG(reportedType != glu::TYPE_LAST, "Invalid uniform type");
1617 << " for the uniform at index " << reportedIndex << " (" << reference.name << ")"
1668 log << TestLog::Message << "// Checking uniform " << uniformName << TestLog::EndMessage;
1672 log << TestLog::Message << "// FAILURE: glGetActiveUniform() and glGetUniformIndices() gave different indices for uniform " << uniformName << TestLog::EndMessage;
1677 log << TestLog::Message << "// FAILURE: glGetActiveUniform() and glGetActiveUniformsiv() gave incompatible name lengths for uniform " << uniformName << TestLog::EndMessage;
1682 log << TestLog::Message << "// FAILURE: glGetActiveUniform() and glGetActiveUniformsiv() gave different sizes for uniform " << uniformName << TestLog::EndMessage;
1687 log << TestLog::Message << "// FAILURE: glGetActiveUniform() and glGetActiveUniformsiv() gave different types for uniform " << uniformName << TestLog::EndMessage;
1693 log << TestLog::Message << "// FAILURE: uniform " << uniformName << " was reported active by glGetActiveUniform() but not by glGetUniformIndices()" << TestLog::EndMessage;
1706 log << TestLog::Message << "// FAILURE: uniform " << uniformsivName << " was reported active by glGetUniformIndices() but not by glGetActiveUniform()" << TestLog::EndMessage;
1721 const BasicUniform& uniform = basicUniforms[unifNdx];
1722 const string queryName = m_features & FEATURE_ARRAY_FIRST_ELEM_NAME_NO_INDEX && uniform.elemNdx == 0 ? beforeLast(uniform.name, '[') : uniform.name;
1724 const int size = glu::getDataTypeScalarSize(uniform.type);
1733 if (uniform.isUsedInShader)
1735 log << TestLog::Message << "// FAILURE: " << uniform.name << " was used in shader, but has location -1" << TestLog::EndMessage;
1741 value.type = uniform.type;
1747 if (glu::isDataTypeFloatOrVec(uniform.type) || glu::isDataTypeMatrix(uniform.type))
1749 else if (glu::isDataTypeIntOrIVec(uniform.type))
1751 else if (glu::isDataTypeUintOrUVec(uniform.type))
1753 else if (glu::isDataTypeBoolOrBVec(uniform.type))
1774 else if (glu::isDataTypeSampler(uniform.type))
1785 log << TestLog::Message << "// Got " << uniform.name << " value " << apiVarValueStr(value) << TestLog::EndMessage;
1800 const BasicUniform& uniform = basicUniforms[unifNdx];
1802 const int valSize = glu::getDataTypeScalarSize(uniform.type);
1804 log << TestLog::Message << "// Checking uniform " << uniform.name << TestLog::EndMessage;
1816 log << TestLog::Message << "// FAILURE: uniform " << uniform.name << " has non-zero initial value" << TestLog::EndMessage; \
1822 if (glu::isDataTypeFloatOrVec(uniform.type) || glu::isDataTypeMatrix(uniform.type))
1824 else if (glu::isDataTypeIntOrIVec(uniform.type))
1826 else if (glu::isDataTypeUintOrUVec(uniform.type))
1828 else if (glu::isDataTypeBoolOrBVec(uniform.type))
1830 else if (glu::isDataTypeSampler(uniform.type))
1834 log << TestLog::Message << "// FAILURE: uniform " << uniform.name << " has non-zero initial value" << TestLog::EndMessage;
1858 const BasicUniform& uniform = basicUniforms[unifNdx];
1859 const bool isArrayMember = uniform.elemNdx >= 0;
1860 const string queryName = m_features & FEATURE_ARRAY_FIRST_ELEM_NAME_NO_INDEX && uniform.elemNdx == 0 ? beforeLast(uniform.name, '[') : uniform.name;
1862 : m_features & FEATURE_ARRAYASSIGN_FULL ? (uniform.elemNdx == 0 ? uniform.rootSize : 0)
1863 : m_features & FEATURE_ARRAYASSIGN_BLOCKS_OF_TWO ? (uniform.elemNdx % 2 == 0 ? 2 : 0)
1871 log << TestLog::Message << "// Uniform " << uniform.name << " is covered by another glUniform*v() call to the same array" << TestLog::EndMessage;
1876 const int typeSize = glu::getDataTypeScalarSize(uniform.type);
1877 const bool assignByValue = m_features & FEATURE_UNIFORMFUNC_VALUE && !glu::isDataTypeMatrix(uniform.type) && numValuesToAssign == 1;
1882 const string curName = isArrayMember ? beforeLast(uniform.rootName, '[') + "[" + de::toString(uniform.elemNdx+i) + "]" : uniform.name;
1893 unifValue = uniform.finalValue;
1901 if (glu::isDataTypeBoolOrBVec(uniform.type))
1903 else if (glu::isDataTypeSampler(uniform.type))
1904 log << TestLog::Message << "// Texture for the sampler uniform " << curName << " will be filled with color " << apiVarValueStr(getSamplerFillValue(uniform.finalValue)) << TestLog::EndMessage;
1952 switch (uniform.type)
2038 GLU_CHECK_CALL(glUniform1i(location, uniform.finalValue.val.samplerV.unit));
2041 const GLint unit = uniform.finalValue.val.samplerV.unit;
2057 const BasicUniform& uniform = basicUniforms[unifNdx];
2060 log << TestLog::Message << "// Checking uniform " << uniform.name << TestLog::EndMessage;
2065 if (!apiVarValueEquals(unifValue, uniform.finalValue))
2067 log << TestLog::Message << "// FAILURE: value obtained with glGetUniform*() for uniform " << uniform.name << " differs from value set with glUniform*()" << TestLog::EndMessage;
2253 const ScopedLogSection section(log, "InfoGetActiveUniform", "Uniform information queries with glGetActiveUniform()");
2274 const ScopedLogSection section(log, "InfoGetActiveUniformsiv", "Uniform information queries with glGetUniformIndices() and glGetActiveUniformsiv()");
2369 case VALUETOCHECK_INITIAL: return "Check initial uniform values (zeros)";
2370 case VALUETOCHECK_ASSIGNED: return "Check assigned uniform values";
2441 const ScopedLogSection section(log, "UniformAssign", "Uniform value assignments");
2452 const ScopedLogSection section(log, "GetUniforms", "Uniform value query");
2538 Uniform information queries with glGetActiveUniform()");
2540 PERFORM_AND_CHECK(getActiveUniformsiv(reportsUniformsiv, basicUniformReportsRef, programGL), "InfoGetActiveUniformsiv", "Uniform information queries with glGetIndices() and glGetActiveUniformsiv()");
2549 PERFORM_AND_CHECK(getUniforms(uniformDefaultValues, basicUniforms, programGL), "GetUniformDefaults", "Uniform default value query");
2559 const ScopedLogSection section(log, "UniformAssign", "Uniform value assignments");
2564 PERFORM_AND_CHECK(getUniforms(uniformValues, basicUniforms, programGL), "GetUniforms", "Uniform value query");
2578 : TestCaseGroup(context, "uniform_api", "Uniform API Tests")
2677 TestCaseGroup* const infoQueryGroup = new TestCaseGroup(m_context, "info_query", "Test uniform info querying functions");
2737 // Cases testing uniform values.
2740 TestCaseGroup* const valueGroup = new TestCaseGroup(m_context, "value", "Uniform value tests");
2798 // Cases that first assign values to each uniform, then check the values with glGetUniform*() or by rendering.