Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions samples/cuda_core/glInteropFluid/glInteropFluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
import random
import sys
import time
from pathlib import Path

import numpy as np

Expand All @@ -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)
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions samples/cuda_core/glInteropMipmapLod/glInteropMipmapLod.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
import platform
import sys
import time
from pathlib import Path

import numpy as np

Expand All @@ -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)
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -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")
Expand Down
9 changes: 9 additions & 0 deletions samples/cuda_core/glInteropPlasma/glInteropPlasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import platform
import sys
import time
from pathlib import Path

try:
import numpy as np
Expand All @@ -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:")
Expand Down Expand Up @@ -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)

Expand Down
Loading