0
$\begingroup$

I see two kinds of passing Instance Data to Vertex Shader in different Examples.

1 .Using a Uniform Buffer and filling in an array, like below

struct UniformBlock
{
    mat4 mProjectView;
    mat4 mToWorldMat[MAX_INSTANCE];
    vec4 mColor[MAX_INSTANCES];
};

2. Filling in buffers, and then define the buffer as RATE_PER_INSTANCE in vertex layout description (I assume this is the more usual way)

  • My Question is :

    • How do these differ from hardware or memory access Point of View?
    • Are there any cases which one is considered "better" or "faster" than the other?
$\endgroup$
  • $\begingroup$ Are you asking about Vulkan or D3D12? Because Vulkan doesn't have "rate per instance"; are you talking about instanced vertex arrays? $\endgroup$ – Nicol Bolas Aug 23 at 13:53
  • $\begingroup$ I meant VK_VERTEX_INPUT_RATE_INSTANCE @NicolBolas $\endgroup$ – Erfan Ahmadi Aug 23 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.