Skip to content

Comments

Improve Vulkan ACES HDR pipeline#23

Merged
timfox merged 48 commits intomainfrom
next-gen
Feb 19, 2026
Merged

Improve Vulkan ACES HDR pipeline#23
timfox merged 48 commits intomainfrom
next-gen

Conversation

@timfox
Copy link
Owner

@timfox timfox commented Feb 19, 2026

Summary

  • ensure Vulkan post-process writes HDR into RGBA16F, selects the SRGB swapchain, and relies on the ACES fitted curve before clamping
  • feed the exposure/tonemap/bloom knobs through the specialization constants, remove redundant gamma fixes, and keep brightness boosts in the HDR path
  • recompile the SPIR-V blobs so the new shader logic ships with the renderer

Testing

  • ./scripts/compile_shaders.sh
  • ./scripts/compile_shaders.sh --apply
  • ./scripts/compile_engine.sh vulkan
  • ./release/idtech3

CI runs should cover the broader build matrix.

timfox and others added 30 commits February 17, 2026 00:31
- Introduced new fragment specifications for deluxe mapping and deluxe specular scale in the Vulkan pipeline.
- Updated GLSL shader to incorporate Disney diffuse model and improved visibility calculations.
- Enhanced specular calculations to utilize metalness and adjusted diffuse contributions accordingly.

These changes improve the rendering quality and flexibility of the Vulkan renderer.
- Updated CMakeLists.txt to find and link X11 libraries for Unix systems, excluding Apple.
- Implemented Sys_ShowErrorMessage function for Unix to create a graphical error message window using X11.
- Added a corresponding Sys_ShowErrorMessage function for Windows using MessageBox.
- Enhanced FS_Restart to show error messages when game data is missing or default configuration cannot be loaded.

These changes improve error handling and user feedback on Unix platforms while maintaining compatibility with Windows.
…d error handling

- Updated the Vulkan renderer to use a consistent alpha calculation from roughness across multiple shaders.
- Enhanced error handling in the `RB_PrefilterEnvMap` function to provide warnings when prefilter targets cannot be allocated.
- Improved GLSL shaders by adding a utility function for alpha calculation and refining the importance sampling and distribution functions.

These changes enhance the robustness and maintainability of the Vulkan rendering pipeline.
…tter support

- Increased the maximum number of drawable images from 2048 to 32768 for improved texture handling.
- Added mip LOD bias support to Vulkan samplers, allowing for finer control over texture sharpness.
- Introduced new cvars for multi-scatter effects in PBR, enhancing specular IBL calculations.
- Updated shaders to incorporate advanced parameters for multi-scatter compensation, improving rendering quality.

These changes significantly enhance the flexibility and visual fidelity of the Vulkan rendering pipeline.
- Introduced new lookup tables for LTC matrix and amplitude, enhancing area light rendering capabilities.
- Added cvars for enabling LTC and adjusting its quality, providing users with control over the feature.
- Updated shader code to incorporate LTC contributions, improving specular lighting calculations.
- Enhanced Vulkan initialization and descriptor management to accommodate new LTC resources.

These changes significantly improve the realism and flexibility of lighting in the Vulkan rendering pipeline.
- Introduced a new header file for canonical LTC lookup tables, enhancing area-light shading capabilities.
- Updated `tr_image.c` to utilize the new LTC tables for image uploads, improving HDR LUT handling.
- Modified shader code to incorporate canonical LTC contributions, refining specular lighting calculations.
- Enhanced Vulkan image handling to support RGBA16F formats, ensuring compatibility with new LTC resources.

These changes significantly improve the realism and flexibility of lighting in the Vulkan rendering pipeline.
- Introduced a new Python script for deterministic Vulkan shader code generation and validation, enhancing shader management.
- Added CMake targets for regenerating and checking Vulkan shaders, improving build process integration.
- Increased the maximum texture size from 2048 to 32768, allowing for better texture handling in the Vulkan renderer.

