[NFC] Declare format tables as const (#1493)

Without const, these variables would be flagged up by
`-Wunused-variable`.

Drop `struct` from the declarations as that is not needed in C++.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2022-09-13 14:48:54 +01:00
committed by GitHub
parent 1d74c85ff3
commit 5d5bffba13
4 changed files with 36 additions and 32 deletions

View File

@@ -32,12 +32,8 @@ struct format {
};
// These are the typically tested formats.
// TODO: These variables should be made const; until then, suppress unused
// variable warnings as not every translation unit including this header uses
// all variables.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
static struct format common_formats[] = {
// clang-format off
static const format common_formats[] = {
#ifdef __APPLE__
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, kUChar },
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, kUChar },
@@ -57,26 +53,30 @@ static struct format common_formats[] = {
};
#ifdef GL_VERSION_3_2
static struct format depth_formats[] = {
static const format depth_formats[] = {
{ GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, kUShort },
{ GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, kFloat },
{ GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, kUInt },
{ GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, kFloat },
};
#endif
#pragma GCC diagnostic pop
// clang-format on
int test_images_write_common(cl_device_id device, cl_context context,
cl_command_queue queue, struct format* formats, size_t nformats,
GLenum *targets, size_t ntargets, sizevec_t* sizes, size_t nsizes );
cl_command_queue queue, const format *formats,
size_t nformats, GLenum *targets, size_t ntargets,
sizevec_t *sizes, size_t nsizes);
int test_images_read_common( cl_device_id device, cl_context context,
cl_command_queue queue, struct format* formats, size_t nformats,
GLenum *targets, size_t ntargets, sizevec_t *sizes, size_t nsizes );
int test_images_read_common(cl_device_id device, cl_context context,
cl_command_queue queue, const format *formats,
size_t nformats, GLenum *targets, size_t ntargets,
sizevec_t *sizes, size_t nsizes);
int test_images_get_info_common( cl_device_id device, cl_context context,
cl_command_queue queue, struct format* formats, size_t nformats,
GLenum *targets, size_t ntargets, sizevec_t *sizes, size_t nsizes );
int test_images_get_info_common(cl_device_id device, cl_context context,
cl_command_queue queue, const format *formats,
size_t nformats, GLenum *targets,
size_t ntargets, sizevec_t *sizes,
size_t nsizes);
int is_rgb_101010_supported( cl_context context, GLenum gl_target );