-
Notifications
You must be signed in to change notification settings - Fork 149
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 ByteAddressBuffer support #248
Merged
spencer-lunarg
merged 2 commits into
KhronosGroup:main
from
spencer-lunarg:spencer-lunarg-byteAddressBuffer2
Jan 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// dxc -spirv -fspv-reflect -T cs_6_0 -E csmain -fspv-target-env=vulkan1.2 | ||
uint g_global; | ||
|
||
struct MaterialData_t { | ||
float4 g_vTest; | ||
float2 g_vTest2; | ||
float3 g_vTest3; | ||
uint g_tTexture1; | ||
uint g_tTexture2; | ||
bool g_bTest1; | ||
bool g_bTest2; | ||
}; | ||
|
||
static MaterialData_t _g_MaterialData; | ||
|
||
ByteAddressBuffer g_MaterialData : register (t4 , space1); | ||
RWStructuredBuffer<uint2> Output : register(u1); | ||
|
||
[numthreads(1, 1, 1)] | ||
void csmain(uint3 tid : SV_DispatchThreadID) { | ||
uint2 a = g_MaterialData.Load2( tid.x + g_global ); | ||
uint b = g_MaterialData.Load( tid.x + g_global ); | ||
uint2 c = g_MaterialData.Load2(4); | ||
Output[tid.x] = a * uint2(b, b) * c; | ||
} |
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should this check be above this? Otherwise it will return if you have 8 operations when it could have succeeded (if you have exactly 8). I also don't understand why there is such a low cap on this, it seems rather inflexible. Would it be better to scan for how many first then allocate an array with a cap of like the size of the spir-v or something?
The problem is that SPIR-V reflection will completely fail in this case, not just that you won't get the offsets.
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.
so before it failed because I returned an error, not I return the same as "could not find" it it hits the cap
I guess there is no reason for a hard limit, it just I have yet to find a case where it is more then 2 here
So the other issue is I do need "a cap" when doing this search anyways, there is no "correct" way for HLSL/Slang to flatten the
ByteAddressBuffer
so in the future, if some strange pattern arises, I still need some arbitrary number to stop at incase I get in some strange situation and don't want to crash