-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enables images to be read and modified per pixel in shader #2331
Conversation
The compiler seems to think that |
From a quick look to the files changes menu it seems you missed to add the overwrite to the lwjgl2 renderer. |
I am not a big fan of the enum. There are 3 more possible flags available. ( coherent, restricted and volatile) and you are encouraged to use a combination. Like Edit: got confused with glsl parameters. You can dismiss this comment |
I noticed some serious problems with my original approach about a week ago. Today I went and implemented a different approach which I believe is far more flexible, so this PR is now ready for review again. New usage: TextureImage img = new TextureImage(myTexture, TextureImage.Access.ReadWrite);
material.setParam("MyImage", VarType.Image2D, img); This allows for a single texture to be bound differently in different situations, without needing to change values on the texture's image in each situation, which could easily lead to unexpected behavior. |
I think it would be even saver to have the access flags defined in the j3md? kind of the same way we have the -linear option on textures. But your current solution looks better then the first one. |
I experimented with having the j3md define the access flag, but I don't think it is worth it. The material and j3md loader code is a mess and not change-friendly at all. I feel like I'm fighting the code just to put the necessary changes in. I think this PR should be left as-is, because it's already very neat and doesn't change anything that could have far-reaching consequences. Plus, the access flag defaults to |
@codex128 I'll go ahead and merge this prior to the next alpha release in a few days unless anyone contests before then. The only review I have is that it could be useful to make a simple example or some code snippets to show how to use this new feature once it makes it to the stable release. But for now everything looks good and it sounds like this is ready to be merged. |
I have added a test app, but I ran into an error that made me unable to run the test.
I think this is probably a problem in my development environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR enables images to be read/written in a shader using imageLoad, imageStore, etc. This is done by calling glBindImageTexture when an access flag is not null after the texture is bound with glBindTexture.
This feature is disabled by default. Unless the access flag is specifically set to not null on the image, the image will be bound normally.