Why is texture buffer faster than vertex inputs when using instancing in glsl?

I am coding my own rendering engine. I am currently working on the ground. I create a landscape with glDrawArraysInstanced. The terrain is made of many "pieces". Each piece is one quad, which is also one example of a draw call. Each quad is then tessellated in tessellation shaders. For my shader inputs, I use VBOs , instanced VBOs (using the vertex attribute attribute) and texture buffers . This is a simple example of one of my shaders:

#version 410 core

layout (location = 0) in vec3 perVertexVector; // VBO attribute  
layout (location = 1) in vec3 perInstanceVector; // VBO instanced attribute
uniform samplerBuffer someTextureBuffer; // texture buffer
out vec3 outputVector;

void main()
{
    // some processing of the inputs;
    outputVector = something...whatever...;
} 

, . 60-70 FPS. , VBO . - , 120-160 FPS! ( !). , instanced.

instanced ( ):

glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, size, buffer, GL_DYNAMIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (GLvoid*)0);
glEnableVertexAttribArray(0);
glVertexAttribDivisor(0, 1); // this makes the buffer instanced

:

glBindTexture(GL_TEXTURE_BUFFER, textureVBO);
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGB32F, VBO);

, - , . ... , , , , , .

, .

(glDrawArraysInstanced) . , FBO . ( ), , 90 FPS, 60 FPS, .

!, , , . , ( 120-150 )!

, - - , , , , .


:

, instanced?


EDIT:

:

, , , glsl:

layout (location = 1) in vec3 perInstanceVector; // VBO instanced attribute
outputVector = perInstanceVector;

:

uniform samplerBuffer textureBuffer; // texture buffer which has the same data as the previous VBO instanced attribute
outputVector = texelFetch(textureBuffer, gl_InstanceID).xyz

, , .

+4

All Articles