-
Notifications
You must be signed in to change notification settings - Fork 17
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
Shader hot compile and reload #421
Conversation
const std::string& featuresCombine = pMaterialComponent->GetFeaturesCombine(); | ||
|
||
// New shader feature added, need to compile new variants. | ||
m_pRenderContext->CheckShaderProgram(programName, featuresCombine); |
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.
CheckXXX seems like a const function which just returns bool result if shader program modified. How about UpdateShaderProgram
?
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 will add shader compilt task when we don't have a shader program handle and register the new shader feature to ShaderCollections, which did a little bit more than Update?
bool m_crtInputFocus = true; | ||
bool m_preInputFocus = true; |
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.
Seems like you want to check if current window is active. This will be improved after my WindowManager refactor.
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 feature is most interested in detecting the moment when the editor window regains focus.
engine::RenderContext* ShaderHotModifyCallbackWrapper::m_pRenderContext = nullptr; | ||
engine::Window* ShaderHotModifyCallbackWrapper::m_pWindow = 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.
One way to avoid static is to add delegates for EditorApp methods to bind. Here to invoke.
Can be improved after my multiple window PR merged. Or may cause many conflicts.
It is a very useful feature for us to improve experience on developing shaders across platforms. |
Co-authored-by: Jiajun <75730859+T-rvw@users.noreply.github.com>
Finally, we can modify the shader and apply the changes in real time while the editor is launched.
CatDogEngine/Engine/BuiltInShaders/shaders
.TODO:
We can't handle dependencies between resource files right now.