mesa: don't use GET_DISPATCH because it doesn't work with glthread
GET_DISPATCH returns CurrentClientDispatch, which invokes glthread if it's enabled. GL function implementations should never call back to glthread. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6874>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,14 @@
|
||||
#include "main/dispatch.h"
|
||||
#include "main/context.h"
|
||||
|
||||
static struct _glapi_table *
|
||||
get_dispatch(void)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
return ctx->CurrentServerDispatch;
|
||||
}
|
||||
|
||||
|
||||
/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc
|
||||
* calls to a smaller set of driver-provided formats. Currently just
|
||||
* go back to dispatch to find these (eg. call glNormal3f directly),
|
||||
@@ -46,43 +54,43 @@
|
||||
* listed in dd.h. The easiest way for a driver to do this is to
|
||||
* install the supplied software t&l module.
|
||||
*/
|
||||
#define COLORF(r,g,b,a) CALL_Color4f(GET_DISPATCH(), (r,g,b,a))
|
||||
#define VERTEX2(x,y) CALL_Vertex2f(GET_DISPATCH(), (x,y))
|
||||
#define VERTEX3(x,y,z) CALL_Vertex3f(GET_DISPATCH(), (x,y,z))
|
||||
#define VERTEX4(x,y,z,w) CALL_Vertex4f(GET_DISPATCH(), (x,y,z,w))
|
||||
#define NORMAL(x,y,z) CALL_Normal3f(GET_DISPATCH(), (x,y,z))
|
||||
#define TEXCOORD1(s) CALL_TexCoord1f(GET_DISPATCH(), (s))
|
||||
#define TEXCOORD2(s,t) CALL_TexCoord2f(GET_DISPATCH(), (s,t))
|
||||
#define TEXCOORD3(s,t,u) CALL_TexCoord3f(GET_DISPATCH(), (s,t,u))
|
||||
#define TEXCOORD4(s,t,u,v) CALL_TexCoord4f(GET_DISPATCH(), (s,t,u,v))
|
||||
#define INDEX(c) CALL_Indexf(GET_DISPATCH(), (c))
|
||||
#define MULTI_TEXCOORD1(z,s) CALL_MultiTexCoord1fARB(GET_DISPATCH(), (z,s))
|
||||
#define MULTI_TEXCOORD2(z,s,t) CALL_MultiTexCoord2fARB(GET_DISPATCH(), (z,s,t))
|
||||
#define MULTI_TEXCOORD3(z,s,t,u) CALL_MultiTexCoord3fARB(GET_DISPATCH(), (z,s,t,u))
|
||||
#define MULTI_TEXCOORD4(z,s,t,u,v) CALL_MultiTexCoord4fARB(GET_DISPATCH(), (z,s,t,u,v))
|
||||
#define EVALCOORD1(x) CALL_EvalCoord1f(GET_DISPATCH(), (x))
|
||||
#define EVALCOORD2(x,y) CALL_EvalCoord2f(GET_DISPATCH(), (x,y))
|
||||
#define MATERIALFV(a,b,c) CALL_Materialfv(GET_DISPATCH(), (a,b,c))
|
||||
#define RECTF(a,b,c,d) CALL_Rectf(GET_DISPATCH(), (a,b,c,d))
|
||||
#define COLORF(r,g,b,a) CALL_Color4f(get_dispatch(), (r,g,b,a))
|
||||
#define VERTEX2(x,y) CALL_Vertex2f(get_dispatch(), (x,y))
|
||||
#define VERTEX3(x,y,z) CALL_Vertex3f(get_dispatch(), (x,y,z))
|
||||
#define VERTEX4(x,y,z,w) CALL_Vertex4f(get_dispatch(), (x,y,z,w))
|
||||
#define NORMAL(x,y,z) CALL_Normal3f(get_dispatch(), (x,y,z))
|
||||
#define TEXCOORD1(s) CALL_TexCoord1f(get_dispatch(), (s))
|
||||
#define TEXCOORD2(s,t) CALL_TexCoord2f(get_dispatch(), (s,t))
|
||||
#define TEXCOORD3(s,t,u) CALL_TexCoord3f(get_dispatch(), (s,t,u))
|
||||
#define TEXCOORD4(s,t,u,v) CALL_TexCoord4f(get_dispatch(), (s,t,u,v))
|
||||
#define INDEX(c) CALL_Indexf(get_dispatch(), (c))
|
||||
#define MULTI_TEXCOORD1(z,s) CALL_MultiTexCoord1fARB(get_dispatch(), (z,s))
|
||||
#define MULTI_TEXCOORD2(z,s,t) CALL_MultiTexCoord2fARB(get_dispatch(), (z,s,t))
|
||||
#define MULTI_TEXCOORD3(z,s,t,u) CALL_MultiTexCoord3fARB(get_dispatch(), (z,s,t,u))
|
||||
#define MULTI_TEXCOORD4(z,s,t,u,v) CALL_MultiTexCoord4fARB(get_dispatch(), (z,s,t,u,v))
|
||||
#define EVALCOORD1(x) CALL_EvalCoord1f(get_dispatch(), (x))
|
||||
#define EVALCOORD2(x,y) CALL_EvalCoord2f(get_dispatch(), (x,y))
|
||||
#define MATERIALFV(a,b,c) CALL_Materialfv(get_dispatch(), (a,b,c))
|
||||
#define RECTF(a,b,c,d) CALL_Rectf(get_dispatch(), (a,b,c,d))
|
||||
|
||||
#define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x))
|
||||
#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c))
|
||||
#define FOGCOORDF(x) CALL_FogCoordfEXT(get_dispatch(), (x))
|
||||
#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(get_dispatch(), (a,b,c))
|
||||
|
||||
#define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(GET_DISPATCH(), (index,x))
|
||||
#define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(GET_DISPATCH(), (index,x,y))
|
||||
#define ATTRIB3NV(index,x,y,z) CALL_VertexAttrib3fNV(GET_DISPATCH(), (index,x,y,z))
|
||||
#define ATTRIB4NV(index,x,y,z,w) CALL_VertexAttrib4fNV(GET_DISPATCH(), (index,x,y,z,w))
|
||||
#define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(get_dispatch(), (index,x))
|
||||
#define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(get_dispatch(), (index,x,y))
|
||||
#define ATTRIB3NV(index,x,y,z) CALL_VertexAttrib3fNV(get_dispatch(), (index,x,y,z))
|
||||
#define ATTRIB4NV(index,x,y,z,w) CALL_VertexAttrib4fNV(get_dispatch(), (index,x,y,z,w))
|
||||
|
||||
#define ATTRIB1ARB(index,x) CALL_VertexAttrib1fARB(GET_DISPATCH(), (index,x))
|
||||
#define ATTRIB2ARB(index,x,y) CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,x,y))
|
||||
#define ATTRIB3ARB(index,x,y,z) CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,x,y,z))
|
||||
#define ATTRIB4ARB(index,x,y,z,w) CALL_VertexAttrib4fARB(GET_DISPATCH(), (index,x,y,z,w))
|
||||
#define ATTRIB1ARB(index,x) CALL_VertexAttrib1fARB(get_dispatch(), (index,x))
|
||||
#define ATTRIB2ARB(index,x,y) CALL_VertexAttrib2fARB(get_dispatch(), (index,x,y))
|
||||
#define ATTRIB3ARB(index,x,y,z) CALL_VertexAttrib3fARB(get_dispatch(), (index,x,y,z))
|
||||
#define ATTRIB4ARB(index,x,y,z,w) CALL_VertexAttrib4fARB(get_dispatch(), (index,x,y,z,w))
|
||||
|
||||
#define ATTRIBI_1I(index,x) CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index,x))
|
||||
#define ATTRIBI_1UI(index,x) CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index,x))
|
||||
#define ATTRIBI_4I(index,x,y,z,w) CALL_VertexAttribI4iEXT(GET_DISPATCH(), (index,x,y,z,w))
|
||||
#define ATTRIBI_1I(index,x) CALL_VertexAttribI1iEXT(get_dispatch(), (index,x))
|
||||
#define ATTRIBI_1UI(index,x) CALL_VertexAttribI1uiEXT(get_dispatch(), (index,x))
|
||||
#define ATTRIBI_4I(index,x,y,z,w) CALL_VertexAttribI4iEXT(get_dispatch(), (index,x,y,z,w))
|
||||
|
||||
#define ATTRIBI_4UI(index,x,y,z,w) CALL_VertexAttribI4uiEXT(GET_DISPATCH(), (index,x,y,z,w))
|
||||
#define ATTRIBI_4UI(index,x,y,z,w) CALL_VertexAttribI4uiEXT(get_dispatch(), (index,x,y,z,w))
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_Color3b( GLbyte red, GLbyte green, GLbyte blue )
|
||||
@@ -353,7 +361,7 @@ _mesa_Indexubv( const GLubyte *c )
|
||||
void GLAPIENTRY
|
||||
_mesa_EdgeFlagv(const GLboolean *flag)
|
||||
{
|
||||
CALL_EdgeFlag(GET_DISPATCH(), (*flag));
|
||||
CALL_EdgeFlag(get_dispatch(), (*flag));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -383,12 +383,14 @@ _mesa_exec_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
CALL_Begin(GET_DISPATCH(), (GL_QUADS));
|
||||
CALL_Vertex2f(GET_DISPATCH(), (x1, y1));
|
||||
CALL_Vertex2f(GET_DISPATCH(), (x2, y1));
|
||||
CALL_Vertex2f(GET_DISPATCH(), (x2, y2));
|
||||
CALL_Vertex2f(GET_DISPATCH(), (x1, y2));
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_QUADS));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
CALL_Vertex2f(dispatch, (x1, y1));
|
||||
CALL_Vertex2f(dispatch, (x2, y1));
|
||||
CALL_Vertex2f(dispatch, (x2, y2));
|
||||
CALL_Vertex2f(dispatch, (x1, y2));
|
||||
CALL_End(dispatch, ());
|
||||
}
|
||||
|
||||
|
||||
@@ -420,11 +422,14 @@ _mesa_EvalMesh1(GLenum mode, GLint i1, GLint i2)
|
||||
du = ctx->Eval.MapGrid1du;
|
||||
u = ctx->Eval.MapGrid1u1 + i1 * du;
|
||||
|
||||
CALL_Begin(GET_DISPATCH(), (prim));
|
||||
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (prim));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
for (i = i1; i <= i2; i++, u += du) {
|
||||
CALL_EvalCoord1f(GET_DISPATCH(), (u));
|
||||
CALL_EvalCoord1f(dispatch, (u));
|
||||
}
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_End(dispatch, ());
|
||||
}
|
||||
|
||||
|
||||
@@ -455,40 +460,50 @@ _mesa_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
|
||||
v1 = ctx->Eval.MapGrid2v1 + j1 * dv;
|
||||
u1 = ctx->Eval.MapGrid2u1 + i1 * du;
|
||||
|
||||
struct _glapi_table *dispatch;
|
||||
|
||||
switch (mode) {
|
||||
case GL_POINT:
|
||||
CALL_Begin(GET_DISPATCH(), (GL_POINTS));
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_POINTS));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
dispatch = ctx->CurrentServerDispatch;
|
||||
for (v = v1, j = j1; j <= j2; j++, v += dv) {
|
||||
for (u = u1, i = i1; i <= i2; i++, u += du) {
|
||||
CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
|
||||
CALL_EvalCoord2f(dispatch, (u, v));
|
||||
}
|
||||
}
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_End(dispatch, ());
|
||||
break;
|
||||
case GL_LINE:
|
||||
for (v = v1, j = j1; j <= j2; j++, v += dv) {
|
||||
CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP));
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_LINE_STRIP));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
dispatch = ctx->CurrentServerDispatch;
|
||||
for (u = u1, i = i1; i <= i2; i++, u += du) {
|
||||
CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
|
||||
CALL_EvalCoord2f(dispatch, (u, v));
|
||||
}
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_End(dispatch, ());
|
||||
}
|
||||
for (u = u1, i = i1; i <= i2; i++, u += du) {
|
||||
CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP));
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_LINE_STRIP));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
dispatch = ctx->CurrentServerDispatch;
|
||||
for (v = v1, j = j1; j <= j2; j++, v += dv) {
|
||||
CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
|
||||
CALL_EvalCoord2f(dispatch, (u, v));
|
||||
}
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_End(dispatch, ());
|
||||
}
|
||||
break;
|
||||
case GL_FILL:
|
||||
for (v = v1, j = j1; j < j2; j++, v += dv) {
|
||||
CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP));
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_TRIANGLE_STRIP));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
dispatch = ctx->CurrentServerDispatch;
|
||||
for (u = u1, i = i1; i <= i2; i++, u += du) {
|
||||
CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
|
||||
CALL_EvalCoord2f(GET_DISPATCH(), (u, v + dv));
|
||||
CALL_EvalCoord2f(dispatch, (u, v));
|
||||
CALL_EvalCoord2f(dispatch, (u, v + dv));
|
||||
}
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_End(dispatch, ());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -159,9 +159,9 @@ void vbo_exec_do_EvalCoord1f(struct vbo_exec_context *exec, GLfloat u)
|
||||
map->Order);
|
||||
|
||||
if (exec->eval.map1[0].sz == 4)
|
||||
CALL_Vertex4fv(GET_DISPATCH(), ( vertex ));
|
||||
CALL_Vertex4fv(exec->ctx->CurrentServerDispatch, ( vertex ));
|
||||
else
|
||||
CALL_Vertex3fv(GET_DISPATCH(), ( vertex ));
|
||||
CALL_Vertex3fv(exec->ctx->CurrentServerDispatch, ( vertex ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,9 +239,9 @@ void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec,
|
||||
}
|
||||
|
||||
if (exec->vtx.attr[VBO_ATTRIB_POS].size == 4)
|
||||
CALL_Vertex4fv(GET_DISPATCH(), ( vertex ));
|
||||
CALL_Vertex4fv(exec->ctx->CurrentServerDispatch, ( vertex ));
|
||||
else
|
||||
CALL_Vertex3fv(GET_DISPATCH(), ( vertex ));
|
||||
CALL_Vertex3fv(exec->ctx->CurrentServerDispatch, ( vertex ));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1227,7 +1227,7 @@ _save_PrimitiveRestartNV(void)
|
||||
bool no_current_update = save->no_current_update;
|
||||
|
||||
/* restart primitive */
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_End(ctx->CurrentServerDispatch, ());
|
||||
vbo_save_NotifyBegin(ctx, curPrim, no_current_update);
|
||||
}
|
||||
}
|
||||
@@ -1242,12 +1242,14 @@ static void GLAPIENTRY
|
||||
_save_OBE_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
|
||||
vbo_save_NotifyBegin(ctx, GL_QUADS, false);
|
||||
CALL_Vertex2f(GET_DISPATCH(), (x1, y1));
|
||||
CALL_Vertex2f(GET_DISPATCH(), (x2, y1));
|
||||
CALL_Vertex2f(GET_DISPATCH(), (x2, y2));
|
||||
CALL_Vertex2f(GET_DISPATCH(), (x1, y2));
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_Vertex2f(dispatch, (x1, y1));
|
||||
CALL_Vertex2f(dispatch, (x2, y1));
|
||||
CALL_Vertex2f(dispatch, (x2, y2));
|
||||
CALL_Vertex2f(dispatch, (x1, y2));
|
||||
CALL_End(dispatch, ());
|
||||
}
|
||||
|
||||
|
||||
@@ -1280,7 +1282,7 @@ _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
_mesa_array_element(ctx, start + i);
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_End(ctx->CurrentServerDispatch, ());
|
||||
|
||||
_mesa_vao_unmap_arrays(ctx, vao);
|
||||
}
|
||||
@@ -1335,7 +1337,7 @@ array_element(struct gl_context *ctx,
|
||||
*/
|
||||
if (ctx->Array._PrimitiveRestart &&
|
||||
elt == ctx->Array._RestartIndex[index_size - 1]) {
|
||||
CALL_PrimitiveRestartNV(GET_DISPATCH(), ());
|
||||
CALL_PrimitiveRestartNV(ctx->CurrentServerDispatch, ());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1403,7 +1405,7 @@ _save_OBE_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
|
||||
break;
|
||||
}
|
||||
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_End(ctx->CurrentServerDispatch, ());
|
||||
|
||||
_mesa_vao_unmap(ctx, vao);
|
||||
}
|
||||
@@ -1456,11 +1458,13 @@ static void GLAPIENTRY
|
||||
_save_OBE_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
|
||||
const GLvoid * const *indices, GLsizei primcount)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
GLsizei i;
|
||||
|
||||
for (i = 0; i < primcount; i++) {
|
||||
if (count[i] > 0) {
|
||||
CALL_DrawElements(GET_DISPATCH(), (mode, count[i], type, indices[i]));
|
||||
CALL_DrawElements(dispatch, (mode, count[i], type, indices[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1473,11 +1477,13 @@ _save_OBE_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
|
||||
GLsizei primcount,
|
||||
const GLint *basevertex)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
GLsizei i;
|
||||
|
||||
for (i = 0; i < primcount; i++) {
|
||||
if (count[i] > 0) {
|
||||
CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode, count[i], type,
|
||||
CALL_DrawElementsBaseVertex(dispatch, (mode, count[i], type,
|
||||
indices[i],
|
||||
basevertex[i]));
|
||||
}
|
||||
|
@@ -112,7 +112,7 @@ loopback_prim(struct gl_context *ctx,
|
||||
stride);
|
||||
|
||||
if (prim->begin) {
|
||||
CALL_Begin(GET_DISPATCH(), (prim->mode));
|
||||
CALL_Begin(ctx->Exec, (prim->mode));
|
||||
}
|
||||
else {
|
||||
start += wrap_count;
|
||||
@@ -128,7 +128,7 @@ loopback_prim(struct gl_context *ctx,
|
||||
}
|
||||
|
||||
if (prim->end) {
|
||||
CALL_End(GET_DISPATCH(), ());
|
||||
CALL_End(ctx->Exec, ());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user