-
Notifications
You must be signed in to change notification settings - Fork 634
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 new plugin: real time shader selection #733
Add new plugin: real time shader selection #733
Conversation
1a7c85f
to
ac48c2a
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.
Interesting approach!
Did I get it right, that nothing is done when switching the language?
app/plugins/real_time_shader_selection/real_time_shader_selection.h
Outdated
Show resolved
Hide resolved
app/plugins/real_time_shader_selection/real_time_shader_selection.h
Outdated
Show resolved
Hide resolved
app/plugins/real_time_shader_selection/real_time_shader_selection.h
Outdated
Show resolved
Hide resolved
6aedcfe
to
9cb31ee
Compare
yes, currently only this sample "dynamic_uniform_buffers" can support this plugin "args": [
"sample",
"dynamic_uniform_buffers"
,"--realtimeshaderselection"
] and changing the shader won't change anything because the function " DynamicUniformBuffers::change_shader is empty (no shader replacement). I wasn't sure if it makes sense to implement this for this sample, because I know that the principle of loading shaders in this PR #655 will change a bit, so I also didn't want to generate conflicts. But if you think it's worth implementing this function to show the actions, no problem. |
a3d3dc1
to
c1550ca
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.
I found 2 more naming convention issues.
Besides that, without actual usage of this new plugin, you don't know for sure that it's working. So I would vote for actually changing the shader in at least one sample to demonstrate it. Even though that might be changed by some future shader handling changes.
c1550ca
to
3ba304c
Compare
6942a5b
to
3847033
Compare
Looks good now, and works. |
Hi @asuessenbach , thanks for noticing that there is no HPP example. During the implementation I noticed that we have two classes for the Drawer (ImGUi) So my suggestion is to remove HPPDrawer and use only Drawer class. Because currently I don't see any logical example that we need to have two classes that do exactly the same thing and the only difference is in the types. Alternatively, if we don't want to remove HPPDrawer, I think we should make an Interface IDrawer that describes the functions that can be used in these classes. Do you think that we should remove the HPPDrawer class and the ability to implement the Drawer class in functions in C and CPP, or creating an interface will be a better solution ? |
Totally agree, that |
3847033
to
0b83285
Compare
As the last commit added quite a lot of changes, I will describe those that may be the most important
vk::ArrayProxyNoTemporaries<const vk::PipelineShaderStageCreateInfo> const &shader_stages
using HPPDrawer = Drawer; because the samples from HPP used such a name and I didn't want to change it in a very large number of files, of course if we want to get rid of the HPPDrawer name, I can remove the "using" and change the class name in each of the files
a) Use a template, it will involve quite a lot of changes |
0b83285
to
b6ef4ba
Compare
samples/api/hpp_dynamic_uniform_buffers/hpp_dynamic_uniform_buffers.cpp
Outdated
Show resolved
Hide resolved
samples/api/hpp_dynamic_uniform_buffers/hpp_dynamic_uniform_buffers.cpp
Outdated
Show resolved
Hide resolved
samples/api/hpp_dynamic_uniform_buffers/hpp_dynamic_uniform_buffers.cpp
Outdated
Show resolved
Hide resolved
samples/api/hpp_dynamic_uniform_buffers/hpp_dynamic_uniform_buffers.h
Outdated
Show resolved
Hide resolved
samples/api/hpp_dynamic_uniform_buffers/hpp_dynamic_uniform_buffers.h
Outdated
Show resolved
Hide resolved
b6ef4ba
to
3720723
Compare
After thinking about your changes yet another time, I would propose the following adjustments:
|
3720723
to
5058b97
Compare
I did as you @asuessenbach suggested with a few changes
|
I have tested every sample to ensure everything runs correctly - used "batch" command on Ubuntu 22.04.3 LTS. |
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.
Works locally for me. Fits well with the HLSL/GLSL offline compilation branch. We can expand this in the future to allow for hot reloading as well!
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.
LGTM
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.
How do I test this? There don't appear to be any samples here that are actually using anything other than GLSL
@@ -1,4 +1,4 @@ | |||
/* Copyright (c) 2023, Google | |||
/* Copyright (c) 2024, Google |
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.
You shouldn't need to update copyright if the file hasn't been changed in this PR
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.
Fixed
@@ -340,7 +340,6 @@ void DynamicUniformBuffers::prepare_pipelines() | |||
|
|||
// Load shaders | |||
std::array<VkPipelineShaderStageCreateInfo, 2> shader_stages; | |||
|
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 doesn't seem intentional. A single blank line has been removed.
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.
Fixed
@@ -1,4 +1,4 @@ | |||
/* Copyright (c) 2020-2021, Arm Limited and Contributors | |||
/* Copyright (c) 2020-2024, Arm Limited and Contributors |
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.
Nothing changed here but the copyright year?
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.
Fixed
@gary-sweet |
in "dynamic_uniform_buffers.cpp"
00dd13d
@Seweryn-Zielas-Mobica That patch doesn't apply for me ( Can you make a separate temporary PR that has that change on top of this one that I can checkout instead perhaps? |
@gary-sweet I created temporary PR like you requested - #953 |
I don't have that ability. It may be quicker to just push a small change to this PR to re-trigger them. |
Looks like we have merge conflicts on this one. LMK when fixed and I'll merge. Thx |
a82bff5
@marty-johnson59 I've fixed merge conflict, it was a small one in ".copyrightignore" file. |
Description
This PR adds a new plugin that enables dynamic shader switching in samples. The plugin can be enabled via the command line switch "--realtimeshaderselection". The sample must define the shaders that can be used by calling "ApiVulkanSample::store_shader" and implement the "change_shader" function, which notifies the sample about shader changes.
General Checklist:
Please ensure the following points are checked:
My code follows the coding style
I have reviewed file licenses
I have commented any added functions (in line with Doxygen)
I have commented any code that could be hard to understand
My changes do not add any new compiler warnings
My changes do not add any new validation layer errors or warnings
I have used existing framework/helper functions where possible
My changes do not add any regressions
I have tested every sample to ensure everything runs correctly
This PR describes the scope and expected impact of the changes I am making
Note: The Samples CI runs a number of checks including:
Sample Checklist
If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist: