diff --git a/samples/cuda_core/glInteropFluid/glInteropFluid.py b/samples/cuda_core/glInteropFluid/glInteropFluid.py index 2382be74eae..daec5cc9163 100644 --- a/samples/cuda_core/glInteropFluid/glInteropFluid.py +++ b/samples/cuda_core/glInteropFluid/glInteropFluid.py @@ -99,6 +99,7 @@ import random import sys import time +from pathlib import Path import numpy as np @@ -122,6 +123,9 @@ ReadModeType, ) +sys.path.insert(0, str(Path(__file__).resolve().parents[3] / "cuda_python_test_helpers")) +from cuda_python_test_helpers.graphics import gl_context_not_on_nvidia_gpu_reason + # --------------------------------------------------------------------------- # Simulation parameters (feel free to change these) # --------------------------------------------------------------------------- @@ -560,6 +564,11 @@ def main(argv=None): print(f"Could not open a pyglet window ({exc}); waiving glInteropFluid.", file=sys.stderr) sys.exit(EXIT_WAIVED) + if reason := gl_context_not_on_nvidia_gpu_reason(): + print(f"{reason}; waiving glInteropFluid.", file=sys.stderr) + window.close() + sys.exit(EXIT_WAIVED) + # --- Step 3: Create GL resources for drawing a texture to screen --- # (Standard OpenGL boilerplate -- not CUDA-specific.) shader_prog, quad_vao, tex_id = create_display_resources(gl, WIDTH, HEIGHT) diff --git a/samples/cuda_core/glInteropMipmapLod/glInteropMipmapLod.py b/samples/cuda_core/glInteropMipmapLod/glInteropMipmapLod.py index 04f98ca3006..93808aacbb6 100644 --- a/samples/cuda_core/glInteropMipmapLod/glInteropMipmapLod.py +++ b/samples/cuda_core/glInteropMipmapLod/glInteropMipmapLod.py @@ -92,6 +92,7 @@ import platform import sys import time +from pathlib import Path import numpy as np @@ -115,6 +116,9 @@ ReadModeType, ) +sys.path.insert(0, str(Path(__file__).resolve().parents[3] / "cuda_python_test_helpers")) +from cuda_python_test_helpers.graphics import gl_context_not_on_nvidia_gpu_reason + # --------------------------------------------------------------------------- # Configuration (feel free to change these) # --------------------------------------------------------------------------- @@ -468,6 +472,12 @@ def main(argv=None): except Exception as exc: print(f"Could not open a pyglet window ({exc}); waiving glInteropMipmapLod.", file=sys.stderr) sys.exit(EXIT_WAIVED) + + if reason := gl_context_not_on_nvidia_gpu_reason(): + print(f"{reason}; waiving glInteropMipmapLod.", file=sys.stderr) + window.close() + sys.exit(EXIT_WAIVED) + shader_prog, quad_vao, tex_id = create_display_resources(gl, WIDTH, HEIGHT) pbo_id, _ = create_pixel_buffer(gl, WIDTH, HEIGHT) resource = GraphicsResource.from_gl_buffer(pbo_id, flags="write_discard") diff --git a/samples/cuda_core/glInteropPlasma/glInteropPlasma.py b/samples/cuda_core/glInteropPlasma/glInteropPlasma.py index de7751b6e7b..ff96d598079 100644 --- a/samples/cuda_core/glInteropPlasma/glInteropPlasma.py +++ b/samples/cuda_core/glInteropPlasma/glInteropPlasma.py @@ -64,6 +64,7 @@ import platform import sys import time +from pathlib import Path try: import numpy as np @@ -76,6 +77,9 @@ ProgramOptions, launch, ) + + sys.path.insert(0, str(Path(__file__).resolve().parents[3] / "cuda_python_test_helpers")) + from cuda_python_test_helpers.graphics import gl_context_not_on_nvidia_gpu_reason except ImportError as e: print(f"Error: Required package not found: {e}") print("Please install from requirements.txt:") @@ -318,6 +322,11 @@ def main(): print(f"Could not open a pyglet window ({e}); waiving GL interop sample.", file=sys.stderr) sys.exit(EXIT_WAIVED) + if reason := gl_context_not_on_nvidia_gpu_reason(): + print(f"{reason}; waiving GL interop sample.", file=sys.stderr) + window.close() + sys.exit(EXIT_WAIVED) + # --- Step 3: Create GL resources for drawing a texture to screen --- shader_prog, quad_vao, tex_id = create_display_resources(gl, WIDTH, HEIGHT)