From 60ef4e95fdd0ff963e3102a73d85179654941e0b Mon Sep 17 00:00:00 2001 From: Chris Havlin Date: Fri, 28 Jun 2024 13:27:00 -0500 Subject: [PATCH] add some comments --- yt_idv/shader_objects.py | 5 +++++ yt_idv/tests/test_yt_idv.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/yt_idv/shader_objects.py b/yt_idv/shader_objects.py index 384cc83..2289298 100644 --- a/yt_idv/shader_objects.py +++ b/yt_idv/shader_objects.py @@ -239,6 +239,11 @@ class Shader(traitlets.HasTraits): This can either be a string containing a full source of a shader, an absolute path to a source file or a filename of a shader residing in the ./shaders/ directory. + allow_null : bool + If True (default) then shader compilation errors will be caught and + printed without raising exception (convenient for general use and for + developing new shaders). If False, any compilation errors will raise + a RunTimeError (useful for CI testing). """ diff --git a/yt_idv/tests/test_yt_idv.py b/yt_idv/tests/test_yt_idv.py index 8a47cf1..11fa8c3 100644 --- a/yt_idv/tests/test_yt_idv.py +++ b/yt_idv/tests/test_yt_idv.py @@ -163,6 +163,8 @@ def test_curves(osmesa_fake_amr, image_store): @pytest.fixture() def set_very_bad_shader(): + # this temporarily points the default vertex shader source file to a + # bad shader that will raise compilation errors. known_shaders = shader_objects.known_shaders good_shader = known_shaders["vertex"]["default"]["source"] known_shaders["vertex"]["default"]["source"] = "bad_shader.vert.glsl" @@ -171,6 +173,8 @@ def set_very_bad_shader(): def test_bad_shader(osmesa_empty, set_very_bad_shader): + # this test is meant to check that a bad shader would indeed be caught + # by the subsequent test_shader_programs test. shader_name = "box_outline" program = shader_objects.component_shaders[shader_name]["default"]