Commit Graph

58 Commits

Author SHA1 Message Date
Peterino2 d5b381526c Add parser documentation and clean up planning files
Added:
- PARSER_OVERVIEW.md: Concise guide on how the parser works
  - Architecture overview
  - Input/output examples
  - Usage instructions
  - Statistics and limitations

- AGENTS.md: Added 3 new issues from mock testing work
  - Build.addStaticLibrary removal in Zig 0.15
  - C mock type definition requirements
  - Testing strategy lessons

Removed completed planning/work log files:
- MOCK_FLAG_UPDATE.md
- PHASE1_COMPLETE.md
- SUMMARY.md
- TEST_HARNESS_PLAN_V2.md

Keeping only essential docs: AGENTS.md, PARSER_OVERVIEW.md, DEPENDENCY_PLAN.md, TODO.md
2026-01-22 01:36:16 -08:00
Peterino2 fd37a11da8 Update mock testing to use full SDL_gpu.h with proper header includes
Key changes:
- Updated regenerate-test-mocks to parse SDL_gpu.h (169 declarations)
- Modified mock_codegen.zig to include SDL headers instead of manual typedefs
- Added SDL include path to mock library compilation
- Expanded mock_test.zig with comprehensive tests for SDL_gpu types
- All 7 tests passing with 94 mock functions linked successfully

Results:
- Generated 1,229 lines of Zig bindings from 169 declarations
- Generated 577 lines of C mock code
- Compiled to 71KB static library with all 94 functions exported
- Tests verify: opaque types, enums, structs, packed structs, and functions
- Demonstrates parser works with large, complex headers

Stats: 13 opaque types, 24 enums, 35 structs, 3 flags, 94 functions
2026-01-22 01:32:58 -08:00
Peterino2 5dae1139b7 Add mock compilation testing to SDL3 build system
- Added regenerate-test-mocks step to generate bindings and C mocks
- Added check-mocks step to compile generated code without running tests
- Added test-mocks step to run full test suite (4 tests)
- Implemented parser/test/mock_test.zig with comprehensive tests
- Verified C mocks compile to static library with correct symbols
- All tests pass: opaque types, enums, and function calls work correctly

Build commands:
  zig build regenerate-test-mocks - Generate bindings and mocks
  zig build check-mocks           - Compile check only
  zig build test-mocks            - Run full test suite

Tests verify:
- Generated Zig code is syntactically valid
- C mocks compile and link correctly
- Functions are callable from Zig
- Type safety is preserved across C/Zig boundary
2026-01-22 01:27:36 -08:00
Peterino2 291adf94d3 parser work continued 2026-01-22 01:18:04 -08:00
Peterino2 204460f500 saving mocks implementation 2026-01-22 00:14:48 -08:00
Peterino2 ec10f75888 Add TODO.md with next implementation steps
Document the current completed state and outline the next phase:
- Mock code generator implementation
- Test project with C linkage and function coverage
- Golden file regression testing
- Multi-header support

Provides clear roadmap based on TEST_HARNESS_PLAN_V2.md with
time estimates and prioritization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 20:28:07 -08:00
Peterino2 35a171f804 Remove obsolete TEST_HARNESS_PLAN.md
Keep only TEST_HARNESS_PLAN_V2.md which includes the enhanced design
with mock generation and complete test project architecture.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 20:27:32 -08:00
Peterino2 9f4c2b6914 Add comprehensive documentation and reorganize project structure
Created human-readable documentation under docs/ directory:
- docs/README.md: Project overview, quick start, features, and status
- docs/architecture.md: Pipeline design, components, and implementation details
- docs/usage.md: Usage guide, integration examples, and troubleshooting
- docs/naming.md: Detailed explanation of C-to-Zig naming conventions

Removed obsolete documentation files:
- PARSER_FIX_PLAN.md: Content moved to architecture.md
- IMPLEMENTATION_COMPLETE.md: Content moved to README.md

