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 8357073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:22:10+00:00 2026-06-09T10:22:10+00:00

I am trying to implement a depth peel algorithm using integer textures for shader

  • 0

I am trying to implement a depth peel algorithm using integer textures for shader mutexes. As suggested in this question, I suspect one can use imageAtomicCompSwap(…).

Looking in the documentation for that function, and selecting the overload for an unsigned integer:

uint imageAtomicCompSwap(gimage2D image, ivec2 P, uint data);

However, it’s unclear how this can be used. The documentation reads:

imageAtomicCompSwap atomically compares the value of data with that of the texel at coordinate P . . . . If the values are equal, data is stored into the texel, otherwise it is discarded. It returns the new value of the texel.

This sounds to me like the function compares the data to the already existing value in the texel. If the values are equal, effectively nothing happens (“data is stored into the texel”, but they compared equal so there’s no change). If the values are unequal, nothing happens (“otherwise it is discarded”). The function then returns the new value of the texel (which, because nothing happened either way, is just the original value of the texel to begin with). Clearly I am missing something.

Complicating matters, I also haven’t been able to get this function to even show up. Writing:

//img2D_0 is declared "layout(r32ui) coherent restrict uniform uimage2D img2D_0"
imageAtomicCompSwap(img2D_0,coord,1u);

. . . gives:

0(14) : error C1115: unable to find compatible overloaded function “imageAtomicCompSwap(struct uimage2D1x32, ivec2, uint)”

It’s worth mentioning that if I pass two numbers:

imageAtomicCompSwap(img2D_0,coord,1u,1u);

It compiles fine–I understand this should only work for multisampling, though; did I somehow declare a multisampled image? So, A: what does the documentation mean, B: why doesn’t the function I need work? I’m confused.

  • 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-09T10:22:11+00:00Added an answer on June 9, 2026 at 10:22 am

    Looking in the documentation for that function

    Man, those pages cause more problems than they solve…

    In short, the docs are broken. The specification (ie: the docs that matter) states the function is defined as:

    uint imageAtomicCompSwap(IMAGE_PARAMS, uint compare, uint data)
    

    Where IMAGE_PARAMS are the image uniform and the texture coordinate appropriate to that image uniform. For a 1D image, it takes an image1D and an int; for a 2D image, it takes an image2D and an ivec2; etc.

    It works by comparing the value in the image with compare. If they are equal, then data is stored at this location (swapped in); otherwise, no swapping is done. The return value will be whatever value is stored at this location before the conditional swap is done.

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

Sidebar

Related Questions

I am trying to implement depth first search algorithm using adjacency list representation of
I am trying to implement the depth first search algorithm into my game. I
I'm trying to implement the negamax algorithm, and this is how I thought it
This a conceptual question on how one would implement the following in Lisp (assuming
I am trying to implement a modified parallel depth-first search algorithm in Erlang (let's
Trying to implement a search similar to here .This searches properties based on city,locality,property
I'm trying to improve my current algorithm for the 8 Queens problem, and this
I am trying to implement a camera controlled scene using the camera code from:
I'm trying implement a way to recursively template using jsRender. The issue is, my
I'm trying to implement the technique described at : Compositing Images with Depth .

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.