GithubHelp home page GithubHelp logo

Instancing about shadergen HOT 3 CLOSED

mellinoe avatar mellinoe commented on May 28, 2024
Instancing

from shadergen.

Comments (3)

mellinoe avatar mellinoe commented on May 28, 2024

Could you clarify what you mean? Instancing is controlled by how you issue your draw commands, not really how you write your shaders. You can read from ShaderBuiltins.InstanceID to get the instance's ID (SV_instanceID, gl_InstanceID, etc.).

from shadergen.

erictuvesson avatar erictuvesson commented on May 28, 2024

Sorry for not being more specific, I can't generate a Matrix4x4 array.

I get "Shader resource fields must be simple blittable structures." when I use Matrix4x4[]. And using ArraySizeAttribute doesn't make any difference.

from shadergen.

erictuvesson avatar erictuvesson commented on May 28, 2024

While reading though the test code I noticed that I can do it like this, I guess it solves the problem.

public InstanceInfo Instances;

public struct InstanceInfo
{
    [ArraySize(4)] 
    public InstanceData[] Instances;
}

public struct InstanceData
{
    public Matrix4x4 World;
}

from shadergen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.