These changes enhance the Vulkan rendering pipeline's flexibility and shader management capabilities.
- Updated the ResampleTexture function to dynamically allocate memory for texture rows, improving memory management and error handling.
- Added checks for invalid output dimensions and memory allocation failures, enhancing robustness.
- Modified Vulkan initialization to store the maximum image dimension in a new variable, ensuring accurate texture size handling.

These changes improve the stability and efficiency of the Vulkan rendering pipeline.
…and clean up whitespace in Vulkan pipeline creation. This change enhances code clarity and maintains consistent shader behavior.
- Implemented a fallback mechanism for binding deterministic descriptors for emissive maps, ensuring no stale bindings occur.
- Updated the shader code to conditionally bind the emissive descriptor based on the presence of the emissive map, improving rendering consistency.

These changes enhance the robustness of the Vulkan rendering pipeline by ensuring proper handling of emissive textures.
…sotropy, transmission, and subsurface maps

- Added support for binding descriptors for clearcoat, sheen, anisotropy, transmission, and subsurface maps in the Vulkan rendering pipeline.
- Implemented a fallback mechanism to ensure proper descriptor handling when specific maps are not present, improving rendering consistency.

These changes enhance the robustness of the Vulkan rendering pipeline by ensuring accurate handling of various material properties.
…lar calculations

- Enhanced normal mapping by implementing textureGrad for better detail and accuracy.
- Introduced anisotropic calculations for specular reflection, allowing for more realistic surface interactions.
- Updated the CalcSpecular function to accommodate anisotropic parameters and improve overall shading quality.
- Added variance handling for roughness to refine specular response based on texture sampling.

These changes significantly enhance the visual fidelity and realism of materials in the Vulkan rendering pipeline.
- Introduced new cvars for bloom knee, exposure, and tonemapping modes in the Vulkan rendering pipeline.
- Enhanced shader code to utilize these parameters for improved post-processing effects.
- Updated fragment shaders to support ACES and Reinhard tonemapping methods, allowing for better HDR image handling.
- Implemented sRGB gamma application control for final image output, enhancing color accuracy.

These changes significantly improve the visual quality and flexibility of the Vulkan rendering pipeline.
- Introduced new cvars for specular anti-aliasing mode and strength, allowing for enhanced control over specular rendering.
- Updated Vulkan fragment shaders to utilize these parameters, improving visual quality and reducing artifacts in specular highlights.
- Implemented mip level prefiltering for environment maps, refining texture sampling for better lighting accuracy.

These changes enhance the realism and flexibility of the Vulkan rendering pipeline, particularly in handling specular reflections.
…sk handling

- Updated the Vulkan renderer to support an additional color attachment for SSAO, improving the rendering pipeline's capabilities.
- Introduced a new image and image view for the VAO mask, enhancing the handling of occlusion effects.
- Modified shader code to accommodate the new attachment, ensuring proper integration with the SSAO process.

These changes improve the visual fidelity and flexibility of the Vulkan rendering pipeline, particularly in ambient occlusion rendering.
- Added support for post-processing parameters in the Vulkan renderer, including exposure and pre-exposure scale.
- Updated shader code to utilize these parameters, improving the handling of HDR images and tonemapping.
- Introduced a new cvar for applying sRGB gamma correction, enhancing color accuracy in final outputs.

These changes significantly improve the visual quality and flexibility of the Vulkan rendering pipeline, particularly in post-processing effects.
…cvars

- Added static color definitions for black and origin vectors to streamline color management in the Vulkan renderer.
- Updated various functions to utilize these new static definitions, enhancing code clarity and consistency.
- Introduced new cvars for HDR post-processing controls, including options for clearing the Vulkan HDR target and disabling blending, improving rendering flexibility.

These changes enhance the Vulkan rendering pipeline's robustness and maintainability, particularly in color and post-processing management.
- Introduced new cvars for Panini projection strength (r_paniniD) and squeeze factor (r_paniniS) to enhance perspective correction in the Vulkan rendering pipeline.
- Updated shader code to utilize these parameters, allowing for improved image distortion handling during post-processing.
- Enhanced Vulkan initialization and push constant structures to accommodate new projection settings, improving rendering flexibility.

