-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix uniform sets in "Compute Texture" #1247
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
Fix uniform sets in "Compute Texture" #1247
Conversation
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.
Tested locally on 4.4.1.stable and 4.5.rc2, it works as expected. Code looks good to me.
@@ -143,13 +143,13 @@ var pipeline: RID | |||
var texture_rds: Array[RID] = [RID(), RID(), RID()] | |||
var texture_sets: Array[RID] = [RID(), RID(), RID()] | |||
|
|||
func _create_uniform_set(texture_rd: RID) -> RID: | |||
func _create_uniform_set(texture_rd: RID, uniform_set: int) -> RID: | |||
var uniform := RDUniform.new() | |||
uniform.uniform_type = RenderingDevice.UNIFORM_TYPE_IMAGE | |||
uniform.binding = 0 | |||
uniform.add_id(texture_rd) | |||
# Even though we're using 3 sets, they are identical, so we're kinda cheating. |
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.
The comment can be removed
# Create our uniform sets so we can use these textures in our shader. | ||
var current_set := _create_uniform_set(current_texture_rd, 0) | ||
var previous_set := _create_uniform_set(previous_texture_rd, 1) | ||
var next_set := _create_uniform_set(next_texture_rd, 2) |
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.
This seems to create uniforms every frame, no? I think we just need 9 uniforms and should cache them. Or use UniformSetCacheRD
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.
Feel free to open a PR for this 🙂
Same for the above comment.
Fix uniform sets that were hardcoded as
0
, which seems to work withv4.4
but has broken this demo inv4.5
.Still works with
v4.4.1
✅Also removed the unnecessary texture usage bits.