Advertisement

Does sync be needed to read texture content after access texture image in compute shader

Started by January 12, 2018 06:06 AM
1 comment, last by DragonJoker 7 years ago

Does sync be needed to read texture content after access texture image in compute shader?

My simple code is as below,

glUseProgram(program.get());
glBindImageTexture(0, texture[0], 0, GL_FALSE, 3, GL_READ_ONLY, GL_R32UI);
glBindImageTexture(1, texture[1], 0, GL_FALSE, 4, GL_WRITE_ONLY, GL_R32UI);
glDispatchCompute(1, 1, 1);

// Does sync be needed here?

glUseProgram(0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                               GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture[1], 0);
glReadPixels(0, 0, kWidth, kHeight, GL_RED_INTEGER, GL_UNSIGNED_INT, outputValues);

 

Compute shader is very simple, imageLoad content from texture[0], and imageStore content to texture[1]. Does need to sync after dispatchCompute?

Hi!

 

I usually sync when modifying a SSBO from a compute shader, my guess is that it will needed for textures too.

If you can't find anything, look for something else.

This topic is closed to new replies.

Advertisement