summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2018-01-01 02:55:58 +0100
committerRoland Scheidegger <sroland@vmware.com>2018-01-04 04:30:41 +0100
commit384a7fdac1c8c184b9cdf635500edd4a0ecb18f4 (patch)
tree1a5f0bc4ab82d760d8136b30a80b82e90d3fe95e
parent119cf8df354c6cca60d6c5a36493ec650dc2e07f (diff)
arb_texture_buffer_object/max-size: skip if the buffer can't be allocated
The max size reported by GL_MAX_TEXTURE_BUFFER_SIZE only guarantees that buffers which contain that many texels can be sampled from. It does not mean it is guaranteed the corresponding huge buffers can be allocated in the first place. (r600 for instance will report some huge number, the test cuts this to 512 million texels, but naturally fails to allocate the 2GB buffer for it, at least on my card with 1GB vram. The driver actually will report 0.7 times the max of vram and gart size, but since the gl cap is in texels this doesn't really help as the test uses rgba8 format.) Since the test specifically tries to test the max, skip it when this happens (instead of trying lower sizes). Reviewed-by: Fabian Bieler <fabianbieler@fastmail.fm>
-rw-r--r--tests/spec/arb_texture_buffer_object/max-size.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/spec/arb_texture_buffer_object/max-size.c b/tests/spec/arb_texture_buffer_object/max-size.c
index 19f4ddf04..b94d2d094 100644
--- a/tests/spec/arb_texture_buffer_object/max-size.c
+++ b/tests/spec/arb_texture_buffer_object/max-size.c
@@ -76,6 +76,7 @@ piglit_init(int argc, char **argv)
static const uint8_t data[4] = {0x00, 0xff, 0x00, 0x00};
GLuint prog;
GLint max;
+ GLenum err;
prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
@@ -101,6 +102,11 @@ piglit_init(int argc, char **argv)
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA8, tbo);
glBufferData(GL_TEXTURE_BUFFER,
max * sizeof(data), NULL, GL_STATIC_READ);
+ err = glGetError();
+ if (err == GL_OUT_OF_MEMORY) {
+ printf("couldn't allocate buffer due to OOM, skipping.\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
glBufferSubData(GL_TEXTURE_BUFFER,
(max - 1) * sizeof(data), sizeof(data), data);