Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7784971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:10:51+00:00 2026-06-01T20:10:51+00:00

Using image load and store, i would like to do the following in GLSL

  • 0

Using image load and store, i would like to do the following in GLSL 4.2:

vec3 someColor = ...;
vec4 currentPixel = imageLoad(myImage, uv);
float a = currentPixel.a/(currentPixel.a+1.0f);
vec4 newPixel = vec4(currentPixel.rgb*a+someColor*(1.0f-a),currentPixel.a+1.0f);
imageStore(myImage, uv, newPixel);

the value for ‘uv’ can be the same for multiple rasterized pixels. In order to get the proper result, of course I want no other shaderexecution to write into my pixel inbetween the calls of imageLoad() and imageStore();

Is this possible to do somehow with memoryBarrier? if so, how does it have to be used in this code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:10:51+00:00Added an answer on June 1, 2026 at 8:10 pm

    the value for ‘uv’ can be the same for multiple rasterized pixels.

    Then you can’t do it.

    memoryBarrier is not a way to create an atomic operation. It only guarantees the ordering for a single shader’s operation. So if a particular shader invocation reads an image, writes it, and then reads it again, you need a memoryBarrier to ensure that what is read is what was written before. If some other shader invocation wrote to it, then you’re out of luck (unless it was a dependent invocation. The rules for this stuff are complex).

    If you’re trying to do programmatic blending, then you need to make certain that each fragment shader invocation reads/writes to a unique value. Otherwise, it’s not going to work.

    You don’t say what it is you’re trying to actually achieve, so it’s not possible to provide a better way of getting what you want. All I can say is that this way is not going to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to write an image labeling tool using PyQT4: load a number
Im trying to load a image at runtime in WPF using the following code
I am using following code to load an image from internal memory to tab
I'm using the following code to load a grayscale JPG image, and query a
I am trying to load a JPEG image using the cvLoadImage function and it
I am using an UIImageView to load an image with aspectfit. Hence the image
i Had load my image Buffered image now need to brighten it using Slider
Using simplexml_load_file(), if I'm parsing out XML and I get the following for image...
i am using a class written by someone to resize the image and store
I'm trying to load some images using Bitmap.getBitmapResource() , but it takes about 2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.