mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-10 22:05:06 +00:00
gfx-shader: Deal with remaining compile errors
This commit is contained in:
parent
731a22e1ea
commit
f79502b9b0
2 changed files with 20 additions and 17 deletions
|
@ -79,24 +79,23 @@ bool gfx::shader::shader::is_technique_different(const std::string& tech)
|
|||
|
||||
bool gfx::shader::shader::load_shader(const std::filesystem::path& file, const std::string& tech, bool& shader_dirty,
|
||||
bool& param_dirty)
|
||||
{
|
||||
try {
|
||||
if (!std::filesystem::exists(file))
|
||||
return false;
|
||||
|
||||
shader_dirty = is_shader_different(file);
|
||||
param_dirty = is_technique_different(tech) || shader_dirty;
|
||||
|
||||
// Update Shader
|
||||
if (shader_dirty) {
|
||||
try {
|
||||
_shader = gs::effect(file);
|
||||
_shader_file = file;
|
||||
_shader_file_mt = std::filesystem::last_write_time(file);
|
||||
_shader_file_sz = std::filesystem::file_size(file);
|
||||
_shader_file_tick = 0;
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
_shader = gs::effect(file);
|
||||
_shader_file_mt = std::filesystem::last_write_time(file);
|
||||
_shader_file_sz = std::filesystem::file_size(file);
|
||||
_shader_file = file;
|
||||
_shader_file_tick = 0;
|
||||
}
|
||||
|
||||
// Update Params
|
||||
if (param_dirty) {
|
||||
auto settings =
|
||||
std::shared_ptr<obs_data_t>(obs_source_get_settings(_self), [](obs_data_t* p) { obs_data_release(p); });
|
||||
|
@ -164,6 +163,8 @@ bool gfx::shader::shader::load_shader(const std::filesystem::path& file, const s
|
|||
}
|
||||
|
||||
return true;
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void gfx::shader::shader::properties(obs_properties_t* pr)
|
||||
|
|
|
@ -50,6 +50,8 @@ namespace gfx {
|
|||
Transition,
|
||||
};
|
||||
|
||||
typedef std::map<std::string, std::shared_ptr<parameter>> shader_param_map_t;
|
||||
|
||||
class shader {
|
||||
obs_source_t* _self;
|
||||
|
||||
|
@ -61,13 +63,13 @@ namespace gfx {
|
|||
std::shared_ptr<gs::texture> _input_b;
|
||||
|
||||
// Shader
|
||||
gs::effect _shader;
|
||||
std::filesystem::path _shader_file;
|
||||
std::string _shader_tech;
|
||||
std::filesystem::file_time_type _shader_file_mt;
|
||||
uintmax_t _shader_file_sz;
|
||||
float_t _shader_file_tick;
|
||||
std::map<std::string, std::shared_ptr<parameter>> _shader_params;
|
||||
gs::effect _shader;
|
||||
std::filesystem::path _shader_file;
|
||||
std::string _shader_tech;
|
||||
std::filesystem::file_time_type _shader_file_mt;
|
||||
uintmax_t _shader_file_sz;
|
||||
float_t _shader_file_tick;
|
||||
shader_param_map_t _shader_params;
|
||||
|
||||
// Options
|
||||
size_type _width_type;
|
||||
|
|
Loading…
Reference in a new issue