Search Unity

Compute shader texture input

Discussion in 'Shaders' started by BadFoolPrototype, Aug 7, 2018.

  1. BadFoolPrototype

    BadFoolPrototype

    Joined:
    Sep 7, 2013
    Posts:
    14
    Hello everyone,
    I found myself with new questions on Compute Shaders.

    I am using SRP as a hook to write a render pipeline from scratch.
    I am experimenting with writing compute shaders, and found a net difference between the command buffer API and the Compute Shader one.

    1) In the command buffer API, you can set textures on a compute shader but ONLY with a RenderTargetIdentifier.
    2) In the compute shader API, you can set texture but ONLY with the Texture class.

    I wanted to use Command Buffers everywhere to have a more homogeneous code, but now I am not sure the best way to proceed.

    If for example, I want to write a SSAO compute shader, I would have both a Noise texture (an asset, loaded from disk) and at least the depth buffer to read.

    What is the best way to achieve this ?
    Tried searching around but no luck.

    Thank you a lot!