1 #ifndef _GL4CENHANCEDLAYOUTSTESTS_HPP
2 #define _GL4CENHANCEDLAYOUTSTESTS_HPP
3 /*-------------------------------------------------------------------------
4 * OpenGL Conformance Test Suite
5 * -----------------------------
7 * Copyright (c) 2015-2016 The Khronos Group Inc.
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
24 */ /*-------------------------------------------------------------------*/
27 * \file gl4cEnhancedLayoutsTests.hpp
28 * \brief Declares test classes for "Enhanced Layouts" functionality.
29 */ /*-------------------------------------------------------------------*/
31 #include "glcTestCase.hpp"
32 #include "glwDefs.hpp"
42 namespace EnhancedLayouts
46 /** Represents data type
62 std::vector<glw::GLubyte> GenerateData() const;
63 std::vector<glw::GLubyte> GenerateDataPacked() const;
64 glw::GLuint GetActualAlignment(glw::GLuint align, bool is_array) const;
65 glw::GLuint GetBaseAlignment(bool is_array) const;
66 std::string GetGLSLConstructor(const glw::GLvoid* data) const;
67 const glw::GLchar* GetGLSLTypeName() const;
68 glw::GLuint GetLocations(bool is_vs_input = false) const;
69 glw::GLuint GetSize(const bool is_std140 = false) const;
70 glw::GLenum GetTypeGLenum() const;
71 glw::GLuint GetNumComponents() const;
73 /* Public static routines */
75 static glw::GLuint CalculateStd140Stride(glw::GLuint alignment, glw::GLuint n_columns,
76 glw::GLuint n_array_elements);
78 static bool DoesTypeSupportMatrix(TYPES type);
80 static glw::GLuint GetActualOffset(glw::GLuint start_offset, glw::GLuint actual_alignment);
82 static Type GetType(TYPES basic_type, glw::GLuint n_columns, glw::GLuint n_rows);
84 static glw::GLuint GetTypeSize(TYPES type);
87 static glw::GLenum GetTypeGLenum(TYPES type);
91 glw::GLuint m_n_columns;
94 /* Public constants */
95 static const Type _double;
96 static const Type dmat2;
97 static const Type dmat2x3;
98 static const Type dmat2x4;
99 static const Type dmat3x2;
100 static const Type dmat3;
101 static const Type dmat3x4;
102 static const Type dmat4x2;
103 static const Type dmat4x3;
104 static const Type dmat4;
105 static const Type dvec2;
106 static const Type dvec3;
107 static const Type dvec4;
108 static const Type _float;
109 static const Type _int;
110 static const Type ivec2;
111 static const Type ivec3;
112 static const Type ivec4;
113 static const Type mat2;
114 static const Type mat2x3;
115 static const Type mat2x4;
116 static const Type mat3x2;
117 static const Type mat3;
118 static const Type mat3x4;
119 static const Type mat4x2;
120 static const Type mat4x3;
121 static const Type mat4;
122 static const Type vec2;
123 static const Type vec3;
124 static const Type vec4;
125 static const Type uint;
126 static const Type uvec2;
127 static const Type uvec3;
128 static const Type uvec4;
131 /** Represents buffer instance
132 * Provides basic buffer functionality
170 Buffer(deqp::Context& context);
174 void Init(BUFFERS buffer, USAGE usage, glw::GLsizeiptr size, glw::GLvoid* data);
179 void BindBase(glw::GLuint index) const;
181 void BindRange(glw::GLuint index, glw::GLintptr offset, glw::GLsizeiptr size) const;
183 void Data(USAGE usage, glw::GLsizeiptr size, glw::GLvoid* data);
185 glw::GLvoid* Map(ACCESS access);
187 void SubData(glw::GLintptr offset, glw::GLsizeiptr size, glw::GLvoid* data);
191 /* Public static routines */
193 static void Bind(const glw::Functions& gl, glw::GLuint id, BUFFERS buffer);
195 static void BindBase(const glw::Functions& gl, glw::GLuint id, BUFFERS buffer, glw::GLuint index);
197 static void BindRange(const glw::Functions& gl, glw::GLuint id, BUFFERS buffer, glw::GLuint index,
198 glw::GLintptr offset, glw::GLsizeiptr size);
200 static void Data(const glw::Functions& gl, BUFFERS buffer, USAGE usage, glw::GLsizeiptr size, glw::GLvoid* data);
202 static void Generate(const glw::Functions& gl, glw::GLuint& out_id);
204 static void* Map(const glw::Functions& gl, BUFFERS buffer, ACCESS access);
206 static void SubData(const glw::Functions& gl, BUFFERS buffer, glw::GLintptr offset, glw::GLsizeiptr size,
209 static void UnMap(const glw::Functions& gl, BUFFERS buffer);
212 static glw::GLenum GetAccessGLenum(ACCESS access);
213 static glw::GLenum GetBufferGLenum(BUFFERS buffer);
214 static glw::GLenum GetUsageGLenum(USAGE usage);
217 static const glw::GLchar* GetBufferName(BUFFERS buffer);
222 /* Public constants */
223 static const glw::GLuint m_invalid_id;
225 /* Buffer type maybe changed for different cases*/
230 deqp::Context& m_context;
233 /** Represents framebuffer
234 * Provides basic functionality
241 Framebuffer(deqp::Context& context);
249 void AttachTexture(glw::GLenum attachment, glw::GLuint texture_id, glw::GLuint width, glw::GLuint height);
252 void Clear(glw::GLenum mask);
254 void ClearColor(glw::GLfloat red, glw::GLfloat green, glw::GLfloat blue, glw::GLfloat alpha);
256 /* Public static routines */
257 static void AttachTexture(const glw::Functions& gl, glw::GLenum attachment, glw::GLuint texture_id,
258 glw::GLuint width, glw::GLuint height);
260 static void Bind(const glw::Functions& gl, glw::GLuint id);
262 static void Clear(const glw::Functions& gl, glw::GLenum mask);
264 static void ClearColor(const glw::Functions& gl, glw::GLfloat red, glw::GLfloat green, glw::GLfloat blue,
267 static void Generate(const glw::Functions& gl, glw::GLuint& out_id);
272 /* Public constants */
273 static const glw::GLuint m_invalid_id;
277 deqp::Context& m_context;
280 /** Represents shader instance.
281 * Provides basic functionality for shaders.
302 class InvalidSourceException : public std::exception
305 InvalidSourceException(const glw::GLchar* error_message, const std::string& source, STAGES stage);
307 virtual ~InvalidSourceException() throw()
311 virtual const char* what() const throw();
313 void log(deqp::Context& context) const;
315 std::string m_message;
316 std::string m_source;
322 Shader(deqp::Context& context);
326 void Init(STAGES stage, const std::string& source);
329 /* Public static routines */
331 static void Compile(const glw::Functions& gl, glw::GLuint id);
333 static void Create(const glw::Functions& gl, STAGES stage, glw::GLuint& out_id);
335 static void Source(const glw::Functions& gl, glw::GLuint id, const std::string& source);
338 static glw::GLenum GetShaderStageGLenum(STAGES stage);
341 static const glw::GLchar* GetStageName(STAGES stage);
344 static void LogSource(deqp::Context& context, const std::string& source, STAGES stage);
349 /* Public constants */
350 static const glw::GLuint m_invalid_id;
354 class CompilationException : public std::exception
357 CompilationException(const glw::GLchar* message);
359 virtual ~CompilationException() throw()
363 virtual const char* what() const throw();
365 std::string m_message;
369 deqp::Context& m_context;
372 /* Forward declaration */
375 /** Represents GLSL variable
382 typedef std::vector<Variable> Vector;
383 typedef std::vector<Variable*> PtrVector;
398 enum VARYING_DIRECTION
408 INDEXED_BY_INVOCATION_ID,
422 typedef std::vector<Descriptor> Vector;
425 Descriptor(const glw::GLchar* name, const glw::GLchar* qualifiers, glw::GLint expected_component,
426 glw::GLint expected_location, const Type& type, glw::GLboolean normalized,
427 glw::GLuint n_array_elements, glw::GLint expected_stride_of_element, glw::GLuint offset);
429 Descriptor(const glw::GLchar* name, const glw::GLchar* qualifiers, glw::GLint expected_componenet,
430 glw::GLint expected_location, Interface* interface, glw::GLuint n_array_elements,
431 glw::GLint expected_stride_of_element, glw::GLuint offset);
434 std::string GetDefinition(FLAVOUR flavour, STORAGE storage) const;
437 glw::GLint m_expected_component;
438 glw::GLint m_expected_location;
439 glw::GLint m_expected_stride_of_element;
440 glw::GLuint m_n_array_elements;
442 glw::GLboolean m_normalized;
443 glw::GLuint m_offset;
444 std::string m_qualifiers;
449 Interface* m_interface;
454 template <typename T>
455 Variable(const glw::GLchar* name, const glw::GLchar* qualifiers, glw::GLint expected_component,
456 glw::GLint expected_location, const Type& type, glw::GLboolean normalized, glw::GLuint n_array_elements,
457 glw::GLint expected_stride_of_element, glw::GLuint offset, const T* data, size_t data_size,
459 : m_data((glw::GLvoid*)data)
460 , m_data_size(data_size)
461 , m_descriptor(name, qualifiers, expected_component, expected_location, type, normalized, n_array_elements,
462 expected_stride_of_element, offset)
467 template <typename T>
468 Variable(const glw::GLchar* name, const glw::GLchar* qualifiers, glw::GLint expected_component,
469 glw::GLint expected_location, Interface* interface, glw::GLuint n_array_elements,
470 glw::GLint expected_stride_of_element, glw::GLuint offset, const T* data, size_t data_size,
472 : m_data((glw::GLvoid*)data)
473 , m_data_size(data_size)
474 , m_descriptor(name, qualifiers, expected_component, expected_location, interface, n_array_elements,
475 expected_stride_of_element, offset)
480 Variable(const Variable& var);
483 std::string GetDefinition(FLAVOUR flavour) const;
484 glw::GLuint GetSize() const;
485 glw::GLuint GetStride() const;
486 bool IsBlock() const;
487 bool IsStruct() const;
488 /* Static routines */
489 static FLAVOUR GetFlavour(Shader::STAGES stage, VARYING_DIRECTION direction);
490 static std::string GetReference(const std::string& parent_name, const Descriptor& variable, FLAVOUR flavour,
491 glw::GLuint array_index);
496 Descriptor m_descriptor;
500 static const glw::GLint m_automatic_location;
503 /* Define the methods NAME, that will add new variable to VECTOR with STORAGE set */
504 #define DEFINE_VARIABLE_CLASS(NAME, STORAGE, VECTOR) \
505 template <typename T> \
506 Variable* NAME(const glw::GLchar* name, const glw::GLchar* qualifiers, glw::GLint expected_component, \
507 glw::GLint expected_location, const Type& type, glw::GLboolean normalized, \
508 glw::GLuint n_array_elements, glw::GLint expected_stride_of_element, glw::GLuint offset, \
509 const T* data, size_t data_size) \
511 Variable* var = new Variable(name, qualifiers, expected_component, expected_location, type, normalized, \
512 n_array_elements, expected_stride_of_element, offset, data, data_size, STORAGE); \
515 TCU_FAIL("Memory allocation"); \
517 VECTOR.push_back(var); \
518 return VECTOR.back(); \
521 template <typename T> \
522 Variable* NAME(const glw::GLchar* name, const glw::GLchar* qualifiers, glw::GLint expected_component, \
523 glw::GLint expected_location, Interface* interface, glw::GLuint n_array_elements, \
524 glw::GLint expected_stride_of_element, glw::GLuint offset, const T* data, size_t data_size) \
526 Variable* var = new Variable(name, qualifiers, expected_component, expected_location, interface, \
527 n_array_elements, expected_stride_of_element, offset, data, data_size, STORAGE); \
530 TCU_FAIL("Memory allocation"); \
532 VECTOR.push_back(var); \
533 return VECTOR.back(); \
536 /** Represents structures and block
543 typedef std::vector<Interface> Vector;
544 typedef std::vector<Interface*> PtrVector;
554 Interface(const glw::GLchar* name, TYPE type);
557 Variable::Descriptor* Member(const glw::GLchar* name, const glw::GLchar* qualifiers, glw::GLint expected_component,
558 glw::GLint expected_location, const Type& type, glw::GLboolean normalized,
559 glw::GLuint n_array_elements, glw::GLint expected_stride_of_element,
561 Variable::Descriptor* Member(const glw::GLchar* name, const glw::GLchar* qualifiers, glw::GLint expected_component,
562 glw::GLint expected_location, Interface* interface, glw::GLuint n_array_elements,
563 glw::GLint expected_stride_of_element, glw::GLuint offset);
566 Variable::Descriptor* AddMember(const Variable::Descriptor& member);
568 std::string GetDefinition() const;
571 Variable::Descriptor::Vector m_members;
576 struct ShaderInterface
578 ShaderInterface(Shader::STAGES stage);
580 DEFINE_VARIABLE_CLASS(Input, Variable::VARYING_INPUT, m_inputs);
581 DEFINE_VARIABLE_CLASS(Output, Variable::VARYING_OUTPUT, m_outputs);
582 DEFINE_VARIABLE_CLASS(Uniform, Variable::UNIFORM, m_uniforms);
583 DEFINE_VARIABLE_CLASS(SSB, Variable::SSB, m_ssb_blocks);
586 std::string GetDefinitionsGlobals() const;
587 std::string GetDefinitionsInputs() const;
588 std::string GetDefinitionsOutputs() const;
589 std::string GetDefinitionsSSBs() const;
590 std::string GetDefinitionsUniforms() const;
592 std::string m_globals;
593 Variable::PtrVector m_inputs;
594 Variable::PtrVector m_outputs;
595 Variable::PtrVector m_uniforms;
596 Variable::PtrVector m_ssb_blocks;
598 Shader::STAGES m_stage;
601 struct VaryingConnection
604 typedef std::vector<VaryingConnection> Vector;
607 VaryingConnection(Variable* in, Variable* out);
614 struct VaryingPassthrough
617 void Add(Shader::STAGES stage, Variable* in, Variable* out);
619 VaryingConnection::Vector& Get(Shader::STAGES stage);
622 VaryingConnection::Vector m_fragment;
623 VaryingConnection::Vector m_geometry;
624 VaryingConnection::Vector m_tess_ctrl;
625 VaryingConnection::Vector m_tess_eval;
626 VaryingConnection::Vector m_vertex;
629 struct ProgramInterface
637 Interface* AddInterface(const glw::GLchar* name, Interface::TYPE type);
638 Interface* Block(const glw::GLchar* name);
639 Interface* GetBlock(const glw::GLchar* name);
640 ShaderInterface& GetShaderInterface(Shader::STAGES stage);
641 const ShaderInterface& GetShaderInterface(Shader::STAGES stage) const;
642 Interface* GetStructure(const glw::GLchar* name);
643 Interface* Structure(const glw::GLchar* name);
646 std::string GetDefinitionsStructures() const;
647 std::string GetInterfaceForStage(Shader::STAGES stage) const;
650 Interface* CloneBlockForStage(const Interface& block, Shader::STAGES stage, Variable::STORAGE storage,
651 const glw::GLchar* prefix);
652 void CloneVertexInterface(VaryingPassthrough& variable_pass);
655 static const glw::GLchar* GetStagePrefix(Shader::STAGES stage, Variable::STORAGE storage);
658 Interface::PtrVector m_structures;
659 Interface::PtrVector m_blocks;
661 ShaderInterface m_compute;
662 ShaderInterface m_vertex;
663 ShaderInterface m_tess_ctrl;
664 ShaderInterface m_tess_eval;
665 ShaderInterface m_geometry;
666 ShaderInterface m_fragment;
668 //Variable::Vector m_fragment_outputs;
669 //Variable::PtrVector m_captured_varyings;
673 void cloneVariableForStage(const Variable& variable, Shader::STAGES stage, const glw::GLchar* prefix,
674 VaryingPassthrough& varying_passthrough);
675 Variable* cloneVariableForStage(const Variable& variable, Shader::STAGES stage, Variable::STORAGE storage,
676 const glw::GLchar* prefix);
677 void replaceBinding(Variable& variable, Shader::STAGES stage);
680 /** Represents program pipeline
688 Pipeline(deqp::Context& context);
697 void UseProgramStages(glw::GLuint program_id, glw::GLenum stages);
699 /* Public static routines */
701 void Bind(const glw::Functions& gl, glw::GLuint id);
702 void UseProgramStages(const glw::Functions& gl, glw::GLuint id, glw::GLuint program_id, glw::GLenum stages);
707 /* Public constants */
708 static const glw::GLuint m_invalid_id;
712 deqp::Context& m_context;
715 /** Represents program instance.
716 * Provides basic functionality
722 class BuildException : public std::exception
725 BuildException(const glw::GLchar* error_message, const std::string compute_shader,
726 const std::string fragment_shader, const std::string geometry_shader,
727 const std::string tess_ctrl_shader, const std::string tess_eval_shader,
728 const std::string vertex_shader);
729 virtual ~BuildException() throw()
733 virtual const char* what() const throw();
735 void log(deqp::Context& context) const;
737 std::string m_error_message;
738 std::string m_compute_shader;
739 std::string m_fragment_shader;
740 std::string m_geometry_shader;
741 std::string m_tess_ctrl_shader;
742 std::string m_tess_eval_shader;
743 std::string m_vertex_shader;
746 typedef std::vector<std::string> NameVector;
750 Program(deqp::Context& context);
754 void Init(const std::string& compute_shader, const std::string& fragment_shader, const std::string& geometry_shader,
755 const std::string& tessellation_control_shader, const std::string& tessellation_evaluation_shader,
756 const std::string& vertex_shader, const NameVector& captured_varyings, bool capture_interleaved,
759 void Init(const std::string& compute_shader, const std::string& fragment_shader, const std::string& geometry_shader,
760 const std::string& tessellation_control_shader, const std::string& tessellation_evaluation_shader,
761 const std::string& vertex_shader, bool is_separable);
766 void GetActiveUniformsiv(glw::GLsizei count, const glw::GLuint* indices, glw::GLenum pname,
767 glw::GLint* params) const;
769 glw::GLint GetAttribLocation(const std::string& name) const;
771 void GetResource(glw::GLenum interface, glw::GLuint index, glw::GLenum property, glw::GLsizei buf_size,
772 glw::GLint* params) const;
774 glw::GLuint GetResourceIndex(const std::string& name, glw::GLenum interface) const;
776 void GetUniformIndices(glw::GLsizei count, const glw::GLchar** names, glw::GLuint* indices) const;
778 glw::GLint GetUniformLocation(const std::string& name) const;
781 /* Public static routines */
783 static void Attach(const glw::Functions& gl, glw::GLuint program_id, glw::GLuint shader_id);
785 static void Capture(const glw::Functions& gl, glw::GLuint id, const NameVector& captured_varyings,
786 bool capture_interleaved);
788 static void Create(const glw::Functions& gl, glw::GLuint& out_id);
790 static void GetActiveUniformsiv(const glw::Functions& gl, glw::GLuint program_id, glw::GLsizei count,
791 const glw::GLuint* indices, glw::GLenum pname, glw::GLint* params);
793 static void GetUniformIndices(const glw::Functions& gl, glw::GLuint program_id, glw::GLsizei count,
794 const glw::GLchar** names, glw::GLuint* indices);
796 static void Link(const glw::Functions& gl, glw::GLuint id);
798 static void Uniform(const glw::Functions& gl, const Type& type, glw::GLsizei count, glw::GLint location,
799 const glw::GLvoid* data);
801 static void Use(const glw::Functions& gl, glw::GLuint id);
804 static glw::GLint GetAttribLocation(const glw::Functions& gl, glw::GLuint id, const std::string& name);
806 static void GetResource(const glw::Functions& gl, glw::GLuint id, glw::GLenum interface, glw::GLuint index,
807 glw::GLenum property, glw::GLsizei buf_size, glw::GLint* params);
809 static glw::GLuint GetResourceIndex(const glw::Functions& gl, glw::GLuint id, const std::string& name,
810 glw::GLenum interface);
812 static glw::GLint GetUniformLocation(const glw::Functions& gl, glw::GLuint id, const std::string& name);
824 /* Public constants */
825 static const glw::GLuint m_invalid_id;
829 class LinkageException : public std::exception
832 LinkageException(const glw::GLchar* error_message);
834 virtual ~LinkageException() throw()
838 virtual const char* what() const throw();
840 std::string m_error_message;
844 deqp::Context& m_context;
865 Texture(deqp::Context& context);
869 void Init(TYPES tex_type, glw::GLuint width, glw::GLuint height, glw::GLuint depth, glw::GLenum internal_format,
870 glw::GLenum format, glw::GLenum type, glw::GLvoid* data);
872 void Init(glw::GLenum internal_format, glw::GLuint buffer_id);
878 void Get(glw::GLenum format, glw::GLenum type, glw::GLvoid* out_data) const;
880 /* Public static routines */
882 static void Bind(const glw::Functions& gl, glw::GLuint id, TYPES tex_type);
884 static void Generate(const glw::Functions& gl, glw::GLuint& out_id);
886 static void Get(const glw::Functions& gl, TYPES tex_type, glw::GLenum format, glw::GLenum type,
887 glw::GLvoid* out_data);
889 static void Storage(const glw::Functions& gl, TYPES tex_type, glw::GLuint width, glw::GLuint height,
890 glw::GLuint depth, glw::GLenum internal_format);
892 static void TexBuffer(const glw::Functions& gl, glw::GLenum internal_format, glw::GLuint& buffer_id);
894 static void Update(const glw::Functions& gl, TYPES tex_type, glw::GLuint width, glw::GLuint height,
895 glw::GLuint depth, glw::GLenum format, glw::GLenum type, glw::GLvoid* data);
898 static glw::GLenum GetTargetGLenum(TYPES tex_type);
903 /* Public constants */
904 static const glw::GLuint m_invalid_id;
907 deqp::Context& m_context;
911 /** Represents Vertex array object
912 * Provides basic functionality
919 VertexArray(deqp::Context& Context);
924 //void Init(const ProgramInterface& program_interface,
925 // glw::GLuint vertex_buffer,
926 // glw::GLuint index_buffer);
929 void Attribute(glw::GLuint index, const Type& type, glw::GLuint n_array_elements, glw::GLboolean normalized,
930 glw::GLsizei stride, const glw::GLvoid* pointer);
934 /* Public static methods */
935 static void AttribPointer(const glw::Functions& gl, glw::GLuint index, const Type& type,
936 glw::GLuint n_array_elements, glw::GLboolean normalized, glw::GLsizei stride,
937 const glw::GLvoid* pointer);
939 static void Bind(const glw::Functions& gl, glw::GLuint id);
941 static void Disable(const glw::Functions& gl, glw::GLuint index, const Type& type, glw::GLuint n_array_elements);
943 static void Divisor(const glw::Functions& gl, glw::GLuint index, glw::GLuint divisor);
945 static void Enable(const glw::Functions& gl, glw::GLuint index, const Type& type, glw::GLuint n_array_elements);
947 static void Generate(const glw::Functions& gl, glw::GLuint& out_id);
952 /* Public constants */
953 static const glw::GLuint m_invalid_id;
956 deqp::Context& m_context;
959 /* UniformN*v prototypes */
960 typedef GLW_APICALL void(GLW_APIENTRY* uniformNdv)(glw::GLint, glw::GLsizei, const glw::GLdouble*);
961 typedef GLW_APICALL void(GLW_APIENTRY* uniformNfv)(glw::GLint, glw::GLsizei, const glw::GLfloat*);
962 typedef GLW_APICALL void(GLW_APIENTRY* uniformNiv)(glw::GLint, glw::GLsizei, const glw::GLint*);
963 typedef GLW_APICALL void(GLW_APIENTRY* uniformNuiv)(glw::GLint, glw::GLsizei, const glw::GLuint*);
964 typedef GLW_APICALL void(GLW_APIENTRY* uniformMatrixNdv)(glw::GLint, glw::GLsizei, glw::GLboolean,
965 const glw::GLdouble*);
966 typedef GLW_APICALL void(GLW_APIENTRY* uniformMatrixNfv)(glw::GLint, glw::GLsizei, glw::GLboolean, const glw::GLfloat*);
968 /* Public static methods */
969 /* UniformN*v routine getters */
970 uniformNdv getUniformNdv(const glw::Functions& gl, glw::GLuint n_rows);
971 uniformNfv getUniformNfv(const glw::Functions& gl, glw::GLuint n_rows);
972 uniformNiv getUniformNiv(const glw::Functions& gl, glw::GLuint n_rows);
973 uniformNuiv getUniformNuiv(const glw::Functions& gl, glw::GLuint n_rows);
974 uniformMatrixNdv getUniformMatrixNdv(const glw::Functions& gl, glw::GLuint n_columns, glw::GLuint n_rows);
975 uniformMatrixNfv getUniformMatrixNfv(const glw::Functions& gl, glw::GLuint n_columns, glw::GLuint n_rows);
978 bool checkProgramInterface(const ProgramInterface& program_interface, Program& program, std::stringstream& stream);
980 bool isExtensionSupported(deqp::Context& context, const glw::GLchar* extension_name);
982 bool isGLVersionAtLeast(const glw::Functions& gl, glw::GLint required_major, glw::GLint required_minor);
984 void replaceToken(const glw::GLchar* token, size_t& search_position, const glw::GLchar* text, std::string& string);
986 void replaceAllTokens(const glw::GLchar* token, const glw::GLchar* text, std::string& string);
988 glw::GLuint roundUpToPowerOf2(glw::GLuint value);
990 void insertElementOfList(const glw::GLchar* element, const glw::GLchar* separator, size_t& search_position,
991 std::string& string);
993 void endList(const glw::GLchar* separator, size_t& search_position, std::string& string);
994 } /* Utils namespace */
996 /** Base class for tests **/
997 class TestBase : public deqp::TestCase
1000 /* Public methods */
1001 TestBase(deqp::Context& context, const glw::GLchar* test_name, const glw::GLchar* test_description);
1007 /* Public methods inherited from TestCase */
1008 virtual tcu::TestNode::IterateResult iterate(void);
1011 /* Methods to be implemented by child class */
1012 virtual std::string getTestCaseName(glw::GLuint test_case_index);
1013 virtual glw::GLuint getTestCaseNumber();
1014 virtual bool testCase(glw::GLuint test_case_index) = 0;
1015 virtual void testInit();
1017 /* Routines avaiable for children */
1018 glw::GLuint calculateStride(const Utils::Interface& interface) const;
1019 void generateData(const Utils::Interface& interface, glw::GLuint offset, std::vector<glw::GLubyte>& out_data) const;
1021 glw::GLint getLastInputLocation(Utils::Shader::STAGES stage, const Utils::Type& type, glw::GLuint array_lenth);
1023 glw::GLint getLastOutputLocation(Utils::Shader::STAGES stage, const Utils::Type& type, glw::GLuint array_lenth);
1025 Utils::Type getType(glw::GLuint index) const;
1026 std::string getTypeName(glw::GLuint index) const;
1027 glw::GLuint getTypesNumber() const;
1029 bool isFlatRequired(Utils::Shader::STAGES stage, const Utils::Type& type, Utils::Variable::STORAGE storage) const;
1032 /* Private methods */
1036 /** Base class for test doing Buffer alghorithm **/
1037 class BufferTestBase : public TestBase
1040 /* Public methods */
1041 BufferTestBase(deqp::Context& context, const glw::GLchar* test_name, const glw::GLchar* test_description);
1043 virtual ~BufferTestBase()
1049 struct bufferDescriptor
1052 typedef std::vector<bufferDescriptor> Vector;
1055 std::vector<glw::GLubyte> m_expected_data;
1056 std::vector<glw::GLubyte> m_initial_data;
1057 glw::GLuint m_index;
1058 Utils::Buffer::BUFFERS m_target;
1061 static const glw::GLuint m_non_indexed;
1064 class bufferCollection
1069 Utils::Buffer* m_buffer;
1070 bufferDescriptor* m_descriptor;
1073 ~bufferCollection();
1075 typedef std::vector<pair> Vector;
1080 virtual bool executeDrawCall(bool tesEnabled, glw::GLuint test_case_index);
1082 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
1084 virtual void getCapturedVaryings(glw::GLuint test_case_index, Utils::Program::NameVector& captured_varyings, glw::GLint* xfb_components);
1086 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
1087 std::string& out_calculations);
1089 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
1090 std::string& out_interface);
1092 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1094 virtual bool inspectProgram(glw::GLuint test_case_index, Utils::Program& program, std::stringstream& out_stream);
1096 virtual bool testCase(glw::GLuint test_case_index);
1097 virtual bool verifyBuffers(bufferCollection& buffers);
1100 void cleanBuffers();
1101 std::string getShaderTemplate(Utils::Shader::STAGES stage);
1102 void prepareBuffer(Utils::Buffer& buffer, bufferDescriptor& descriptor);
1103 void prepareBuffers(bufferDescriptor::Vector& descriptors, bufferCollection& out_buffers);
1108 class NegativeTestBase : public TestBase
1111 /* Public methods */
1112 NegativeTestBase(deqp::Context& context, const glw::GLchar* test_name, const glw::GLchar* test_description);
1114 virtual ~NegativeTestBase()
1119 /* Methods to be implemented by child class */
1120 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage) = 0;
1121 virtual bool isComputeRelevant(glw::GLuint test_case_index);
1122 virtual bool isFailureExpected(glw::GLuint test_case_index);
1123 virtual bool testCase(glw::GLuint test_case_index);
1126 /** Base class for test doing Texture alghorithm **/
1127 class TextureTestBase : public TestBase
1130 /* Public methods */
1131 TextureTestBase(deqp::Context& context, const glw::GLchar* test_name, const glw::GLchar* test_description);
1133 virtual ~TextureTestBase()
1138 /* Methods to be implemented by child class */
1139 virtual bool checkResults(glw::GLuint test_case_index, Utils::Texture& color_0);
1141 virtual void executeDispatchCall(glw::GLuint test_case_index);
1142 virtual void executeDrawCall(glw::GLuint test_case_index);
1144 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1145 Utils::VaryingPassthrough& varying_passthrough);
1147 virtual std::string getPassSnippet(glw::GLuint test_case_index, Utils::VaryingPassthrough& varying_passthrough,
1148 Utils::Shader::STAGES stage);
1150 virtual std::string getVerificationSnippet(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1151 Utils::Shader::STAGES stage);
1153 virtual bool isComputeRelevant(glw::GLuint test_case_index);
1154 virtual bool isDrawRelevant(glw::GLuint test_case_index);
1156 virtual void prepareAttributes(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1157 Utils::Buffer& buffer, Utils::VertexArray& vao);
1159 virtual void prepareAttribLocation(Utils::Program& program, Utils::ProgramInterface& program_interface);
1161 virtual void prepareFragmentDataLoc(Utils::Program& program, Utils::ProgramInterface& program_interface);
1163 virtual void prepareFramebuffer(Utils::Framebuffer& framebuffer, Utils::Texture& color_0_texture);
1165 virtual void prepareImage(glw::GLint location, Utils::Texture& image_texture) const;
1167 virtual void prepareSSBs(glw::GLuint test_case_index, Utils::ShaderInterface& si, Utils::Program& program,
1168 Utils::Buffer& buffer);
1170 virtual void prepareSSBs(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1171 Utils::Program& program, Utils::Buffer& cs_buffer);
1173 virtual void prepareSSBs(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1174 Utils::Program& program, Utils::Buffer& fs_buffer, Utils::Buffer& gs_buffer,
1175 Utils::Buffer& tcs_buffer, Utils::Buffer& tes_buffer, Utils::Buffer& vs_buffer);
1177 virtual void prepareUniforms(glw::GLuint test_case_index, Utils::ShaderInterface& si, Utils::Program& program,
1178 Utils::Buffer& buffer);
1180 virtual void prepareUniforms(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1181 Utils::Program& program, Utils::Buffer& cs_buffer);
1183 virtual void prepareUniforms(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1184 Utils::Program& program, Utils::Buffer& fs_buffer, Utils::Buffer& gs_buffer,
1185 Utils::Buffer& tcs_buffer, Utils::Buffer& tes_buffer, Utils::Buffer& vs_buffer);
1187 virtual void prepareUniforms(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1188 Utils::Program& fs_program, Utils::Program& gs_program, Utils::Program& tcs_program,
1189 Utils::Program& tes_program, Utils::Program& vs_program, Utils::Buffer& fs_buffer,
1190 Utils::Buffer& gs_buffer, Utils::Buffer& tcs_buffer, Utils::Buffer& tes_buffer,
1191 Utils::Buffer& vs_buffer);
1192 //virtual void prepareDrawPrograms (glw::GLuint test_case_index,
1193 // Utils::Program& fragment,
1194 // Utils::Program& geometry,
1195 // Utils::Program& tess_ctrl,
1196 // Utils::Program& tess_eval,
1197 // Utils::Program& vertex);
1198 virtual bool testCase(glw::GLuint test_case_index);
1199 virtual bool testMonolithic(glw::GLuint test_case_index);
1200 virtual bool testSeparable(glw::GLuint test_case_index);
1201 virtual bool useComponentQualifier(glw::GLuint test_case_index);
1202 virtual bool useMonolithicProgram(glw::GLuint test_case_index);
1204 /* Protected constants */
1205 static const glw::GLuint m_width;
1206 static const glw::GLuint m_height;
1209 std::string getShaderSource(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1210 Utils::VaryingPassthrough& varying_passthrough, Utils::Shader::STAGES stage);
1212 const glw::GLchar* getShaderTemplate(Utils::Shader::STAGES stage);
1214 std::string getVariablePassthrough(const std::string& in_parent_name,
1215 const Utils::Variable::Descriptor& in_variable,
1216 Utils::Variable::FLAVOUR in_flavour, const std::string& out_parent_name,
1217 const Utils::Variable::Descriptor& out_variable,
1218 Utils::Variable::FLAVOUR out_flavour);
1220 std::string getVariableVerification(const std::string& parent_name, const glw::GLvoid* data,
1221 const Utils::Variable::Descriptor& variable, Utils::Variable::FLAVOUR flavour);
1223 void prepareSSB(Utils::Program& program, Utils::Variable& variable, Utils::Buffer& buffer);
1225 void prepareUniform(Utils::Program& program, Utils::Variable& variable, Utils::Buffer& buffer);
1228 /** Implementation of test APIConstantValues. Description follows:
1230 * Test verifies values of the following constants are at least as specified:
1231 * - MAX_TRANSFORM_FEEDBACK_BUFFERS - 4,
1232 * - MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS - 64.
1234 class APIConstantValuesTest : public deqp::TestCase
1237 /* Public methods */
1238 APIConstantValuesTest(deqp::Context& context);
1239 virtual ~APIConstantValuesTest()
1243 /* Public methods inherited from TestCase */
1244 virtual tcu::TestNode::IterateResult iterate(void);
1247 /** Implementation of test APIErrors. Description follows:
1249 * Test verifies that errors are generated as specified:
1250 * - GetProgramInterfaceiv should generate INVALID_OPERATION when
1251 * <programInterface> is TRANSFORM_FEEDBACK_BUFFER and <pname> is
1253 * - GetProgramResourceIndex should generate INVALID_ENUM when
1254 * <programInterface> is TRANSFORM_FEEDBACK_BUFFER;
1255 * - GetProgramResourceName should generate INVALID_ENUM when
1256 * <programInterface> is TRANSFORM_FEEDBACK_BUFFER;
1258 class APIErrorsTest : public deqp::TestCase
1261 /* Public methods */
1262 APIErrorsTest(deqp::Context& context);
1263 virtual ~APIErrorsTest()
1267 /* Public methods inherited from TestCase */
1268 virtual tcu::TestNode::IterateResult iterate(void);
1271 void checkError(glw::GLenum expected_error, const glw::GLchar* message, bool& test_result);
1274 /** Implementation of test GLSLContantValues. Description follows:
1276 * Test verifies values of the following symbols:
1278 * GL_ARB_enhanced_layouts,
1279 * gl_MaxTransformFeedbackBuffers,
1280 * gl_MaxTransformFeedbackInterleavedComponents.
1282 * This test implements Texture algorithm. Test following code snippet:
1284 * if (1 != GL_ARB_enhanced_layouts)
1288 * else if (MAX_TRANSFORM_FEEDBACK_BUFFERS
1289 * != gl_MaxTransformFeedbackBuffers)
1293 * else if (MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS
1294 * != gl_MaxTransformFeedbackInterleavedComponents)
1299 class GLSLContantValuesTest : public TextureTestBase
1302 GLSLContantValuesTest(deqp::Context& context);
1303 ~GLSLContantValuesTest()
1308 virtual std::string getVerificationSnippet(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1309 Utils::Shader::STAGES stage);
1311 virtual bool isComputeRelevant(glw::GLuint test_case_index);
1314 /** Implementation of test GLSLContantImmutablity. Description follows:
1316 * Test verifies that values of the following symbols cannot be changed in
1319 * GL_ARB_enhanced_layouts,
1320 * gl_MaxTransformFeedbackBuffers,
1321 * gl_MaxTransformFeedbackInterleavedComponents.
1323 * Compile following code snippet:
1327 * It is expected that compilation will fail. Test each shader stage
1328 * separately. Test each constant separately.
1330 class GLSLContantImmutablityTest : public NegativeTestBase
1333 /* Public methods */
1334 GLSLContantImmutablityTest(deqp::Context& context);
1336 virtual ~GLSLContantImmutablityTest()
1341 /* Methods to be implemented by child class */
1342 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1344 virtual std::string getTestCaseName(glw::GLuint test_case_index);
1345 virtual glw::GLuint getTestCaseNumber();
1346 virtual bool isComputeRelevant(glw::GLuint test_case_index);
1347 virtual void testInit();
1353 GL_ARB_ENHANCED_LAYOUTS,
1355 GL_MAX_XFB_INT_COMP,
1364 CONSTANTS m_constant;
1365 Utils::Shader::STAGES m_stage;
1368 /* Private methods */
1369 const glw::GLchar* getConstantName(CONSTANTS constant);
1371 /* Private fields */
1372 std::vector<testCase> m_test_cases;
1375 /** Implementation of test GLSLConstantIntegralExpression. Description follows:
1377 * Check that following symbols can be used as integral constant expressions:
1379 * GL_ARB_enhanced_layouts,
1380 * gl_MaxTransformFeedbackBuffers,
1381 * gl_MaxTransformFeedbackInterleavedComponents.
1383 * Test implement Texture algorithm. Test following code snippet:
1385 * uniform uint goku [GL_ARB_enhanced_layouts / GOKU_DIV];
1386 * uniform uint gohan[gl_MaxTransformFeedbackBuffers / GOHAN_DIV];
1387 * uniform uint goten[gl_MaxTransformFeedbackInterleavedComponents /
1390 * for (i = 0; i < goku.length; ++i)
1391 * goku_sum += goku[i];
1393 * for (i = 0; i < gohan.length; ++i)
1394 * gohan_sum += gohan[i];
1396 * for (i = 0; i < goten.length; ++i)
1397 * goten_sum += goten[i];
1399 * if ( (expected_goku_sum == goku_sum) &&
1400 * (expected_gohan_sum == gohan_sum) &&
1401 * (expected_goten_sum == goten_sum) )
1406 * Select DIV values so as array lengths are below 16.
1408 class GLSLConstantIntegralExpressionTest : public TextureTestBase
1411 /* Public methods */
1412 GLSLConstantIntegralExpressionTest(deqp::Context& context);
1414 virtual ~GLSLConstantIntegralExpressionTest()
1419 /* Protected methods */
1420 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1421 Utils::VaryingPassthrough& varying_passthrough);
1423 virtual std::string getVerificationSnippet(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1424 Utils::Shader::STAGES stage);
1426 virtual void prepareUniforms(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1427 Utils::Program& program, Utils::Buffer& cs_buffer);
1429 virtual void prepareUniforms(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1430 Utils::Program& program, Utils::Buffer& fs_buffer, Utils::Buffer& gs_buffer,
1431 Utils::Buffer& tcs_buffer, Utils::Buffer& tes_buffer, Utils::Buffer& vs_buffer);
1434 glw::GLint m_gohan_length;
1435 glw::GLint m_goten_length;
1438 /** Implementation of test UniformBlockMemberOffsetAndAlign. Description follows:
1440 * Test verifies that:
1441 * - offset and align qualifiers are respected for uniform block members,
1442 * - align qualifier is ignored if value is too small,
1443 * - align qualifier accepts values bigger than size of base type,
1444 * - manual and automatic offsets and alignments can be mixed.
1446 * This test implement Texture algorithm. Test following code snippet:
1448 * const int basic_size = sizeof(basic_type_of(type));
1449 * const int type_size = sizeof(type);
1450 * const int type_align = roundUpToPowerOf2(type_size);
1452 * layout (std140, offset = 0) uniform Block {
1453 * layout(align = 8 * basic_size) type at_first_offset;
1454 * layout(offset = type_size, align = basic_size / 2)
1455 * type at_second_offset;
1456 * layout(align = 2 * type_align) type at_third_offset;
1457 * layout(offset = 3 * type_align + type_size)
1458 * type at_fourth_offset;
1459 * type at_fifth_offset;
1460 * type at_sixth_offset[2];
1461 * layout(align = 8 * basic_size) type at_eight_offset;
1464 * if ( (at_first_offset == at_eight_offset ) &&
1465 * (at_second_offset == at_sixth_offset[1]) &&
1466 * (at_third_offset == at_sixth_offset[0]) &&
1467 * (at_fourth_offset == at_fifth_offset ) )
1472 * Additionally inspect program to verify that all block members:
1474 * - have correct offsets.
1476 * Test should be executed for all types.
1478 class UniformBlockMemberOffsetAndAlignTest : public TextureTestBase
1481 /* Public methods */
1482 UniformBlockMemberOffsetAndAlignTest(deqp::Context& context);
1484 virtual ~UniformBlockMemberOffsetAndAlignTest()
1489 /* Protected methods */
1490 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1491 Utils::VaryingPassthrough& varying_passthrough);
1493 virtual std::string getTestCaseName(glw::GLuint test_case_index);
1494 virtual glw::GLuint getTestCaseNumber();
1496 virtual std::string getVerificationSnippet(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1497 Utils::Shader::STAGES stage);
1500 std::vector<glw::GLubyte> m_data;
1503 /** Implementation of test UniformBlockLayoutQualifierConflict. Description follows:
1505 * Test verifies that offset and align can only be used on members of blocks
1506 * declared as std140.
1508 * Test following code snippet with all shader stages:
1510 * layout(QUALIFIER) uniform Block {
1511 * layout(offset = 16) vec4 boy;
1512 * layout(align = 48) vec4 man;
1515 * Test following block qualifiers and all types:
1517 * default - meaning not declared by shader
1522 * Qualifier std430 is not allowed for uniform blocks.
1524 * Test expect that only case using std140 will compile and link successfully,
1525 * while the rest will fail to compile or link.
1527 class UniformBlockLayoutQualifierConflictTest : public NegativeTestBase
1530 /* Public methods */
1531 UniformBlockLayoutQualifierConflictTest(deqp::Context& context);
1533 virtual ~UniformBlockLayoutQualifierConflictTest()
1538 /* Methods to be implemented by child class */
1539 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1541 virtual std::string getTestCaseName(glw::GLuint test_case_index);
1542 virtual glw::GLuint getTestCaseNumber();
1544 virtual bool isComputeRelevant(glw::GLuint test_case_index);
1545 virtual bool isFailureExpected(glw::GLuint test_case_index);
1546 virtual void testInit();
1564 QUALIFIERS m_qualifier;
1565 Utils::Shader::STAGES m_stage;
1568 /* Private methods */
1569 const glw::GLchar* getQualifierName(QUALIFIERS qualifier);
1571 /* Private fields */
1572 std::vector<testCase> m_test_cases;
1575 /** Implementation of test UniformBlockMemberInvalidOffsetAlignment. Description follows:
1577 * Test verifies that offset alignment rules are enforced.
1579 * Declare uniform block, which contains following member declaration:
1581 * layout(offset = X) type block_member
1583 * Shader compilation is expected to fail for any X that is not a multiple of
1584 * the base alignment of type.
1585 * Test all offsets covering locations first and one before last:
1588 * <MAX_UNIFORM_BLOCK_SIZE - 2 * sizeof(type),
1589 * MAX_UNIFORM_BLOCK_SIZE - sizeof(type)>
1591 * Test all shader stages. Test all types. Each case should be tested
1594 class UniformBlockMemberInvalidOffsetAlignmentTest : public NegativeTestBase
1597 /* Public methods */
1598 UniformBlockMemberInvalidOffsetAlignmentTest(deqp::Context& context);
1600 UniformBlockMemberInvalidOffsetAlignmentTest(deqp::Context& context, const glw::GLchar* name,
1601 const glw::GLchar* description);
1603 virtual ~UniformBlockMemberInvalidOffsetAlignmentTest()
1608 /* Methods to be implemented by child class */
1609 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1611 virtual std::string getTestCaseName(glw::GLuint test_case_index);
1612 virtual glw::GLuint getTestCaseNumber();
1613 virtual glw::GLint getMaxBlockSize();
1614 virtual bool isComputeRelevant(glw::GLuint test_case_index);
1615 virtual bool isFailureExpected(glw::GLuint test_case_index);
1616 virtual bool isStageSupported(Utils::Shader::STAGES stage);
1617 virtual void testInit();
1620 /* Protected types */
1623 glw::GLuint m_offset;
1625 Utils::Shader::STAGES m_stage;
1629 /* Protected fields */
1630 std::vector<testCase> m_test_cases;
1633 /** Implementation of test UniformBlockMemberOverlappingOffsets. Description follows:
1635 * Test verifies that block members cannot overlap.
1637 * Use following code snippet:
1639 * layout (std140) uniform Block {
1640 * layout (offset = boy_offset) boy_type boy;
1641 * layout (offset = man_offset) man_type man;
1644 * It is expected that overlapping members will cause compilation failure.
1646 * There are three cases to test:
1648 * - when member is declared with the same offset as already declared
1650 * - when member is declared with offset that lay in the middle of already
1652 * - when member is declared with offset just before already declared
1653 * member and there is not enough space.
1655 * Test all shader stages. Test all types. Test cases separately.
1657 * Note that not all type combinations let to test all three cases, e.g.
1660 class UniformBlockMemberOverlappingOffsetsTest : public NegativeTestBase
1663 /* Public methods */
1664 UniformBlockMemberOverlappingOffsetsTest(deqp::Context& context);
1666 UniformBlockMemberOverlappingOffsetsTest(deqp::Context& context, const glw::GLchar* name,
1667 const glw::GLchar* description);
1669 virtual ~UniformBlockMemberOverlappingOffsetsTest()
1674 /* Methods to be implemented by child class */
1675 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1677 virtual std::string getTestCaseName(glw::GLuint test_case_index);
1678 virtual glw::GLuint getTestCaseNumber();
1679 virtual bool isComputeRelevant(glw::GLuint test_case_index);
1680 virtual bool isStageSupported(Utils::Shader::STAGES stage);
1681 virtual void testInit();
1684 /* Protected types */
1687 glw::GLuint m_boy_offset;
1688 Utils::Type m_boy_type;
1689 glw::GLuint m_man_offset;
1690 Utils::Type m_man_type;
1691 Utils::Shader::STAGES m_stage;
1694 /* Protected methods */
1695 glw::GLuint gcd(glw::GLuint a, glw::GLuint b);
1696 glw::GLuint lcm(glw::GLuint a, glw::GLuint b);
1698 /* Protected fields */
1699 std::vector<testCase> m_test_cases;
1702 /** Implementation of test UniformBlockMemberAlignNonPowerOf2. Description follows:
1704 * Test verifies that align qualifier must use power of 2.
1706 * Test following code snippet:
1708 * layout (std140, offset = 8) uniform Block {
1710 * layout (align = man_alignment) type man;
1713 * It is expected that compilation will fail whenever man_alignment is not
1716 * Test all alignment in range <0, sizeof(dmat4)>. Test all shader stages.
1719 class UniformBlockMemberAlignNonPowerOf2Test : public NegativeTestBase
1722 /* Public methods */
1723 UniformBlockMemberAlignNonPowerOf2Test(deqp::Context& context);
1725 UniformBlockMemberAlignNonPowerOf2Test(deqp::Context& context, const glw::GLchar* name,
1726 const glw::GLchar* description);
1728 virtual ~UniformBlockMemberAlignNonPowerOf2Test()
1733 /* Methods to be implemented by child class */
1734 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1736 virtual std::string getTestCaseName(glw::GLuint test_case_index);
1737 virtual glw::GLuint getTestCaseNumber();
1738 virtual bool isComputeRelevant(glw::GLuint test_case_index);
1739 virtual bool isFailureExpected(glw::GLuint test_case_index);
1740 virtual bool isStageSupported(Utils::Shader::STAGES stage);
1741 virtual void testInit();
1744 /* Protected types */
1747 glw::GLuint m_alignment;
1750 Utils::Shader::STAGES m_stage;
1753 /* Protected methods */
1754 bool isPowerOf2(glw::GLuint val);
1756 /* Protected fields */
1757 std::vector<testCase> m_test_cases;
1760 /** Implementation of test UniformBlockAlignment. Description follows:
1762 * UniformBlockAlignment
1764 * Test verifies that align qualifier is applied to block members as specified.
1766 * This test implements Texture algorithm. Test following code snippet:
1773 * layout (std140, offset = 8, align = 64) uniform Block {
1778 * layout (align = 16) vec4 fifth[2];
1782 * Verify that all uniforms have correct values. Additionally inspect program
1783 * to check that all offsets are as expected.
1785 class UniformBlockAlignmentTest : public TextureTestBase
1788 /* Public methods */
1789 UniformBlockAlignmentTest(deqp::Context& context);
1791 virtual ~UniformBlockAlignmentTest()
1796 /* Protected methods */
1797 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1798 Utils::VaryingPassthrough& varying_passthrough);
1801 std::vector<glw::GLubyte> m_data;
1804 /** Implementation of test SSBMemberOffsetAndAlign. Description follows:
1806 * Test verifies that:
1807 * - offset and align qualifiers are respected for shader storage block
1809 * - align qualifier is ignored if value is too small,
1810 * - align qualifier accepts values bigger than size of base type,
1811 * - manual and automatic offsets and alignments can be mixed.
1813 * Modify UniformBlockMemberOffsetAndAlign to test shader storage block instead
1816 class SSBMemberOffsetAndAlignTest : public TextureTestBase
1819 /* Public methods */
1820 SSBMemberOffsetAndAlignTest(deqp::Context& context);
1821 virtual ~SSBMemberOffsetAndAlignTest()
1826 /* Protected methods */
1827 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1828 Utils::VaryingPassthrough& varying_passthrough);
1830 virtual std::string getTestCaseName(glw::GLuint test_case_index);
1831 virtual glw::GLuint getTestCaseNumber();
1833 virtual std::string getVerificationSnippet(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1834 Utils::Shader::STAGES stage);
1836 virtual bool isDrawRelevant(glw::GLuint test_case_index);
1839 std::vector<glw::GLubyte> m_data;
1842 /** Implementation of test SSBLayoutQualifierConflict. Description follows:
1844 * Test verifies that offset and align can only be used on members of blocks
1845 * declared as std140 or std430.
1847 * Modify UniformBlockMemberOffsetAndAlign to test shader storage block instead
1850 * Qualifier std430 is allowed for shader storage blocks, it should be included
1851 * in test. It is expected that std430 case will build successfully.
1853 class SSBLayoutQualifierConflictTest : public NegativeTestBase
1856 /* Public methods */
1857 SSBLayoutQualifierConflictTest(deqp::Context& context);
1859 virtual ~SSBLayoutQualifierConflictTest()
1864 /* Methods to be implemented by child class */
1865 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1867 virtual std::string getTestCaseName(glw::GLuint test_case_index);
1868 virtual glw::GLuint getTestCaseNumber();
1869 virtual bool isComputeRelevant(glw::GLuint test_case_index);
1870 virtual bool isFailureExpected(glw::GLuint test_case_index);
1871 virtual void testInit();
1890 QUALIFIERS m_qualifier;
1891 Utils::Shader::STAGES m_stage;
1894 /* Private methods */
1895 const glw::GLchar* getQualifierName(QUALIFIERS qualifier);
1896 bool isStageSupported(Utils::Shader::STAGES stage);
1898 /* Private fields */
1899 std::vector<testCase> m_test_cases;
1902 /** Implementation of test SSBMemberInvalidOffsetAlignment. Description follows:
1904 * Test verifies that offset alignment rules are enforced.
1906 * Modify UniformBlockMemberInvalidOffsetAlignment to test shader
1907 * storage block against MAX_SHADER_STORAGE_BLOCK_SIZE instead of
1910 class SSBMemberInvalidOffsetAlignmentTest : public UniformBlockMemberInvalidOffsetAlignmentTest
1913 /* Public methods */
1914 SSBMemberInvalidOffsetAlignmentTest(deqp::Context& context);
1916 virtual ~SSBMemberInvalidOffsetAlignmentTest()
1921 /* Methods to be implemented by child class */
1922 virtual glw::GLint getMaxBlockSize();
1923 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1925 virtual bool isStageSupported(Utils::Shader::STAGES stage);
1928 /** Implementation of test SSBMemberOverlappingOffsets. Description follows:
1930 * Test verifies that block members cannot overlap.
1932 * Modify UniformBlockMemberOverlappingOffsets to test shader storage block
1933 * instead of uniform block.
1935 class SSBMemberOverlappingOffsetsTest : public UniformBlockMemberOverlappingOffsetsTest
1938 /* Public methods */
1939 SSBMemberOverlappingOffsetsTest(deqp::Context& context);
1940 virtual ~SSBMemberOverlappingOffsetsTest()
1945 /* Methods to be implemented by child class */
1946 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1948 virtual bool isStageSupported(Utils::Shader::STAGES stage);
1951 /** Implementation of test SSBMemberAlignNonPowerOf2. Description follows:
1953 * Test verifies that align qualifier must use power of 2.
1955 * Modify UniformBlockMemberAlignNonPowerOf2 to test shader storage block
1956 * instead of uniform block.
1958 class SSBMemberAlignNonPowerOf2Test : public UniformBlockMemberAlignNonPowerOf2Test
1961 /* Public methods */
1962 SSBMemberAlignNonPowerOf2Test(deqp::Context& context);
1964 virtual ~SSBMemberAlignNonPowerOf2Test()
1969 /* Methods to be implemented by child class */
1970 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
1972 virtual bool isStageSupported(Utils::Shader::STAGES stage);
1975 /** Implementation of test SSBAlignment. Description follows:
1977 * Test verifies that align qualifier is applied to block members as specified.
1979 * Modify UniformBlockAlignment to test shader storage block instead
1982 class SSBAlignmentTest : public TextureTestBase
1985 /* Public methods */
1986 SSBAlignmentTest(deqp::Context& context);
1988 virtual ~SSBAlignmentTest()
1993 /* Protected methods */
1994 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
1995 Utils::VaryingPassthrough& varying_passthrough);
1997 virtual bool isDrawRelevant(glw::GLuint test_case_index);
2000 std::vector<glw::GLubyte> m_data;
2003 /** Implementation of test VaryingLocations. Description follows:
2005 * Test verifies that "varying" locations are assigned as declared in shader.
2007 * This test implements Texture algorithm. Use separate shader objects instead
2008 * of monolithic program. Test following code snippet:
2010 * layout(location = 0) in type input_at_first_location;
2011 * layout(location = last_input) in type input_at_last_location;
2012 * layout(location = 1) out type output_at_first_location;
2013 * layout(location = last_output) out type output_at_last_location;
2015 * output_at_first_location = input_at_first_location;
2016 * output_at_last_location = input_at_last_location;
2018 * if ( (EXPECTED_VALUE == input_at_first_location) &&
2019 * (EXPECTED_VALUE == input_at_last_location) )
2024 * Additionally inspect program to check that all locations are as expected.
2026 * Test all types. Test all shader stages.
2028 class VaryingLocationsTest : public TextureTestBase
2031 VaryingLocationsTest(deqp::Context& context);
2033 VaryingLocationsTest(deqp::Context& context, const glw::GLchar* test_name, const glw::GLchar* test_description);
2035 ~VaryingLocationsTest()
2040 /* Protected methods */
2041 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
2042 Utils::VaryingPassthrough& varying_passthrough);
2044 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2045 virtual glw::GLuint getTestCaseNumber();
2046 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2047 virtual bool useMonolithicProgram(glw::GLuint test_case_index);
2049 /* To be implemented by children */
2050 virtual void prepareShaderStage(Utils::Shader::STAGES stage, const Utils::Type& type,
2051 Utils::ProgramInterface& program_interface,
2052 Utils::VaryingPassthrough& varying_passthrough);
2054 /* Protected methods */
2055 std::string prepareGlobals(glw::GLint last_in_loc, glw::GLint last_out_loc);
2057 /* Protected fields */
2058 std::vector<glw::GLubyte> m_first_data;
2059 std::vector<glw::GLubyte> m_last_data;
2062 /** Implementation of test VertexAttribLocations. Description follows:
2064 * Test verifies that drawing operations provide vertex attributes at expected
2067 * This test implements Texture algorithm. Use separate shader objects instead
2068 * of monolithic program. Tessellation stages are not necessary and can be
2069 * omitted. Test following code snippet:
2071 * layout (location = 2) in uint vertex_index;
2072 * layout (location = 5) in uint instance_index;
2074 * if ( (gl_VertexID == vertex_index) &&
2075 * (gl_InstanceID == instance_index) )
2080 * Test following Draw* operations:
2082 * - DrawArraysInstanced,
2084 * - DrawElementsBaseVertex,
2085 * - DrawElementsInstanced,
2086 * - DrawElementsInstancedBaseInstance,
2087 * - DrawElementsInstancedBaseVertex,
2088 * - DrawElementsInstancedBaseVertexBaseInstance.
2090 * Number of drawn instances should be equal 4. base_vertex parameter should be
2091 * set to 4. base_instance should be set to 2.
2093 * Values provided for "vertex_index" should match index of vertex. Values
2094 * provided for "instance_index" should match index of instance
2095 * (use VertexAttribDivisor).
2097 class VertexAttribLocationsTest : public TextureTestBase
2100 VertexAttribLocationsTest(deqp::Context& context);
2102 ~VertexAttribLocationsTest()
2107 /* Protected methods */
2108 virtual void executeDrawCall(glw::GLuint test_case_index);
2110 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
2111 Utils::VaryingPassthrough& varying_passthrough);
2113 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2114 virtual glw::GLuint getTestCaseNumber();
2116 virtual std::string getVerificationSnippet(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
2117 Utils::Shader::STAGES stage);
2119 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2121 virtual void prepareAttributes(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
2122 Utils::Buffer& buffer, Utils::VertexArray& vao);
2124 virtual bool useMonolithicProgram(glw::GLuint test_case_index);
2131 DRAWARRAYSINSTANCED,
2133 DRAWELEMENTSBASEVERTEX,
2134 DRAWELEMENTSINSTANCED,
2135 DRAWELEMENTSINSTANCEDBASEINSTANCE,
2136 DRAWELEMENTSINSTANCEDBASEVERTEX,
2137 DRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCE,
2143 /* Private constants */
2144 static const glw::GLuint m_base_vertex;
2145 static const glw::GLuint m_base_instance;
2146 static const glw::GLuint m_loc_vertex;
2147 static const glw::GLuint m_loc_instance;
2148 static const glw::GLuint m_n_instances;
2151 /** Implementation of test VaryingArrayLocations. Description follows:
2153 * VaryingArrayLocations
2155 * Test verifies that locations of arrays of "varying" are assigned as declared
2158 * This test implements Texture algorithm. Use separate shader objects instead
2159 * of monolithic program. Test following code snippet:
2161 * layout(location = 0) in type in_at_first_loc[FIRST_LENGTH];
2162 * layout(location = last_input) in type in_at_last_loc[LAST_LENGTH];
2163 * layout(location = 1) out type out_at_first_loc[FIRST_LENGTH];
2164 * layout(location = last_output) out type out_at_last_loc[LAST_LENGTH];
2166 * for (uint i = 0u; i < in_at_first_loc.length(); ++i)
2168 * out_at_first_loc[i] = in_at_first_loc[i];
2170 * if (EXPECTED_VALUE[i] != in_at_first_loc[i])
2176 * for (uint i = 0u; i < in_at_last_loc.length(); ++i)
2178 * out_at_last_loc[i] = in_at_last_loc[i];
2180 * if (EXPECTED_VALUE[i] != in_at_last_loc[i])
2186 * FIRST_LENGTH and LAST_LENGTH values should be selected so as not to exceed
2189 * Additionally inspect program to check that all locations are as expected.
2191 * Test all types. Test all shader stages.
2193 class VaryingArrayLocationsTest : public VaryingLocationsTest
2196 VaryingArrayLocationsTest(deqp::Context& context);
2198 ~VaryingArrayLocationsTest()
2203 /* Protected methods */
2204 virtual void prepareShaderStage(Utils::Shader::STAGES stage, const Utils::Type& type,
2205 Utils::ProgramInterface& program_interface,
2206 Utils::VaryingPassthrough& varying_passthrough);
2209 /** Implementation of test VaryingStructureLocations. Description follows:
2211 * Test verifies that structures locations are as expected.
2213 * This test implements Texture algorithm. Use separate shader objects instead
2214 * of monolithic program. Test following code snippet:
2219 * type array[ARRAY_LENGTH];
2222 * layout (location = INPUT_LOCATION) in Data input[VARYING_LENGTH];
2223 * layout (location = OUTPUT_LOCATION) out Data output[VARYING_LENGTH];
2225 * if ( (EXPECTED_VALUE == input[0].single) &&
2226 * (EXPECTED_VALUE == input[0].array[0]) &&
2227 * (EXPECTED_VALUE == input[0].array[last]) &&
2228 * (EXPECTED_VALUE == input[last].single) &&
2229 * (EXPECTED_VALUE == input[last].array[0]) &&
2230 * (EXPECTED_VALUE == input[last].array[last]) )
2235 * output[0].single = input[0].single;
2236 * output[0].array[0] = input[0].array[0];
2237 * output[0].array[last] = input[0].array[last];
2238 * output[last].single = input[last].single;
2239 * output[last].array[0] = input[last].array[0];
2240 * output[last].array[last] = input[last].array[last];
2242 * Select array lengths and locations so as no limits are exceeded.
2245 class VaryingStructureLocationsTest : public TextureTestBase
2248 VaryingStructureLocationsTest(deqp::Context& context);
2250 ~VaryingStructureLocationsTest()
2255 /* Protected methods */
2256 virtual std::string getPassSnippet(glw::GLuint test_case_index, Utils::VaryingPassthrough& varying_passthrough,
2257 Utils::Shader::STAGES stage);
2259 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
2260 Utils::VaryingPassthrough& varying_passthrough);
2262 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2263 virtual glw::GLuint getTestCaseNumber();
2264 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2265 virtual bool useMonolithicProgram(glw::GLuint test_case_index);
2267 /* Protected fields */
2268 std::vector<glw::GLubyte> m_single_data;
2269 std::vector<glw::GLubyte> m_array_data;
2270 std::vector<glw::GLubyte> m_data;
2273 /** Implementation of test VaryingStructureMemberLocation. Description follows:
2275 * Test verifies that it is not allowed to declare structure member at specific
2278 * Test following code snippet:
2283 * layout (location = LOCATION) vec4 goten;
2288 * Select LOCATION so as not to exceed limits. Test all shader stages. Test
2289 * both in and out varyings.
2291 * It is expected that compilation will fail.
2293 class VaryingStructureMemberLocationTest : public NegativeTestBase
2296 VaryingStructureMemberLocationTest(deqp::Context& context);
2298 ~VaryingStructureMemberLocationTest()
2303 /* Methods to be implemented by child class */
2304 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
2306 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2307 virtual glw::GLuint getTestCaseNumber();
2308 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2309 virtual void testInit();
2316 Utils::Shader::STAGES m_stage;
2319 /* Private fields */
2320 std::vector<testCase> m_test_cases;
2323 /** Implementation of test VaryingBlockLocations. Description follows:
2325 * Test verifies that "block varyings" locations are as expected.
2327 * This test implements Texture algorithm. Use separate shader objects instead
2328 * of monolithic program. Test following code snippet:
2330 * layout (location = GOKU_LOCATION) in Goku
2333 * layout (location = GOTEN_LOCATION) vec4 goten;
2337 * layout (location = VEGETA_LOCATION) out Vegeta
2340 * layout (location = BRA_LOCATION) vec4 bra;
2344 * if ( (EXPECTED_VALUE == gohan) &&
2345 * (EXPECTED_VALUE == goten) &&
2346 * (EXPECTED_VALUE == chichi) )
2355 * Select all locations so as not to cause any conflicts or exceed limits.
2357 class VaryingBlockLocationsTest : public TextureTestBase
2360 VaryingBlockLocationsTest(deqp::Context& context);
2361 ~VaryingBlockLocationsTest()
2366 /* Protected methods */
2367 virtual std::string getPassSnippet(glw::GLuint test_case_index, Utils::VaryingPassthrough& varying_passthrough,
2368 Utils::Shader::STAGES stage);
2370 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
2371 Utils::VaryingPassthrough& varying_passthrough);
2373 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2374 virtual bool useMonolithicProgram(glw::GLuint test_case_index);
2376 /* Protected fields */
2377 std::vector<glw::GLubyte> m_third_data;
2378 std::vector<glw::GLubyte> m_fourth_data;
2379 std::vector<glw::GLubyte> m_fifth_data;
2380 std::vector<glw::GLubyte> m_data;
2383 /** Implementation of test VaryingBlockMemberLocations. Description follows:
2385 * Test verifies that it is a compilation error to declare some of block
2386 * members with location qualifier, but not all, when there is no "block level"
2387 * location qualifier.
2389 * Test following code snippets:
2394 * layout (location = GOTEN_LOCATION) vec4 goten;
2402 * layout (location = GOHAN_LOCATION) vec4 gohan;
2403 * layout (location = GOTEN_LOCATION) vec4 goten;
2404 * layout (location = CHICHI_LOCATION) vec4 chichi;
2407 * Select all locations so as not to exceed any limits.
2409 * It is expected that compilation of first snippet will fail. Compilation of
2410 * second snippet should be successful.
2412 * Test all shader stages. Test both in and out blocks.
2414 class VaryingBlockMemberLocationsTest : public NegativeTestBase
2417 /* Public methods */
2418 VaryingBlockMemberLocationsTest(deqp::Context& context);
2420 virtual ~VaryingBlockMemberLocationsTest()
2425 /* Methods to be implemented by child class */
2426 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
2428 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2429 virtual glw::GLuint getTestCaseNumber();
2430 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2431 virtual bool isFailureExpected(glw::GLuint test_case_index);
2432 virtual void testInit();
2440 Utils::Shader::STAGES m_stage;
2443 /* Private fields */
2444 std::vector<testCase> m_test_cases;
2447 /** Implementation of test VaryingBlockAutomaticMemberLocations. Description follows:
2449 * Test verifies that compiler will assign subsequent locations to block
2452 * Test following code snippet:
2454 * layout (location = 2) in DBZ
2457 * vec4 gohan[GOHAN_LENGTH]; // 3
2458 * vec4 goten; // 3 + GOHAN_LENGTH
2459 * layout (location = 1) vec4 chichi; // 1
2460 * vec4 pan; // 2; ERROR location 2 used twice
2463 * Test all shader stages. Test both in and out blocks.
2465 * It is expected that build process will fail.
2467 class VaryingBlockAutomaticMemberLocationsTest : public NegativeTestBase
2470 /* Public methods */
2471 VaryingBlockAutomaticMemberLocationsTest(deqp::Context& context);
2473 virtual ~VaryingBlockAutomaticMemberLocationsTest()
2478 /* Methods to be implemented by child class */
2479 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
2481 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2482 virtual glw::GLuint getTestCaseNumber();
2483 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2484 virtual void testInit();
2491 Utils::Shader::STAGES m_stage;
2494 /* Private fields */
2495 std::vector<testCase> m_test_cases;
2498 /** Implementation of test VaryingLocationLimit. Description follows:
2500 * Test verifies that "location" qualifier cannot exceed limits.
2502 * Test following code snippet:
2504 * layout (location = LAST + 1) in type goku;
2506 * LAST should be set to index of last available location.
2508 * Test all types. Test all shader stages. Test both in and out varyings.
2510 * It is expected that shader compilation will fail.
2512 class VaryingLocationLimitTest : public NegativeTestBase
2515 /* Public methods */
2516 VaryingLocationLimitTest(deqp::Context& context);
2518 virtual ~VaryingLocationLimitTest()
2523 /* Methods to be implemented by child class */
2524 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
2526 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2527 virtual glw::GLuint getTestCaseNumber();
2528 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2529 virtual void testInit();
2537 Utils::Shader::STAGES m_stage;
2540 /* Private fields */
2541 std::vector<testCase> m_test_cases;
2544 /** Implementation of test VaryingComponents. Description follows:
2548 * Test verifies that "varying" can be assigned to specific components.
2550 * Modify VaryingLocations to test all possible combinations of components
2556 * - gvec2, scalar, scalar
2557 * - scalar, gvec2, scalar
2558 * - scalar, scalar, gvec2
2559 * - scalar, scalar, scalar, scalar.
2561 * Additionally inspect program to check that all locations and components are
2564 class VaryingComponentsTest : public VaryingLocationsTest
2567 VaryingComponentsTest(deqp::Context& context);
2569 VaryingComponentsTest(deqp::Context& context, const glw::GLchar* test_name, const glw::GLchar* test_description);
2571 ~VaryingComponentsTest()
2576 /* Protected methods */
2577 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
2578 Utils::VaryingPassthrough& varying_passthrough);
2580 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2581 virtual glw::GLuint getTestCaseNumber();
2582 virtual void testInit();
2583 virtual bool useComponentQualifier(glw::GLuint test_case_index);
2585 /* To be implemented by children */
2586 virtual glw::GLuint getArrayLength();
2590 enum COMPONENTS_LAYOUT
2596 GVEC2_SCALAR_SCALAR,
2597 SCALAR_GVEC2_SCALAR,
2598 SCALAR_SCALAR_GVEC2,
2599 SCALAR_SCALAR_SCALAR_SCALAR,
2602 /* Private struct */
2605 void assign(glw::GLint component, const glw::GLchar* component_str, glw::GLint location,
2606 const glw::GLchar* location_str, glw::GLuint n_rows, const glw::GLchar* name);
2608 glw::GLint m_component;
2609 const glw::GLchar* m_component_str;
2610 glw::GLint m_location;
2611 const glw::GLchar* m_location_str;
2612 glw::GLuint m_n_rows;
2613 const glw::GLchar* m_name;
2618 testCase(COMPONENTS_LAYOUT layout, Utils::Type::TYPES type);
2620 COMPONENTS_LAYOUT m_layout;
2621 Utils::Type::TYPES m_type;
2624 /* Private routines */
2625 std::string prepareGlobals(glw::GLuint last_in_location, glw::GLuint last_out_location);
2627 std::string prepareName(const glw::GLchar* name, glw::GLint location, glw::GLint component,
2628 Utils::Shader::STAGES stage, Utils::Variable::STORAGE storage);
2630 std::string prepareQualifiers(const glw::GLchar* location, const glw::GLchar* component,
2631 const glw::GLchar* interpolation);
2633 using VaryingLocationsTest::prepareShaderStage;
2635 void prepareShaderStage(Utils::Shader::STAGES stage, const Utils::Type& vector_type,
2636 Utils::ProgramInterface& program_interface, const testCase& test_case,
2637 Utils::VaryingPassthrough& varying_passthrough);
2639 Utils::Variable* prepareVarying(const Utils::Type& basic_type, const descriptor& desc,
2640 const glw::GLchar* interpolation, Utils::ShaderInterface& si,
2641 Utils::Shader::STAGES stage, Utils::Variable::STORAGE storage);
2643 /* Private fields */
2644 std::vector<testCase> m_test_cases;
2645 std::vector<glw::GLubyte> m_data;
2648 /** Implementation of test VaryingArrayComponents. Description follows:
2650 * Test verifies that arrays of "varyings" can be assigned to specific
2653 * Modify VaryingComponents similarly to VaryingArrayLocations.
2655 class VaryingArrayComponentsTest : public VaryingComponentsTest
2658 VaryingArrayComponentsTest(deqp::Context& context);
2660 ~VaryingArrayComponentsTest()
2665 /* Protected methods */
2666 virtual glw::GLuint getArrayLength();
2669 /** Implementation of test VaryingExceedingComponents. Description follows:
2671 * Test verifies that it is not allowed to exceed components.
2673 * Test following code snippets:
2675 * layout (location = 1, component = COMPONENT) in type gohan;
2679 * layout (location = 1, component = COMPONENT) in type gohan[LENGTH];
2681 * Select COMPONENT so as to exceed space available at location, eg. 2 for
2682 * vec4. Select array length so as to not exceed limits of available locations.
2684 * Test all types. Test all shader stages. Test both in and out varyings.
2686 * It is expected that build process will fail.
2688 class VaryingExceedingComponentsTest : public NegativeTestBase
2691 /* Public methods */
2692 VaryingExceedingComponentsTest(deqp::Context& context);
2694 virtual ~VaryingExceedingComponentsTest()
2699 /* Methods to be implemented by child class */
2700 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
2702 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2703 virtual glw::GLuint getTestCaseNumber();
2704 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2705 virtual void testInit();
2711 glw::GLuint m_component;
2714 Utils::Shader::STAGES m_stage;
2718 /* Private fields */
2719 std::vector<testCase> m_test_cases;
2722 /** Implementation of test VaryingComponentWithoutLocation. Description follows:
2724 * Test verifies that "component" qualifier cannot be used without "location"
2727 * Test following code snippet:
2729 * layout (component = COMPONENT) in type goku;
2731 * Test all types. Test all valid COMPONENT values. Test all shader stages.
2732 * Test both in and out varyings.
2734 * It is expected that shader compilation will fail.
2736 class VaryingComponentWithoutLocationTest : public NegativeTestBase
2739 /* Public methods */
2740 VaryingComponentWithoutLocationTest(deqp::Context& context);
2742 virtual ~VaryingComponentWithoutLocationTest()
2747 /* Methods to be implemented by child class */
2748 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
2750 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2751 virtual glw::GLuint getTestCaseNumber();
2752 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2753 virtual void testInit();
2759 glw::GLuint m_component;
2761 Utils::Shader::STAGES m_stage;
2765 /* Private fields */
2766 std::vector<testCase> m_test_cases;
2769 /** Implementation of test VaryingComponentOfInvalidType. Description follows:
2771 * Test verifies that it is not allowed to declare matrix, struct, block and
2772 * array of those at specific component.
2774 * Test following code snippets:
2776 * layout (location = 0, component = COMPONENT) in matrix_type varying;
2780 * layout (location = 0, component = COMPONENT)
2781 * in matrix_type varying[LENGTH];
2785 * layout (location = 0, component = COMPONENT) in Block
2792 * layout (location = 0, component = COMPONENT) in Block
2804 * layout (location = 0, component = COMPONENT) in Data varying;
2813 * layout (location = 0, component = COMPONENT) in Data varying[LENGTH];
2815 * Test all types. Test all shader stages. Test both in and out varyings.
2817 * It is expected that build process will fail.
2819 class VaryingComponentOfInvalidTypeTest : public NegativeTestBase
2822 /* Public methods */
2823 VaryingComponentOfInvalidTypeTest(deqp::Context& context);
2825 virtual ~VaryingComponentOfInvalidTypeTest()
2830 /* Methods to be implemented by child class */
2831 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
2833 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2834 virtual glw::GLuint getTestCaseNumber();
2836 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2837 virtual void testInit();
2855 glw::GLuint m_component;
2858 Utils::Shader::STAGES m_stage;
2862 /* Private fields */
2863 std::vector<testCase> m_test_cases;
2866 /** Implementation of test InputComponentAliasing. Description follows:
2868 * Test verifies that component aliasing cause compilation or linking error.
2870 * Test following code snippet:
2872 * layout (location = 1, component = GOHAN_COMPONENT) in type gohan;
2873 * layout (location = 1, component = GOTEN_COMPONENT) in type goten;
2875 * if (EXPECTED_VALUE == gohan)
2880 * Test all components combinations that cause aliasing. Test all types. Test
2881 * all shader stages. It is expected that build process will fail.
2883 * Vertex shader allows component aliasing on input as long as only one of the
2884 * attributes is used in each execution path. Test vertex shader stage with two
2886 * - first as presented above,
2887 * - second, where "result = 1;" is replaced with "result = goten;".
2888 * In first case build process should succeed, in the second case build process
2891 class InputComponentAliasingTest : public NegativeTestBase
2894 /* Public methods */
2895 InputComponentAliasingTest(deqp::Context& context);
2897 virtual ~InputComponentAliasingTest()
2902 /* Methods to be implemented by child class */
2903 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
2905 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2906 virtual glw::GLuint getTestCaseNumber();
2908 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2909 virtual bool isFailureExpected(glw::GLuint test_case_index);
2910 virtual void testInit();
2916 glw::GLuint m_component_gohan;
2917 glw::GLuint m_component_goten;
2918 Utils::Shader::STAGES m_stage;
2922 /* Private fields */
2923 std::vector<testCase> m_test_cases;
2926 /** Implementation of test OutputComponentAliasing. Description follows:
2928 * Test verifies that component aliasing cause compilation or linking error.
2930 * Test following code snippet:
2932 * layout (location = 1, component = GOHAN_COMPONENT) out type gohan;
2933 * layout (location = 1, component = GOTEN_COMPONENT) out type goten;
2935 * gohan = GOHAN_VALUE;
2936 * goten = GOTEN_VALUE;
2938 * Test all components combinations that cause aliasing. Test all types. Test
2939 * all shader stages. It is expected that build process will fail.
2941 class OutputComponentAliasingTest : public NegativeTestBase
2944 /* Public methods */
2945 OutputComponentAliasingTest(deqp::Context& context);
2947 virtual ~OutputComponentAliasingTest()
2952 /* Methods to be implemented by child class */
2953 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
2955 virtual std::string getTestCaseName(glw::GLuint test_case_index);
2956 virtual glw::GLuint getTestCaseNumber();
2957 virtual bool isComputeRelevant(glw::GLuint test_case_index);
2958 virtual void testInit();
2964 glw::GLuint m_component_gohan;
2965 glw::GLuint m_component_goten;
2966 Utils::Shader::STAGES m_stage;
2970 /* Private fields */
2971 std::vector<testCase> m_test_cases;
2974 /** Implementation of test VaryingLocationAliasingWithMixedTypes. Description follows:
2976 * Test verifies that it is not allowed to mix integer and float base types at
2979 * Test following code snippet:
2981 * layout (location = 1, component = GOHAN_COMPONENT) in gohan_type gohan;
2982 * layout (location = 1, component = GOTEN_COMPONENT) in goten_type goten;
2984 * Test all components combinations that do not cause component aliasing. Test
2985 * all types combinations that cause float/integer conflict. Test all shader
2986 * stages. Test both in and out varyings.
2988 * It is expected that build process will fail.
2990 class VaryingLocationAliasingWithMixedTypesTest : public NegativeTestBase
2993 /* Public methods */
2994 VaryingLocationAliasingWithMixedTypesTest(deqp::Context& context);
2996 virtual ~VaryingLocationAliasingWithMixedTypesTest()
3001 /* Methods to be implemented by child class */
3002 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
3004 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3005 virtual glw::GLuint getTestCaseNumber();
3006 virtual bool isComputeRelevant(glw::GLuint test_case_index);
3007 virtual void testInit();
3013 glw::GLuint m_component_gohan;
3014 glw::GLuint m_component_goten;
3016 Utils::Shader::STAGES m_stage;
3017 Utils::Type m_type_gohan;
3018 Utils::Type m_type_goten;
3021 /* Private routines */
3022 bool isFloatType(const Utils::Type& type);
3024 /* Private fields */
3025 std::vector<testCase> m_test_cases;
3028 /** Implementation of test VaryingLocationAliasingWithMixedInterpolation. Description follows:
3030 * Test verifies that it is not allowed to mix interpolation methods at aliased
3033 * Test following code snippet:
3035 * layout (location = 1, component = GOHAN_COMPONENT)
3036 * GOHAN_INTERPOLATION in type gohan;
3037 * layout (location = 1, component = GOTEN_COMPONENT)
3038 * GOTEN_INTERPOLATION in type goten;
3040 * Test all interpolation combinations that cause conflict. Select components
3041 * so as not to cause component aliasing. Test all types. Test all shader
3042 * stages. Test both in and out varyings.
3044 * Note, that vertex shader's input and fragment shader's output cannot be
3045 * qualified with interpolation method.
3047 * It is expected that build process will fail.
3049 class VaryingLocationAliasingWithMixedInterpolationTest : public NegativeTestBase
3052 /* Public methods */
3053 VaryingLocationAliasingWithMixedInterpolationTest(deqp::Context& context);
3055 virtual ~VaryingLocationAliasingWithMixedInterpolationTest()
3060 /* Methods to be implemented by child class */
3061 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
3063 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3064 virtual glw::GLuint getTestCaseNumber();
3065 virtual bool isComputeRelevant(glw::GLuint test_case_index);
3066 virtual void testInit();
3082 glw::GLuint m_component_gohan;
3083 glw::GLuint m_component_goten;
3084 INTERPOLATIONS m_interpolation_gohan;
3085 INTERPOLATIONS m_interpolation_goten;
3087 Utils::Shader::STAGES m_stage;
3088 Utils::Type m_type_gohan;
3089 Utils::Type m_type_goten;
3092 /* Private routines */
3093 const glw::GLchar* getInterpolationQualifier(INTERPOLATIONS interpolation);
3094 bool isFloatType(const Utils::Type& type);
3096 /* Private fields */
3097 std::vector<testCase> m_test_cases;
3100 /** Implementation of test VaryingLocationAliasingWithMixedAuxiliaryStorage. Description follows:
3102 * Test verifies that it is not allowed to mix auxiliary storage at aliased
3105 * Test following code snippet:
3107 * layout (location = 1, component = GOHAN_COMPONENT)
3108 * GOHAN_AUXILIARY in type gohan;
3109 * layout (location = 1, component = GOTEN_COMPONENT)
3110 * GOTEN_AUXILIARY in type goten;
3112 * Test all auxiliary storage combinations that cause conflict. Select
3113 * components so as not to cause component aliasing. Test all types. Test all
3114 * shader stages. Test both in and out varyings.
3116 * It is expected that build process will fail.
3118 class VaryingLocationAliasingWithMixedAuxiliaryStorageTest : public NegativeTestBase
3121 /* Public methods */
3122 VaryingLocationAliasingWithMixedAuxiliaryStorageTest(deqp::Context& context);
3124 virtual ~VaryingLocationAliasingWithMixedAuxiliaryStorageTest()
3129 /* Methods to be implemented by child class */
3130 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
3132 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3133 virtual glw::GLuint getTestCaseNumber();
3134 virtual bool isComputeRelevant(glw::GLuint test_case_index);
3135 virtual void testInit();
3152 glw::GLuint m_component_gohan;
3153 glw::GLuint m_component_goten;
3154 AUXILIARIES m_aux_gohan;
3155 AUXILIARIES m_aux_goten;
3156 const glw::GLchar* m_int_gohan;
3157 const glw::GLchar* m_int_goten;
3159 Utils::Shader::STAGES m_stage;
3160 Utils::Type m_type_gohan;
3161 Utils::Type m_type_goten;
3164 /* Private routines */
3165 const glw::GLchar* getAuxiliaryQualifier(AUXILIARIES aux);
3166 bool isFloatType(const Utils::Type& type);
3168 /* Private fields */
3169 std::vector<testCase> m_test_cases;
3172 /** Implementation of test VertexAttribLocationAPI. Description follows:
3174 * Test verifies that vertex attribute location API works as expected.
3176 * This test implements Texture algorithm. Tessellation shaders are not
3177 * necessary and can be omitted. Test following code snippet in vertex shader:
3179 * layout (location = GOKU_LOCATION) in vec4 goku;
3184 * if ( (EXPECTED_VALUE == goku) &&
3185 * (EXPECTED_VALUE == gohan) &&
3186 * (EXPECTED_VALUE == gotan) &&
3187 * (EXPECTED_VALUE == chichi) )
3192 * After compilation, before program is linked, specify locations for goku,
3193 * and goten with glBindAttribLocation. Specify different location than the one
3196 * Select all locations so as not to exceed any limits.
3198 * Additionally inspect program to verify that:
3199 * - goku location is as specified in shader text,
3200 * - goten location is as specified with API.
3202 class VertexAttribLocationAPITest : public TextureTestBase
3205 VertexAttribLocationAPITest(deqp::Context& context);
3207 ~VertexAttribLocationAPITest()
3212 /* Protected methods */
3213 virtual void prepareAttribLocation(Utils::Program& program, Utils::ProgramInterface& program_interface);
3215 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
3216 Utils::VaryingPassthrough& varying_passthrough);
3218 virtual bool isComputeRelevant(glw::GLuint test_case_index);
3221 /* Private fields */
3222 std::vector<glw::GLubyte> m_goku_data;
3223 std::vector<glw::GLubyte> m_gohan_data;
3224 std::vector<glw::GLubyte> m_goten_data;
3225 std::vector<glw::GLubyte> m_chichi_data;
3227 /* Private constants */
3228 static const glw::GLuint m_goten_location;
3230 /** Implementation of test FragmentDataLocationAPI. Description follows:
3232 * Test verifies that fragment data location API works as expected.
3234 * This test implements Texture algorithm. Tessellation shaders are not
3235 * necessary and can be omitted. "result" is not necessary and can be omitted.
3236 * Test following code snippet in fragment shader:
3238 * layout (location = GOKU_LOCATION) out vec4 goku;
3243 * goku = EXPECTED_VALUE;
3244 * gohan = EXPECTED_VALUE;
3245 * goten = EXPECTED_VALUE;
3246 * chichi = EXPECTED_VALUE;
3248 * After compilation, before program is linked, specify locations for goku,
3249 * and goten with glBindFragDataLocation. Specify different location than the
3250 * one used in shader.
3252 * Select all locations so as not to exceed any limits.
3254 * Additionally inspect program to verify that:
3255 * - goku location is as specified in shader text,
3256 * - goten location is as specified with API.
3258 class FragmentDataLocationAPITest : public TextureTestBase
3261 FragmentDataLocationAPITest(deqp::Context& context);
3263 ~FragmentDataLocationAPITest()
3268 /* Protected methods */
3269 virtual bool checkResults(glw::GLuint test_case_index, Utils::Texture& color_0);
3271 virtual std::string getPassSnippet(glw::GLuint test_case_index, Utils::VaryingPassthrough& varying_passthrough,
3272 Utils::Shader::STAGES stage);
3274 virtual void getProgramInterface(glw::GLuint test_case_index, Utils::ProgramInterface& program_interface,
3275 Utils::VaryingPassthrough& varying_passthrough);
3277 virtual bool isComputeRelevant(glw::GLuint test_case_index);
3279 virtual void prepareFragmentDataLoc(Utils::Program& program, Utils::ProgramInterface& program_interface);
3281 virtual void prepareFramebuffer(Utils::Framebuffer& framebuffer, Utils::Texture& color_0_texture);
3284 /* Private fields */
3285 Utils::Texture m_goku;
3286 Utils::Texture m_gohan;
3287 Utils::Texture m_goten;
3288 Utils::Texture m_chichi;
3290 glw::GLint m_goku_location;
3291 glw::GLint m_gohan_location;
3292 glw::GLint m_chichi_location;
3294 /* Private constants */
3295 static const glw::GLuint m_goten_location;
3298 /** Implementation of test XFBInput. Description follows:
3300 * Test verifies that using xfb_buffer, xfb_stride or xfb_offset qualifiers on
3301 * input variables will cause failure of build process.
3303 * Test all shader stages.
3305 class XFBInputTest : public NegativeTestBase
3308 /* Public methods */
3309 XFBInputTest(deqp::Context& context);
3310 virtual ~XFBInputTest()
3315 /* Methods to be implemented by child class */
3316 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
3318 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3319 virtual glw::GLuint getTestCaseNumber();
3320 virtual bool isComputeRelevant(glw::GLuint test_case_index);
3321 virtual void testInit();
3337 QUALIFIERS m_qualifier;
3338 Utils::Shader::STAGES m_stage;
3341 /* Private fields */
3342 std::vector<testCase> m_test_cases;
3345 /** Implementation of test XFBAllStages. Description follows:
3347 * Test verifies that only outputs from last stage processing primitives can be
3348 * captured with XFB.
3350 * This test implements Buffer algorithm. Rasterization can be discarded.
3352 * At each stage declare a single active output variable qualified with
3353 * xfb_buffer and xfb_offset = 0. Use separate buffers for each stage.
3355 * Test pass if outputs from geometry shader are captured, while outputs from:
3356 * vertex and tessellation stages are ignored.
3358 class XFBAllStagesTest : public BufferTestBase
3361 XFBAllStagesTest(deqp::Context& context);
3368 /* Protected methods */
3369 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
3371 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
3372 std::string& out_calculations);
3374 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
3375 std::string& out_interface);
3379 static const glw::GLuint m_gs_index;
3382 /** Implementation of test XFBStrideOfEmptyList. Description follows:
3384 * Test verifies that xfb_stride directive is respected even if there are no
3385 * variables qualified with xfb_offset.
3387 * Test implements Buffer algorithm. Rasterization can be discarded.
3389 * Test following code snippet:
3391 * layout (xfb_buffer = 1, xfb_stride = 64) out;
3393 * Moreover program should output something to xfb at index 0
3395 * Test following cases:
3396 * 1 Provide buffers to XFB at index 0 and 1
3397 * 2 Provide buffer to XFB at index 1, index 0 should be missing
3398 * 3 Provide buffer to XFB at index 0, index 1 should be missing
3400 * It is expected that:
3401 * - BeginTransformFeedback operation will report GL_INVALID_OPERATION in cases
3403 * - XFB at index 1 will not be modified in case 1.
3405 class XFBStrideOfEmptyListTest : public BufferTestBase
3408 XFBStrideOfEmptyListTest(deqp::Context& context);
3410 ~XFBStrideOfEmptyListTest()
3415 /* Protected methods */
3416 using BufferTestBase::executeDrawCall;
3417 virtual bool executeDrawCall(bool tesEnabled, glw::GLuint test_case_index);
3419 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
3421 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
3422 std::string& out_calculations);
3424 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
3425 std::string& out_interface);
3427 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3428 virtual glw::GLuint getTestCaseNumber();
3438 /* Private constants */
3439 static const glw::GLuint m_stride;
3442 /** Implementation of test XFBStrideOfEmptyListAndAPI. Description follows:
3444 * Test verifies that xfb_stride qualifier is not overridden by API.
3446 * Test implements Buffer algorithm. Rasterization can be discarded.
3448 * Test following code snippet:
3450 * layout (xfb_buffer = 0, xfb_stride = 64) out;
3452 * Moreover program should output something to xfb at index 1
3454 * Use TransformFeedbackVaryings to declare a single vec4 output variable to be
3457 * Test following cases:
3458 * 1 Provide buffers to XFB at index 0 and 1
3459 * 2 Provide buffer to XFB at index 1, index 0 should be missing
3460 * 3 Provide buffer to XFB at index 0, index 1 should be missing
3462 * It is expected that:
3463 * - BeginTransformFeedback operation will report GL_INVALID_OPERATION in cases
3465 * - XFB at index 0 will not be modified in case 1.
3467 class XFBStrideOfEmptyListAndAPITest : public BufferTestBase
3470 XFBStrideOfEmptyListAndAPITest(deqp::Context& context);
3472 ~XFBStrideOfEmptyListAndAPITest()
3477 /* Protected methods */
3478 using BufferTestBase::executeDrawCall;
3479 virtual bool executeDrawCall(bool tesEnabled, glw::GLuint test_case_index);
3480 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
3482 virtual void getCapturedVaryings(glw::GLuint test_case_index, Utils::Program::NameVector& captured_varyings, glw::GLint* xfb_components);
3484 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
3485 std::string& out_calculations);
3487 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
3488 std::string& out_interface);
3490 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3491 virtual glw::GLuint getTestCaseNumber();
3501 /* Private constants */
3502 static const glw::GLuint m_stride;
3505 /** Implementation of test XFBTooSmallStride. Description follows:
3507 * Test verifies that build process fails when xfb_stride qualifier sets not
3508 * enough space for all variables.
3510 * Test following code snippets:
3512 * layout (xfb_buffer = 0, xfb_stride = 40) out;
3514 * layout (xfb_offset = 32) out vec4 goku;
3516 * goku = EXPECTED_VALUE.
3520 * layout (xfb_buffer = 0, xfb_stride = 32) out;
3522 * layout (xfb_offset = 16, xfb_stride = 32) out vec4 goku;
3524 * goku = EXPECTED_VALUE.
3528 * layout (xfb_buffer = 0, xfb_stride = 32) out;
3530 * layout (xfb_offset = 0) out Goku {
3536 * gohan = EXPECTED_VALUE;
3537 * goten = EXPECTED_VALUE;
3538 * chichi = EXPECTED_VALUE;
3542 * layout (xfb_buffer = 0, xfb_stride = 32) out;
3544 * layout (xfb_offset = 16) out vec4 goku[4];
3546 * goku[0] = EXPECTED_VALUE.
3547 * goku[1] = EXPECTED_VALUE.
3548 * goku[2] = EXPECTED_VALUE.
3549 * goku[3] = EXPECTED_VALUE.
3551 * It is expected that build process will fail.
3553 * Test all shader stages.
3555 class XFBTooSmallStrideTest : public NegativeTestBase
3558 /* Public methods */
3559 XFBTooSmallStrideTest(deqp::Context& context);
3561 virtual ~XFBTooSmallStrideTest()
3566 /* Methods to be implemented by child class */
3567 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
3569 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3570 virtual glw::GLuint getTestCaseNumber();
3571 virtual bool isComputeRelevant(glw::GLuint test_case_index);
3572 virtual void testInit();
3590 Utils::Shader::STAGES m_stage;
3593 /* Private fields */
3594 std::vector<testCase> m_test_cases;
3597 /** Implementation of test XFBVariableStride. Description follows:
3599 * Test verifies that xfb_stride qualifier change stride of output variable.
3601 * Test following code snippets:
3603 * layout (xfb_offset = 0, xfb_stride = 2 * sizeof(type)) out type goku;
3607 * layout (xfb_offset = 0, xfb_stride = 2 * sizeof(type)) out type goku;
3608 * layout (xfb_offset = sizeof(type)) out type vegeta;
3610 * It is expected that:
3611 * - first snippet will build successfully,
3612 * - second snippet will fail to build.
3614 * Test all types. Test all shader stages.
3616 class XFBVariableStrideTest : public NegativeTestBase
3619 /* Public methods */
3620 XFBVariableStrideTest(deqp::Context& context);
3621 virtual ~XFBVariableStrideTest()
3626 /* Methods to be implemented by child class */
3627 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
3629 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3630 virtual glw::GLuint getTestCaseNumber();
3631 virtual bool isComputeRelevant(glw::GLuint test_case_index);
3632 virtual bool isFailureExpected(glw::GLuint test_case_index);
3633 virtual void testInit();
3649 Utils::Shader::STAGES m_stage;
3653 /* Private fields */
3654 std::vector<testCase> m_test_cases;
3657 /** Implementation of test XFBBlockStride. Description follows:
3659 * Test verifies that xfb_stride qualifier change stride of output block.
3661 * Test following code snippet:
3663 * layout (xfb_offset = 0, xfb_stride = 128) out Goku {
3669 * Inspect program to check if Goku stride is 128 units.
3671 * Test all shader stages.
3673 class XFBBlockStrideTest : public TestBase
3676 /* Public methods */
3677 XFBBlockStrideTest(deqp::Context& context);
3679 virtual ~XFBBlockStrideTest()
3684 /* Methods to be implemented by child class */
3685 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3686 virtual glw::GLuint getTestCaseNumber();
3687 virtual bool testCase(glw::GLuint test_case_index);
3688 virtual void testInit();
3691 /* Private methods */
3692 std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
3694 bool inspectProgram(Utils::Program& program);
3696 /* Private fields */
3697 std::vector<Utils::Shader::STAGES> m_test_cases;
3700 /** Implementation of test XFBBlockMemberStride. Description follows:
3702 * Test verifies that xfb_stride qualifier change stride of output block
3705 * This test implements Buffer algorithm. Rasterization can be discarded. Test
3706 * following code snippet:
3708 * layout (xfb_offset = 0) out Goku {
3710 * layout (xfb_stride = 32) vec4 goten;
3714 * gohan = EXPECTED_VALUE;
3715 * goten = EXPECTED_VALUE;
3716 * chichi = EXPECTED_VALUE;
3719 * - goten stride is reported as 32,
3720 * - chichi offset is reported as 48,
3721 * - values captured for all members match expected values,
3722 * - part of memory reserved for goten, that is not used, is not modified.
3724 class XFBBlockMemberStrideTest : public BufferTestBase
3727 XFBBlockMemberStrideTest(deqp::Context& context);
3728 ~XFBBlockMemberStrideTest()
3733 /* Protected methods */
3734 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
3736 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
3737 std::string& out_calculations);
3739 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
3740 std::string& out_interface);
3742 virtual bool inspectProgram(glw::GLuint test_case_index, Utils::Program& program, std::stringstream& out_stream);
3745 /** Implementation of test XFBDuplicatedStride. Description follows:
3747 * Test verifies that conflicting xfb_stride qualifiers cause build process
3750 * Test following code snippets:
3752 * layout (xfb_buffer = 0, xfb_stride = 64) out;
3753 * layout (xfb_buffer = 0, xfb_stride = 64) out;
3757 * layout (xfb_buffer = 0, xfb_stride = 64) out;
3758 * layout (xfb_buffer = 0, xfb_stride = 128) out;
3760 * It is expected that:
3761 * - first snippet will build successfully,
3762 * - second snippet will fail to build.
3764 class XFBDuplicatedStrideTest : public NegativeTestBase
3767 /* Public methods */
3768 XFBDuplicatedStrideTest(deqp::Context& context);
3770 virtual ~XFBDuplicatedStrideTest()
3775 /* Methods to be implemented by child class */
3776 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
3778 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3779 virtual glw::GLuint getTestCaseNumber();
3780 virtual bool isComputeRelevant(glw::GLuint test_case_index);
3781 virtual bool isFailureExpected(glw::GLuint test_case_index);
3782 virtual void testInit();
3798 Utils::Shader::STAGES m_stage;
3801 /* Private fields */
3802 std::vector<testCase> m_test_cases;
3805 /** Implementation of test XFBGetProgramResourceAPI. Description follows:
3807 * Test verifies that GetProgramResource* API work as expected for transform
3810 * Test results of following queries:
3812 * - TRANSFORM_FEEDBACK_BUFFER_INDEX,
3813 * - TRANSFORM_FEEDBACK_BUFFER_STRIDE,
3816 * Test following cases:
3817 * - captured varyings are declared with API, TransformFeedbackVaryings
3818 * with INTERLEAVED_ATTRIBS,
3819 * - captured varyings are declared with API, TransformFeedbackVaryings
3820 * with SEPARATE_ATTRIBS,
3821 * - captured varyings are declared with "xfb" qualifiers.
3823 * Following layout should be used in cases of INTERLEAVED_ATTRIBS and "xfb"
3825 * | var 0 | var 1 | var 2 | var 3
3826 * buffer 0 | used | used | empty | used
3827 * buffer 1 | empty | used | empty | empty
3829 * In "xfb" qualifiers case, use following snippet:
3831 * layout (xfb_buffer = 1, xfb_stride = 4 * sizeof(type)) out;
3833 * Declaration in shader should use following order:
3839 * To make sure that captured varyings are active, they should be assigned.
3841 * Test all types. Test all shader stages.
3843 class XFBGetProgramResourceAPITest : public TestBase
3846 /* Public methods */
3847 XFBGetProgramResourceAPITest(deqp::Context& context);
3849 virtual ~XFBGetProgramResourceAPITest()
3854 /* Methods to be implemented by child class */
3855 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3856 virtual glw::GLuint getTestCaseNumber();
3857 virtual bool testCase(glw::GLuint test_case_index);
3858 virtual void testInit();
3859 virtual void insertSkipComponents(int num_components, Utils::Program::NameVector& varyings);
3874 Utils::Shader::STAGES m_stage;
3878 /* Private methods */
3879 std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
3881 bool inspectProgram(glw::GLuint test_case_index, Utils::Program& program);
3883 /* Private fields */
3884 std::vector<test_Case> m_test_cases;
3887 /** Implementation of test XFBOverrideQualifiersWithAPI. Description follows:
3889 * Test verifies that API is ignored, when qualifiers are in use.
3891 * This test follows Buffer algorithm. Rasterization can disabled. Test
3892 * following code snippet:
3894 * layout (xfb_offset = 2 * sizeof(type)) out type vegeta;
3896 * layout (xfb_offset = 0) out type goku;
3899 * vegeta = EXPECTED_VALUE;
3900 * trunks = EXPECTED_VALUE;
3901 * goku = EXPECTED_VALUE;
3902 * gohan = EXPECTED_VALUE;
3904 * Use API, TransformFeedbackVaryings, to specify trunks and gohan as outputs
3908 * - correct values are captured for vegeta and goku,
3909 * - trunks and gohan are not captured,
3910 * - correct stride is reported.
3912 * Test all types. Test all shader stages.
3914 class XFBOverrideQualifiersWithAPITest : public BufferTestBase
3917 XFBOverrideQualifiersWithAPITest(deqp::Context& context);
3919 ~XFBOverrideQualifiersWithAPITest()
3924 /* Protected methods */
3925 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
3927 virtual void getCapturedVaryings(glw::GLuint test_case_index, Utils::Program::NameVector& captured_varyings, glw::GLint* xfb_components);
3929 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
3930 std::string& out_calculations);
3932 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
3933 std::string& out_interface);
3935 virtual std::string getTestCaseName(glw::GLuint test_case_index);
3936 virtual glw::GLuint getTestCaseNumber();
3938 virtual bool inspectProgram(glw::GLuint test_case_index, Utils::Program& program, std::stringstream& out_stream);
3941 /** Implementation of test XFBVertexStreams. Description follows:
3943 * Test verifies that "xfb" qualifiers work as expected with multiple output
3946 * Test implements Buffer algorithm. Rasterization can be discarded.
3948 * Test following code snippet:
3950 * layout (xfb_buffer = 1, xfb_stride = 64) out;
3951 * layout (xfb_buffer = 2, xfb_stride = 64) out;
3952 * layout (xfb_buffer = 3, xfb_stride = 64) out;
3954 * layout (stream = 0, xfb_buffer = 1, xfb_offset = 48) out vec4 goku;
3955 * layout (stream = 0, xfb_buffer = 1, xfb_offset = 32) out vec4 gohan;
3956 * layout (stream = 0, xfb_buffer = 1, xfb_offset = 16) out vec4 goten;
3957 * layout (stream = 1, xfb_buffer = 3, xfb_offset = 48) out vec4 picolo;
3958 * layout (stream = 1, xfb_buffer = 3, xfb_offset = 32) out vec4 vegeta;
3959 * layout (stream = 2, xfb_buffer = 2, xfb_offset = 32) out vec4 bulma;
3961 * goku = EXPECTED_VALUE;
3962 * gohan = EXPECTED_VALUE;
3963 * goten = EXPECTED_VALUE;
3964 * picolo = EXPECTED_VALUE;
3965 * vegeta = EXPECTED_VALUE;
3966 * bulma = EXPECTED_VALUE;
3968 * Test pass if all captured outputs have expected values.
3970 class XFBVertexStreamsTest : public BufferTestBase
3973 XFBVertexStreamsTest(deqp::Context& context);
3975 ~XFBVertexStreamsTest()
3980 /* Protected methods */
3981 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
3983 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
3984 std::string& out_calculations);
3986 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
3987 std::string& out_interface);
3990 /** Implementation of test XFBMultipleVertexStreams. Description follows:
3992 * Test verifies that outputs from single stream must be captured with single
3995 * Test following code snippet:
3997 * layout (xfb_buffer = 1, xfb_stride = 64) out;
3998 * layout (xfb_buffer = 3, xfb_stride = 64) out;
4000 * layout (stream = 0, xfb_buffer = 1, xfb_offset = 48) out vec4 goku;
4001 * layout (stream = 1, xfb_buffer = 1, xfb_offset = 32) out vec4 gohan;
4002 * layout (stream = 2, xfb_buffer = 1, xfb_offset = 16) out vec4 goten;
4004 * It is expected that linking of program will fail.
4006 class XFBMultipleVertexStreamsTest : public NegativeTestBase
4009 /* Public methods */
4010 XFBMultipleVertexStreamsTest(deqp::Context& context);
4012 virtual ~XFBMultipleVertexStreamsTest()
4017 /* Methods to be implemented by child class */
4018 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4020 virtual bool isComputeRelevant(glw::GLuint test_case_index);
4023 /** Implementation of test XFBExceedBufferLimit. Description follows:
4025 * Test verifies that MAX_TRANSFORM_FEEDBACK_BUFFERS limit is respected.
4027 * Test following code snippets:
4029 * layout (xfb_buffer = MAX_TRANSFORM_FEEDBACK_BUFFERS) out;
4033 * layout (xfb_buffer = MAX_TRANSFORM_FEEDBACK_BUFFERS) out vec4 output;
4037 * layout (xfb_buffer = MAX_TRANSFORM_FEEDBACK_BUFFERS) out Block {
4041 * It is expected that build process will fail.
4043 * Test all shader stages.
4045 class XFBExceedBufferLimitTest : public NegativeTestBase
4048 /* Public methods */
4049 XFBExceedBufferLimitTest(deqp::Context& context);
4050 virtual ~XFBExceedBufferLimitTest()
4055 /* Methods to be implemented by child class */
4056 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4058 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4059 virtual glw::GLuint getTestCaseNumber();
4060 virtual bool isComputeRelevant(glw::GLuint test_case_index);
4061 virtual void testInit();
4078 Utils::Shader::STAGES m_stage;
4081 /* Private fields */
4082 std::vector<testCase> m_test_cases;
4085 /** Implementation of test XFBExceedOffsetLimit. Description follows:
4087 * Test verifies that MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS limit is
4090 * Test following code snippets:
4092 * layout (xfb_buffer = 0, xfb_stride = MAX_SIZE + 16) out;
4096 * layout (xfb_buffer = 0, xfb_offset = MAX_SIZE) out vec4 output;
4100 * layout (xfb_buffer = 0, xfb_offset = MAX_SIZE) out Block
4105 * where MAX_SIZE is the maximum supported size of transform feedback buffer,
4106 * which should be equal to:
4108 * MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS * sizeof(float)
4110 * It is expected that build process will fail.
4112 * Test all shader stages.
4114 class XFBExceedOffsetLimitTest : public NegativeTestBase
4117 /* Public methods */
4118 XFBExceedOffsetLimitTest(deqp::Context& context);
4119 virtual ~XFBExceedOffsetLimitTest()
4124 /* Methods to be implemented by child class */
4125 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4127 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4128 virtual glw::GLuint getTestCaseNumber();
4129 virtual bool isComputeRelevant(glw::GLuint test_case_index);
4130 virtual void testInit();
4147 Utils::Shader::STAGES m_stage;
4150 /* Private fields */
4151 std::vector<testCase> m_test_cases;
4154 /** Implementation of test XFBGlobalBuffer. Description follows:
4156 * Test verifies that global setting of xfb_buffer qualifier work as expected.
4158 * This test implements Buffer algorithm. Rasterization can be discarded. Test
4159 * following code snippet:
4161 * layout (xfb_buffer = 3) out;
4163 * layout ( xfb_offset = 2 * sizeof(type)) out type chichi;
4164 * layout (xfb_buffer = 1, xfb_offset = 0) out type bulma;
4165 * layout (xfb_buffer = 1, xfb_offset = sizeof(type)) out Vegeta {
4169 * layout ( xfb_offset = 0) out Goku {
4174 * chichi = EXPECTED_VALUE;
4175 * bulma = EXPECTED_VALUE;
4176 * trunks = EXPECTED_VALUE;
4177 * bra = EXPECTED_VALUE;
4178 * gohan = EXPECTED_VALUE;
4179 * goten = EXPECTED_VALUE;
4181 * Test pass if all captured outputs have expected values.
4183 * Test all shader stages. Test all types.
4185 class XFBGlobalBufferTest : public BufferTestBase
4188 XFBGlobalBufferTest(deqp::Context& context);
4190 ~XFBGlobalBufferTest()
4195 /* Protected methods */
4196 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
4198 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4200 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4201 virtual glw::GLuint getTestCaseNumber();
4202 virtual void testInit();
4208 Utils::Shader::STAGES m_stage;
4212 /* Private fields */
4213 std::vector<_testCase> m_test_cases;
4216 /** Implementation of test XFBStride. Description follows:
4218 * Test verifies that expected stride values are used.
4220 * Test following code snippet:
4222 * layout (xfb_offset = 0) out type output;
4224 * output = EXPECTED_VALUE;
4226 * Test all types. Test all shader stages.
4228 class XFBStrideTest : public BufferTestBase
4231 XFBStrideTest(deqp::Context& context);
4237 /* Protected methods */
4238 using BufferTestBase::executeDrawCall;
4240 virtual bool executeDrawCall(bool tesEnabled, glw::GLuint test_case_index);
4241 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
4243 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
4244 std::string& out_calculations);
4246 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
4247 std::string& out_interface);
4249 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4251 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4252 virtual glw::GLuint getTestCaseNumber();
4253 virtual void testInit();
4259 Utils::Shader::STAGES m_stage;
4263 /* Private fields */
4264 std::vector<testCase> m_test_cases;
4267 /** Implementation of test XFBBlockMemberBuffer. Description follows:
4269 * Test verifies that member of block have to use same buffer as block.
4271 * Test following code snippet:
4273 * layout (xfb_offset = 0) out Goku
4276 * layout (xfb_buffer = 1) vec4 goten;
4279 * It is expected that compilation will fail.
4281 * Test all shader stages.
4283 class XFBBlockMemberBufferTest : public NegativeTestBase
4286 /* Public methods */
4287 XFBBlockMemberBufferTest(deqp::Context& context);
4289 virtual ~XFBBlockMemberBufferTest()
4294 /* Methods to be implemented by child class */
4295 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4297 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4298 virtual glw::GLuint getTestCaseNumber();
4299 virtual bool isComputeRelevant(glw::GLuint test_case_index);
4300 virtual void testInit();
4306 Utils::Shader::STAGES m_stage;
4309 /* Private fields */
4310 std::vector<testCase> m_test_cases;
4313 /** Implementation of test XFBOutputOverlapping. Description follows:
4315 * Test verifies that overlapped outputs are reported as errors by compiler.
4317 * Test following code snippet:
4319 * layout (xfb_offset = sizeof(type)) out type gohan;
4320 * layout (xfb_offset = 1.5 * sizeof(type)) out type goten;
4322 * gohan = EXPECTED_VALUE;
4323 * goten = EXPECTED_VALUE;
4325 * It is expected that compilation will fail.
4327 * Test all shader stages. Test all types.
4329 class XFBOutputOverlappingTest : public NegativeTestBase
4332 /* Public methods */
4333 XFBOutputOverlappingTest(deqp::Context& context);
4335 virtual ~XFBOutputOverlappingTest()
4340 /* Methods to be implemented by child class */
4341 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4343 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4344 virtual glw::GLuint getTestCaseNumber();
4345 virtual bool isComputeRelevant(glw::GLuint test_case_index);
4346 virtual void testInit();
4352 glw::GLuint m_offset_gohan;
4353 glw::GLuint m_offset_goten;
4354 Utils::Shader::STAGES m_stage;
4358 /* Private fields */
4359 std::vector<testCase> m_test_cases;
4362 /** Implementation of test XFBInvalidOffsetAlignment. Description follows:
4364 * Test verifies that invalidly aligned outputs cause a failure to build
4367 * Test following code snippet:
4369 * layout (xfb_offset = OFFSET) out type goku;
4371 * goku = EXPECTED_VALUE;
4373 * Select OFFSET values so as to cause invalid alignment. Inspect program to
4374 * verify offset of goku.
4376 * Test all shader stages. Test all types. Test all offsets in range:
4377 * (sizeof(type), 2 * sizeof(type)).
4379 class XFBInvalidOffsetAlignmentTest : public NegativeTestBase
4382 /* Public methods */
4383 XFBInvalidOffsetAlignmentTest(deqp::Context& context);
4385 virtual ~XFBInvalidOffsetAlignmentTest()
4390 /* Methods to be implemented by child class */
4391 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4393 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4394 virtual glw::GLuint getTestCaseNumber();
4395 virtual bool isComputeRelevant(glw::GLuint test_case_index);
4396 virtual void testInit();
4402 glw::GLuint m_offset;
4403 Utils::Shader::STAGES m_stage;
4407 /* Private fields */
4408 std::vector<testCase> m_test_cases;
4411 /** Implementation of test XFBCaptureInactiveOutputVariable. Description follows:
4413 * Test verifies behaviour of inactive outputs.
4415 * This test implements Buffer algorithm. Rasterization can be disabled. Draw
4416 * two vertices instead of one. Test following code snippet:
4418 * layout (xfb_offset = 16) out vec4 goku;
4419 * layout (xfb_offset = 32) out vec4 gohan;
4420 * layout (xfb_offset = 0) out vec4 goten;
4422 * gohan = EXPECTED_VALUE;
4423 * goten = EXPECTED_VALUE;
4426 * - values captured for goten and gohan are as expected,
4427 * - goku value is undefined
4428 * - stride is 3 * sizeof(vec4) - 48
4430 * Test all shader stages.
4432 class XFBCaptureInactiveOutputVariableTest : public BufferTestBase
4435 XFBCaptureInactiveOutputVariableTest(deqp::Context& context);
4436 ~XFBCaptureInactiveOutputVariableTest()
4441 /* Protected methods */
4442 using BufferTestBase::executeDrawCall;
4443 virtual bool executeDrawCall(bool tesEnabled, glw::GLuint test_case_index);
4444 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
4446 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
4447 std::string& out_calculations);
4449 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
4450 std::string& out_interface);
4452 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4454 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4455 virtual glw::GLuint getTestCaseNumber();
4457 virtual bool inspectProgram(glw::GLuint test_case_index, Utils::Program& program, std::stringstream& out_stream);
4459 virtual bool verifyBuffers(bufferCollection& buffers);
4473 /** Implementation of test XFBCaptureInactiveOutputComponent. Description follows:
4475 * Test verifies behaviour of inactive component.
4477 * This test implements Buffer algorithm. Rasterization can be disabled. Draw
4478 * two vertices instead of one. Test following code snippet:
4480 * layout (xfb_offset = 32) out vec4 goku;
4481 * layout (xfb_offset = 0) out vec4 gohan;
4482 * layout (xfb_offset = 16) out vec4 goten;
4483 * layout (xfb_offset = 48) out vec4 chichi;
4484 * layout (xfb_offset = 112) out vec4 vegeta;
4485 * layout (xfb_offset = 96) out vec4 trunks;
4486 * layout (xfb_offset = 80) out vec4 bra;
4487 * layout (xfb_offset = 64) out vec4 bulma;
4489 * goku.x = EXPECTED_VALUE;
4490 * goku.z = EXPECTED_VALUE;
4491 * gohan.y = EXPECTED_VALUE;
4492 * gohan.w = EXPECTED_VALUE;
4493 * goten.x = EXPECTED_VALUE;
4494 * goten.y = EXPECTED_VALUE;
4495 * chichi.z = EXPECTED_VALUE;
4496 * chichi.w = EXPECTED_VALUE;
4497 * vegeta.x = EXPECTED_VALUE;
4498 * trunks.y = EXPECTED_VALUE;
4499 * bra.z = EXPECTED_VALUE;
4500 * bulma.w = EXPECTED_VALUE;
4502 * Test pass when captured values of all assigned components match expected
4503 * values, while not assigned ones are undefined.
4505 * Test all shader stages.
4507 class XFBCaptureInactiveOutputComponentTest : public BufferTestBase
4510 XFBCaptureInactiveOutputComponentTest(deqp::Context& context);
4511 ~XFBCaptureInactiveOutputComponentTest()
4516 /* Protected methods */
4517 using BufferTestBase::executeDrawCall;
4518 virtual bool executeDrawCall(bool tesEnabled, glw::GLuint test_case_index);
4520 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
4522 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
4523 std::string& out_calculations);
4525 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
4526 std::string& out_interface);
4528 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4530 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4531 virtual glw::GLuint getTestCaseNumber();
4532 virtual bool verifyBuffers(bufferCollection& buffers);
4546 /** Implementation of test XFBCaptureInactiveOutputBlockMember. Description follows:
4548 * Test verifies behaviour of inactive block member.
4550 * This test implements Buffer algorithm. Rasterization can be disabled. Draw
4551 * two vertices instead of one. Test following code snippet:
4553 * layout (xfb_offset = 16) out Goku {
4559 * gohan = EXPECTED_VALUE;
4560 * chichi = EXPECTED_VALUE;
4562 * Test pass when captured values of gohan and chichi match expected values.
4563 * It is expected that goten will receive undefined value.
4565 * Test all shader stages.
4567 class XFBCaptureInactiveOutputBlockMemberTest : public BufferTestBase
4570 XFBCaptureInactiveOutputBlockMemberTest(deqp::Context& context);
4572 ~XFBCaptureInactiveOutputBlockMemberTest()
4577 /* Protected methods */
4578 using BufferTestBase::executeDrawCall;
4579 virtual bool executeDrawCall(bool tesEnabled, glw::GLuint test_case_index);
4580 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
4582 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
4583 std::string& out_calculations);
4585 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
4586 std::string& out_interface);
4588 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4590 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4591 virtual glw::GLuint getTestCaseNumber();
4592 virtual bool verifyBuffers(bufferCollection& buffers);
4606 /** Implementation of test XFBCaptureStruct. Description follows:
4608 * Test verifies that structures are captured as expected.
4610 * This test implements Buffer algorithm. Rasterization can be disabled. Draw
4611 * two vertices instead of one. Test following code snippet:
4619 * layout (xfb_offset = 16) out Goku goku;
4621 * goku.gohan = EXPECTED_VALUE;
4622 * goku.chichi = EXPECTED_VALUE;
4624 * Test pass when captured values of gohan and chichi match expected values.
4625 * It is expected that goten will receive undefined value.
4627 * Test all shader stages.
4629 class XFBCaptureStructTest : public BufferTestBase
4632 XFBCaptureStructTest(deqp::Context& context);
4634 ~XFBCaptureStructTest()
4639 /* Protected methods */
4640 using BufferTestBase::executeDrawCall;
4641 virtual bool executeDrawCall(bool tesEnabled, glw::GLuint test_case_index);
4643 virtual void getBufferDescriptors(glw::GLuint test_case_index, bufferDescriptor::Vector& out_descriptors);
4645 virtual void getShaderBody(glw::GLuint test_case_index, Utils::Shader::STAGES stage, std::string& out_assignments,
4646 std::string& out_calculations);
4648 virtual void getShaderInterface(glw::GLuint test_case_index, Utils::Shader::STAGES stage,
4649 std::string& out_interface);
4651 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4653 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4654 virtual glw::GLuint getTestCaseNumber();
4655 virtual bool verifyBuffers(bufferCollection& buffers);
4669 /** Implementation of test XFBCaptureUnsizedArray. Description follows:
4671 * Test verifies this is not allowed to qualify unsized array with "xfb".
4673 * Test following code snippet:
4675 * layout (xfb_offset = 0) out vec4 goku[];
4677 * goku[0] = EXPECTED_VALUE;
4679 * It is expected that compilation will fail.
4681 * Test all shader stages.
4683 class XFBCaptureUnsizedArrayTest : public NegativeTestBase
4686 /* Public methods */
4687 XFBCaptureUnsizedArrayTest(deqp::Context& context);
4688 virtual ~XFBCaptureUnsizedArrayTest()
4693 /* Methods to be implemented by child class */
4694 virtual std::string getShaderSource(glw::GLuint test_case_index, Utils::Shader::STAGES stage);
4696 virtual std::string getTestCaseName(glw::GLuint test_case_index);
4697 virtual glw::GLuint getTestCaseNumber();
4698 virtual bool isComputeRelevant(glw::GLuint test_case_index);
4699 virtual void testInit();
4705 Utils::Shader::STAGES m_stage;
4708 /* Private fields */
4709 std::vector<testCase> m_test_cases;
4712 } /* EnhancedLayouts namespace */
4714 /** Group class for Shader Language 420Pack conformance tests */
4715 class EnhancedLayoutsTests : public deqp::TestCaseGroup
4718 /* Public methods */
4719 EnhancedLayoutsTests(deqp::Context& context);
4721 virtual ~EnhancedLayoutsTests(void)
4725 virtual void init(void);
4728 /* Private methods */
4729 EnhancedLayoutsTests(const EnhancedLayoutsTests& other);
4730 EnhancedLayoutsTests& operator=(const EnhancedLayoutsTests& other);
4735 #endif // _GL4CENHANCEDLAYOUTSTESTS_HPP