Kode / khamake

Kha's build tool.
http://kha.tech
15 stars 45 forks source link

Shader compiler error writes to log.info() instead of log.error()? #228

Closed MoritzBrueckner closed 4 years ago

MoritzBrueckner commented 4 years ago

A while ago I've implemented a quiet flag for khamake that silences regular compile information. It seems that when the shader compilation fails, the shader error is not displayed when quiet is enabled.

To me it looks like the issue is the Promise.reject() here but I'm not sure: https://github.com/Kode/khamake/blob/164247fade2710f73acaf4c9a13f8a93bb190071/src/ShaderCompiler.ts#L235-L239

Without quiet (expected behaviour):

(node:21968) UnhandledPromiseRejectionWarning: Shader compiler error.
(node:21968) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:21968) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ERROR: #version: ES shaders for OpenGL SPIR-V are not supported
ERROR: A:\Workspace\[...]\Shaders\test.vert.glsl:1: '' :  syntax error, unexpected COLON, expecting COMMA or SEMICOLON
ERROR: 2 compilation errors.  No code generated.

ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point

SPIR-V is not generated for failed compile or link

Compiling shader 2 of 2 (test.vert.glsl) failed:
Shader compiler error.

With quiet (should look exactly like above):

(node:45388) UnhandledPromiseRejectionWarning: Shader compiler error.
(node:45388) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:45388) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Compiling shader 2 of 2 (test.vert.glsl) failed:
Shader compiler error.