PBR icon indicating copy to clipboard operation
PBR copied to clipboard

If vulkan version miss some .spv files?

Open irimsky opened this issue 3 years ago • 2 comments

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 avatar Oct 29 '21 18:10 irimsky

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 avatar Oct 29 '21 19:10 irimsky

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...

irimsky avatar Oct 30 '21 03:10 irimsky