These changes significantly enhance the visual quality and control of the Vulkan rendering pipeline, particularly in handling wide-angle perspectives.
- Introduced a new cvar, r_panini, to enable Panini projection warp, enhancing perspective correction in the Vulkan rendering pipeline.
- Updated Vulkan initialization and shader code to incorporate the new r_panini parameter, improving image distortion handling during post-processing.
- Enhanced gamma correction handling in shaders to support the new projection settings.

These changes significantly improve the visual quality and control of the Vulkan rendering pipeline, particularly for wide-angle perspectives.
- Introduced a new gamma post-processing sampler and updated the Vulkan renderer to utilize it for enhanced image quality.
- Modified bloom shader to improve threshold handling and added support for adjustable bloom intensity and clamp values.
- Updated Vulkan initialization to allocate descriptor sets for gamma processing, enhancing flexibility in post-processing effects.

These changes significantly improve the visual fidelity and control of the Vulkan rendering pipeline, particularly in gamma correction and bloom effects.
Co-authored-by: Cursor <cursoragent@cursor.com>
- Introduced a new Python script for deterministic Vulkan shader code generation and validation, enhancing shader management.
- Added CMake targets for regenerating and checking Vulkan shaders, improving build process integration.
- Increased the maximum texture size from 2048 to 32768, allowing for better texture handling in the Vulkan renderer.

These changes enhance the Vulkan rendering pipeline's flexibility and shader management capabilities.
- Introduced new cvars for Panini projection strength (r_paniniD) and squeeze factor (r_paniniS) to enhance perspective correction in the Vulkan rendering pipeline.
- Updated shader code to utilize these parameters, allowing for improved image distortion handling during post-processing.
- Enhanced Vulkan initialization and push constant structures to accommodate new projection settings, improving rendering flexibility.

These changes significantly enhance the visual quality and control of the Vulkan rendering pipeline, particularly in handling wide-angle perspectives.
- Introduced a new cvar, r_panini, to enable Panini projection warp, enhancing perspective correction in the Vulkan rendering pipeline.
- Updated Vulkan initialization and shader code to incorporate the new r_panini parameter, improving image distortion handling during post-processing.
- Enhanced gamma correction handling in shaders to support the new projection settings.

These changes significantly improve the visual quality and control of the Vulkan rendering pipeline, particularly for wide-angle perspectives.
- Introduced several new cvars: r_bloomKnee, r_exposure, r_tonemap, r_post, and r_post_debug to enhance post-processing capabilities.
- Updated Vulkan initialization to register these new parameters, allowing for improved control over bloom effects, exposure adjustments, and tonemapping modes.
- Enhanced shader descriptions to provide clarity on the functionality of the new cvars, improving user understanding and flexibility in rendering settings.

These changes significantly enhance the visual quality and control of the Vulkan rendering pipeline, particularly in HDR post-processing and tonemapping.
- Removed unused static cvars related to HDR clearing, blending, and binding logs to streamline the Vulkan renderer.
- Updated shader code to enhance gamma correction and dither functionality, improving visual fidelity.
- Adjusted render pass configurations to optimize attachment handling and reduce complexity in the Vulkan rendering pipeline.

These changes enhance the maintainability and performance of the Vulkan renderer, particularly in post-processing effects.
- Introduced new CMake variables and custom commands to automate the generation of Vulkan shader binaries from GLSL source files.
- Added a custom target for shader generation dependencies, ensuring shaders are compiled before the Vulkan renderer builds.
- Enhanced the build process to include shader tools for better management of Vulkan shaders.

These changes improve the build integration and management of Vulkan shaders, streamlining the development workflow.
- Updated compile_engine.sh to include new options for macOS app bundling and universal binary creation.
- Introduced compile_shaders.sh for automated GLSL to SPIR-V shader compilation, improving shader management.
- Removed outdated make-macosx-app.sh and make-macosx-ub2.sh scripts, consolidating functionality into the new scripts.
- Enhanced argument parsing in compile_engine.sh for better usability and added error handling for new macOS options.

These changes streamline the shader compilation process and improve the macOS application bundling workflow, enhancing overall development efficiency.
- Introduced a new cvar, r_vk_pipeline_debug, to enable detailed logging of Vulkan pipeline creation information, aiding in debugging and performance analysis.
- Enhanced swapchain management by adding functions to query surface extent and log swapchain recreation events, improving stability and responsiveness in rendering.
- Updated shader code to utilize the new debug cvar for conditional logging, providing developers with insights into the rendering pipeline.

These changes improve the debugging capabilities and overall robustness of the Vulkan rendering pipeline, facilitating better performance tuning and error tracking.
…agement

- Updated shader code to initialize texture set variables to -1 by default, enhancing clarity and consistency in texture handling.
- Modified conditional checks in the shader to use >= 0 instead of > -1, improving readability and ensuring correct texture set usage.
- Enhanced Vulkan pipeline creation logging to include detailed PBR texture set information, aiding in debugging and performance analysis.

These changes streamline texture management in the Vulkan renderer and improve debugging capabilities for the rendering pipeline.
…ement

- Updated shader code to provide detailed debug information for PBR modes, including descriptions for debug view settings.
- Introduced a new VkSampler variable in the image structure for better texture handling.
- Added functions to update descriptor sets with image references, improving texture management in the Vulkan pipeline.
- Enhanced shader code for better handling of bloom effects and post-processing parameters.

These changes improve the debugging capabilities and overall texture management in the Vulkan renderer, facilitating better performance tuning and visual fidelity.
…hader handling

- Removed redundant sampler assignment in the image structure to streamline texture management.
- Updated loop variable names in descriptor binding for better readability and consistency.
- Updated shader build metadata timestamp to reflect recent changes.

These changes enhance the clarity and efficiency of the Vulkan renderer's descriptor set management and shader handling processes.
- Introduced new cvars: r_paniniBrightness, r_paniniCircle, and r_paniniOverdraw to enhance post-processing control in the Vulkan rendering pipeline.
- Updated Vulkan initialization to register these parameters, allowing for improved adjustments in Panini projection effects.
- Modified shader code to utilize the new parameters, enhancing visual fidelity and flexibility in rendering settings.

These changes significantly improve the control and quality of the Vulkan rendering pipeline, particularly in post-processing effects related to Panini projection.
…ader updates

- Added a new `circle_blend` function to the gamma fragment shader, allowing for circular blending based on a mix value, enhancing visual effects.
- Updated the gamma shader binary size to accommodate the new functionality.
- Modified shader build metadata to reflect the latest changes and ensure accurate tracking of shader versions.

These improvements enhance the visual fidelity of the Vulkan rendering pipeline, particularly in post-processing effects.
…ents

- Introduced new cvars: r_ltc and r_ltc_quality to enable and configure LTC area light functionality in the Vulkan renderer.
- Updated shader and initialization code to incorporate LTC parameters, enhancing lighting effects and visual fidelity.
- Removed unused Panini projection cvars to streamline the renderer and improve clarity in post-processing controls.
- Enhanced render pass configurations to support additional color attachments for improved post-processing capabilities.

These changes significantly improve the lighting effects and overall rendering quality in the Vulkan pipeline, particularly in relation to area lights and post-processing techniques.
- Introduced new cvars: r_panini, r_paniniBrightness, r_paniniCircle, and r_paniniOverdraw to improve control over Panini projection effects in the Vulkan renderer.
- Updated Vulkan initialization to register these new parameters, enhancing post-processing capabilities.
- Added r_vk_pipeline_debug cvar for detailed logging of Vulkan pipeline creation information, aiding in debugging and performance analysis.
- Modified shader code to utilize new Panini parameters and improve visual fidelity in rendering.

These changes significantly enhance the flexibility and quality of the Vulkan rendering pipeline, particularly in relation to post-processing effects and debugging capabilities.
- Enabled FreeType font generation by default, automatically downloading Source Sans 3 fonts during configuration.
- Updated CMakeLists.txt to create a fonts directory and download missing font files if needed.
- Modified the renderer to find and utilize available fonts, improving font management and fallback options.
- Added a README in the fonts directory to guide users on font usage and customization.

