Skip to content

Commit

Permalink
[Examples] Minor update in EampleBase and PBR example.
Browse files Browse the repository at this point in the history
- Added report output to ExampleBase to log failure reason when render system could not be loaded.
- Lowered GLSL version in PBR example from 450 to 410 to make it work on Mac.
  • Loading branch information
LukasBanana committed Aug 16, 2024
1 parent d871410 commit 5887e46
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion examples/Cpp/ExampleBase/ExampleBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,13 +523,15 @@ ExampleBase::ExampleBase(const LLGL::UTF8String& title)
}

// Create render system
LLGL::Report report;
rendererDesc.flags |= g_Config.flags;
renderer = LLGL::RenderSystem::Load(rendererDesc);
renderer = LLGL::RenderSystem::Load(rendererDesc, &report);

// Fallback to null device if selected renderer cannot be loaded
if (!renderer)
{
LLGL::Log::Errorf("Failed to load \"%s\" module. Falling back to \"Null\" device.\n", rendererDesc.moduleName.c_str());
LLGL::Log::Errorf("Reason for failure: %s", report.HasErrors() ? report.GetText() : "Unknown\n");
renderer = LLGL::RenderSystem::Load("Null");
if (!renderer)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/Cpp/PBR/Example.Mesh.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// PBR GLSL Mesh Fragment Shader

#version 450 core
#version 410 core

#define M_PI 3.141592654

Expand Down
2 changes: 1 addition & 1 deletion examples/Cpp/PBR/Example.Mesh.vert
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// PBR GLSL Mesh Vertex Shader

#version 450 core
#version 410 core

uniform Settings
{
Expand Down
2 changes: 1 addition & 1 deletion examples/Cpp/PBR/Example.Sky.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// PBR GLSL Skybox Fragment Shader

#version 450 core
#version 410 core

uniform Settings
{
Expand Down
2 changes: 1 addition & 1 deletion examples/Cpp/PBR/Example.Sky.vert
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// PBR GLSL Skybox Vertex Shader

#version 450 core
#version 410 core

uniform Settings
{
Expand Down
4 changes: 3 additions & 1 deletion examples/Cpp/PBR/Example.metal
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ float3 BRDF(

float3 color = (diffuse + specular) * NdotL;

//color += SampleEnvironment(envMap, envMapLayer, smpl, roughness, reflection) * 0.2;
// Sample incoming light from environment map
float3 reflection = -normalize(reflect(viewDir, normal));
color += SampleEnvironment(envMap, envMapLayer, smpl, roughness, reflection) * 0.2;

return color;
}
Expand Down

0 comments on commit 5887e46

Please sign in to comment.