-
Notifications
You must be signed in to change notification settings - Fork 52
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
Allow specialization constant overrides in config #46
Conversation
Only simple types (bool, int, float) for now. Example: ```ini reshade = reshade-shaders/Pixelate.fx # type = slider # min = 2 # max = 48 # Cell Size #cell_size = 4 cell_size = 2 # type = slider # min = 0.0 # max = 1.0 # Smoothness #avg_amount = 0.333 avg_amount = 1.0 ```
Interesting. The my question is if this would be easier for the end user than editing the shader file directly. Also different shaders could have a spec constant with the same name and the user probably does not want to set all of them to the same value. |
Anyway, they don't forced to configure effects or add every option in other case. It's even better when all unused options will be commented out, then their default values will be used. |
could the name in the config file be changed to something like effects = effect1:effect2
effect1 = ...
effect2 = ...
effect1.cell_size = 2
effect2.cell_size = 5 |
I guess per-effect config file support would be better. But shouldn't be a problem to cut |
Yes I think that would be the best solution . |
Also, the problem is that some effects can have long names with spaces. E.g. |
maybe we should support quotes? effect1 = "reshade-shaders/PD80 Contrasts & ColorFX.fx" |
Or maybe INI file format. It will allow to use sections, and spaces in section names. Should be possible to do something like this: [reshade-shaders/PD80 Contrasts & ColorFX.fx]
option = 1
option2 = 2.2
[reshade-shaders/CRT.fx]
option = 1 |
BTW, similar thing (dynamic spec constants) can be done for your "simple effects", what (I guess) will let you merge all separate effects code. The downside is that additional dependency will be needed, e.g. spirv-cross. Sample code for config file generator: #include "spirv_cross/spirv_cross.hpp"
...
// Read SPIR-V file
std::ifstream rawCFile(spvFile, std::ios::binary);
std::vector<char> spirv_data((std::istreambuf_iterator<char>(rawCFile)), std::istreambuf_iterator<char>());
// evil magic
spirv_cross::Compiler comp(std::move(*reinterpret_cast<std::vector<uint32_t>*>(&spirv_data)));
for (auto& con : comp.get_specialization_constants()) {
spirv_cross::SPIRConstant cnst = comp.get_constant(con.id);
output
<< "c: " << con.constant_id
<< " : " << comp.get_name(con.id)
<< " = " << cnst.scalar()
<< " t:" << cnst.constant_type
<< std::endl;
} Since you already have SPIR-V file loaded, you could feed it's data to spirv_cross::Compiler and get what you need from it. LDFLAGS += But that just FYI. |
INI format would have the advantage that you could plug in existing ReShade preset files: ReShade generates files of the format:
Where the INI categories are effect file names (file name only, no directory, but with fx extension) and the But that would mean adding an INI parser, which, while not overly complicated, may not be desireable. |
I want a at least somewhat consistent naming scheme
I'm merging this for now but the config system needs a overhaul |
* Allow specialization constant overrides in config Only simple types (bool, int, float) for now. Example: ```ini reshade = reshade-shaders/Pixelate.fx # type = slider # min = 2 # max = 48 # Cell Size #cell_size = 4 cell_size = 2 # type = slider # min = 0.0 # max = 1.0 # Smoothness #avg_amount = 0.333 avg_amount = 1.0 ``` * Move temporary variables initializations into loop * Use smallCamelCase for variables I want a at least somewhat consistent naming scheme Co-authored-by: DadSchoorse <[email protected]>
Only simple types (bool, int, float) for now.
Example: