mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-26 00:39:03 +00:00
test_common: Capitalize macro and clang-format (#1813)
The `CHECK_GL_ERROR` macro was lowercase before, which confused clang-format and resulted in some odd indentations. Capitalize the macro and run clang-format to fix the indentation. Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
committed by
GitHub
parent
d20913b4e3
commit
1c616238bc
@@ -966,12 +966,13 @@ void reorder_verification_buffer(GLenum glFormat, GLenum glType, char* buffer, s
|
|||||||
|
|
||||||
#ifdef GL_VERSION_3_2
|
#ifdef GL_VERSION_3_2
|
||||||
|
|
||||||
#define check_gl_error() \
|
#define CHECK_GL_ERROR() \
|
||||||
{ \
|
{ \
|
||||||
GLenum errnom = GL_NO_ERROR;\
|
GLenum errnom = GL_NO_ERROR; \
|
||||||
if ((errnom = glGetError()) != GL_NO_ERROR)\
|
if ((errnom = glGetError()) != GL_NO_ERROR) \
|
||||||
log_error("GL Error: 0x%04X at %s:%d\n", errnom, __FILE__, __LINE__);\
|
log_error("GL Error: 0x%04X at %s:%d\n", errnom, __FILE__, \
|
||||||
}
|
__LINE__); \
|
||||||
|
}
|
||||||
|
|
||||||
const char *get_gl_vector_type( GLenum internalformat )
|
const char *get_gl_vector_type( GLenum internalformat )
|
||||||
{
|
{
|
||||||
@@ -1045,7 +1046,7 @@ void * CreateGLTexture2DMultisample( size_t width, size_t height, size_t samples
|
|||||||
|
|
||||||
// Check if the renderer supports enough samples
|
// Check if the renderer supports enough samples
|
||||||
GLint max_samples = get_gl_max_samples(target, internalFormat);
|
GLint max_samples = get_gl_max_samples(target, internalFormat);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
if (max_samples < (GLint)samples)
|
if (max_samples < (GLint)samples)
|
||||||
log_error("GL error: requested samples (%zu) exceeds renderer max "
|
log_error("GL error: requested samples (%zu) exceeds renderer max "
|
||||||
@@ -1077,36 +1078,36 @@ void * CreateGLTexture2DMultisample( size_t width, size_t height, size_t samples
|
|||||||
glShaderWrapper vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
glShaderWrapper vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
||||||
glShaderSource(vertex_shader, 1, &vertex_source, NULL);
|
glShaderSource(vertex_shader, 1, &vertex_source, NULL);
|
||||||
glCompileShader(vertex_shader);
|
glCompileShader(vertex_shader);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
glShaderWrapper fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
|
glShaderWrapper fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
glShaderSource(fragment_shader, 1, &fragment_source, NULL);
|
glShaderSource(fragment_shader, 1, &fragment_source, NULL);
|
||||||
glCompileShader(fragment_shader);
|
glCompileShader(fragment_shader);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
GLuint prog = glCreateProgram();
|
GLuint prog = glCreateProgram();
|
||||||
glAttachShader(prog, vertex_shader);
|
glAttachShader(prog, vertex_shader);
|
||||||
glAttachShader(prog, fragment_shader);
|
glAttachShader(prog, fragment_shader);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
glBindAttribLocation(prog, 0, "att0");
|
glBindAttribLocation(prog, 0, "att0");
|
||||||
glLinkProgram(prog);
|
glLinkProgram(prog);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
// Setup the FBO and texture
|
// Setup the FBO and texture
|
||||||
glFramebufferWrapper fbo;
|
glFramebufferWrapper fbo;
|
||||||
glGenFramebuffers(1, &fbo);
|
glGenFramebuffers(1, &fbo);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
GLuint tex = 0;
|
GLuint tex = 0;
|
||||||
glGenTextures(1, &tex);
|
glGenTextures(1, &tex);
|
||||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
|
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
|
||||||
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, samples, internalFormat, width, height, fixedSampleLocations);
|
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, samples, internalFormat, width, height, fixedSampleLocations);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
GLint attachment;
|
GLint attachment;
|
||||||
switch (internalFormat) {
|
switch (internalFormat) {
|
||||||
@@ -1124,7 +1125,7 @@ void * CreateGLTexture2DMultisample( size_t width, size_t height, size_t samples
|
|||||||
}
|
}
|
||||||
|
|
||||||
glFramebufferTexture(GL_FRAMEBUFFER, attachment, tex, 0);
|
glFramebufferTexture(GL_FRAMEBUFFER, attachment, tex, 0);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
GLint status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
GLint status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||||
if (status == GL_FRAMEBUFFER_UNSUPPORTED) {
|
if (status == GL_FRAMEBUFFER_UNSUPPORTED) {
|
||||||
@@ -1144,7 +1145,7 @@ void * CreateGLTexture2DMultisample( size_t width, size_t height, size_t samples
|
|||||||
// Check if the framebuffer supports enough samples
|
// Check if the framebuffer supports enough samples
|
||||||
GLint fbo_samples = 0;
|
GLint fbo_samples = 0;
|
||||||
glGetIntegerv(GL_SAMPLES, &fbo_samples);
|
glGetIntegerv(GL_SAMPLES, &fbo_samples);
|
||||||
check_gl_error();
|
CHECK_GL_ERROR();
|
||||||
|
|
||||||
if (fbo_samples < (GLint)samples)
|
if (fbo_samples < (GLint)samples)
|
||||||
log_error(
|
log_error(
|
||||||
@@ -1152,16 +1153,16 @@ void * CreateGLTexture2DMultisample( size_t width, size_t height, size_t samples
|
|||||||
samples, fbo_samples);
|
samples, fbo_samples);
|
||||||
|
|
||||||
glUseProgram(prog);
|
glUseProgram(prog);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
if (attachment != GL_DEPTH_ATTACHMENT && attachment != GL_DEPTH_STENCIL_ATTACHMENT) {
|
if (attachment != GL_DEPTH_ATTACHMENT && attachment != GL_DEPTH_STENCIL_ATTACHMENT) {
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDepthFunc(GL_ALWAYS);
|
glDepthFunc(GL_ALWAYS);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the VBO for rendering a quad
|
// Setup the VBO for rendering a quad
|
||||||
@@ -1176,14 +1177,14 @@ void * CreateGLTexture2DMultisample( size_t width, size_t height, size_t samples
|
|||||||
glGenBuffers(1, &vbo);
|
glGenBuffers(1, &vbo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(quad), quad, GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(quad), quad, GL_STREAM_DRAW);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
glVertexArraysWrapper vao;
|
glVertexArraysWrapper vao;
|
||||||
glGenVertexArrays(1, &vao);
|
glGenVertexArrays(1, &vao);
|
||||||
glBindVertexArray(vao);
|
glBindVertexArray(vao);
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*2, 0);
|
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*2, 0);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
//clearing color and depth buffer
|
//clearing color and depth buffer
|
||||||
glClearColor(0, 0, 0, 0);
|
glClearColor(0, 0, 0, 0);
|
||||||
@@ -1227,13 +1228,13 @@ void * CreateGLTexture2DMultisample( size_t width, size_t height, size_t samples
|
|||||||
color += color_delta;
|
color += color_delta;
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
check_gl_error();
|
CHECK_GL_ERROR();
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
glDisable(GL_SAMPLE_MASK);
|
glDisable(GL_SAMPLE_MASK);
|
||||||
check_gl_error();
|
CHECK_GL_ERROR();
|
||||||
|
|
||||||
*outTextureID = tex;
|
*outTextureID = tex;
|
||||||
|
|
||||||
@@ -1339,36 +1340,36 @@ void * CreateGLTexture2DArrayMultisample(size_t width, size_t height,
|
|||||||
glShaderWrapper vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
glShaderWrapper vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
||||||
glShaderSource(vertex_shader, 1, &vertex_source, NULL);
|
glShaderSource(vertex_shader, 1, &vertex_source, NULL);
|
||||||
glCompileShader(vertex_shader);
|
glCompileShader(vertex_shader);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
glShaderWrapper fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
|
glShaderWrapper fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
glShaderSource(fragment_shader, 1, &fragment_source, NULL);
|
glShaderSource(fragment_shader, 1, &fragment_source, NULL);
|
||||||
glCompileShader(fragment_shader);
|
glCompileShader(fragment_shader);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
glProgramWrapper prog = glCreateProgram();
|
glProgramWrapper prog = glCreateProgram();
|
||||||
glAttachShader(prog, vertex_shader);
|
glAttachShader(prog, vertex_shader);
|
||||||
glAttachShader(prog, fragment_shader);
|
glAttachShader(prog, fragment_shader);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
glBindAttribLocation(prog, 0, "att0");
|
glBindAttribLocation(prog, 0, "att0");
|
||||||
glLinkProgram(prog);
|
glLinkProgram(prog);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
// Setup the FBO and texture
|
// Setup the FBO and texture
|
||||||
glFramebufferWrapper fbo;
|
glFramebufferWrapper fbo;
|
||||||
glGenFramebuffers(1, &fbo);
|
glGenFramebuffers(1, &fbo);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
GLuint tex = 0;
|
GLuint tex = 0;
|
||||||
glGenTextures(1, &tex);
|
glGenTextures(1, &tex);
|
||||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex);
|
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex);
|
||||||
glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, samples, internalFormat, width, height, total_layers, fixedSampleLocations);
|
glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, samples, internalFormat, width, height, total_layers, fixedSampleLocations);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
GLint attachment;
|
GLint attachment;
|
||||||
switch (internalFormat) {
|
switch (internalFormat) {
|
||||||
@@ -1390,12 +1391,12 @@ void * CreateGLTexture2DArrayMultisample(size_t width, size_t height,
|
|||||||
|
|
||||||
if (attachment != GL_DEPTH_ATTACHMENT && attachment != GL_DEPTH_STENCIL_ATTACHMENT) {
|
if (attachment != GL_DEPTH_ATTACHMENT && attachment != GL_DEPTH_STENCIL_ATTACHMENT) {
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDepthFunc(GL_ALWAYS);
|
glDepthFunc(GL_ALWAYS);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the VBO for rendering a quad
|
// Setup the VBO for rendering a quad
|
||||||
@@ -1410,18 +1411,18 @@ void * CreateGLTexture2DArrayMultisample(size_t width, size_t height,
|
|||||||
glGenBuffers(1, &vbo);
|
glGenBuffers(1, &vbo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(quad), quad, GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(quad), quad, GL_STREAM_DRAW);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
glVertexArraysWrapper vao;
|
glVertexArraysWrapper vao;
|
||||||
glGenVertexArrays(1, &vao);
|
glGenVertexArrays(1, &vao);
|
||||||
glBindVertexArray(vao);
|
glBindVertexArray(vao);
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*2, 0);
|
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*2, 0);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
for (size_t l=0; l!=total_layers; ++l) {
|
for (size_t l=0; l!=total_layers; ++l) {
|
||||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, attachment, tex, 0, l);
|
glFramebufferTextureLayer(GL_FRAMEBUFFER, attachment, tex, 0, l);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||||
if (status == GL_FRAMEBUFFER_UNSUPPORTED) {
|
if (status == GL_FRAMEBUFFER_UNSUPPORTED) {
|
||||||
@@ -1441,7 +1442,7 @@ void * CreateGLTexture2DArrayMultisample(size_t width, size_t height,
|
|||||||
// Check if the framebuffer supports enough samples
|
// Check if the framebuffer supports enough samples
|
||||||
GLint fbo_samples = 0;
|
GLint fbo_samples = 0;
|
||||||
glGetIntegerv(GL_SAMPLES, &fbo_samples);
|
glGetIntegerv(GL_SAMPLES, &fbo_samples);
|
||||||
check_gl_error();
|
CHECK_GL_ERROR();
|
||||||
|
|
||||||
if (fbo_samples < (GLint)samples)
|
if (fbo_samples < (GLint)samples)
|
||||||
log_error(
|
log_error(
|
||||||
@@ -1449,7 +1450,7 @@ void * CreateGLTexture2DArrayMultisample(size_t width, size_t height,
|
|||||||
samples, fbo_samples);
|
samples, fbo_samples);
|
||||||
|
|
||||||
glUseProgram(prog);
|
glUseProgram(prog);
|
||||||
check_gl_error()
|
CHECK_GL_ERROR()
|
||||||
|
|
||||||
//clearing color and depth buffer
|
//clearing color and depth buffer
|
||||||
glClearColor(0, 0, 0, 0);
|
glClearColor(0, 0, 0, 0);
|
||||||
@@ -1490,13 +1491,13 @@ void * CreateGLTexture2DArrayMultisample(size_t width, size_t height,
|
|||||||
glUniform1f(glGetUniformLocation(prog, "depthVal"), val);
|
glUniform1f(glGetUniformLocation(prog, "depthVal"), val);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
check_gl_error();
|
CHECK_GL_ERROR();
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
glDisable(GL_SAMPLE_MASK);
|
glDisable(GL_SAMPLE_MASK);
|
||||||
check_gl_error();
|
CHECK_GL_ERROR();
|
||||||
}
|
}
|
||||||
|
|
||||||
*outTextureID = tex;
|
*outTextureID = tex;
|
||||||
|
|||||||
Reference in New Issue
Block a user