ShaderError$ ( shader )
Parameters
| shader - shader handle |
Description
|
Returns any diagnostic text retained by a shader instance. The string is empty when there is nothing to report. Note the split: a load that fails outright - missing file, bad descriptor, compile failure - raises a normal Blitz runtime error from LoadShader rather than returning a handle, and mistakes such as setting a missing parameter are runtime errors too. ShaderError is for the quieter cases: warnings and compile diagnostics retained on an instance that did load. That makes it most useful during development - print it after loading a source-backed asset you are iterating on, or surface it in a debug overlay, so you see warnings without the program stopping. For the full story, see diagnostics in the shader guide. Requires Extended mode. See also: LoadShader, CopyShader, ShaderFloat. |
Example
; ShaderError Example ; ------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() ; Load a shader and query the diagnostic text stored on it shader=LoadShader("assets/help_surface.b3shader") diagnostic$=ShaderError(shader) If diagnostic="" Then diagnostic="(empty - the shader compiled cleanly)" While Not KeyDown(1) Cls Text 0,0,"ShaderError(shader) = "+diagnostic Text 0,30,"An empty string means no warning or error is stored." Text 0,50,"A failed LoadShader raises a runtime error instead, so" Text 0,70,"use ShaderError for diagnostics kept by a valid shader." Text 0,100,"Esc: exit" Flip Wend FreeShader shader End
Index