Skip to content
titas-mahatoPublic

About

Minimalist C++ graphics benchmark analyzing CPU driver submission stalls vs. contiguous GPU vertex stream consolidation across 100,000 dynamic entities

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ray-bench

Lightweight C++ GPU & Draw-Call Stress Benchmark for Budget Hardware (Raylib)

ray-bench is an open-source, minimalist C++ graphics and hardware stress benchmark made for low-spec and budget gaming hardware specifically calibrated for an NVIDIA GeForce GTX 1650 (4GB VRAM) and 8GB System RAM.

Rather than testing complex geometry or compute shaders, ray-bench isolates the primary architectural bottleneck on budget hardware: CPU Draw-Call Driver Dispatch vs. GPU Vertex Batching. It simulates and renders up to 100,000 interactive 2D entities in real-time, allowing instant switching between unbatched (Naive) and batched (Optimized) pipelines.


Quickstart (Build & Run in 2 Steps)

# 1. Clone repository
git clone https://github.com/titas-mahato/ray-bench.git && cd ray-bench

# 2. Build and launch (Automatic Raylib fetch via CMake)
powershell -ExecutionPolicy Bypass -File .\build.ps1 -Run

# Or double-click run.bat directly on Windows
.\run.bat

Alternatively, using standard CMake:

cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
./build/bin/Release/ray-bench.exe

Benchmark Controls & Hotkeys

Key Action Technical Impact
[SPACE] Toggle Rendering Mode Switches instantly between Mode A (Naive) and Mode B (Batched).
[1] – [5] Entity Count Presets [1] = 1,000 • [2] = 10,000 • [3] = 25,000 • [4] = 50,000 • [5] = 100,000
[UP] / [DOWN] Fine Scale Entities Increases or decreases particle count by ±5,000 in real time.
[V] Toggle V-Sync / Framerate Alternates between V-Sync (60 FPS target cap) and Uncapped (raw hardware limit).
[R] Reset Simulation Re-randomizes all particle positions, velocities, and color vectors.
[H] Toggle HUD Overlay Hides or displays the performance metrics telemetry overlay.
[F11] Toggle Fullscreen Cycles borderless window / exclusive fullscreen mode.

Benchmark Methodology & Performance Results

Test Environment Hardware Specifications

  • GPU: NVIDIA GeForce GTX 1650 (4GB GDDR5/GDDR6, 128-bit Memory Bus, Turing TU117, 896 CUDA Cores)
  • System Memory: 8GB DDR4 RAM (Single-Channel / Dual-Channel 2666–3200 MHz)
  • Target Resolution: 1080p (1920 × 1080) / 1600 × 900 Windowed
  • OS: Windows 10 / 11 (WDDM 2.7+)
  • Graphics API: OpenGL 3.3 Core (via Raylib 5.0 rlgl)

Performance Comparison Matrix (GTX 1650)

The table below measures the GTX 1650 performance under identical entity simulation workloads, contrasting unbatched driver dispatch (Mode A) with streamed vertex batching (Mode B):

Entity Count Mode Avg Framerate Frame Latency (ms) Draw Calls / Frame Primary Bottleneck
10,000 Mode A (Naive) 24 FPS 41.6 ms 10,000 CPU Driver Submission Queue
Mode B (Batched) 360+ FPS 2.7 ms ~5 GPU Rasterization (Uncapped)
50,000 Mode A (Naive) 5 FPS 200.0 ms 50,000 Severe CPU Kernel Driver Stall
Mode B (Batched) 180+ FPS 5.5 ms ~25 GPU Memory Bus Fill Rate
100,000 Mode A (Naive) < 2 FPS > 500.0 ms 100,000 Complete Driver Pipe Starvation
Mode B (Batched) 90+ FPS 11.1 ms ~49 GPU Vertex Assembly Throughput

Key Observation: In Mode A at 50,000 entities, the GTX 1650 GPU core load sits at < 15% while a single CPU core is pegged at 100%, waiting on driver validation and kernel draw calls. In Mode B, draw calls drop by 99.9%, shifting workload entirely to GPU rasterization and easily sustaining >60 FPS (<16.6ms frame time).

Performance Comparison Matrix (RTX 3050 6GB - Ampere Profile)

Entity Count Mode Avg Framerate Frame Latency (ms) Draw Calls / Frame Primary Bottleneck
50,000 Mode A (Naive) 12 FPS 83.3 ms 50,000 CPU Driver Submission Queue
Mode B (Batched) 420+ FPS 2.3 ms ~25 GPU Rasterization (Uncapped)
250,000 Mode A (Naive) < 2 FPS > 500.0 ms 250,000 Severe Driver Command Queue Stall
Mode B (Batched) 140+ FPS 7.1 ms ~122 GPU Vertex Assembly Throughput
500,000 Mode A (Naive) Slide Show (<1 FPS) > 1000.0 ms 500,000 Complete CPU Driver Lockup
Mode B (Batched) 75+ FPS 13.3 ms ~244 GPU Fill-rate & Raster Saturation

Project Architecture

ray-bench/
├── CMakeLists.txt              # Standard CMake build definition with Raylib FetchContent
├── build.ps1                   # One-click Windows PowerShell build & run utility
├── .gitignore                  # Git exclusions for build artifacts and IDE metadata
├── src/
│   ├── main.cpp                # Application entry point, main benchmark loop & inputs
│   ├── ParticleSystem.hpp      # Particle simulation header (Structs & RenderMode enums)
│   ├── ParticleSystem.cpp      # Implementation of Naive (flush) vs Batched (quad stream)
│   ├── BenchmarkHUD.hpp        # HUD overlay header (Metrics tracking & 1% low calculations)
│   └── BenchmarkHUD.cpp        # Real-time telemetry rendering (FPS, frame time, draw calls)
└── README.md                   # Technical documentation & low-spec optimization guide

License

This project is open-source under the MIT License. Built using Raylib.

About

Minimalist C++ graphics benchmark analyzing CPU driver submission stalls vs. contiguous GPU vertex stream consolidation across 100,000 dynamic entities

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages