Xavier Gomez
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    {%hackmd theme-dark %} # Render|Frame Graph ## TODO List - [ ] Blog intro frame graph - [ ] Mini RenderGraph (Vulkan|DX) => Exemple Code sans/avec - [ ] Crash Course Render Dependency Graph Unreal - [ ] What is ring allocation ? - [ ] Show the complete (DX12) graphic pipeline - [ ] Talk about Mesh Shader Stage and Amplification Shader Stage (parts of graphic pipeline) - [ ] Talk about FLOP (float operation) based on precision ![](https://i.imgur.com/MMijnY7.png) https://www.techpowerup.com/gpu-specs/quadro-rtx-3000-mobile.c3428 ## Introduction A Render Graph(or Frame Graph) is **high-level** representation of the graphic operations to render a scene. In other words, it is basically a **wrapper** around a(or multiple) low-level **graphic API**(Vulkan, DirectX12, OpenGL, ...). Examples: <a href="https://www.gdcvault.com/play/1024612/FrameGraph-Extensible-Rendering-Architecture-in">Frosbite (DICE): Frame Graph</a> <a href="https://www.gdcvault.com/play/1024612/FrameGraph-Extensible-Rendering-Architecture-in">Unreal Engine(Epic Games): Render Dependency Graph</a> <a href="https://www.gdcvault.com/play/1024612/FrameGraph-Extensible-Rendering-Architecture-in">Anvil Engine(Ubisoft): Frame Graph</a> ## Properties - Each render operation gets abstracted to a **single way to produce render code**. - Clearer and lighter code - Easier to debug (The implementation of the render operation is not broken, call to the function is the issue) - **Hide many low level operations** (memory allocation, ressource state transition) - Low-level and high-level code are optimized independently. ### Recent 3D APIs **D3D12|Vulkan**: &rarr; Manage **resources states**: ![](https://i.imgur.com/HmQSvUf.png) (https://learn.microsoft.com/fr-fr/windows/win32/direct3d12/using-resource-barriers-to-synchronize-resource-states-in-direct3d-12#implicit-state-transitions) &rarr; Manage **relative transition**: Switching resource from a state to another. Consider the following example: ![](https://i.imgur.com/Tp7Fmgx.png) <span style="background-color: #00AA00">&rarr;</span>: Read <span style="background-color: #AA0000">&rarr;</span>: Write **Render Graph** has information about these interactions: Can figure out best place for **barrier transition**. In general, the more we can **group resource transitions** in a single call, the less calls to the SDK and the faster our program will perform. *** ### Minimize And Group Resource Barriers For example, running a shadow mapping algorithm: - Pass 1: Outputs **depth buffer** - Pass 2 (Compute Shader Pass): Reads **depth buffer** per-pixel (UAV: UnorderedAccessView -> representing ReadWrite data) and outputs **shadow buffer** <span style="background-color: #AAAA00">***Warning:***</span> ***Textures can be read per-pixel and be ReadWrite but Sample() does not work*** - Pass 3: Takes **depth buffer** and **shadow buffer** as input. Transition of **depth buffer** and **shadow buffer**, `write` &rarr; `read` to be used as shader resource in the `Pass 3`, should be grouped. ![](https://i.imgur.com/SiBBgH5.png) It is possible to group **resource barriers** from **different command queues**. (In tripleA engine there are atleast 3 command queues a **graphic**, a **compute** and a **copy**). Main command queue is the graphic &rarr; queues need **synchronisation mechanism** to communicate with each other. Optimization of resource transition: https://levelup.gitconnected.com/organizing-gpu-work-with-directed-acyclic-graphs-f3fd5f2c2af3. *** ### Manage And Optimize Resource Memory ![](https://i.imgur.com/NBiCWHw.png) Here `Resource A` stops being used in pass 3, `Resource C` is used in pass 4 which means their lifetimes do not overlap so the same memory can be used for `A` and `C` (same for `A` and `D`) **Types of resources:** - **Graph|Transient resources:** Used on a per-frame basis (*GBuffer*, *Deferred lightning pass*, ...) &rarr; their lifetime can be **fully handled** by render graph. - **External resources:** Whose lifetime is dependent on systems outside the graph ([**swapchain**](#Swapchain) back buffer) &rarr; **render graph** will just manage their **states**. #### Transient Resource System **Transient resource** are owned by the *RDG* and last for a maximum of one frame. &rarr; High potential of **memory re-use** &rarr; resource lifetime is then used to apply [**resource aliasing**](#Resource-aliasing) on [**placed resources**](#Placed-resource). ### Parallel Command List Recording Check: https://learn.microsoft.com/en-us/windows/win32/direct3d12/user-mode-heap-synchronization https://devblogs.microsoft.com/directx/gpus-in-the-task-manager/#:~:text=GPU%20engines%20are%20made%20up,of%20that%20engine's%20underlying%20cores. **GPU Engines**: - **3D Engine**: The 3D engine is responsible for processing and rendering 3D graphics. It contains specialized hardware components such as a geometry processor, rasterizer, and pixel shader that work together to transform 3D objects into 2D images that can be displayed on a screen. The geometry processor handles tasks such as transforming vertices, calculating lighting and shading effects, and applying textures to 3D objects. The rasterizer then converts the 3D objects into pixels that can be displayed on a screen, while the pixel shader applies additional effects such as transparency and anti-aliasing to the rendered image. - **Compute Engine**: The compute engine is responsible for performing general-purpose computing tasks on the GPU. It is used for tasks that do not necessarily involve graphics processing, such as scientific simulations, data processing, and machine learning. The compute engine is designed to perform highly parallel computations, meaning that it can perform many calculations simultaneously, making it well-suited for tasks that involve large amounts of data or complex mathematical operations. - **Copy Engine**: The copy engine is responsible for moving data between the CPU and the GPU, as well as between different areas of the GPU itself. It is used for tasks such as uploading data from the CPU to the GPU's memory, copying data between different memory locations within the GPU, and downloading data from the GPU's memory back to the CPU. The copy engine is designed to transfer data quickly and efficiently, making it an important component for many graphics and compute tasks. ## Glossary ### **Swapchain**: Vulkan ne possède pas de concept comme le framebuffer par défaut, et nous devons donc créer une infrastructure qui contiendra les buffers sur lesquels nous effectuerons les rendus avant de les présenter à l'écran. Cette infrastructure s'appelle swap chain sur Vulkan et doit être créée explicitement. La swap chain est essentiellement une file d'attente d'images attendant d'être affichées. Notre application devra récupérer une des images de la file, dessiner dessus puis la retourner à la file d'attente. Le fonctionnement de la file d'attente et les conditions de la présentation dépendent du paramétrage de la swap chain. Cependant, l'intérêt principal de la swap chain est de synchroniser la présentation avec le rafraîchissement de l'écran. ### **Resource aliasing**: Consists of using the **same GPU memory** for different resources whose **lifetime don’t overlap** during frame computation. ### **Placed resource**: Resource that allows developers to specify the **location of the resource's memory** directly. Placed resources are the **lightest weight** resource objects available, and are the **fastest to create and destroy**. ## External resources - D3D12 Placed resources: https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createplacedresource - D3D12 Resource Handling: https://logins.github.io/graphics/2020/07/31/DX12ResourceHandling.html - D3D12 resource aliasing: https://learn.microsoft.com/en-us/windows/win32/direct3d12/memory-aliasing-and-data-inheritance - Memory aliasing algorithm: https://levelup.gitconnected.com/gpu-memory-aliasing-45933681a15e - Resource aliasing: https://gpuopen-librariesandsdks.github.io/D3D12MemoryAllocator/html/resource_aliasing.html - Vulkan swapchain: https://vulkan-tutorial.com/fr/Dessiner_un_triangle/Presentation/Swap_chain

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully