2 * Copyright (c) 2017 Józef Kucia <joseph.kucia@gmail.com>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * \file rendering-r32ui.c
26 * Exercises a Radeonsi bug.
29 #include "piglit-util-gl.h"
31 PIGLIT_GL_TEST_CONFIG_BEGIN
33 config
.supports_gl_compat_version
= 30;
34 config
.window_visual
= PIGLIT_GL_VISUAL_RGBA
| PIGLIT_GL_VISUAL_DOUBLE
;
35 config
.khr_no_error_support
= PIGLIT_NO_ERRORS
;
37 PIGLIT_GL_TEST_CONFIG_END
39 static const char *vs
=
42 " gl_Position = gl_Vertex;\n"
45 static const char *ps
=
49 " color = uvec4(0xff, 0, 0, 0);\n"
61 piglit_init(int argc
, char **argv
)
63 GLuint tex
, view
, framebuffer
, prog
;
64 GLuint data
[TEX_SIZE
* TEX_SIZE
];
67 piglit_require_gl_version(30);
68 piglit_require_extension("GL_ARB_texture_view");
70 glGenTextures(1, &tex
);
71 glBindTexture(GL_TEXTURE_2D
, tex
);
72 glTexStorage2D(GL_TEXTURE_2D
, 1, GL_R32F
, TEX_SIZE
, TEX_SIZE
);
74 glGenTextures(1, &view
);
75 glTextureView(view
, GL_TEXTURE_2D
, tex
, GL_R32UI
, 0, 1, 0, 1);
77 glGenFramebuffers(1, &framebuffer
);
78 glBindFramebuffer(GL_FRAMEBUFFER
, framebuffer
);
79 glFramebufferTexture2D(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
80 GL_TEXTURE_2D
, view
, 0);
82 prog
= piglit_build_simple_program(vs
, ps
);
85 piglit_draw_rect(-1, -1, 2, 2);
87 glBindTexture(GL_TEXTURE_2D
, view
);
88 glGetTexImage(GL_TEXTURE_2D
, 0, GL_RED_INTEGER
, GL_UNSIGNED_INT
,
90 if (data
[0] != 0xff) {
91 printf("Got value %#x\n", data
[0]);
95 glDeleteTextures(1, &view
);
96 glDeleteTextures(1, &tex
);
97 glDeleteFramebuffers(1, &framebuffer
);
98 glDeleteProgram(prog
);
100 pass
= piglit_check_gl_error(GL_NO_ERROR
) && pass
;
101 piglit_report_result(pass
? PIGLIT_PASS
: PIGLIT_FAIL
);