Open samsonsite1 opened 7 years ago
I've build the project on an AMD graphics card, these errors all seem to be related to shader compilation on NVidia drivers. It appears NVidia drivers are strict on implicit conversion (have to be explicit there with (bool)/(float) casts) and it seems NVidia drivers require shader version #420 (or with relevant extension explicitly enabled). I can't fix them myself at the moment as my NVidia machine is currently out of commission so I can't test the compilation.
Thanks for reply.
So, assuming the program code is ok, the problem is mainly the code in the shaders?
What is best practices for shader support? Creating shaders that work the same with both AMD/nVidia cards, or creating two sets of vendor-specific shaders?
I fixed one error. Must make the following changes:
BEFORE: layout (std140, binding = 0) uniform Global { AFTER: layout (std140) uniform Global {
I can see something in the window now. The window is no longer black.
Still looking for these errors:
ERROR: Fragment shader compilation error at: post process! 0(41) : error C7011: implicit cast from "int" to "bool" 0(56) : error C7011: implicit cast from "int" to "bool" 0(69) : error C7011: implicit cast from "int" to "bool" 0(84) : error C7011: implicit cast from "int" to "bool" 0(88) : error C7011: implicit cast from "int" to "bool"
error: uniform variable "projection" is already declared in the interface block "Global" and cannot also be declared in the default uniform block error: uniform variable "view" is already declared in the interface block "Global" and cannot also be declared in the default uniform block
error: members of uniform block (named Global) are not the same between shader stages
More fixes:
post_processing.fs: (change to bool)
// post-process effect toggles //uniform int Vignette; //uniform int Sepia; //uniform int Bloom; //uniform int SSAO; //uniform int SSR; //uniform int MotionBlur;
uniform bool Vignette; uniform bool Sepia; uniform bool Bloom; uniform bool SSAO; uniform bool SSR; uniform bool MotionBlur;
capture.vs: (comment out view/projection, already defined in uniforms.glsl)
//uniform mat4 projection; //uniform mat4 view; uniform mat4 model;
Shaders are easier to fix if logging is added to LoadShader() in resources.cpp. Otherwise, we have no idea where the error is coming from.
Shader* Resources::LoadShader(std::string name, std::string vsPath, std::string fsPath, std::vector<std::string> defines)
{
Log::Message("Resources::LoadShader: " + vsPath + ", " + fsPath + "...", LOG_INIT);
}
All errors fixed!
This is a nice demo, btw. Although, the camera movement is a bit nauseating with the blurring. :)
I found the tab settings. I discovered you can turn off motionBlur there.
BTW, after playing around with the demo for a while, I noticed a small black square "popping" on my main window randomly every 5-10 seconds or so. It's only there for a second. This happens when I rotate the camera around. I turned off all tab settings except for Bloom. It still appears. When Bloom is turned off, it stops appearing, so maybe something related to Bloom.
There's also a problem with the SSAO tab setting. When turned off, a ghost image remains from the last camera view. Turning it back on, the ghost image disappears.
Nice! I'm surprised it actually works when you removed the binding = 0
from the Global
UBO, it could be it defaults to binding 0 implicitly, but this binding is required. It's likely better if the shader simply uses a higher GLSL version (I believe #420 should be sufficient), or explicitly set the binding from the OpenGL code.
Also, removing the view
and projection
matrices shouldn't work, as for the probe capture stage it uses a custom set of view
projection
matrices that it doesn't take from the uniform buffer object so it's likely the irradiance probes have no proper effect on your screen.
And as for fixing those kind of errors: yes, there's usually some sort of common ground where AMD and NVidia (and Intel as well) agree on when it comes to shader compilation, but you'll have to test on different kind of drivers to ensure driver comparability. This is one of the major reasons I like SPIR-V as an intermediate shader form that works exactly the same on all GPU drivers.
As for SSAO, the engine isn't finished as of this writing so there are still several glitchjes I'll have to fix. The SSAO toggle being one of them. When toggled of it simply stops generating the SSAO texture, but it keeps the last SSAO buffer before disabling it which doesn't match the environment anymore when rotating the camera which is a bug indeed.
Thanks, I noticed capture.fs uses uniforms.glsl, while capture.vs doesn't. I assumed this is why I was receiving a shadder error, so I added uniforms.glsl to both files.
I guess I don't have a screenshot of what it should look like, so I can't say if it's working or not.
Also, removing the
view
andprojection
matrices shouldn't work, as for the probe capture stage it uses a custom set ofview
projection
matrices that it doesn't take from the uniform buffer object so it's likely the irradiance probes have no proper effect on your screen.hey Joey, I find the shader program in
PBR.cpp
withcapture.vs
andcapture.fs
, however, I can't find any specified for theview
projection
uniform which declare incapture.vs
.
Also, if it was specified, should not it conflict with the capture.fs
's global uniform since they have the same name projection
view
?
Thanks to the guy above for the tip,i replaced all 'int' to "bool" it seems to work .but the fps is really bad ,Why is that? And it doesn't look normal when I change some parameters by the window made of imgui
Hello! I tried to compile and run demo project, but I only get a black window when running it.
How to fix?
Windows 7, 64-bit Geforce GTX 1080 nVidia drivers 385.69
Demo dump:
INIT: Initializing GLFW INIT: GLFW initialized INIT: Initializing render system INIT: OpenGL functions succesfully loaded. INIT: Version - Major: 4 Minor: 3 INIT: Driver: NVIDIA Corporation Renderer: GeForce GTX 1080/PCIe/SSE2 INIT: Initializing debug Output. INIT: Debug output initialized. ERROR: Fragment shader compilation error at: post process! 0(41) : error C7011: implicit cast from "int" to "bool" 0(56) : error C7011: implicit cast from "int" to "bool" 0(69) : error C7011: implicit cast from "int" to "bool" 0(84) : error C7011: implicit cast from "int" to "bool" 0(88) : error C7011: implicit cast from "int" to "bool"
ERROR: Shader program linking error: Fragment info
0(41) : error C7011: implicit cast from "int" to "bool" 0(56) : error C7011: implicit cast from "int" to "bool" 0(69) : error C7011: implicit cast from "int" to "bool" 0(84) : error C7011: implicit cast from "int" to "bool" 0(88) : error C7011: implicit cast from "int" to "bool" (0) : error C2003: incompatible options for link
ERROR: Vertex shader compilation error at: default! 0(53) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(53) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(53) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(53) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
INIT: Loading texture file at: textures/checkerboard.png. INIT: Succesfully loaded: textures/checkerboard.png. INIT: Loading texture file at: textures/norm.png. INIT: Succesfully loaded: textures/norm.png. INIT: Loading texture file at: textures/black.png. INIT: Succesfully loaded: textures/black.png. INIT: Loading texture file at: textures/checkerboard.png. INIT: Succesfully loaded: textures/checkerboard.png. ERROR: Vertex shader compilation error at: glass! 0(50) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(50) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Fragment shader compilation error at: glass! 0(91) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(91) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(50) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(50) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
Fragment info
0(91) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(91) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
INIT: Loading texture file at: textures/glass.png. INIT: Succesfully loaded: textures/glass.png. INIT: Loading texture file at: textures/pbr/plastic/normal.png. INIT: Succesfully loaded: textures/pbr/plastic/normal.png. INIT: Loading texture file at: textures/pbr/plastic/metallic.png. INIT: Succesfully loaded: textures/pbr/plastic/metallic.png. INIT: Loading texture file at: textures/pbr/plastic/roughness.png. INIT: Succesfully loaded: textures/pbr/plastic/roughness.png. INIT: Loading texture file at: textures/pbr/plastic/ao.png. INIT: Succesfully loaded: textures/pbr/plastic/ao.png. ERROR: Vertex shader compilation error at: alpha blend! 0(50) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(50) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Fragment shader compilation error at: alpha blend! 0(91) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(91) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(50) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(50) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
Fragment info
0(91) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(91) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
ERROR: Vertex shader compilation error at: alpha discard! 0(50) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(50) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Fragment shader compilation error at: alpha discard! 0(91) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(91) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(50) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(50) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
Fragment info
0(91) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(91) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
ERROR: Vertex shader compilation error at: deferred ambient! 0(46) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(46) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Fragment shader compilation error at: deferred ambient! 0(219) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(219) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(46) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(46) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
Fragment info
0(219) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(219) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
ERROR: Vertex shader compilation error at: deferred directional! 0(46) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(46) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Fragment shader compilation error at: deferred directional! 0(163) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(163) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(46) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(46) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
Fragment info
0(163) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(163) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
ERROR: Vertex shader compilation error at: deferred point! 0(46) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(46) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Fragment shader compilation error at: deferred point! 0(122) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(122) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(46) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(46) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
Fragment info
0(122) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(122) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
ERROR: Vertex shader compilation error at: debug light! 0(43) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(43) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(43) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(43) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
ERROR: Fragment shader compilation error at: pbr:capture! 0(48) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(48) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Fragment info
0(48) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(48) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
INIT: Render system initialized ERROR: Vertex shader compilation error at: plasma orb! 0(49) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(49) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Fragment shader compilation error at: plasma orb! 0(47) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(47) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(49) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(49) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
Fragment info
0(47) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(47) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
INIT: Loading texture file at: textures/perlin.png. INIT: Succesfully loaded: textures/perlin.png. ERROR: Vertex shader compilation error at: background! 0(43) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(43) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable
ERROR: Shader program linking error: Vertex info
0(43) : error C7532: layout qualifier 'binding' requires "#version 420" or later 0(43) : error C0000: ... or #extension GL_ARB_shading_language_420pack : enable (0) : error C2003: incompatible options for link
INIT: Loading mesh file at: meshes/sponza/sponza.obj. INIT: Succesfully loaded: meshes/sponza/sponza.obj. INIT: Loading texture file at: meshes/sponza/textures\sponza_thorn_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_thorn_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\vase_plant.tga. INIT: Succesfully loaded: meshes/sponza/textures\vase_plant.tga. INIT: Loading texture file at: meshes/sponza/textures\vase_round.tga. INIT: Succesfully loaded: meshes/sponza/textures\vase_round.tga. INIT: Loading texture file at: meshes/sponza/textures\background.tga. INIT: Succesfully loaded: meshes/sponza/textures\background.tga. INIT: Loading texture file at: meshes/sponza/textures\gi_flag.tga. WARNING: Texture failed to load at path: meshes/sponza/textures\gi_flag.tga INIT: Succesfully loaded: meshes/sponza/textures\gi_flag.tga. INIT: Loading texture file at: meshes/sponza/textures\gi_flag.tga. WARNING: Texture failed to load at path: meshes/sponza/textures\gi_flag.tga INIT: Succesfully loaded: meshes/sponza/textures\gi_flag.tga. INIT: Loading texture file at: meshes/sponza/textures\spnza_bricks_a_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\spnza_bricks_a_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_arch_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_arch_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_ceiling_a_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_ceiling_a_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_column_a_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_column_a_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_floor_a_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_floor_a_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_column_c_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_column_c_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_details_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_details_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_column_b_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_column_b_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_flagpole_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_flagpole_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_fabric_green_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_fabric_green_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_fabric_blue_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_fabric_blue_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_fabric_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_fabric_diff.tga. INIT: Loading texture file at: meshes/sponza/textures\sponza_curtain_blue_diff.tga. INIT: Succesfully loaded: meshes/sponza/textures\sponza_curtain_blue_diff.tga.