The documentation provides:
- Complete architecture overview of the 4-stage pipeline
- Detailed explanation of the "first underscore" naming rule
- Integration examples and common usage patterns
- Troubleshooting guide and FAQ
- Extension points for adding new C patterns

Kept TEST_HARNESS_PLAN.md and TEST_HARNESS_PLAN_V2.md as they document
future implementation plans for testing infrastructure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 20:20:07 -08:00
Peterino2 0c5383f518 Fix SDL3 parser critical issues and add comprehensive test plans
## Critical Fixes Implemented

### 1. Memory Leak Resolution
- Fixed doc comment allocation in peekDocComment() to properly allocate memory
- Added cleanup for pending_doc_comment when skipping lines
- All tests now run with zero memory leaks (GPA verified)

### 2. Flag Definition Parsing (CRITICAL)
- Added skipWhitespace() helper to handle newlines before #define statements
- Flag structures now properly populated with all fields
- Before: empty structs with only padding
- After: all 7 flags present in GPUTextureUsageFlags

### 3. Invalid Identifier Generation (CRITICAL)
- Implemented "first underscore" naming rule
- Prevents enum values starting with numbers (e.g., 16bit, 2d)
- detectCommonPrefix() now only strips SDL_GPU_/SDL_ prefix
- enumValueToZig() splits on first underscore to preserve type prefix

### 4. Naming Convention Alignment
- Changed from "last underscore" to "first underscore" rule
- Type part: all lowercase (e.g., primitivetype)
- Value part: TitleCamelCase (e.g., Trianglelist)
- Result: primitivetypeTrianglelist (matches existing codebase)
- Added screaminToTitleCamel() helper for proper camelCase conversion

## Test Coverage

### New Tests Added
- patterns.zig: 3 new tests for flag scanning with whitespace
- naming.zig: 10 new comprehensive tests for naming conventions
- All 18 unit tests passing
- Integration test with SDL_gpu.h successful (169 declarations)

### Files Modified
1. **patterns.zig**
   - Added skipWhitespace() helper (lines 609-618)
   - Updated scanFlagTypedef() to skip whitespace before #define
   - Added 3 new flag scanning tests

2. **naming.zig**
   - Rewrote detectCommonPrefix() to only strip SDL prefix
   - Rewrote enumValueToZig() with first underscore rule
   - Added screaminToTitleCamel() helper
   - Added 10 comprehensive naming tests

3. **parser.zig**
   - Previous memory leak fixes intact
   - No changes needed for this iteration

## Documentation Added

1. **PARSER_FIX_PLAN.md** - Detailed implementation plan
2. **IMPLEMENTATION_COMPLETE.md** - Summary of fixes and results
3. **TEST_HARNESS_PLAN.md** - Original test harness design
4. **TEST_HARNESS_PLAN_V2.md** - Enhanced plan with mock generation

## Verification

 Parser generates valid Zig code (no compilation errors)
 All flag fields populated correctly
 No invalid identifiers (no numeric prefixes)
 Naming matches existing codebase conventions
 All 18 unit tests passing
 No memory leaks (GPA verified)
 Successfully parsed SDL_gpu.h (169 declarations)

## Next Steps (Planned)

