# glDrawArraysIndirect not setting gl_VertexID correctly?

Question asked by soconnell on Jul 26, 2013
Latest reply on Jul 26, 2013 by cameni

I'm not 100% positive what the correct behavior is here, but on NVIDIA hardware, gl_VertexID = first + [vertex index].  So if I specify first=2, count = 6, then the values for gl_VertexID in each instance of the shader are: 2, 3, 4, 5, 6, 7.  However on AMD hardware, gl_VertexID always starts at 0.  When calling glDrawArrays with no bound attributes, the behavior between NVIDIA and AMD is the same and correct.  Has anybody else experienced this issue on AMD hardware?

//-------------------------Create and set up indirect draw buffer-------------------------

typedef struct

{

GLuint count;

GLuint primCount;

GLuint first;

GLuint baseInstance;

} DrawArraysIndirectCommand;

DrawArraysIndirectCommand command;

command.count = 6;

command.primCount= 1;

command.first = 2;

command.baseInstance = 0;

glGenBuffers(1, &indirectBuffer);

glBindBuffer(GL_DRAW_INDIRECT_BUFFER, indirectBuffer);

glBufferData(GL_DRAW_INDIRECT_BUFFER, sizeof(DrawArraysIndirectCommand), &command, GL_STATIC_DRAW);

glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0);

//-------------------------Make indirect draw call-------------------------

glBindVertexArray(dummyVao);

glBindBuffer(GL_DRAW_INDIRECT_BUFFER, indirectBuffer);

glDrawArraysIndirect(GL_POINTS, 0);

glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0);

glBindVertexArray(0);

#version 430 core

layout (std430, binding = 0) buffer BufferObject

{

int data[];

};

uniform mat4 ModelViewProjectionMatrix;

void main()

{

data[gl_VertexID] = gl_VertexID;

gl_Position = ModelViewProjectionMatrix * vec4(gl_VertexID, 0.0, 0.0, 1.0);

}
{"ft_lang_label":"__label__en","ft_lang_prob":0.6831451,"math_prob":0.51187676,"size":2237,"snap":"2019-13-2019-22","text_gpt3_token_len":557,"char_repetition_ratio":0.18002687,"word_repetition_ratio":0.045454547,"special_character_ratio":0.2919088,"punctuation_ratio":0.22375691,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9727606,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-03-21T05:31:42Z\",\"WARC-Record-ID\":\"<urn:uuid:6c1e379b-360c-4ffc-a0cf-b4f3cc85a723>\",\"Content-Length\":\"83872\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:1c55a16c-98c4-4551-8def-a1aa74792d98>\",\"WARC-Concurrent-To\":\"<urn:uuid:a0274fd3-0d97-4cb4-aee5-799ead9a83ed>\",\"WARC-IP-Address\":\"23.218.145.81\",\"WARC-Target-URI\":\"https://community.amd.com/thread/167220\",\"WARC-Payload-Digest\":\"sha1:UXIZXUM2KN6K4GRR5OOOJIVMTEY5QNNI\",\"WARC-Block-Digest\":\"sha1:MQYIXEBPDHPE5VLDHP6A4IYZOZ3O4VTK\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-13/CC-MAIN-2019-13_segments_1552912202496.35_warc_CC-MAIN-20190321051516-20190321073516-00106.warc.gz\"}"}