[Mesa-dev] [Mesa-users] Problem with ARB_copy_buffer on Mesa 9.2.4
Jonas Kulla
nyocurio at gmail.com
Tue May 6 14:54:07 PDT 2014
Hello Benjamin,
thank you very much for testing this. If this issue is fixed in latest
Mesa, then I don't
have to issue a bug report after all. It's also not critical for me to have
this issue fixed
on my distribution as I can easily work around it; I just wanted to make
sure that the
fix for this is available in a higher Mesa version so I'll eventually get
it via upgrading.
Thanks a lot,
Jonas
2014-05-06 20:01 GMT+02:00 Benjamin Bellec <b.bellec at gmail.com>:
> Hello Jonas,
>
> I tested your program and on my system (Fedora 19) on an Evergreen (Radeon
> HD 5850) and I have the same issue indeed.
> Here is my result :
>
> Mesa 9.2.4 (from F19 repo) => Data does NOT match up!
> Mesa 9.2.5 => Data does NOT match up!
> Mesa 10.0.5 => Data does NOT match up!
> Mesa 10.1.0 => Data matches.
>
> So this is fixed in newer version.
> That said, Mesa 9.2 is not supported anymore and I really don't know if
> there will be a new Mesa 10.0.x release given the imminence of Mesa 10.2.
> If yes, I can bisect and you can open a bug.
>
> Mesa-dev, any new 10.0.x release planned ?
>
> Regards.
>
> Benjamin
>
> Le 06/05/2014 13:40, Jonas Kulla a écrit :
>
> Hello list,
>
> after about 3 days of debugging, I was able to isolate a rather weird
> behavior in Mesa GL.
> The gist of it is the following: When I create a buffer object and
> allocate uninitilaized
> memory for it (glBufferData() with nullptr as 'data'),
> then glCopyBufferSubData() data into
> it from another buffer object, then subsequently fill a part of it with
> glBufferSubData(),
> this new data isn't visible to the buffer object. In fact, it seems that
> the SubData'ed bytes
> are completely lost. Any further data uploads however work as expected. I
> will attach
> a small C test case below that demonstrates this behavior.
>
> I realize that I am working with an old Mesa release (on Fedora 19), but
> I'm afraid of
> upgrading my system to the newest distro release as I might break my
> working environment.
> That's why I would like to kindly ask if someone could verify that this
> problem still persists
> on the newest Mesa code, in which case I would go ahead and file a bug
> report. At the
> same time, maybe someone could spot a critical mistake in my code that
> would explain
> this strange behavior I'm seeing. I think the code paths I'm hitting here
> in the driver are
> sufficiently obscure though.
>
> I should probably mention that my card is a Mobility Radeon HD 3650 (ie.
> r600).
>
> Here's the code sample (you can replace the GL setup code with your own):
>
> #include <stdlib.h>
> #include <string.h>
>
> #include <GL/glew.h>
> #include <SDL2/SDL.h>
>
> static SDL_Window *win;
> static SDL_GLContext *ctx;
>
> void setupGL()
> {
> SDL_Init(SDL_INIT_VIDEO);
> win = SDL_CreateWindow("CopyBufferBug", SDL_WINDOWPOS_UNDEFINED,
> SDL_WINDOWPOS_UNDEFINED, 64, 64, SDL_WINDOW_OPENGL);
> ctx = SDL_GL_CreateContext(win);
> glewInit();
> }
>
> static void teardownGL()
> {
> SDL_GL_DeleteContext(ctx);
> SDL_DestroyWindow(win);
>
> SDL_Quit();
> }
>
> int main(int argc, char *argv[])
> {
> setupGL();
>
> /* These don't matter I think */
> #define BLOCK_SIZE 128
> #define BUFFER1_SIZE BLOCK_SIZE
> #define BUFFER2_SIZE BLOCK_SIZE
> #define BUFFER1_TARGET GL_COPY_READ_BUFFER
> #define BUFFER2_TARGET GL_COPY_WRITE_BUFFER
> #define BUFFER1_USAGE GL_DYNAMIC_DRAW
> #define BUFFER2_USAGE GL_DYNAMIC_DRAW
>
> GLuint buffers[2];
> glGenBuffers(2, buffers);
>
> /* We allocate both buffers with undefined memory */
> glBindBuffer(BUFFER1_TARGET, buffers[0]);
> glBufferData(BUFFER1_TARGET, BUFFER1_SIZE, 0, BUFFER1_USAGE);
>
> glBindBuffer(BUFFER2_TARGET, buffers[1]);
> glBufferData(BUFFER2_TARGET, BUFFER2_SIZE, 0, BUFFER2_USAGE);
>
> /* Then copy (undefined) bytes from the first into the second
> buffer */
> /* Note: If I comment this line out, everything works */
> glCopyBufferSubData(BUFFER1_TARGET, BUFFER2_TARGET, 0, 0,
> BUFFER1_SIZE);
>
> /* Generate random string */
> FILE *rand = fopen("/dev/urandom", "r");
> char data[BLOCK_SIZE];
> fread(data, 1, sizeof(data), rand);
> fclose(rand);
>
> /* We fill the second buffer with defined data */
> /* Note: If I execute this call twice (just copy paste the line),
> everything works */
> glBufferSubData(BUFFER2_TARGET, 0, sizeof(data), data);
>
> /* Then download it again to compare its contents against our test
> string */
> char data2[BLOCK_SIZE];
> glGetBufferSubData(BUFFER2_TARGET, 0, sizeof(data2), data2);
>
> if (memcmp(data, data2, sizeof(data)))
> printf("Data does NOT match up!\n");
> else
> printf("Data matches.\n");
>
> glDeleteBuffers(2, buffers);
>
> teardownGL();
>
> return 0;
> }
>
> Thank you very much for your time.
> Jonas
>
>
> _______________________________________________
> mesa-users mailing listmesa-users at lists.freedesktop.orghttp://lists.freedesktop.org/mailman/listinfo/mesa-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140506/0aff56b9/attachment.html>
More information about the mesa-dev
mailing list