Skip to content
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

Add Access Flags for DescriptorBinding #224

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

spencer-lunarg
Copy link
Contributor

@spencer-lunarg spencer-lunarg commented Sep 16, 2023

closes #222

The logic uses the same pattern as we do to detect accessed boolean but expands the logic to look up one more instruction to see what type it was

Example: if we have the instructions OpImageRead -> OpLoad -> OpVariable, before we just tracked the OpLoad touched the OpVariable and marked as accessed

now we track this OpLoad as a SpvReflectPrvAccessedVariable and we know both the OpVariable it points to, but now also track the Result ID so the OpImageRead can find this OpLoad


I wrote the code to be consistent with the current code, which I think could be cleaned up to be easier to read/maintain, but would like to do that as a separate PR

@spencer-lunarg spencer-lunarg changed the title [WIP] Add Access Flags for DescriptorBinding Add Access Flags for DescriptorBinding Oct 29, 2023
@@ -115,6 +115,7 @@ all_descriptor_bindings:
block: *bv2 #
array: { dims_count: 0, dims: [] }
accessed: 1
access_flags: 0x00000000 # NONE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last thing left in PR is figure out why this is not consistent with accessed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is

         %13 = OpAccessChain %_ptr_StorageBuffer__struct_3 %2
         %14 = OpArrayLength %uint %13 1
                     OpReturn
                     OpFunctionEn

and from looking at spec, this is not considered a read, just an access

@@ -316,6 +317,7 @@ all_descriptor_bindings:
block: *bv7 # ""
array: { dims_count: 0, dims: [] }
accessed: 1
access_flags: 0x00000000 # NONE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems

OpStore -> OpAccessChain -> OpAccessChain -> OpVariable

is a valid thing... need to fix

SPV_REFLECT_ACCESS_READ = 0x00000001,
SPV_REFLECT_ACCESS_WRITE = 0x00000002,
// Atomic will always also be marked as READ and WRITE
SPV_REFLECT_ACCESS_ATOMIC = 0x00000004,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there ever a case where ATOMIC is used or checked by itself it it always inlcudes READ and WRITE? Wondering if there's a different way to express this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I had it before as separate... #222 (comment) convinced me otherwise

spirv_reflect.c Show resolved Hide resolved
spirv_reflect.c Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reflecting capabilities used by a shader more finely
2 participants