Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

How expensive is UNITY_SAMPLE_TEX2DARRAY?

Discussion in 'Shaders' started by hungrybelome, Jun 14, 2018.

  1. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    179
    I'm working on a mobile game where all 3d models use the same shader but have different albedo and AO maps. I'm currently experimenting with using a single shader with 2 Texture2DArrays, for both my albedo and AO maps.

    Before I take the time to fully implement this, is UNITY_SAMPLE_TEX2DARRAY and
    UNITY_ACCESS_INSTANCED_PROP fairly expensive? Since I have to do this in the fragment shader, I'll have 2 UNITY_SAMPLE_TEX2DARRAY and 2 UNITY_ACCESS_INSTANCED_PROP per fragment. Since I am working on an AR mobile game, I am only dealing with 2016 and newer higher end mobile devices, but I still run into heating issues, so I was hoping to know how expensive these features are. I wonder if the cost of the instanced properties and sampling is negligible, or if it is something to be concerned about.

    Thanks!
     
    Last edited: Jun 14, 2018
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,063
    In theory it's the same as a regular texture sample..
     
  3. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    179
    How about the usage of UNITY_ACCESS_INSTANCED_PROP? I'm wondering whether to parameterize specularity and other shader params while I'm at it. Basically have close to 6 UNITY_ACCESS_INSTANCED_PROP calls in my shader.
     
    Last edited: Jun 14, 2018
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,063
    No idea, there's only one way to find out though..