docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method UseTextureFragment

    UseTextureFragment(TextureHandle, int, AccessFlags)

    Use the texture as an rendertarget/renderpass attachment. Writing: Indicate this pass will write a texture on the current fragment position and sample index through MRT writes. The graph will automatically bind the texture as an MRT output on the indicated index slot. Write in shader as float4 out : SV_Target{index} = value; This texture always needs to be written as an render target (SV_Targetx) writing using other methods (like operator[] = ) may not work even if using the current fragment+sampleIdx pos. When using operator[] please use the WriteTexture function instead. Reading: Indicates this pass will read a texture on the current fragment position. If the texture is msaa then the sample index to read may be chosen by the shader. This informs the graph that any shaders in pass will only read from this texture at the current fragment position using the LOAD_FRAMEBUFFER_INPUT(idx)/LOAD_FRAMEBUFFER_INPUT_MS(idx,sampleIdx) macros. I.e this texture is bound as an render pass attachment on compatible hardware (or as a regular texture as a fall back). The index passed to LOAD_FRAMEBUFFER_INPUT needs to match the index passed to ReadTextureFragment for this texture.

    Declaration
    TextureHandle UseTextureFragment(TextureHandle tex, int index, IBaseRenderGraphBuilder.AccessFlags flags = AccessFlags.Write)
    Parameters
    Type Name Description
    TextureHandle tex

    Texture to use during this pass.

    int index

    Index the shader will use to access this texture.

    IBaseRenderGraphBuilder.AccessFlags flags

    How this pass will acess the texture. Default value is set to AccessFlag.Write

    Returns
    Type Description
    TextureHandle

    A explicitly versioned handle representing the latest version of the pased in texture. Note that except for special cases where you want to refer to a specific version return value is generally discarded.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)