Nadrin / PBR

An implementation of physically based shading & image based lighting in D3D11, D3D12, Vulkan, and OpenGL 4.
https://www.siejak.pl/projects/pbr
MIT License
1.4k stars 115 forks source link

If vulkan version miss some .spv files? #11

Open irimsky opened 3 years ago

irimsky commented 3 years ago

When I run PBR -vulkan on Windows, it first threw the VK_ERROR_LAYER_NOT_PRESENT ERROR, then I modified the related code not to load layers, then run again, it threw the Error: Could not open file: shaders/spirv/tonemap_vs.spv But I didn't find the tonemap_vs.spv in the shaders dir. Is there anything missed?

irimsky commented 3 years ago

I may got that spv should be translated from glsl. Maybe my vulkan version is the newest, so it don't support "VK_LAYER_KHRONOS_validation" But it still can't work after I change the layer, because it has no output of spv files. Maybe it's not compatible with the new version?

irimsky commented 3 years ago

So I have to solve it by manually add .psv files like this:

void add_spirv(const char* shadername, const char* stage)
{
    char cmdline[225];
    sprintf(cmdline, "glslangValidator -V -S %s -o \".\\shaders\\spirv\\%s.spv\" \".\\shaders\\glsl\\%s.glsl\" ", stage, shadername, shadername);
    std::cout << cmdline << std::endl;
    system(cmdline);
}

...

add_spirv("equirect2cube_cs", "comp");
add_spirv("irmap_cs", "comp");
add_spirv("pbr_fs", "frag");
add_spirv("pbr_vs", "vert");
add_spirv("skybox_fs", "frag");
add_spirv("skybox_vs", "vert");
add_spirv("spbrdf_cs", "comp");
add_spirv("spmap_cs", "comp");
add_spirv("tonemap_fs", "frag");
add_spirv("tonemap_vs", "vert");

then it can work at least...