Skip to content

Conversation

@mborgerson
Copy link
Member

Improves performance in some cases.

@gemini-code-assist
Copy link

Summary of Changes

Hello @mborgerson, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the process of converting render surfaces to textures within the nv2a/vk graphics pipeline. It introduces more flexible compatibility checks between surface and texture formats and provides an alternative, potentially more efficient, path for depth/stencil data conversion, aiming to enhance overall rendering performance.

Highlights

  • Simplified Surface-to-Texture Compatibility Checks: The logic for determining if a surface can be copied to a texture has been significantly streamlined, replacing a large switch-case with a more generic check based on Vulkan format texel sizes and removing specific format-to-format mappings.
  • Conditional Depth/Stencil Conversion Path: The depth/stencil surface-to-texture conversion now supports an alternative path that bypasses compute shaders, allowing for more flexible and potentially more efficient handling of depth/stencil data.
  • Refined Error Tracing for Compatibility: The logging for surface-to-texture compatibility failures has been moved from the compatibility check function to the texture creation function, and is now more specific, only triggering for color surfaces that fail the new compatibility checks.
Changelog
  • hw/xbox/nv2a/pgraph/vk/texture.c
    • Removed an unimplemented assertion in copy_zeta_surface_to_texture.
    • Refactored depth/stencil packing logic to be conditional based on use_compute_to_convert_depth_stencil.
    • Introduced a new helper function vk_format_texel_size for Vulkan format texel size determination.
    • Rewrote check_surface_to_texture_compatiblity to use a more generic format matching approach.
    • Relocated the trace_nv2a_pgraph_surface_texture_compat_failed call to create_texture with a specific condition.
Activity
  • No specific human activity (comments, reviews) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to relax and simplify surface-to-texture constraints, which can improve performance in some cases. The changes primarily involve simplifying the compatibility check between surfaces and textures and adding a more direct copy path for depth/stencil surfaces that do not require format conversion via a compute shader. While the overall direction is good, I've identified a critical issue in the new compatibility check logic that could lead to invalid Vulkan API calls. My review includes a detailed comment on this issue, which remains relevant as originally stated.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes the surface-to-texture copy path in the NV2A Vulkan renderer by relaxing format compatibility constraints and adding a fast path for depth surfaces that don't require compute shader conversion.

Changes:

  • Removed assertion that forced all depth-surface-to-texture copies to use compute shader conversion
  • Added conditional logic to use direct buffer transfer when compute conversion is unnecessary
  • Simplified surface-to-texture compatibility checking to compare texel sizes rather than explicit format pairs
  • Added vk_format_texel_size() helper function to determine format sizes

@Triticum0
Copy link
Collaborator

Improves performance on fireblade
0.8.49
Image

Pr
Screenshot_20260212_084527

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.

2 participants