- Implement mock_codegen.zig for C stub generation
- Create test_project/ with complete build system
- Add function call coverage tests
- Implement golden file regression testing

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 19:37:26 -08:00
Peterino2 5ae025a691 sdl3 initial parser 2026-01-21 16:28:12 -08:00
Peterino2 eee1bd265e saving 2026-01-21 00:16:03 -08:00
peterino2 bb99e9025e saving 2025-12-28 17:38:50 -08:00
peterino2 cc00fb076e switched all builds to bh.declareOptions 2025-11-28 20:14:56 -08:00
peterino2 1572f96429 fixed all tests and added bh.zig 2025-11-06 20:42:48 -08:00
peterino2 55e7c955c1 saving 2025-11-02 00:55:21 -07:00
peterino2 2e4f7d98e4 crated zuck game content and creating hello-window 2025-10-26 20:02:36 -07:00
peterino2 6618e20e31 adding sdl3 compile test 2025-10-15 00:22:18 -07:00
peterino2 43a88376ee libraries have been updated to 0.15 2025-10-13 22:15:30 -07:00
peterino2 de6ccd211b objloader, ozz, sdl3 all updated 2025-10-13 20:57:04 -07:00
peterino2 9d8b2bea9a updated builds to use spvreflect2 and updated the build code 2025-08-18 23:35:35 -07:00
peterino2 393b550c74 created spvreflect2 2025-08-17 18:36:40 -07:00
peterino2 8458a6e026 new project maker 2025-06-29 22:15:34 -07:00
peterino2 b269188c72 vendoring linux deps for SDL 2025-06-17 23:09:10 -07:00
peterino2 67883be7fb module forwarding optionals and apigen 2025-06-08 18:06:19 -07:00
peterino2 4d57518bc0 updated build scripts 2025-06-08 11:25:44 -07:00
peterino2 a7505acf8b i think we cracked the code on getting some linux builds working 2025-06-07 15:20:52 -07:00
peterino2 ea14d8941d reverted changes to SDL_gpu 2025-06-07 15:07:18 -07:00
peterino2 116f5b010f saving 2025-06-07 14:15:40 -07:00
peterino2 6f2396c814 upgrading to sdl 3.16 2025-06-07 14:05:12 -07:00
Peter Li 74228b388d so much work on hot reloading done 2025-05-19 21:35:04 -07:00
Peter Li f74c50e493 > shadow casting lights 2025-04-27 12:58:06 -07:00
Peter Li 481a8f411f fixed input stack issue and removed old inputs implementation 2025-04-24 19:44:13 -07:00
Peter Li 6d1c2a4bd8 corrected camera transforms 2025-04-23 07:34:43 -07:00
Peter Li 8647ac8bc9 > HOT LOADING FRAGMENT SHADERS AND TEXTURES ARE LOADED 2025-04-20 17:09:51 -07:00
Peter Li 4670f874f5 rendering component seems to be working but odd transforms are happening with the perspective 2025-04-18 22:07:31 -07:00
Peter Li ff101925ff saving before stash 2025-04-18 19:54:59 -07:00
Peter Li b9f3f75972 Mesh pool storage + mesh asset loader interfaces 2025-04-18 10:49:49 -07:00
Peter Li ed3eb8ac83 saving 2025-04-16 23:00:42 -07:00
Peter Li 69df1ea67e updating spv parser 2025-04-16 22:56:00 -07:00
Peter Li 8cdac4e2e7 added gltf mesh loader back 2025-04-14 23:58:08 -07:00
Peter Li 373eb9600c simple triangle example working with new sdl api 2025-04-14 17:59:00 -07:00
Peter Li 86d56cf5e6 SDL events input routing 2025-04-14 16:09:50 -07:00
Peter Li 341e69b32e The shader compilation story kicks ass now 2025-04-13 18:13:45 -07:00
Peter Li 806c7942e8 saving 2025-04-13 17:41:16 -07:00
Peter Li f4381446db content and shader cooking stuff 2025-04-13 14:12:48 -07:00
Peter Li 9a295f3f2f scancode, and starting to pass zig build on the individual libraries 2025-04-11 22:06:17 -07:00
Peter Li 22d3322867 saving 2025-04-11 18:00:58 -07:00
Peter Li 8c59117ccd saving 2025-04-11 15:19:50 -07:00
Peter Li b500809d6f updating p2 to 0.14 2025-04-11 14:35:42 -07:00
Peter Li 3b65cdb8f5 sdl3 hello world gpu working 2025-04-11 13:57:04 -07:00