Hi there,
I found a new bug that occurs only with hyperthreading (intel 4 cpu) in my software which I don’t understand:
I have a thread which does the rendering of my data, sorted in a vertex array. Another thread is filling the array with the data that is to be rendered. The synchronization is safe (at least, that’s what I’m hoping ). The data that i want to render are (x,y) pairs of a (for example sine) curve, packed tight in the vertex array.
In the function which does the rendering, I change the data that is rendered before rendering, and that’s where the trouble starts:
for (int j = 1; j < VertexArraySize * 2; j+= 2) {
ArrayData[j] += Offset;
}
glVertexPointer (2, GL_INT, 0, ArrayData);
glDrawArrays (GL_LINE_STRIP, 0, VertexArraySize);
Obviously, this function should shift the line which i want to display by the given Offset in y-direction. Sometimes, though, it seems that the for()-loop is not executed completely before the glDrawArrays-call is executed. That is: the line which i want to display is only shifted partially. This happens when the process in running in default settings, which is on two processors of the hyper threading machine i’m using. When I set the affinity mask of the process to use only
one processor (which one: 0 or 1 does not care) the line is shifted correctly !
Does the vertex array get displayed more often than I call glDrawArrays() (in the background ?), or can the system (win xp) execute the for()-loop on one processor, and call the glDrawArrays() function on the other one ? — or something even more weired ??
Anybody an idea ??
Greetings,
fetz
[This message has been edited by fetz (edited 12-01-2003).]