return n_loc_per_column * m_n_columns;
}
-/** Get size of the type in bytes. Note that this routine assumes tightly packing
+/** Get size of the type in bytes.
+ * Note that this routine doesn't consider arrays and assumes
+ * column_major matrices.
*
- * @return Formula Number of columns * number of rows * sizeof(base_type)
+ * @return Formula:
+ * - If std140 packaging and matrix; number of columns * base alignment
+ * - Otherwise; number of elements * sizeof(base_type)
**/
-GLuint Type::GetSize() const
+GLuint Type::GetSize(const bool is_std140) const
{
const GLuint basic_type_size = GetTypeSize(m_basic_type);
const GLuint n_elements = m_n_columns * m_n_rows;
+ if (is_std140 && m_n_columns > 1)
+ {
+ return m_n_columns * GetBaseAlignment(false);
+ }
+
return basic_type_size * n_elements;
}
result = "vertex";
break;
case TESS_CTRL:
- result = "tesselation control";
+ result = "tessellation control";
break;
case TESS_EVAL:
- result = "tesselation evaluation";
+ result = "tessellation evaluation";
break;
case GEOMETRY:
- result = "geomtery";
+ result = "geometry";
break;
case FRAGMENT:
result = "fragment";
/** Initialize program instance
*
- * @param compute_shader Compute shader source code
- * @param fragment_shader Fragment shader source code
- * @param geometry_shader Geometry shader source code
- * @param tesselation_control_shader Tesselation control shader source code
- * @param tesselation_evaluation_shader Tesselation evaluation shader source code
- * @param vertex_shader Vertex shader source code
- * @param captured_varyings Vector of variables to be captured with transfrom feedback
- * @param capture_interleaved Select mode of transform feedback (separate or interleaved)
- * @param is_separable Selects if monolithic or separable program should be built. Defaults to false
+ * @param compute_shader Compute shader source code
+ * @param fragment_shader Fragment shader source code
+ * @param geometry_shader Geometry shader source code
+ * @param tessellation_control_shader Tessellation control shader source code
+ * @param tessellation_evaluation_shader Tessellation evaluation shader source code
+ * @param vertex_shader Vertex shader source code
+ * @param captured_varyings Vector of variables to be captured with transfrom feedback
+ * @param capture_interleaved Select mode of transform feedback (separate or interleaved)
+ * @param is_separable Selects if monolithic or separable program should be built. Defaults to false
**/
void Program::Init(const std::string& compute_shader, const std::string& fragment_shader,
- const std::string& geometry_shader, const std::string& tesselation_control_shader,
- const std::string& tesselation_evaluation_shader, const std::string& vertex_shader,
+ const std::string& geometry_shader, const std::string& tessellation_control_shader,
+ const std::string& tessellation_evaluation_shader, const std::string& vertex_shader,
const NameVector& captured_varyings, bool capture_interleaved, bool is_separable)
{
/* Delete previous program */
m_compute.Init(Shader::COMPUTE, compute_shader);
m_fragment.Init(Shader::FRAGMENT, fragment_shader);
m_geometry.Init(Shader::GEOMETRY, geometry_shader);
- m_tess_ctrl.Init(Shader::TESS_CTRL, tesselation_control_shader);
- m_tess_eval.Init(Shader::TESS_EVAL, tesselation_evaluation_shader);
+ m_tess_ctrl.Init(Shader::TESS_CTRL, tessellation_control_shader);
+ m_tess_eval.Init(Shader::TESS_EVAL, tessellation_evaluation_shader);
m_vertex.Init(Shader::VERTEX, vertex_shader);
/* Create program, set up transform feedback and attach shaders */
}
catch (const LinkageException& exc)
{
- throw BuildException(exc.what(), compute_shader, fragment_shader, geometry_shader, tesselation_control_shader,
- tesselation_evaluation_shader, vertex_shader);
+ throw BuildException(exc.what(), compute_shader, fragment_shader, geometry_shader, tessellation_control_shader,
+ tessellation_evaluation_shader, vertex_shader);
}
}
/** Initialize program instance
*
- * @param compute_shader Compute shader source code
- * @param fragment_shader Fragment shader source code
- * @param geometry_shader Geometry shader source code
- * @param tesselation_control_shader Tesselation control shader source code
- * @param tesselation_evaluation_shader Tesselation evaluation shader source code
- * @param vertex_shader Vertex shader source code
- * @param is_separable Selects if monolithic or separable program should be built. Defaults to false
+ * @param compute_shader Compute shader source code
+ * @param fragment_shader Fragment shader source code
+ * @param geometry_shader Geometry shader source code
+ * @param tessellation_control_shader Tessellation control shader source code
+ * @param tessellation_evaluation_shader Tessellation evaluation shader source code
+ * @param vertex_shader Vertex shader source code
+ * @param is_separable Selects if monolithic or separable program should be built. Defaults to false
**/
void Program::Init(const std::string& compute_shader, const std::string& fragment_shader,
- const std::string& geometry_shader, const std::string& tesselation_control_shader,
- const std::string& tesselation_evaluation_shader, const std::string& vertex_shader,
+ const std::string& geometry_shader, const std::string& tessellation_control_shader,
+ const std::string& tessellation_evaluation_shader, const std::string& vertex_shader,
bool is_separable)
{
NameVector captured_varying;
- Init(compute_shader, fragment_shader, geometry_shader, tesselation_control_shader, tesselation_evaluation_shader,
+ Init(compute_shader, fragment_shader, geometry_shader, tessellation_control_shader, tessellation_evaluation_shader,
vertex_shader, captured_varying, true, is_separable);
}
* @param compute_shader Source code for compute stage
* @param fragment_shader Source code for fragment stage
* @param geometry_shader Source code for geometry stage
- * @param tess_ctrl_shader Source code for tesselation control stage
- * @param tess_eval_shader Source code for tesselation evaluation stage
+ * @param tess_ctrl_shader Source code for tessellation control stage
+ * @param tess_eval_shader Source code for tessellation evaluation stage
* @param vertex_shader Source code for vertex stage
**/
Program::BuildException::BuildException(const glw::GLchar* error_message, const std::string compute_shader,
/* GL entry points */
const Functions& gl = m_context.getRenderContext().getFunctions();
- /* Tesselation patch set up */
+ /* Tessellation patch set up */
gl.patchParameteri(GL_PATCH_VERTICES, 1);
GLU_EXPECT_NO_ERROR(gl.getError(), "PatchParameteri");
if (is_build_error != is_failure_expected)
{
+ if (!is_build_error)
+ {
+ m_context.getTestContext().getLog()
+ << tcu::TestLog::Message << "Unexpected success: " << tcu::TestLog::EndMessage;
+ Utils::Shader::LogSource(m_context, cs_source, Utils::Shader::COMPUTE);
+ }
test_case_result = false;
}
}
if (is_build_error != is_failure_expected)
{
+ if (!is_build_error)
+ {
+ m_context.getTestContext().getLog()
+ << tcu::TestLog::Message << "Unexpected success: " << tcu::TestLog::EndMessage;
+ Utils::Shader::LogSource(m_context, vs_source, Utils::Shader::VERTEX);
+ Utils::Shader::LogSource(m_context, tcs_source, Utils::Shader::TESS_CTRL);
+ Utils::Shader::LogSource(m_context, tes_source, Utils::Shader::TESS_EVAL);
+ Utils::Shader::LogSource(m_context, gs_source, Utils::Shader::GEOMETRY);
+ Utils::Shader::LogSource(m_context, fs_source, Utils::Shader::FRAGMENT);
+ }
test_case_result = false;
}
}
* @param program Program
* @param fs_buffer Buffer for fragment shader stage
* @param gs_buffer Buffer for geometry shader stage
- * @param tcs_buffer Buffer for tesselation control shader stage
- * @param tes_buffer Buffer for tesselation evaluation shader stage
+ * @param tcs_buffer Buffer for tessellation control shader stage
+ * @param tes_buffer Buffer for tessellation evaluation shader stage
* @param vs_buffer Buffer for vertex shader stage
**/
void TextureTestBase::prepareSSBs(GLuint test_case_index, Utils::ProgramInterface& program_interface,
* @param program Program
* @param fs_buffer Buffer for fragment shader stage
* @param gs_buffer Buffer for geometry shader stage
- * @param tcs_buffer Buffer for tesselation control shader stage
- * @param tes_buffer Buffer for tesselation evaluation shader stage
+ * @param tcs_buffer Buffer for tessellation control shader stage
+ * @param tes_buffer Buffer for tessellation evaluation shader stage
* @param vs_buffer Buffer for vertex shader stage
**/
void TextureTestBase::prepareUniforms(GLuint test_case_index, Utils::ProgramInterface& program_interface,
* @param program Program
* @param fs_buffer Buffer for fragment shader stage
* @param gs_buffer Buffer for geometry shader stage
- * @param tcs_buffer Buffer for tesselation control shader stage
- * @param tes_buffer Buffer for tesselation evaluation shader stage
+ * @param tcs_buffer Buffer for tessellation control shader stage
+ * @param tes_buffer Buffer for tessellation evaluation shader stage
* @param vs_buffer Buffer for vertex shader stage
**/
void TextureTestBase::prepareUniforms(GLuint test_case_index, Utils::ProgramInterface& program_interface,
{
const Utils::Type& type = getType(i);
const GLuint alignment = type.GetBaseAlignment(false);
- const GLuint type_size = type.GetSize();
+ const GLuint type_size = type.GetSize(true);
const GLuint sec_to_end = max_size - 2 * type_size;
for (GLuint stage = 0; stage < Utils::Shader::STAGE_MAX; ++stage)
VaryingBlockAutomaticMemberLocationsTest::VaryingBlockAutomaticMemberLocationsTest(deqp::Context& context)
: NegativeTestBase(
context, "varying_block_automatic_member_locations",
- "Test verifies that compiler assigns subsequent locations to block members, even if this casue error")
+ "Test verifies that compiler assigns subsequent locations to block members, even if this causes errors")
{
}
**/
std::string VaryingComponentWithoutLocationTest::getShaderSource(GLuint test_case_index, Utils::Shader::STAGES stage)
{
- static const GLchar* var_definition = "layout (component = COMPONENT) flat DIRECTION TYPE gokuARRAY;\n";
+ static const GLchar* var_definition = "layout (component = COMPONENT) FLAT DIRECTION TYPE gokuARRAY;\n";
static const GLchar* input_use = " if (TYPE(0) == gokuINDEX)\n"
" {\n"
" result += vec4(1, 0.5, 0.25, 0.125);\n"
"\n"
"VARIABLE_USE"
"\n"
- " fs_out += result;\n"
+ " fs_out = result;\n"
"}\n"
"\n";
static const GLchar* gs = "#version 430 core\n"
"\n"
"VARIABLE_USE"
"\n"
- " tes_gs += result;\n"
+ " tes_gs = result;\n"
"}\n"
"\n";
static const GLchar* vs = "#version 430 core\n"
"\n"
"VARIABLE_USE"
"\n"
- " vs_tcs += result;\n"
+ " vs_tcs = result;\n"
"}\n"
"\n";
size_t temp;
const GLchar* type_name = test_case.m_type.GetGLSLTypeName();
const GLchar* var_use = input_use;
+ const GLchar* flat = "flat";
if (false == test_case.m_is_input)
{
break;
case Utils::Shader::VERTEX:
source = vs_tested;
+ flat = "";
break;
default:
TCU_FAIL("Invalid enum");
Utils::replaceToken("VAR_DEFINITION", position, var_definition, source);
position = temp;
Utils::replaceToken("COMPONENT", position, buffer, source);
+ Utils::replaceToken("FLAT", position, flat, source);
Utils::replaceToken("DIRECTION", position, direction, source);
Utils::replaceToken("ARRAY", position, array, source);
Utils::replaceToken("VARIABLE_USE", position, var_use, source);
/* Set up drawbuffers */
const Functions& gl = m_context.getRenderContext().getFunctions();
- // 1. There are only 4 outputs in fragment shader, so only need to do buffer mapping for 4 attachments,
- // 2. another issue is each output variable has a location, it is the fragment color index, so the index of
- // GL_COLOR_ATTACHMENT in glDrawBuffers() should keep the same with the location, to make test correct,
- // we needt to change the above code of glDrawBuffers() as :
- GLint buffers_size = 4;
- GLenum buffers[] = { GLenum(GL_COLOR_ATTACHMENT0 + m_chichi_location),
- GLenum(GL_COLOR_ATTACHMENT0 + m_goku_location),
- GLenum(GL_COLOR_ATTACHMENT0 + m_goten_location),
- GLenum(GL_COLOR_ATTACHMENT0 + m_gohan_location) };
- gl.drawBuffers(buffers_size, buffers);
+ // The fragment shader can have more than 4 color outputs, but it only care about 4 (goku, gohan, goten, chichi).
+ // We will first initialize all draw buffers to NONE and then set the real value for the 4 outputs we care about
+ GLint maxDrawBuffers = 0;
+ gl.getIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
+
+ std::vector<GLenum> buffers(maxDrawBuffers, GL_NONE);
+ buffers[m_chichi_location] = GLenum(GL_COLOR_ATTACHMENT0 + m_chichi_location);
+ buffers[m_goten_location] = GLenum(GL_COLOR_ATTACHMENT0 + m_goten_location);
+ buffers[m_goku_location] = GLenum(GL_COLOR_ATTACHMENT0 + m_goku_location);
+ buffers[m_gohan_location] = GLenum(GL_COLOR_ATTACHMENT0 + m_gohan_location);
+
+ gl.drawBuffers(maxDrawBuffers, buffers.data());
GLU_EXPECT_NO_ERROR(gl.getError(), "DrawBuffers");
}
*
* @return true if proper error is reported
**/
-bool XFBStrideOfEmptyListTest::executeDrawCall(GLuint test_case_index)
+bool XFBStrideOfEmptyListTest::executeDrawCall(bool /* tesEnabled */, GLuint test_case_index)
{
const Functions& gl = m_context.getRenderContext().getFunctions();
bool result = true;
*
* @return true if proper error is reported
**/
-bool XFBStrideOfEmptyListAndAPITest::executeDrawCall(GLuint test_case_index)
+bool XFBStrideOfEmptyListAndAPITest::executeDrawCall(bool /* tesEnabled */, GLuint test_case_index)
{
const Functions& gl = m_context.getRenderContext().getFunctions();
bool result = true;
*
* @return true
**/
-bool XFBStrideTest::executeDrawCall(GLuint test_case_index)
+bool XFBStrideTest::executeDrawCall(bool /* tesEnabled */, GLuint test_case_index)
{
const Functions& gl = m_context.getRenderContext().getFunctions();
GLenum primitive_type = GL_PATCHES;
*
* @return true
**/
-bool XFBCaptureInactiveOutputVariableTest::executeDrawCall(GLuint test_case_index)
+bool XFBCaptureInactiveOutputVariableTest::executeDrawCall(bool /* tesEnabled */, GLuint test_case_index)
{
const Functions& gl = m_context.getRenderContext().getFunctions();
GLenum primitive_type = GL_PATCHES;
name = "vertex";
break;
case TEST_TES:
- name = "tesselation evaluation";
+ name = "tessellation evaluation";
break;
case TEST_GS:
name = "geometry";
*
* @return true
**/
-bool XFBCaptureInactiveOutputComponentTest::executeDrawCall(GLuint test_case_index)
+bool XFBCaptureInactiveOutputComponentTest::executeDrawCall(bool /* tesEnabled */, GLuint test_case_index)
{
const Functions& gl = m_context.getRenderContext().getFunctions();
GLenum primitive_type = GL_PATCHES;
name = "vertex";
break;
case TEST_TES:
- name = "tesselation evaluation";
+ name = "tessellation evaluation";
break;
case TEST_GS:
name = "geometry";
*
* @return true
**/
-bool XFBCaptureInactiveOutputBlockMemberTest::executeDrawCall(GLuint test_case_index)
+bool XFBCaptureInactiveOutputBlockMemberTest::executeDrawCall(bool /* tesEnabled */, GLuint test_case_index)
{
const Functions& gl = m_context.getRenderContext().getFunctions();
GLenum primitive_type = GL_PATCHES;
name = "vertex";
break;
case TEST_TES:
- name = "tesselation evaluation";
+ name = "tessellation evaluation";
break;
case TEST_GS:
name = "geometry";
*
* @return true
**/
-bool XFBCaptureStructTest::executeDrawCall(GLuint test_case_index)
+bool XFBCaptureStructTest::executeDrawCall(bool /* tesEnabled */, GLuint test_case_index)
{
const Functions& gl = m_context.getRenderContext().getFunctions();
GLenum primitive_type = GL_PATCHES;
name = "vertex";
break;
case TEST_TES:
- name = "tesselation evaluation";
+ name = "tessellation evaluation";
break;
case TEST_GS:
name = "geometry";