Unity Community


Results 1 to 15 of 15

  1. Posts
    614

    GL_APPLE_shader_framebuffer_fetch

    Hi,

    I just saw that Apple will support an extension GL_APPLE_shader_framebuffer_fetch in OpenGL ES 2.0 on all iOS 6 devices which allows programmable blending by using a built-in variable gl_LastFragData[0] in a fragment shader.

    Is there any chance that this will be accessible any time soon in Unity?

    Thanks
    Last edited by Martin Kraus; 06-20-2012 at 11:32 AM.


  2. Location
    Zürich, Switzerland
    Posts
    26,572
    who knows what Unity 4 will bring
    I would take it for granted that Unity 3 will not get an iOS 6 upgrade


  3. Posts
    614
    Quote Originally Posted by dreamora View Post
    who knows what Unity 4 will bring
    Aras?

    I would take it for granted that Unity 3 will not get an iOS 6 upgrade
    Thinking about it, I'm not sure how much support from Unity is necessary: maybe one doesn't even have to call any OpenGL function but the variable gl_LastFragData[0] is just available in GLSL fragment shaders on iOS 6.

  4. Unity Graphics Developer

    Location
    Unity Technologies, basement
    Posts
    3,974
    Well, we learned about this feature at exactly the same time you did, which is to say, "a couple of days ago"

    Features take time to expose, but yeah, if you're writing raw GLSL yourself, then it should (haven't checked) "just work", just write GLSL shader that uses the variable.

    If you want shaders written in Cg/HLSL to be able to do this, then it's more complex for us to implement. We'd need to extend our HLSL2GLSL translator and GLSL Optimizer to "understand" this, and produce valid iOS6 GLSL in the end.

    But you know what? Since both of those pieces are open source... hint hint... pull request... https://github.com/aras-p/hlsl2glslfork and https://github.com/aras-p/glsl-optimizer


  5. Posts
    614
    Thanks for the reply, Aras! And, yes, I do write raw, untamed GLSL code.

  6. Unity Graphics Developer

    Location
    Unity Technologies, basement
    Posts
    3,974
    Quote Originally Posted by Martin Kraus View Post
    And, yes, I do write raw, untamed GLSL code.
    Then I think it should work (well I haven't checked). All the extension requires is adding an extension statement to your shader, and then using gl_LastFragData.

  7. brn brn is offline

    Location
    Tasmania-Australia
    Posts
    291
    I haven't read up about this functionality properly yet, so i might be jumping to conclusions.

    But it should open up a whole world of possibilities. Looking forward to it being implemented some time in the future. Aras will this be mapped to unitys the grabpass functionality, or will you keep it as a separate feature?

    Right now the hoops I'm jumping through to avoid reading from the frame buffer on IOS are quite inconvenient, worth the performance gain though.

  8. Unity Graphics Developer

    Location
    Unity Technologies, basement
    Posts
    3,974
    Quote Originally Posted by brn View Post
    But it should open up a whole world of possibilities. Looking forward to it being implemented some time in the future. Aras will this be mapped to unitys the grabpass functionality, or will you keep it as a separate feature?
    It has nothing to do with GrabPass, I think.

    This new feature lets you read the color of the curent pixel in your pixel shader. Common use cases are pretty much what is mentioned in the extension specification: implementing custom blending modes (think all of the Photoshop ones) and doing really simple postprocessing effects that only need to read the current pixel (color correction etc.).


  9. Posts
    614
    Quote Originally Posted by Aras View Post
    This new feature lets you read the color of the curent pixel in your pixel shader. Common use cases are pretty much what is mentioned in the extension specification: implementing custom blending modes (think all of the Photoshop ones) and doing really simple postprocessing effects that only need to read the current pixel (color correction etc.).
    Where can I read the extension specification? I didn't see it at http://www.khronos.org/registry/gles/ and I didn't find it in Apple's developer resources (apart from the WWDC presentation).


  10. Location
    Zürich, Switzerland
    Posts
    26,572
    Quote Originally Posted by Aras View Post
    This new feature lets you read the color of the curent pixel in your pixel shader. Common use cases are pretty much what is mentioned in the extension specification: implementing custom blending modes (think all of the Photoshop ones) and doing really simple postprocessing effects that only need to read the current pixel (color correction etc.).

    I would assume that the only reason apple even added it is the new image processing effects in Core Image, but I might be wrong there


  11. Posts
    614
    Quote Originally Posted by Martin Kraus View Post
    Where can I read the extension specification? I didn't see it at http://www.khronos.org/registry/gles/ and I didn't find it in Apple's developer resources (apart from the WWDC presentation).
    O well, I found a link to a document that I don't have access to (I'm in the university developer program): http://developer.apple.com/devcenter...ffer_fetch.txt
    I guess that explains why some people know more than others.


  12. Posts
    614
    Quote Originally Posted by brn View Post
    But it should open up a whole world of possibilities.
    I agree.

  13. Super Moderator
    Location
    Great Britain
    Posts
    9,656
    Correct me if I'm wrong but it seems like a nice speed boost. Shame it does not translate to droid well (unless I'm mistaken and it's supported there).
    Currently working with Sony on our new
    PS4 and Vita game in Unity!

    This post is not representative of Simian Squared Ltd

  14. Unity Graphics Developer

    Location
    Unity Technologies, basement
    Posts
    3,974
    Quote Originally Posted by hippocoder View Post
    Shame it does not translate to droid well (unless I'm mistaken and it's supported there).
    In theory all PowerVR GPUs can do it; whether the drivers expose the functionality or not is a different story.

    A lot of other GPUs can't do it and won't be able to anytime soon, so yeah, not very much "cross platform appeal".


  15. Posts
    614
    Quote Originally Posted by Aras View Post
    In theory all PowerVR GPUs can do it; whether the drivers expose the functionality or not is a different story.

    A lot of other GPUs can't do it and won't be able to anytime soon, so yeah, not very much "cross platform appeal".
    I just learned that Nvidia's Tegra chip has been supporting this functionality for a long time (GL_NV_shader_framebuffer_fetch: http://developer.download.nvidia.com...evelopment.pdf ); but I assume that not all Tegra-based devices expose it. Khronos now lists the (multi-vendor) extension GL_EXT_shader_framebuffer_fetch: http://www.khronos.org/registry/gles...ffer_fetch.txt . Since Qualcomm's and ARM's mobile GPUs are tile-based, they are probably also able to implement this without too much effort (at least in future hardware).

    UPDATE: I just tried it on an iPod touch 4 with iOS 6 and it works fine except that you have to ask for GL_EXT_shader_framebuffer_fetch instead of GL_APPLE_shader_framebuffer_fetch (I guess Apple used the GL_APPLE_... name in earlier pre-release builds of iOS 6). I also noted that you have to use gl_LastFragData[0] while using gl_LastFragColor results in an error. (GL_NV_shader_framebuffer_fetch allows to use gl_LastFragColor instead of gl_LastFragData[0]).
    Last edited by Martin Kraus; 09-22-2012 at 10:24 AM.

Posting Permissions

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