Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Fragment output

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    717

    Fragment output

    I am trying to convert a DirectX shader to OpenGL.

    The shader outputs to an 8 bit unsigned integer texture and a half-float RGBA (ie 16 bit) texture.

    how do I describe these in the glsl layout command in the fragment shader?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,713

    Re: Fragment output

    You don't.

    It's not the shader's responsibility to say what kind of texture it writes to. All it writes are output values. What decides the format of the values written to the framebuffer images are the framebuffer images themselves.

    The only thing you have to decide is what GLSL type you're writing to. Floating point outputs can be written to either a normalized integer image format or to floating-point formats. Signed integral outputs can be written to signed integral image formats. And unsigned integral outputs can be written to unsigned integral outputs.

    If you write a `vec4`, it could go to an RGB16F texture, an RGBA8 texture, an RGBA16 texture, an RG8_SNORM, or whatever. If you write to an `ivec4`, then it can go to an RGB8I, RGB16I, an RG8I, an RGBA16I, and so froth, as long as it ends in `I`. Similarly, if you write to a `uvec4`, then it can go to an RGB8UI, RG16UI, RGBA8UI, etc.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    717

    Re: Fragment output

    thanks for that

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •