bsf icon indicating copy to clipboard operation
bsf copied to clipboard

[Vulkan] Using precompiled SPIR-V (1.3) instead of sources?

Open L2NE-dev opened this issue 7 years ago • 4 comments

I want ask about direct support of precompiled (i.e. from .spv files) SPIR-V for Vulkan API 1.1, and probably, support SPIRV-Cross for compilation to other API (HLSL, GLSL, "VKSL").

L2NE-dev avatar May 24 '18 10:05 L2NE-dev

Adding direct support for SPIR-V shouldn't be too difficult. Design wise it is just a matter of registering a new GpuProgramFactory, similar to the current VulkanGLSLProgramFactory. Do you have a specific use-case for this feature or is it just a general request?

I'm wondering what would be the purpose of integrating SPIRV-Cross? If its used for just pure translation purposes, then it should be easy enough for developers to include it in their project on a case-by-case basis rather than integrating it. Or would it be used similarly to the current BSL and used for generating high-level Shader that works on all platforms? But in that case we are lacking a lot of information to generate a complete Shader. Plus if you are doing that you lose the (only?) benefit of using SPIRV directly, which is the ability to fully optimize and tweak the code - so you might just want to use a higher level language straight away.

BearishSun avatar May 24 '18 10:05 BearishSun

SPIRV-Cross idea suggested for backward compatibility with other API (if possible), in my use case SPIR-V I could to use in Vulkan API 1.1 backend only.

L2NE-dev avatar May 24 '18 10:05 L2NE-dev

Isn't the use case here to avoid doing shader source compiles at runtime and to instead just turn it all into SPIR-V at build time?

Fishrock123 avatar Sep 24 '19 20:09 Fishrock123

SPIR-V is cached at build/import time under the current system.

BearishSun avatar Sep 25 '19 08:09 BearishSun