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

Metal fix #6413

Merged
merged 2 commits into from
Feb 21, 2025
Merged

Metal fix #6413

merged 2 commits into from
Feb 21, 2025

Conversation

kaizhangNV
Copy link
Contributor

@kaizhangNV kaizhangNV commented Feb 20, 2025

Fix the issue in creating texture view in metal.
In newTextureView, levelRange should represent the mipmap level range,
while sliceRange should represent the texture layer range for texture
array. But the implementation inverses those two wrongly.

Fix the issue when emitting read only texture_buffer<>
texture_buffer doesn't support access::sample, we should emit access::read when it's read only buffer.

@kaizhangNV kaizhangNV requested a review from a team as a code owner February 20, 2025 18:05
@kaizhangNV kaizhangNV closed this Feb 20, 2025
@kaizhangNV kaizhangNV reopened this Feb 20, 2025
@kaizhangNV kaizhangNV added the pr: non-breaking PRs without breaking changes label Feb 20, 2025
csyonghe
csyonghe previously approved these changes Feb 20, 2025
@@ -404,7 +404,7 @@ Result DeviceImpl::createTextureResource(
break;
}

bool isArray = desc.arraySize > 0;
bool isArray = desc.arraySize > 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This was discussed when it was initially submitted.
Please see the discussion:
#4331 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@skallweitNV for an opinion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder why this is needed? What issue is this fixing?

Are there no 1-element texture arrays in metal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fix this issue on SGL side. So no fix needed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue I'm trying to fix is that SGL presume that desc.arraySize == 1 is a non-array texture, however, slang-gfx assume this is a texture array with array size of 1. Those assumption conflicts.

@kaizhangNV
Copy link
Contributor Author

kaizhangNV commented Feb 20, 2025

In the new commit, I fix an obvious bug in metal.
8db65b6

@kaizhangNV
Copy link
Contributor Author

In the new commit, I fix an obvious bug in metal. 8db65b6

FYI @skallweitNV the same issue is also in slang-rhi.

In newTextureView, levelRange should represent the mipmap level range,
while sliceRange should represent the texture layer range for texture
array. But the implement inverse those two wrongly.
@kaizhangNV kaizhangNV merged commit 4d286aa into shader-slang:master Feb 21, 2025
16 checks passed
@kaizhangNV kaizhangNV deleted the metal_fix branch February 24, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants