Skip to content

windows: add opt-in D3D11 shader support#7

Closed
GGRei wants to merge 1 commit into
mainfrom
gui-d3d11-shader-support
Closed

windows: add opt-in D3D11 shader support#7
GGRei wants to merge 1 commit into
mainfrom
gui-d3d11-shader-support

Conversation

@GGRei

@GGRei GGRei commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Adds opt-in D3D11 support for v-gui’s built-in shader pipelines.

This PR moves the built-in GUI shaders to a generated v shader pipeline with OpenGL, Metal, and HLSL/D3D11 output, while keeping D3D11 behind the explicit -d sokol_d3d11 flag.

It also updates the Windows raster/readback path so default Windows OpenGL does not accidentally use D3D11-only readback, and the D3D11 path uses the proper backend when enabled.

Details

  • Adds generated built-in shader descriptors from shaders/gui_builtin.glsl.
  • Routes built-in pipelines through *_shader_desc(gfx.query_backend()).
  • Keeps runtime custom shaders as OpenGL/Metal only for now.
  • Documents the D3D11 custom-shader fallback behavior.
  • Uses sapp.glue_environment().defaults for render-target formats instead of direct enum casting.
  • Adds Windows codegen coverage for default Windows vs -d sokol_d3d11 readback routing.
  • Extends the optional Windows smoke workflow with D3D11 compile probes.
  • CI now runs the generated-shader freshness check with GUI_CHECK_GENERATED_SHADERS=1 and triggers on shader source changes.
  • Removes the old duplicated built-in GLSL/Metal shader strings now replaced by the generated shader header; the remaining GLSL/Metal sources are only for the runtime custom Shader API.

Note: the generated built-in shader header now targets the current Sokol shader set: glsl410 for desktop GLCORE, hlsl4 for D3D11, and metal_macos for macOS Metal. Runtime custom Shader.glsl remains GLSL 3.3, that path is separate from the generated built-in shaders.

Validation

  • v -no-parallel test .: 72 passed / 1 skipped / 73 total
  • GUI_CHECK_GENERATED_SHADERS=1 v -no-parallel test _shaders_test.v: passed
  • v -no-parallel test _sokol_formats_test.v _windows_readback_codegen_test.v: passed
  • v -no-parallel test _render_test.v _render_filters_test.v _print_pdf_test.v _print_integration_test.v nativebridge/_readback_abi_test.v: passed
  • Windows generated-C probes for default Windows and -d sokol_d3d11: passed
  • v check-md docs/SHADERS.md docs/WINDOWS.md shaders/README.md: passed
  • git diff --check: passed

Windows Testing Requested

D3D11 is still opt-in in this PR. Before making it the default Windows path, it should be tested on real Windows with -d sokol_d3d11, especially:

  • examples/showcase.v
  • examples/gradient_demo.v
  • examples/shadow_demo.v
  • examples/blur_demo.v
  • examples/image_clip.v
  • examples/svg_demo.v
  • examples/printing.v
  • examples/custom_shader.v fallback behavior

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8aac93cb78

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shaders/gui_builtin.h
@GGRei GGRei force-pushed the gui-d3d11-shader-support branch from 8aac93c to c1731c1 Compare July 5, 2026 11:50
@GGRei

GGRei commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: c1731c18f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant