GS/HW: Allow baking shaders into executable. #13649
Open
+297
−29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
Adds a Python script and build settings to allow baking some GS shaders into the PCSX2 executable.
Affects the following shaders:
Rationale behind Changes
This allows different shaders to be more easily tested. For example, we can test multiple executables with different shaders without having to make sure the shaders on disk don't change.
Suggested Testing Steps
VS (manual): In the file
common/vsprops/ShaderToCpp.props, change the line<BakeShadersInCpp>false</BakeShadersInCpp>to<BakeShadersInCpp>true</BakeShadersInCpp>.VS (UI): In
Property Mangerwindow go under thepcsx2project, select any configuration (e.g.,Debug | x64), double click onShaderToCpp. In theCommon Properties > User Macrossection, change the value ofBakeShadersInCpptotrue.CMake: Build with the config variable
BAKE_SHADERS_IN_CPP=true.When building, you should see messages in the build log that indicate that the shaders are being converted to CPP files. The resulting executable should have the shaders baked at compile time so any changes made to the files in
bin/resources/shadersshould have no effect.Did you use AI to help find, test, or implement this issue or feature?
I used AI to generate the Python files for converting text -> CPP. Also, to get help with the build file setup.