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 push constants #7817
Add push constants #7817
Conversation
poweifeng
commented
May 1, 2024
- Push constants is a small set of bytes that can be recorded directly on the command buffer.
- Introduce its use for internal purposes.
- Implemented it for the vulkan backend.
- Push constants is a small set of bytes that can be recorded directly on the command buffer. - Introduce its use for internal purposes. - Implemented it for the vulkan backend.
f58d5af
to
73569b6
Compare
73569b6
to
c8c1a65
Compare
58a25ff
to
6a0a9b8
Compare
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.
- use std::move()/std::swap() when setting the constants in Program
- use CString instead of char*
- remove conceptually private stuff from EngineEnums.h
dc9cb6f
to
3d1880a
Compare
3d1880a
to
bd34f7d
Compare
|
||
if (!mCurrentPushConstants) { | ||
mCurrentPushConstants = new (std::nothrow) PushConstantBundle{p->getPushConstants()}; | ||
} else { | ||
(*mCurrentPushConstants) = p->getPushConstants(); | ||
} |
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.
Just use a value instead of a pointer since it will always be allocated, this will avoid a if
here the first time.
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's ok to pull in OpenGLProgram.h
in OpenGLDriver.h
?
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.
Yes that should be okay.
@@ -38,6 +38,24 @@ namespace filament::backend { | |||
|
|||
class OpenGLDriver; | |||
|
|||
struct PushConstantBundle { | |||
uint8_t fragmentStageOffset = 0; | |||
utils::FixedCapacityVector<std::pair<GLint, ConstantType>> const* constants = nullptr; |
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.
I think you can even make this a reference
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.
used two slices instead.
ebf15d9
to
66f2533
Compare
7c6f84c
to
4d2565e
Compare