These changes significantly enhance the font rendering capabilities, providing a more seamless experience for users requiring TrueType fonts.
- Added functionality to automatically download Source Sans 3 fonts when FreeType is enabled, improving font availability for rendering.
- Created a dedicated fonts directory in CMake and updated the README to guide users on font usage and customization.
- Introduced a new console variable, r_panini_console, to manage Panini projection visibility when the console is active, enhancing user control over rendering settings.
- Updated Vulkan renderer to utilize the new console variable, improving the handling of Panini projection effects during console visibility.

These changes significantly enhance font rendering capabilities and user experience in the Vulkan rendering pipeline.
- Enhanced the README in the fonts directory to provide clearer instructions on font usage and customization, including the automatic download of Source Sans 3.
- Removed outdated comments in the console code related to Panini projection management for clarity.
- Registered the new console variable `r_panini_console` in the Vulkan renderer to control Panini projection visibility when the console is active, improving user experience.

These updates improve documentation and streamline console functionality, enhancing the overall rendering experience.
…derer

- Disabled FreeType font generation by default to minimize dependencies, with instructions to enable it via CMake.
- Updated console code by removing outdated Panini projection state management, enhancing clarity and functionality.
- Adjusted shader data size for gamma fragment shader, reflecting changes in the rendering pipeline.

These updates improve the overall efficiency and usability of the Vulkan rendering system, particularly in font management and console integration.
- Removed FreeType font downloading functionality from CMake, disabling it by default to reduce dependencies.
- Updated Vulkan renderer to directly read font files without fallback options, simplifying font management.
- Adjusted console variables related to FreeType and Panini projection, enhancing clarity and usability.
- Cleaned up unused variables and functions in the Vulkan renderer, streamlining the codebase.

These changes improve the efficiency and maintainability of the Vulkan rendering system, particularly in font handling and console integration.
- Introduced a new console variable `r_paniniBrightness` to control the brightness multiplier applied after the Panini warp, enhancing post-processing capabilities.
- Updated the Vulkan initialization to register this new variable and set its description for improved usability.
- Modified the Vulkan rendering pipeline to utilize the new brightness parameter, allowing for better visual adjustments in rendering.

These changes enhance the flexibility and quality of the Vulkan rendering pipeline, particularly in relation to post-processing effects and user control over visual settings.
- Expanded the PostProcess_FragSpecData structure to include new parameters: exposure, bloom_knee, tonemap_mode, apply_srgb_gamma, post_debug, and postprocess_enabled, improving control over post-processing effects.
- Updated the Vulkan shader pipeline to utilize these new parameters, enhancing visual fidelity and flexibility in rendering settings.
- Adjusted the gamma fragment shader to incorporate the new exposure parameter and modified the output color calculation for improved brightness handling.

These changes significantly enhance the post-processing capabilities of the Vulkan renderer, allowing for more nuanced visual adjustments.
- Changed the default tonemapping mode from 1 (Reinhard) to 2 (ACES) for improved visual quality in post-processing.
- Updated the high dynamic range (HDR) setting to default to 1 (enabled), enhancing rendering capabilities.
- Adjusted shader code to reflect the new tonemapping logic and improved handling of HDR formats.
- Modified the gamma fragment shader to incorporate the new tonemapping mode, ensuring consistent visual output.

These changes significantly enhance the Vulkan renderer's post-processing capabilities, providing better control over tonemapping and HDR rendering.
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

timfox and others added 3 commits February 18, 2026 21:37
- Updated the shader build metadata with a new timestamp for the latest build.
- Added backup files for generated shader data and bindings, ensuring recovery options for shader compilation outputs.
- The new backup files include shader binding and data in C format, facilitating easier integration and management of shader resources.

These changes enhance the shader management process and provide better support for shader compilation workflows in the Vulkan renderer.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@timfox timfox merged commit 993bd7d into main Feb 19, 2026
17 checks passed
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