News for hackers. Stuff that matters.
Re:The Book of Shaders by coffeeaddicted on Wednesday November 01, 2017 @07:04PM (#15606294)
The compiler is in the graphic card drivers. You pass on shader source-code to it in text-form.
Re:The Book of Shaders by fulafel on Thursday November 02, 2017 @02:08AM (#15608194)
Kind of. The browser WebGL implementation compiles them, producing shaders suitable the native driver shader compiler (conversion from OpenGL to D3D, rewrite texture/buffer access for bounds checking as necessary, etc).
Re:The Book of Shaders by coffeeaddicted on Thursday November 02, 2017 @06:55AM (#15609260)
Ah yes, you are right, WebGL shaders are translated first to GLSL or HLSL with a lib like ANGLE (https://github.com/google/angle). And that source is then send on to the drivers which compile it again to assembler for the graphic card. And there again are some differences between GLSL/HLSL it seems. If I remember right in GLSL the drivers do the work while in HLSL some DLL from MS produces another intermediate format (which I just found out seems to be even open source: https://github.com/Microsoft/DirectXShaderCompiler).