Skip to content

Commit

Permalink
YES
Browse files Browse the repository at this point in the history
  • Loading branch information
mansen420 committed Mar 10, 2024
1 parent 315bd31 commit a9733e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,15 @@ void workspace_panel()
SameLine();
if(Button("Unroll Includes"))
{
if (renderer::unroll_includes(prog_type, shader_type)){std::cout << "HI?" << std::endl;}
//should_load_shader = true;
if (renderer::unroll_includes(prog_type, shader_type))
should_load_shader = true;
}
PopItemWidth();

if (should_load_shader)
{
strcpy(shader_code_buffer, renderer::get_shader_source_reflection(prog_type, shader_type));
//should_load_shader = false;
should_load_shader = false;
}

ImGui::InputTextMultiline("##source", shader_code_buffer, sizeof(shader_code_buffer), whole_window->Size);
Expand Down
9 changes: 3 additions & 6 deletions src/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,12 @@ namespace renderer
bool unroll_includes(shader_prg_option program_type, shader_type_option shader_type)
{
shader_manager::shader_t* shader = find_shader(program_type, shader_type);
std::cout << shader << std::endl;
if (nullptr == shader)
{
std::cout << "HI." << std::endl;
return false;
}//XXX WHAT THE FUCK
std::cout << "HI. yo." << std::endl;
//std::cout << shader;
//shader->unroll_includes();
}
shader->unroll_includes();
return true;
}
//TODO it would be better to relink the program upon any attempt to compile any of its attached shaders.
bool link_program(shader_prg_option program_type)
Expand Down
5 changes: 5 additions & 0 deletions src/shader_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ bool shader_manager::shader_t::load_source_from_path(const char* const path)
bool shader_manager::shader_t::compile() const{return compileShader(type, ID, source_code.c_str());}
bool shader_manager::shader_t::unroll_includes()
{
char* processed_source = nullptr;
renderer::preprocessor::process_shader(source_code.c_str(), processed_source);
source_code = std::string(processed_source);
delete[] processed_source;
return true;
}
shader_manager::shader_t::~shader_t()
{
Expand Down

0 comments on commit a9733e1

Please sign in to comment.