-
Notifications
You must be signed in to change notification settings - Fork 7
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
Param block support for Metal #208
base: main
Are you sure you want to change the base?
Conversation
@@ -22,6 +22,8 @@ elseif(UNIX) | |||
set(SGL_ORIGIN "$ORIGIN") | |||
endif() | |||
|
|||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) |
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.
remove this
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.
can we just keep this for developers using clangd as their language server?
@@ -37,7 +37,7 @@ | |||
CMAKE_PRESET = { | |||
"windows": "windows-msvc", | |||
"linux": "linux-gcc", | |||
"macos": "macos-clang", | |||
"macos": "macos-arm64-clang", |
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.
why did you change this? does the macos-clang preset build for x64 only?
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.
there is no macos-clang preset, only macos-arm64-clang and macos-x64-clang, and I think we don't care macos-x64-clang.
src/sgl/device/shader_cursor.cpp
Outdated
return ShaderCursor(m_shader_object->get_object(m_offset)); | ||
{ | ||
ShaderCursor d = ShaderCursor(m_shader_object->get_object(m_offset)); | ||
#if SGL_MACOS |
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 is wrong. you should check the device type instead.
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.
because, vulkan is a valid device type on macos too.
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.
oh, I don't know vulkan is actually supported on macos.
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.
it is through moltenVK
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.
but switching the layout does depend on the active device type, not the OS, so checking SGL_MACOS
is the wrong approach anyway
src/sgl/device/shader_cursor.cpp
Outdated
@@ -155,10 +164,6 @@ ShaderCursor ShaderCursor::find_field(std::string_view name) const | |||
// | |||
case TypeReflection::Kind::constant_buffer: | |||
case TypeReflection::Kind::parameter_block: { | |||
// We basically need to "dereference" the current cursor |
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.
why is this comment removed?
{ | ||
NestedStruct a; | ||
uint b; | ||
ParameterBlock<NestedStruct> nestParamBlock; |
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.
ideally you would avoid using camelCase
when adding code to sgl. we try to stick to snake_case
convention throughout c++ python and slang code
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.
OK, I see.
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.
updated.
do we not have existing tests for parameter blocks? |
not I'm aware of. |
Add parameter block support for Metal backend, the only thing we need to change to support that is to change the type layout of the parameter block to use argument buffer tier2 rule. In such rule, everything inside parameter block will be uniform, and resource will be represented by device pointer or resource id, which means that they will be bindless resource.
Add a test.