0

I am currently trying to learn Vulkan, so if this question is stupid/obvious feel free to call me out for my lack of knowledge.

I searched the web ( using Google ) to try and get the information I need, with no success, which is why I am here.

My question : Let's say i have a vertex shader with the following inputs :

layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec2 inUV;

I already configured the pipeline and buffers to send information to the vertex shader. My problem comes from trying to draw with indices. Multiple same vertices can have different normals, so i want to specify which index to read data from for the 3 different inputs.

Looking around and at the API, i cannot find a way to have different indices for different inputs for each vertex.

I want something like this :

indices = {0, 0, 0, // Vertice, Normal, UV
  0, 1, 0, // Vertice, Normal, UV
  3, 8, 3};  // Vertice, Normal, UV

So in total, there are 3 vertex but with indices for each different input. Is this possible in vulkan, if not how do i solve this?

Begah
  • 108
  • 9

1 Answers1

0

That's not possible.

You will need to duplicate the data so each unique vertex has its own data. It's the exact same deal in opengl.

There is the option to use a storage buffer to pull the data programmatically based on indices you pass as vertex data but that's likely to lead to poorer performance.

ratchet freak
  • 44,814
  • 5
  • 55
  • 99