aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/SConscript2
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c12
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c2
-rw-r--r--mesalib/src/mesa/main/APIspecutil.py2
-rw-r--r--mesalib/src/mesa/main/api_exec.c52
-rw-r--r--mesalib/src/mesa/main/api_loopback.c439
-rw-r--r--mesalib/src/mesa/main/api_loopback.h4
-rw-r--r--mesalib/src/mesa/main/bufferobj.c4
-rw-r--r--mesalib/src/mesa/main/context.c17
-rw-r--r--mesalib/src/mesa/main/context.h2
-rw-r--r--mesalib/src/mesa/main/dlist.c6
-rw-r--r--mesalib/src/mesa/main/dlist.h2
-rw-r--r--mesalib/src/mesa/main/image.c4
-rw-r--r--mesalib/src/mesa/main/shaderapi.c51
-rw-r--r--mesalib/src/mesa/main/shaderapi.h3
-rw-r--r--mesalib/src/mesa/main/uniforms.c70
-rw-r--r--mesalib/src/mesa/main/uniforms.h3
-rw-r--r--mesalib/src/mesa/main/version.c88
-rw-r--r--mesalib/src/mesa/main/version.h3
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c126
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_blit.c326
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c70
22 files changed, 676 insertions, 612 deletions
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index dba75a264..981908217 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -371,7 +371,7 @@ if env['gles']:
#
# Assembly sources
#
-if env['gcc'] and env['platform'] not in ('darwin', 'windows'):
+if env['gcc'] and env['platform'] not in ('cygwin', 'darwin', 'windows'):
if env['machine'] == 'x86':
env.Append(CPPDEFINES = [
'USE_X86_ASM',
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 6689337e3..d0bb5e0ae 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -3489,12 +3489,16 @@ get_temp_image_type(struct gl_context *ctx, gl_format format)
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
case GL_INTENSITY:
- if (ctx->DrawBuffer->Visual.redBits <= 8)
+ if (ctx->DrawBuffer->Visual.redBits <= 8) {
return GL_UNSIGNED_BYTE;
- else if (ctx->DrawBuffer->Visual.redBits <= 16)
+ } else if (ctx->DrawBuffer->Visual.redBits <= 16) {
return GL_UNSIGNED_SHORT;
- else
- return _mesa_get_format_datatype(format);
+ } else {
+ GLenum datatype = _mesa_get_format_datatype(format);
+ if (datatype == GL_INT || datatype == GL_UNSIGNED_INT)
+ return datatype;
+ return GL_FLOAT;
+ }
case GL_DEPTH_COMPONENT:
return GL_UNSIGNED_INT;
case GL_DEPTH_STENCIL:
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 4276ad981..983bbea49 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -272,7 +272,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
return NULL;
}
- context = malloc(sizeof *context);
+ context = calloc(1, sizeof *context);
if (!context) {
*error = __DRI_CTX_ERROR_NO_MEMORY;
return NULL;
diff --git a/mesalib/src/mesa/main/APIspecutil.py b/mesalib/src/mesa/main/APIspecutil.py
index 9e604bb84..3c1552809 100644
--- a/mesalib/src/mesa/main/APIspecutil.py
+++ b/mesalib/src/mesa/main/APIspecutil.py
@@ -189,7 +189,7 @@ def _MaxVecSize(func, param):
need_conv = __aliases[func.name][1]
if need_conv:
print >>sys.stderr, \
- "Error: unable to dicide the max size of %s in %s" % \
+ "Error: unable to decide the max size of %s in %s" % \
(param.name, func.name)
return size
diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c
index 1da041545..ddf7c7fc1 100644
--- a/mesalib/src/mesa/main/api_exec.c
+++ b/mesalib/src/mesa/main/api_exec.c
@@ -114,7 +114,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
return NULL;
#if _HAVE_FULL_GL
- _mesa_loopback_init_api_table( exec );
+ _mesa_loopback_init_api_table(ctx, exec);
#endif
/* load the dispatch slots we understand */
@@ -188,7 +188,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
_mesa_init_dlist_dispatch(exec);
}
- SET_ClearDepth(exec, _mesa_ClearDepth);
+ if (ctx->API != API_OPENGLES2) {
+ SET_ClearDepth(exec, _mesa_ClearDepth);
+ }
+
if (ctx->API == API_OPENGL) {
SET_ClearIndex(exec, _mesa_ClearIndex);
SET_ClipPlane(exec, _mesa_ClipPlane);
@@ -196,7 +199,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
}
SET_DepthFunc(exec, _mesa_DepthFunc);
SET_DepthMask(exec, _mesa_DepthMask);
- SET_DepthRange(exec, _mesa_DepthRange);
+
+ if (ctx->API != API_OPENGLES2) {
+ SET_DepthRange(exec, _mesa_DepthRange);
+ }
if (ctx->API != API_OPENGLES2 && ctx->API != API_OPENGL_CORE) {
_mesa_init_drawpix_dispatch(exec);
@@ -214,7 +220,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetClipPlane(exec, _mesa_GetClipPlane);
}
SET_GetBooleanv(exec, _mesa_GetBooleanv);
- SET_GetDoublev(exec, _mesa_GetDoublev);
+ if (ctx->API != API_OPENGLES2) {
+ SET_GetDoublev(exec, _mesa_GetDoublev);
+ }
SET_GetIntegerv(exec, _mesa_GetIntegerv);
if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_GetLightfv(exec, _mesa_GetLightfv);
@@ -259,11 +267,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
if (ctx->API != API_OPENGLES2) {
SET_PixelStoref(exec, _mesa_PixelStoref);
- }
- SET_PointSize(exec, _mesa_PointSize);
+ SET_PointSize(exec, _mesa_PointSize);
- if (ctx->API != API_OPENGLES2) {
SET_PolygonMode(exec, _mesa_PolygonMode);
}
@@ -358,8 +364,8 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate);
SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate);
- _mesa_init_shader_dispatch(exec);
- _mesa_init_shader_uniform_dispatch(exec);
+ _mesa_init_shader_dispatch(ctx, exec);
+ _mesa_init_shader_uniform_dispatch(ctx, exec);
/* 2. GL_EXT_blend_color */
#if 0
@@ -422,8 +428,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 54. GL_EXT_point_parameters */
#if _HAVE_FULL_GL
- SET_PointParameterfEXT(exec, _mesa_PointParameterf);
- SET_PointParameterfvEXT(exec, _mesa_PointParameterfv);
+ if (ctx->API != API_OPENGLES2) {
+ SET_PointParameterfEXT(exec, _mesa_PointParameterf);
+ SET_PointParameterfvEXT(exec, _mesa_PointParameterfv);
+ }
#endif
/* 95. GL_ARB_ES2_compatibility */
@@ -450,7 +458,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 196. GL_MESA_resize_buffers */
#if _HAVE_FULL_GL
- SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA);
+ if (_mesa_is_desktop_gl(ctx)) {
+ SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA);
+ }
#endif
/* 197. GL_MESA_window_pos */
@@ -521,8 +531,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 262. GL_NV_point_sprite */
#if _HAVE_FULL_GL
- SET_PointParameteriNV(exec, _mesa_PointParameteri);
- SET_PointParameterivNV(exec, _mesa_PointParameteriv);
+ if (_mesa_is_desktop_gl(ctx)) {
+ SET_PointParameteriNV(exec, _mesa_PointParameteri);
+ SET_PointParameterivNV(exec, _mesa_PointParameteriv);
+ }
#endif
/* 268. GL_EXT_stencil_two_side */
@@ -662,11 +674,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB);
SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB);
+ SET_GetProgramivARB(exec, _mesa_GetProgramivARB);
SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB);
}
- SET_GetProgramivARB(exec, _mesa_GetProgramivARB);
/* ARB 28. GL_ARB_vertex_buffer_object */
_mesa_init_bufferobj_dispatch(ctx, exec);
@@ -862,10 +874,12 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_TexStorage1D(exec, _mesa_TexStorage1D);
SET_TextureStorage1DEXT(exec, _mesa_TextureStorage1DEXT);
}
- SET_TexStorage2D(exec, _mesa_TexStorage2D);
- SET_TexStorage3D(exec, _mesa_TexStorage3D);
- SET_TextureStorage2DEXT(exec, _mesa_TextureStorage2DEXT);
- SET_TextureStorage3DEXT(exec, _mesa_TextureStorage3DEXT);
+ if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+ SET_TexStorage2D(exec, _mesa_TexStorage2D);
+ SET_TexStorage3D(exec, _mesa_TexStorage3D);
+ SET_TextureStorage2DEXT(exec, _mesa_TextureStorage2DEXT);
+ SET_TextureStorage3DEXT(exec, _mesa_TextureStorage3DEXT);
+ }
if (ctx->API != API_OPENGLES2) {
_mesa_init_sampler_object_dispatch(exec);
diff --git a/mesalib/src/mesa/main/api_loopback.c b/mesalib/src/mesa/main/api_loopback.c
index a5fbe8ebf..330eb22f7 100644
--- a/mesalib/src/mesa/main/api_loopback.c
+++ b/mesalib/src/mesa/main/api_loopback.c
@@ -1499,221 +1499,228 @@ loopback_VertexAttribI4usv(GLuint index, const GLushort *v)
* listed in vtxfmt.h.
*/
void
-_mesa_loopback_init_api_table( struct _glapi_table *dest )
-{
- SET_Color3b(dest, loopback_Color3b_f);
- SET_Color3d(dest, loopback_Color3d_f);
- SET_Color3i(dest, loopback_Color3i_f);
- SET_Color3s(dest, loopback_Color3s_f);
- SET_Color3ui(dest, loopback_Color3ui_f);
- SET_Color3us(dest, loopback_Color3us_f);
- SET_Color3ub(dest, loopback_Color3ub_f);
- SET_Color4b(dest, loopback_Color4b_f);
- SET_Color4d(dest, loopback_Color4d_f);
- SET_Color4i(dest, loopback_Color4i_f);
- SET_Color4s(dest, loopback_Color4s_f);
- SET_Color4ui(dest, loopback_Color4ui_f);
- SET_Color4us(dest, loopback_Color4us_f);
- SET_Color4ub(dest, loopback_Color4ub_f);
- SET_Color3bv(dest, loopback_Color3bv_f);
- SET_Color3dv(dest, loopback_Color3dv_f);
- SET_Color3iv(dest, loopback_Color3iv_f);
- SET_Color3sv(dest, loopback_Color3sv_f);
- SET_Color3uiv(dest, loopback_Color3uiv_f);
- SET_Color3usv(dest, loopback_Color3usv_f);
- SET_Color3ubv(dest, loopback_Color3ubv_f);
- SET_Color4bv(dest, loopback_Color4bv_f);
- SET_Color4dv(dest, loopback_Color4dv_f);
- SET_Color4iv(dest, loopback_Color4iv_f);
- SET_Color4sv(dest, loopback_Color4sv_f);
- SET_Color4uiv(dest, loopback_Color4uiv_f);
- SET_Color4usv(dest, loopback_Color4usv_f);
- SET_Color4ubv(dest, loopback_Color4ubv_f);
-
- SET_SecondaryColor3bEXT(dest, loopback_SecondaryColor3bEXT_f);
- SET_SecondaryColor3dEXT(dest, loopback_SecondaryColor3dEXT_f);
- SET_SecondaryColor3iEXT(dest, loopback_SecondaryColor3iEXT_f);
- SET_SecondaryColor3sEXT(dest, loopback_SecondaryColor3sEXT_f);
- SET_SecondaryColor3uiEXT(dest, loopback_SecondaryColor3uiEXT_f);
- SET_SecondaryColor3usEXT(dest, loopback_SecondaryColor3usEXT_f);
- SET_SecondaryColor3ubEXT(dest, loopback_SecondaryColor3ubEXT_f);
- SET_SecondaryColor3bvEXT(dest, loopback_SecondaryColor3bvEXT_f);
- SET_SecondaryColor3dvEXT(dest, loopback_SecondaryColor3dvEXT_f);
- SET_SecondaryColor3ivEXT(dest, loopback_SecondaryColor3ivEXT_f);
- SET_SecondaryColor3svEXT(dest, loopback_SecondaryColor3svEXT_f);
- SET_SecondaryColor3uivEXT(dest, loopback_SecondaryColor3uivEXT_f);
- SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f);
- SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f);
+_mesa_loopback_init_api_table(const struct gl_context *ctx,
+ struct _glapi_table *dest)
+{
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
+ SET_Color3b(dest, loopback_Color3b_f);
+ SET_Color3d(dest, loopback_Color3d_f);
+ SET_Color3i(dest, loopback_Color3i_f);
+ SET_Color3s(dest, loopback_Color3s_f);
+ SET_Color3ui(dest, loopback_Color3ui_f);
+ SET_Color3us(dest, loopback_Color3us_f);
+ SET_Color3ub(dest, loopback_Color3ub_f);
+ SET_Color4b(dest, loopback_Color4b_f);
+ SET_Color4d(dest, loopback_Color4d_f);
+ SET_Color4i(dest, loopback_Color4i_f);
+ SET_Color4s(dest, loopback_Color4s_f);
+ SET_Color4ui(dest, loopback_Color4ui_f);
+ SET_Color4us(dest, loopback_Color4us_f);
+ SET_Color4ub(dest, loopback_Color4ub_f);
+ SET_Color3bv(dest, loopback_Color3bv_f);
+ SET_Color3dv(dest, loopback_Color3dv_f);
+ SET_Color3iv(dest, loopback_Color3iv_f);
+ SET_Color3sv(dest, loopback_Color3sv_f);
+ SET_Color3uiv(dest, loopback_Color3uiv_f);
+ SET_Color3usv(dest, loopback_Color3usv_f);
+ SET_Color3ubv(dest, loopback_Color3ubv_f);
+ SET_Color4bv(dest, loopback_Color4bv_f);
+ SET_Color4dv(dest, loopback_Color4dv_f);
+ SET_Color4iv(dest, loopback_Color4iv_f);
+ SET_Color4sv(dest, loopback_Color4sv_f);
+ SET_Color4uiv(dest, loopback_Color4uiv_f);
+ SET_Color4usv(dest, loopback_Color4usv_f);
+ SET_Color4ubv(dest, loopback_Color4ubv_f);
+
+ SET_SecondaryColor3bEXT(dest, loopback_SecondaryColor3bEXT_f);
+ SET_SecondaryColor3dEXT(dest, loopback_SecondaryColor3dEXT_f);
+ SET_SecondaryColor3iEXT(dest, loopback_SecondaryColor3iEXT_f);
+ SET_SecondaryColor3sEXT(dest, loopback_SecondaryColor3sEXT_f);
+ SET_SecondaryColor3uiEXT(dest, loopback_SecondaryColor3uiEXT_f);
+ SET_SecondaryColor3usEXT(dest, loopback_SecondaryColor3usEXT_f);
+ SET_SecondaryColor3ubEXT(dest, loopback_SecondaryColor3ubEXT_f);
+ SET_SecondaryColor3bvEXT(dest, loopback_SecondaryColor3bvEXT_f);
+ SET_SecondaryColor3dvEXT(dest, loopback_SecondaryColor3dvEXT_f);
+ SET_SecondaryColor3ivEXT(dest, loopback_SecondaryColor3ivEXT_f);
+ SET_SecondaryColor3svEXT(dest, loopback_SecondaryColor3svEXT_f);
+ SET_SecondaryColor3uivEXT(dest, loopback_SecondaryColor3uivEXT_f);
+ SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f);
+ SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f);
- SET_EdgeFlagv(dest, loopback_EdgeFlagv);
-
- SET_Indexd(dest, loopback_Indexd);
- SET_Indexi(dest, loopback_Indexi);
- SET_Indexs(dest, loopback_Indexs);
- SET_Indexub(dest, loopback_Indexub);
- SET_Indexdv(dest, loopback_Indexdv);
- SET_Indexiv(dest, loopback_Indexiv);
- SET_Indexsv(dest, loopback_Indexsv);
- SET_Indexubv(dest, loopback_Indexubv);
- SET_Normal3b(dest, loopback_Normal3b);
- SET_Normal3d(dest, loopback_Normal3d);
- SET_Normal3i(dest, loopback_Normal3i);
- SET_Normal3s(dest, loopback_Normal3s);
- SET_Normal3bv(dest, loopback_Normal3bv);
- SET_Normal3dv(dest, loopback_Normal3dv);
- SET_Normal3iv(dest, loopback_Normal3iv);
- SET_Normal3sv(dest, loopback_Normal3sv);
- SET_TexCoord1d(dest, loopback_TexCoord1d);
- SET_TexCoord1i(dest, loopback_TexCoord1i);
- SET_TexCoord1s(dest, loopback_TexCoord1s);
- SET_TexCoord2d(dest, loopback_TexCoord2d);
- SET_TexCoord2s(dest, loopback_TexCoord2s);
- SET_TexCoord2i(dest, loopback_TexCoord2i);
- SET_TexCoord3d(dest, loopback_TexCoord3d);
- SET_TexCoord3i(dest, loopback_TexCoord3i);
- SET_TexCoord3s(dest, loopback_TexCoord3s);
- SET_TexCoord4d(dest, loopback_TexCoord4d);
- SET_TexCoord4i(dest, loopback_TexCoord4i);
- SET_TexCoord4s(dest, loopback_TexCoord4s);
- SET_TexCoord1dv(dest, loopback_TexCoord1dv);
- SET_TexCoord1iv(dest, loopback_TexCoord1iv);
- SET_TexCoord1sv(dest, loopback_TexCoord1sv);
- SET_TexCoord2dv(dest, loopback_TexCoord2dv);
- SET_TexCoord2iv(dest, loopback_TexCoord2iv);
- SET_TexCoord2sv(dest, loopback_TexCoord2sv);
- SET_TexCoord3dv(dest, loopback_TexCoord3dv);
- SET_TexCoord3iv(dest, loopback_TexCoord3iv);
- SET_TexCoord3sv(dest, loopback_TexCoord3sv);
- SET_TexCoord4dv(dest, loopback_TexCoord4dv);
- SET_TexCoord4iv(dest, loopback_TexCoord4iv);
- SET_TexCoord4sv(dest, loopback_TexCoord4sv);
- SET_Vertex2d(dest, loopback_Vertex2d);
- SET_Vertex2i(dest, loopback_Vertex2i);
- SET_Vertex2s(dest, loopback_Vertex2s);
- SET_Vertex3d(dest, loopback_Vertex3d);
- SET_Vertex3i(dest, loopback_Vertex3i);
- SET_Vertex3s(dest, loopback_Vertex3s);
- SET_Vertex4d(dest, loopback_Vertex4d);
- SET_Vertex4i(dest, loopback_Vertex4i);
- SET_Vertex4s(dest, loopback_Vertex4s);
- SET_Vertex2dv(dest, loopback_Vertex2dv);
- SET_Vertex2iv(dest, loopback_Vertex2iv);
- SET_Vertex2sv(dest, loopback_Vertex2sv);
- SET_Vertex3dv(dest, loopback_Vertex3dv);
- SET_Vertex3iv(dest, loopback_Vertex3iv);
- SET_Vertex3sv(dest, loopback_Vertex3sv);
- SET_Vertex4dv(dest, loopback_Vertex4dv);
- SET_Vertex4iv(dest, loopback_Vertex4iv);
- SET_Vertex4sv(dest, loopback_Vertex4sv);
- SET_MultiTexCoord1dARB(dest, loopback_MultiTexCoord1dARB);
- SET_MultiTexCoord1dvARB(dest, loopback_MultiTexCoord1dvARB);
- SET_MultiTexCoord1iARB(dest, loopback_MultiTexCoord1iARB);
- SET_MultiTexCoord1ivARB(dest, loopback_MultiTexCoord1ivARB);
- SET_MultiTexCoord1sARB(dest, loopback_MultiTexCoord1sARB);
- SET_MultiTexCoord1svARB(dest, loopback_MultiTexCoord1svARB);
- SET_MultiTexCoord2dARB(dest, loopback_MultiTexCoord2dARB);
- SET_MultiTexCoord2dvARB(dest, loopback_MultiTexCoord2dvARB);
- SET_MultiTexCoord2iARB(dest, loopback_MultiTexCoord2iARB);
- SET_MultiTexCoord2ivARB(dest, loopback_MultiTexCoord2ivARB);
- SET_MultiTexCoord2sARB(dest, loopback_MultiTexCoord2sARB);
- SET_MultiTexCoord2svARB(dest, loopback_MultiTexCoord2svARB);
- SET_MultiTexCoord3dARB(dest, loopback_MultiTexCoord3dARB);
- SET_MultiTexCoord3dvARB(dest, loopback_MultiTexCoord3dvARB);
- SET_MultiTexCoord3iARB(dest, loopback_MultiTexCoord3iARB);
- SET_MultiTexCoord3ivARB(dest, loopback_MultiTexCoord3ivARB);
- SET_MultiTexCoord3sARB(dest, loopback_MultiTexCoord3sARB);
- SET_MultiTexCoord3svARB(dest, loopback_MultiTexCoord3svARB);
- SET_MultiTexCoord4dARB(dest, loopback_MultiTexCoord4dARB);
- SET_MultiTexCoord4dvARB(dest, loopback_MultiTexCoord4dvARB);
- SET_MultiTexCoord4iARB(dest, loopback_MultiTexCoord4iARB);
- SET_MultiTexCoord4ivARB(dest, loopback_MultiTexCoord4ivARB);
- SET_MultiTexCoord4sARB(dest, loopback_MultiTexCoord4sARB);
- SET_MultiTexCoord4svARB(dest, loopback_MultiTexCoord4svARB);
- SET_EvalCoord2dv(dest, loopback_EvalCoord2dv);
- SET_EvalCoord2fv(dest, loopback_EvalCoord2fv);
- SET_EvalCoord2d(dest, loopback_EvalCoord2d);
- SET_EvalCoord1dv(dest, loopback_EvalCoord1dv);
- SET_EvalCoord1fv(dest, loopback_EvalCoord1fv);
- SET_EvalCoord1d(dest, loopback_EvalCoord1d);
- SET_Materialf(dest, loopback_Materialf);
- SET_Materiali(dest, loopback_Materiali);
- SET_Materialiv(dest, loopback_Materialiv);
- SET_Rectd(dest, loopback_Rectd);
- SET_Rectdv(dest, loopback_Rectdv);
- SET_Rectfv(dest, loopback_Rectfv);
- SET_Recti(dest, loopback_Recti);
- SET_Rectiv(dest, loopback_Rectiv);
- SET_Rects(dest, loopback_Rects);
- SET_Rectsv(dest, loopback_Rectsv);
- SET_FogCoorddEXT(dest, loopback_FogCoorddEXT);
- SET_FogCoorddvEXT(dest, loopback_FogCoorddvEXT);
-
- SET_VertexAttrib1sNV(dest, loopback_VertexAttrib1sNV);
- SET_VertexAttrib1dNV(dest, loopback_VertexAttrib1dNV);
- SET_VertexAttrib2sNV(dest, loopback_VertexAttrib2sNV);
- SET_VertexAttrib2dNV(dest, loopback_VertexAttrib2dNV);
- SET_VertexAttrib3sNV(dest, loopback_VertexAttrib3sNV);
- SET_VertexAttrib3dNV(dest, loopback_VertexAttrib3dNV);
- SET_VertexAttrib4sNV(dest, loopback_VertexAttrib4sNV);
- SET_VertexAttrib4dNV(dest, loopback_VertexAttrib4dNV);
- SET_VertexAttrib4ubNV(dest, loopback_VertexAttrib4ubNV);
- SET_VertexAttrib1svNV(dest, loopback_VertexAttrib1svNV);
- SET_VertexAttrib1dvNV(dest, loopback_VertexAttrib1dvNV);
- SET_VertexAttrib2svNV(dest, loopback_VertexAttrib2svNV);
- SET_VertexAttrib2dvNV(dest, loopback_VertexAttrib2dvNV);
- SET_VertexAttrib3svNV(dest, loopback_VertexAttrib3svNV);
- SET_VertexAttrib3dvNV(dest, loopback_VertexAttrib3dvNV);
- SET_VertexAttrib4svNV(dest, loopback_VertexAttrib4svNV);
- SET_VertexAttrib4dvNV(dest, loopback_VertexAttrib4dvNV);
- SET_VertexAttrib4ubvNV(dest, loopback_VertexAttrib4ubvNV);
- SET_VertexAttribs1svNV(dest, loopback_VertexAttribs1svNV);
- SET_VertexAttribs1fvNV(dest, loopback_VertexAttribs1fvNV);
- SET_VertexAttribs1dvNV(dest, loopback_VertexAttribs1dvNV);
- SET_VertexAttribs2svNV(dest, loopback_VertexAttribs2svNV);
- SET_VertexAttribs2fvNV(dest, loopback_VertexAttribs2fvNV);
- SET_VertexAttribs2dvNV(dest, loopback_VertexAttribs2dvNV);
- SET_VertexAttribs3svNV(dest, loopback_VertexAttribs3svNV);
- SET_VertexAttribs3fvNV(dest, loopback_VertexAttribs3fvNV);
- SET_VertexAttribs3dvNV(dest, loopback_VertexAttribs3dvNV);
- SET_VertexAttribs4svNV(dest, loopback_VertexAttribs4svNV);
- SET_VertexAttribs4fvNV(dest, loopback_VertexAttribs4fvNV);
- SET_VertexAttribs4dvNV(dest, loopback_VertexAttribs4dvNV);
- SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV);
-
- SET_VertexAttrib1sARB(dest, loopback_VertexAttrib1sARB);
- SET_VertexAttrib1dARB(dest, loopback_VertexAttrib1dARB);
- SET_VertexAttrib2sARB(dest, loopback_VertexAttrib2sARB);
- SET_VertexAttrib2dARB(dest, loopback_VertexAttrib2dARB);
- SET_VertexAttrib3sARB(dest, loopback_VertexAttrib3sARB);
- SET_VertexAttrib3dARB(dest, loopback_VertexAttrib3dARB);
- SET_VertexAttrib4sARB(dest, loopback_VertexAttrib4sARB);
- SET_VertexAttrib4dARB(dest, loopback_VertexAttrib4dARB);
- SET_VertexAttrib1svARB(dest, loopback_VertexAttrib1svARB);
- SET_VertexAttrib1dvARB(dest, loopback_VertexAttrib1dvARB);
- SET_VertexAttrib2svARB(dest, loopback_VertexAttrib2svARB);
- SET_VertexAttrib2dvARB(dest, loopback_VertexAttrib2dvARB);
- SET_VertexAttrib3svARB(dest, loopback_VertexAttrib3svARB);
- SET_VertexAttrib3dvARB(dest, loopback_VertexAttrib3dvARB);
- SET_VertexAttrib4svARB(dest, loopback_VertexAttrib4svARB);
- SET_VertexAttrib4dvARB(dest, loopback_VertexAttrib4dvARB);
- SET_VertexAttrib4NubARB(dest, loopback_VertexAttrib4NubARB);
- SET_VertexAttrib4NubvARB(dest, loopback_VertexAttrib4NubvARB);
- SET_VertexAttrib4bvARB(dest, loopback_VertexAttrib4bvARB);
- SET_VertexAttrib4ivARB(dest, loopback_VertexAttrib4ivARB);
- SET_VertexAttrib4ubvARB(dest, loopback_VertexAttrib4ubvARB);
- SET_VertexAttrib4usvARB(dest, loopback_VertexAttrib4usvARB);
- SET_VertexAttrib4uivARB(dest, loopback_VertexAttrib4uivARB);
- SET_VertexAttrib4NbvARB(dest, loopback_VertexAttrib4NbvARB);
- SET_VertexAttrib4NsvARB(dest, loopback_VertexAttrib4NsvARB);
- SET_VertexAttrib4NivARB(dest, loopback_VertexAttrib4NivARB);
- SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB);
- SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB);
-
- /* GL_EXT_gpu_shader4, GL 3.0 */
- SET_VertexAttribI1ivEXT(dest, loopback_VertexAttribI1iv);
- SET_VertexAttribI1uivEXT(dest, loopback_VertexAttribI1uiv);
- SET_VertexAttribI4bvEXT(dest, loopback_VertexAttribI4bv);
- SET_VertexAttribI4svEXT(dest, loopback_VertexAttribI4sv);
- SET_VertexAttribI4ubvEXT(dest, loopback_VertexAttribI4ubv);
- SET_VertexAttribI4usvEXT(dest, loopback_VertexAttribI4usv);
+ SET_EdgeFlagv(dest, loopback_EdgeFlagv);
+
+ SET_Indexd(dest, loopback_Indexd);
+ SET_Indexi(dest, loopback_Indexi);
+ SET_Indexs(dest, loopback_Indexs);
+ SET_Indexub(dest, loopback_Indexub);
+ SET_Indexdv(dest, loopback_Indexdv);
+ SET_Indexiv(dest, loopback_Indexiv);
+ SET_Indexsv(dest, loopback_Indexsv);
+ SET_Indexubv(dest, loopback_Indexubv);
+ SET_Normal3b(dest, loopback_Normal3b);
+ SET_Normal3d(dest, loopback_Normal3d);
+ SET_Normal3i(dest, loopback_Normal3i);
+ SET_Normal3s(dest, loopback_Normal3s);
+ SET_Normal3bv(dest, loopback_Normal3bv);
+ SET_Normal3dv(dest, loopback_Normal3dv);
+ SET_Normal3iv(dest, loopback_Normal3iv);
+ SET_Normal3sv(dest, loopback_Normal3sv);
+ SET_TexCoord1d(dest, loopback_TexCoord1d);
+ SET_TexCoord1i(dest, loopback_TexCoord1i);
+ SET_TexCoord1s(dest, loopback_TexCoord1s);
+ SET_TexCoord2d(dest, loopback_TexCoord2d);
+ SET_TexCoord2s(dest, loopback_TexCoord2s);
+ SET_TexCoord2i(dest, loopback_TexCoord2i);
+ SET_TexCoord3d(dest, loopback_TexCoord3d);
+ SET_TexCoord3i(dest, loopback_TexCoord3i);
+ SET_TexCoord3s(dest, loopback_TexCoord3s);
+ SET_TexCoord4d(dest, loopback_TexCoord4d);
+ SET_TexCoord4i(dest, loopback_TexCoord4i);
+ SET_TexCoord4s(dest, loopback_TexCoord4s);
+ SET_TexCoord1dv(dest, loopback_TexCoord1dv);
+ SET_TexCoord1iv(dest, loopback_TexCoord1iv);
+ SET_TexCoord1sv(dest, loopback_TexCoord1sv);
+ SET_TexCoord2dv(dest, loopback_TexCoord2dv);
+ SET_TexCoord2iv(dest, loopback_TexCoord2iv);
+ SET_TexCoord2sv(dest, loopback_TexCoord2sv);
+ SET_TexCoord3dv(dest, loopback_TexCoord3dv);
+ SET_TexCoord3iv(dest, loopback_TexCoord3iv);
+ SET_TexCoord3sv(dest, loopback_TexCoord3sv);
+ SET_TexCoord4dv(dest, loopback_TexCoord4dv);
+ SET_TexCoord4iv(dest, loopback_TexCoord4iv);
+ SET_TexCoord4sv(dest, loopback_TexCoord4sv);
+ SET_Vertex2d(dest, loopback_Vertex2d);
+ SET_Vertex2i(dest, loopback_Vertex2i);
+ SET_Vertex2s(dest, loopback_Vertex2s);
+ SET_Vertex3d(dest, loopback_Vertex3d);
+ SET_Vertex3i(dest, loopback_Vertex3i);
+ SET_Vertex3s(dest, loopback_Vertex3s);
+ SET_Vertex4d(dest, loopback_Vertex4d);
+ SET_Vertex4i(dest, loopback_Vertex4i);
+ SET_Vertex4s(dest, loopback_Vertex4s);
+ SET_Vertex2dv(dest, loopback_Vertex2dv);
+ SET_Vertex2iv(dest, loopback_Vertex2iv);
+ SET_Vertex2sv(dest, loopback_Vertex2sv);
+ SET_Vertex3dv(dest, loopback_Vertex3dv);
+ SET_Vertex3iv(dest, loopback_Vertex3iv);
+ SET_Vertex3sv(dest, loopback_Vertex3sv);
+ SET_Vertex4dv(dest, loopback_Vertex4dv);
+ SET_Vertex4iv(dest, loopback_Vertex4iv);
+ SET_Vertex4sv(dest, loopback_Vertex4sv);
+ SET_MultiTexCoord1dARB(dest, loopback_MultiTexCoord1dARB);
+ SET_MultiTexCoord1dvARB(dest, loopback_MultiTexCoord1dvARB);
+ SET_MultiTexCoord1iARB(dest, loopback_MultiTexCoord1iARB);
+ SET_MultiTexCoord1ivARB(dest, loopback_MultiTexCoord1ivARB);
+ SET_MultiTexCoord1sARB(dest, loopback_MultiTexCoord1sARB);
+ SET_MultiTexCoord1svARB(dest, loopback_MultiTexCoord1svARB);
+ SET_MultiTexCoord2dARB(dest, loopback_MultiTexCoord2dARB);
+ SET_MultiTexCoord2dvARB(dest, loopback_MultiTexCoord2dvARB);
+ SET_MultiTexCoord2iARB(dest, loopback_MultiTexCoord2iARB);
+ SET_MultiTexCoord2ivARB(dest, loopback_MultiTexCoord2ivARB);
+ SET_MultiTexCoord2sARB(dest, loopback_MultiTexCoord2sARB);
+ SET_MultiTexCoord2svARB(dest, loopback_MultiTexCoord2svARB);
+ SET_MultiTexCoord3dARB(dest, loopback_MultiTexCoord3dARB);
+ SET_MultiTexCoord3dvARB(dest, loopback_MultiTexCoord3dvARB);
+ SET_MultiTexCoord3iARB(dest, loopback_MultiTexCoord3iARB);
+ SET_MultiTexCoord3ivARB(dest, loopback_MultiTexCoord3ivARB);
+ SET_MultiTexCoord3sARB(dest, loopback_MultiTexCoord3sARB);
+ SET_MultiTexCoord3svARB(dest, loopback_MultiTexCoord3svARB);
+ SET_MultiTexCoord4dARB(dest, loopback_MultiTexCoord4dARB);
+ SET_MultiTexCoord4dvARB(dest, loopback_MultiTexCoord4dvARB);
+ SET_MultiTexCoord4iARB(dest, loopback_MultiTexCoord4iARB);
+ SET_MultiTexCoord4ivARB(dest, loopback_MultiTexCoord4ivARB);
+ SET_MultiTexCoord4sARB(dest, loopback_MultiTexCoord4sARB);
+ SET_MultiTexCoord4svARB(dest, loopback_MultiTexCoord4svARB);
+ SET_EvalCoord2dv(dest, loopback_EvalCoord2dv);
+ SET_EvalCoord2fv(dest, loopback_EvalCoord2fv);
+ SET_EvalCoord2d(dest, loopback_EvalCoord2d);
+ SET_EvalCoord1dv(dest, loopback_EvalCoord1dv);
+ SET_EvalCoord1fv(dest, loopback_EvalCoord1fv);
+ SET_EvalCoord1d(dest, loopback_EvalCoord1d);
+ SET_Materialf(dest, loopback_Materialf);
+ SET_Materiali(dest, loopback_Materiali);
+ SET_Materialiv(dest, loopback_Materialiv);
+ SET_Rectd(dest, loopback_Rectd);
+ SET_Rectdv(dest, loopback_Rectdv);
+ SET_Rectfv(dest, loopback_Rectfv);
+ SET_Recti(dest, loopback_Recti);
+ SET_Rectiv(dest, loopback_Rectiv);
+ SET_Rects(dest, loopback_Rects);
+ SET_Rectsv(dest, loopback_Rectsv);
+ SET_FogCoorddEXT(dest, loopback_FogCoorddEXT);
+ SET_FogCoorddvEXT(dest, loopback_FogCoorddvEXT);
+ }
+
+ if (ctx->API == API_OPENGL) {
+ SET_VertexAttrib1sNV(dest, loopback_VertexAttrib1sNV);
+ SET_VertexAttrib1dNV(dest, loopback_VertexAttrib1dNV);
+ SET_VertexAttrib2sNV(dest, loopback_VertexAttrib2sNV);
+ SET_VertexAttrib2dNV(dest, loopback_VertexAttrib2dNV);
+ SET_VertexAttrib3sNV(dest, loopback_VertexAttrib3sNV);
+ SET_VertexAttrib3dNV(dest, loopback_VertexAttrib3dNV);
+ SET_VertexAttrib4sNV(dest, loopback_VertexAttrib4sNV);
+ SET_VertexAttrib4dNV(dest, loopback_VertexAttrib4dNV);
+ SET_VertexAttrib4ubNV(dest, loopback_VertexAttrib4ubNV);
+ SET_VertexAttrib1svNV(dest, loopback_VertexAttrib1svNV);
+ SET_VertexAttrib1dvNV(dest, loopback_VertexAttrib1dvNV);
+ SET_VertexAttrib2svNV(dest, loopback_VertexAttrib2svNV);
+ SET_VertexAttrib2dvNV(dest, loopback_VertexAttrib2dvNV);
+ SET_VertexAttrib3svNV(dest, loopback_VertexAttrib3svNV);
+ SET_VertexAttrib3dvNV(dest, loopback_VertexAttrib3dvNV);
+ SET_VertexAttrib4svNV(dest, loopback_VertexAttrib4svNV);
+ SET_VertexAttrib4dvNV(dest, loopback_VertexAttrib4dvNV);
+ SET_VertexAttrib4ubvNV(dest, loopback_VertexAttrib4ubvNV);
+ SET_VertexAttribs1svNV(dest, loopback_VertexAttribs1svNV);
+ SET_VertexAttribs1fvNV(dest, loopback_VertexAttribs1fvNV);
+ SET_VertexAttribs1dvNV(dest, loopback_VertexAttribs1dvNV);
+ SET_VertexAttribs2svNV(dest, loopback_VertexAttribs2svNV);
+ SET_VertexAttribs2fvNV(dest, loopback_VertexAttribs2fvNV);
+ SET_VertexAttribs2dvNV(dest, loopback_VertexAttribs2dvNV);
+ SET_VertexAttribs3svNV(dest, loopback_VertexAttribs3svNV);
+ SET_VertexAttribs3fvNV(dest, loopback_VertexAttribs3fvNV);
+ SET_VertexAttribs3dvNV(dest, loopback_VertexAttribs3dvNV);
+ SET_VertexAttribs4svNV(dest, loopback_VertexAttribs4svNV);
+ SET_VertexAttribs4fvNV(dest, loopback_VertexAttribs4fvNV);
+ SET_VertexAttribs4dvNV(dest, loopback_VertexAttribs4dvNV);
+ SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV);
+ }
+
+ if (ctx->API != API_OPENGLES2) {
+ SET_VertexAttrib1sARB(dest, loopback_VertexAttrib1sARB);
+ SET_VertexAttrib1dARB(dest, loopback_VertexAttrib1dARB);
+ SET_VertexAttrib2sARB(dest, loopback_VertexAttrib2sARB);
+ SET_VertexAttrib2dARB(dest, loopback_VertexAttrib2dARB);
+ SET_VertexAttrib3sARB(dest, loopback_VertexAttrib3sARB);
+ SET_VertexAttrib3dARB(dest, loopback_VertexAttrib3dARB);
+ SET_VertexAttrib4sARB(dest, loopback_VertexAttrib4sARB);
+ SET_VertexAttrib4dARB(dest, loopback_VertexAttrib4dARB);
+ SET_VertexAttrib1svARB(dest, loopback_VertexAttrib1svARB);
+ SET_VertexAttrib1dvARB(dest, loopback_VertexAttrib1dvARB);
+ SET_VertexAttrib2svARB(dest, loopback_VertexAttrib2svARB);
+ SET_VertexAttrib2dvARB(dest, loopback_VertexAttrib2dvARB);
+ SET_VertexAttrib3svARB(dest, loopback_VertexAttrib3svARB);
+ SET_VertexAttrib3dvARB(dest, loopback_VertexAttrib3dvARB);
+ SET_VertexAttrib4svARB(dest, loopback_VertexAttrib4svARB);
+ SET_VertexAttrib4dvARB(dest, loopback_VertexAttrib4dvARB);
+ SET_VertexAttrib4NubARB(dest, loopback_VertexAttrib4NubARB);
+ SET_VertexAttrib4NubvARB(dest, loopback_VertexAttrib4NubvARB);
+ SET_VertexAttrib4bvARB(dest, loopback_VertexAttrib4bvARB);
+ SET_VertexAttrib4ivARB(dest, loopback_VertexAttrib4ivARB);
+ SET_VertexAttrib4ubvARB(dest, loopback_VertexAttrib4ubvARB);
+ SET_VertexAttrib4usvARB(dest, loopback_VertexAttrib4usvARB);
+ SET_VertexAttrib4uivARB(dest, loopback_VertexAttrib4uivARB);
+ SET_VertexAttrib4NbvARB(dest, loopback_VertexAttrib4NbvARB);
+ SET_VertexAttrib4NsvARB(dest, loopback_VertexAttrib4NsvARB);
+ SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB);
+ SET_VertexAttrib4NivARB(dest, loopback_VertexAttrib4NivARB);
+ SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB);
+
+ /* GL_EXT_gpu_shader4, GL 3.0 */
+ SET_VertexAttribI1ivEXT(dest, loopback_VertexAttribI1iv);
+ SET_VertexAttribI1uivEXT(dest, loopback_VertexAttribI1uiv);
+ SET_VertexAttribI4bvEXT(dest, loopback_VertexAttribI4bv);
+ SET_VertexAttribI4svEXT(dest, loopback_VertexAttribI4sv);
+ SET_VertexAttribI4ubvEXT(dest, loopback_VertexAttribI4ubv);
+ SET_VertexAttribI4usvEXT(dest, loopback_VertexAttribI4usv);
+ }
}
diff --git a/mesalib/src/mesa/main/api_loopback.h b/mesalib/src/mesa/main/api_loopback.h
index a99c30962..3e43286d2 100644
--- a/mesalib/src/mesa/main/api_loopback.h
+++ b/mesalib/src/mesa/main/api_loopback.h
@@ -32,6 +32,8 @@
struct _glapi_table;
-extern void _mesa_loopback_init_api_table( struct _glapi_table *dest );
+extern void
+_mesa_loopback_init_api_table(const struct gl_context *ctx,
+ struct _glapi_table *dest);
#endif /* API_LOOPBACK_H */
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 9c1e0bf52..efb8df894 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -2332,7 +2332,9 @@ _mesa_init_bufferobj_dispatch(struct gl_context *ctx, struct _glapi_table *disp)
SET_GenBuffersARB(disp, _mesa_GenBuffersARB);
SET_GetBufferParameterivARB(disp, _mesa_GetBufferParameterivARB);
SET_GetBufferPointervARB(disp, _mesa_GetBufferPointervARB);
- SET_GetBufferSubDataARB(disp, _mesa_GetBufferSubDataARB);
+ if (ctx->API != API_OPENGLES2) {
+ SET_GetBufferSubDataARB(disp, _mesa_GetBufferSubDataARB);
+ }
SET_IsBufferARB(disp, _mesa_IsBufferARB);
SET_MapBufferARB(disp, _mesa_MapBufferARB);
SET_UnmapBufferARB(disp, _mesa_UnmapBufferARB);
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index abce52e58..c50504d19 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -797,8 +797,8 @@ init_attrib_groups(struct gl_context *ctx)
/* Miscellaneous */
ctx->NewState = _NEW_ALL;
ctx->NewDriverState = ~0;
- ctx->ErrorValue = (GLenum) GL_NO_ERROR;
- ctx->ResetStatus = (GLenum) GL_NO_ERROR;
+ ctx->ErrorValue = GL_NO_ERROR;
+ ctx->ResetStatus = GL_NO_ERROR;
ctx->varying_vp_inputs = VERT_BIT_ALL;
return GL_TRUE;
@@ -832,8 +832,8 @@ update_default_objects(struct gl_context *ctx)
* This helps prevents a segfault when someone calls a GL function without
* first checking if the extension's supported.
*/
-static int
-generic_nop(void)
+int
+_mesa_generic_nop(void)
{
GET_CURRENT_CONTEXT(ctx);
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -865,7 +865,7 @@ _mesa_alloc_dispatch_table(int size)
_glapi_proc *entry = (_glapi_proc *) table;
GLint i;
for (i = 0; i < numEntries; i++) {
- entry[i] = (_glapi_proc) generic_nop;
+ entry[i] = (_glapi_proc) _mesa_generic_nop;
}
}
return table;
@@ -921,6 +921,10 @@ _mesa_initialize_context(struct gl_context *ctx,
ctx->WinSysDrawBuffer = NULL;
ctx->WinSysReadBuffer = NULL;
+ if (_mesa_is_desktop_gl(ctx)) {
+ _mesa_override_gl_version(ctx);
+ }
+
/* misc one-time initializations */
one_time_init(ctx);
@@ -995,7 +999,7 @@ _mesa_initialize_context(struct gl_context *ctx,
switch (ctx->API) {
case API_OPENGL:
- ctx->Save = _mesa_create_save_table();
+ ctx->Save = _mesa_create_save_table(ctx);
if (!ctx->Save) {
_mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
free(ctx->Exec);
@@ -1003,6 +1007,7 @@ _mesa_initialize_context(struct gl_context *ctx,
}
_mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
+ /* fall-through */
case API_OPENGL_CORE:
break;
case API_OPENGLES:
diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h
index e2387521f..f0b4471b1 100644
--- a/mesalib/src/mesa/main/context.h
+++ b/mesalib/src/mesa/main/context.h
@@ -179,6 +179,8 @@ _mesa_finish(struct gl_context *ctx);
extern void
_mesa_flush(struct gl_context *ctx);
+extern int
+_mesa_generic_nop(void);
extern void GLAPIENTRY
_mesa_Finish( void );
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index b663e364c..99519120a 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -9875,7 +9875,7 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode,
* struct.
*/
struct _glapi_table *
-_mesa_create_save_table(void)
+_mesa_create_save_table(const struct gl_context *ctx)
{
struct _glapi_table *table;
@@ -9883,7 +9883,7 @@ _mesa_create_save_table(void)
if (table == NULL)
return NULL;
- _mesa_loopback_init_api_table(table);
+ _mesa_loopback_init_api_table(ctx, table);
/* GL 1.0 */
SET_Accum(table, save_Accum);
@@ -10410,7 +10410,7 @@ _mesa_create_save_table(void)
SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT);
/* GL_ARB_shader_objects */
- _mesa_init_shader_dispatch(table); /* Plug in glCreate/Delete/Get, etc */
+ _mesa_init_shader_dispatch(ctx, table); /* Plug in glCreate/Delete/Get, etc */
SET_UseProgramObjectARB(table, save_UseProgramObjectARB);
SET_Uniform1fARB(table, save_Uniform1fARB);
SET_Uniform2fARB(table, save_Uniform2fARB);
diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h
index 992a089f1..137245161 100644
--- a/mesalib/src/mesa/main/dlist.h
+++ b/mesalib/src/mesa/main/dlist.h
@@ -61,7 +61,7 @@ extern void _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dl
extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt );
-extern struct _glapi_table *_mesa_create_save_table(void);
+extern struct _glapi_table *_mesa_create_save_table(const struct gl_context *);
extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
const GLvertexformat *vfmt);
diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c
index 91b720373..52804bd8b 100644
--- a/mesalib/src/mesa/main/image.c
+++ b/mesalib/src/mesa/main/image.c
@@ -822,7 +822,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX0 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F; /* flipped??? */
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
*srcX0 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias);
}
else if (*dstX1 < minValue) {
@@ -832,7 +832,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX1 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
+ bias = (*srcX0 < *srcX1) ? -0.5F : 0.5F;
*srcX1 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias);
}
}
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index c2ec1fa42..6ee41f2b6 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -1686,25 +1686,29 @@ _mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string)
* Plug in shader-related functions into API dispatch table.
*/
void
-_mesa_init_shader_dispatch(struct _glapi_table *exec)
+_mesa_init_shader_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec)
{
#if FEATURE_GL
/* GL_ARB_vertex/fragment_shader */
- SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
- SET_GetHandleARB(exec, _mesa_GetHandleARB);
- SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
- SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
+ if (ctx->API != API_OPENGLES2) {
+ SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
+ SET_GetHandleARB(exec, _mesa_GetHandleARB);
+ SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
+ SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
+ SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
+ SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
+ SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
+ SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
+ SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
+ SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
+ }
+
SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);
SET_CompileShaderARB(exec, _mesa_CompileShaderARB);
- SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
- SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
SET_LinkProgramARB(exec, _mesa_LinkProgramARB);
SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);
SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);
- SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
- SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
- SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
- SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);
/* OpenGL 2.0 */
@@ -1727,23 +1731,32 @@ _mesa_init_shader_dispatch(struct _glapi_table *exec)
SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);
SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);
- SET_ProgramParameteriARB(exec, _mesa_ProgramParameteriARB);
+ if (ctx->API != API_OPENGLES2) {
+ SET_ProgramParameteriARB(exec, _mesa_ProgramParameteriARB);
- SET_UseShaderProgramEXT(exec, _mesa_UseShaderProgramEXT);
- SET_ActiveProgramEXT(exec, _mesa_ActiveProgramEXT);
- SET_CreateShaderProgramEXT(exec, _mesa_CreateShaderProgramEXT);
+ SET_UseShaderProgramEXT(exec, _mesa_UseShaderProgramEXT);
+ SET_ActiveProgramEXT(exec, _mesa_ActiveProgramEXT);
+ SET_CreateShaderProgramEXT(exec, _mesa_CreateShaderProgramEXT);
+ }
/* GL_EXT_gpu_shader4 / GL 3.0 */
- SET_BindFragDataLocationEXT(exec, _mesa_BindFragDataLocation);
- SET_GetFragDataLocationEXT(exec, _mesa_GetFragDataLocation);
+ if (ctx->API != API_OPENGLES2) {
+ SET_BindFragDataLocationEXT(exec, _mesa_BindFragDataLocation);
+ }
+ if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+ SET_GetFragDataLocationEXT(exec, _mesa_GetFragDataLocation);
+ }
/* GL_ARB_ES2_compatibility */
SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler);
SET_GetShaderPrecisionFormat(exec, _mesa_GetShaderPrecisionFormat);
+ SET_ShaderBinary(exec, _mesa_ShaderBinary);
/* GL_ARB_blend_func_extended */
- SET_BindFragDataLocationIndexed(exec, _mesa_BindFragDataLocationIndexed);
- SET_GetFragDataIndex(exec, _mesa_GetFragDataIndex);
+ if (ctx->API != API_OPENGLES2) {
+ SET_BindFragDataLocationIndexed(exec, _mesa_BindFragDataLocationIndexed);
+ SET_GetFragDataIndex(exec, _mesa_GetFragDataIndex);
+ }
#endif /* FEATURE_GL */
}
diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h
index 00c7d7f2a..d6382e04a 100644
--- a/mesalib/src/mesa/main/shaderapi.h
+++ b/mesalib/src/mesa/main/shaderapi.h
@@ -51,7 +51,8 @@ _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
const char *caller);
extern void
-_mesa_init_shader_dispatch(struct _glapi_table *exec);
+_mesa_init_shader_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec);
extern unsigned
_mesa_count_active_attribs(struct gl_shader_program *shProg);
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index 04cf0a2b0..39fac1534 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -804,7 +804,8 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex,
* Plug in shader uniform-related functions into API dispatch table.
*/
void
-_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec)
+_mesa_init_shader_uniform_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec)
{
#if FEATURE_GL
SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
@@ -833,38 +834,39 @@ _mesa_init_shader_uniform_dispatch(struct _glapi_table *exec)
SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
/* OpenGL 2.1 */
- SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
- SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
- SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
- SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
- SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
- SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
-
- /* OpenGL 3.0 */
- SET_Uniform1uiEXT(exec, _mesa_Uniform1ui);
- SET_Uniform2uiEXT(exec, _mesa_Uniform2ui);
- SET_Uniform3uiEXT(exec, _mesa_Uniform3ui);
- SET_Uniform4uiEXT(exec, _mesa_Uniform4ui);
- SET_Uniform1uivEXT(exec, _mesa_Uniform1uiv);
- SET_Uniform2uivEXT(exec, _mesa_Uniform2uiv);
- SET_Uniform3uivEXT(exec, _mesa_Uniform3uiv);
- SET_Uniform4uivEXT(exec, _mesa_Uniform4uiv);
- SET_GetUniformuivEXT(exec, _mesa_GetUniformuiv);
-
- /* GL_ARB_robustness */
- SET_GetnUniformfvARB(exec, _mesa_GetnUniformfvARB);
- SET_GetnUniformivARB(exec, _mesa_GetnUniformivARB);
- SET_GetnUniformuivARB(exec, _mesa_GetnUniformuivARB);
- SET_GetnUniformdvARB(exec, _mesa_GetnUniformdvARB); /* GL 4.0 */
-
- /* GL_ARB_uniform_buffer_object / GL 3.1 */
- SET_GetUniformBlockIndex(exec, _mesa_GetUniformBlockIndex);
- SET_GetUniformIndices(exec, _mesa_GetUniformIndices);
- SET_GetActiveUniformsiv(exec, _mesa_GetActiveUniformsiv);
- SET_GetActiveUniformBlockiv(exec, _mesa_GetActiveUniformBlockiv);
- SET_GetActiveUniformBlockName(exec, _mesa_GetActiveUniformBlockName);
- SET_GetActiveUniformName(exec, _mesa_GetActiveUniformName);
- SET_UniformBlockBinding(exec, _mesa_UniformBlockBinding);
-
+ if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+ SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
+ SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
+ SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
+ SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
+ SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
+ SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
+
+ /* OpenGL 3.0 */
+ SET_Uniform1uiEXT(exec, _mesa_Uniform1ui);
+ SET_Uniform2uiEXT(exec, _mesa_Uniform2ui);
+ SET_Uniform3uiEXT(exec, _mesa_Uniform3ui);
+ SET_Uniform4uiEXT(exec, _mesa_Uniform4ui);
+ SET_Uniform1uivEXT(exec, _mesa_Uniform1uiv);
+ SET_Uniform2uivEXT(exec, _mesa_Uniform2uiv);
+ SET_Uniform3uivEXT(exec, _mesa_Uniform3uiv);
+ SET_Uniform4uivEXT(exec, _mesa_Uniform4uiv);
+ SET_GetUniformuivEXT(exec, _mesa_GetUniformuiv);
+
+ /* GL_ARB_robustness */
+ SET_GetnUniformfvARB(exec, _mesa_GetnUniformfvARB);
+ SET_GetnUniformivARB(exec, _mesa_GetnUniformivARB);
+ SET_GetnUniformuivARB(exec, _mesa_GetnUniformuivARB);
+ SET_GetnUniformdvARB(exec, _mesa_GetnUniformdvARB); /* GL 4.0 */
+
+ /* GL_ARB_uniform_buffer_object / GL 3.1 */
+ SET_GetUniformBlockIndex(exec, _mesa_GetUniformBlockIndex);
+ SET_GetUniformIndices(exec, _mesa_GetUniformIndices);
+ SET_GetActiveUniformsiv(exec, _mesa_GetActiveUniformsiv);
+ SET_GetActiveUniformBlockiv(exec, _mesa_GetActiveUniformBlockiv);
+ SET_GetActiveUniformBlockName(exec, _mesa_GetActiveUniformBlockName);
+ SET_GetActiveUniformName(exec, _mesa_GetActiveUniformName);
+ SET_UniformBlockBinding(exec, _mesa_UniformBlockBinding);
+ }
#endif /* FEATURE_GL */
}
diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h
index e84964c6f..3fe7d4402 100644
--- a/mesalib/src/mesa/main/uniforms.h
+++ b/mesalib/src/mesa/main/uniforms.h
@@ -227,7 +227,8 @@ _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,
char *errMsg, size_t errMsgLength);
extern void
-_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec);
+_mesa_init_shader_uniform_dispatch(const struct gl_context *ctx,
+ struct _glapi_table *exec);
extern const struct gl_program_parameter *
get_uniform_parameter(struct gl_shader_program *shProg, GLint index);
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 7ee662714..8d69c3a05 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -28,30 +28,25 @@
/*#include "git_sha1.h"*/
/**
- * Override the context's GL version if the environment variable
- * MESA_GL_VERSION_OVERRIDE is set. Valid values of MESA_GL_VERSION_OVERRIDE
- * are point-separated version numbers, such as "3.0".
+ * Scans 'string' to see if it ends with 'ending'.
*/
-static void
-override_version(struct gl_context *ctx)
+static GLboolean
+check_for_ending(const char *string, const char *ending)
{
- const char *env_var = "MESA_GL_VERSION_OVERRIDE";
- const char *version;
- int n;
- int major, minor;
+ int len1, len2;
- version = getenv(env_var);
- if (!version) {
- return;
- }
+ len1 = strlen(string);
+ len2 = strlen(ending);
- n = sscanf(version, "%u.%u", &major, &minor);
- if (n != 2) {
- fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
- return;
+ if (len2 > len1) {
+ return GL_FALSE;
}
- ctx->Version = major * 10 + minor;
+ if (strcmp(string + (len1 - len2), ending) == 0) {
+ return GL_TRUE;
+ } else {
+ return GL_FALSE;
+ }
}
/**
@@ -65,13 +60,64 @@ create_version_string(struct gl_context *ctx, const char *prefix)
ctx->VersionString = malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
- "%s%u.%u Mesa " MESA_VERSION_STRING
+ "%s%u.%u%s Mesa " MESA_VERSION_STRING
#ifdef MESA_GIT_SHA1
" (" MESA_GIT_SHA1 ")"
#endif
,
prefix,
- ctx->Version / 10, ctx->Version % 10);
+ ctx->Version / 10, ctx->Version % 10,
+ (ctx->API == API_OPENGL_CORE) ? " (Core Profile)" : ""
+ );
+ }
+}
+
+/**
+ * Override the context's version and/or API type if the
+ * environment variable MESA_GL_VERSION_OVERRIDE is set.
+ *
+ * Example uses of MESA_GL_VERSION_OVERRIDE:
+ *
+ * 2.1: select a compatibility (non-Core) profile with GL version 2.1
+ * 3.0: select a compatibility (non-Core) profile with GL version 3.0
+ * 3.0FC: select a Core+Forward Compatible profile with GL version 3.0
+ * 3.1: select a Core profile with GL version 3.1
+ * 3.1FC: select a Core+Forward Compatible profile with GL version 3.1
+ */
+void
+_mesa_override_gl_version(struct gl_context *ctx)
+{
+ const char *env_var = "MESA_GL_VERSION_OVERRIDE";
+ const char *version;
+ int n;
+ int major, minor;
+ GLboolean fc_suffix;
+
+ version = getenv(env_var);
+ if (!version) {
+ return;
+ }
+
+ fc_suffix = check_for_ending(version, "FC");
+
+ n = sscanf(version, "%u.%u", &major, &minor);
+ if (n != 2) {
+ fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
+ } else {
+ ctx->Version = major * 10 + minor;
+ if (ctx->Version < 30 && fc_suffix) {
+ fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
+ } else {
+ if (ctx->Version >= 30 && fc_suffix) {
+ ctx->API = API_OPENGL_CORE;
+ ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
+ } else if (ctx->Version >= 31) {
+ ctx->API = API_OPENGL_CORE;
+ } else {
+ ctx->API = API_OPENGL;
+ }
+ create_version_string(ctx, "");
+ }
}
}
@@ -242,8 +288,6 @@ compute_version(struct gl_context *ctx)
ctx->Version = major * 10 + minor;
- override_version(ctx);
-
create_version_string(ctx, "");
}
diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h
index f0ba6f267..1aab37d69 100644
--- a/mesalib/src/mesa/main/version.h
+++ b/mesalib/src/mesa/main/version.h
@@ -46,6 +46,9 @@ extern void
_mesa_compute_version(struct gl_context *ctx);
extern void
+_mesa_override_gl_version(struct gl_context *ctx);
+
+extern void
_mesa_override_glsl_version(struct gl_context *ctx);
#endif /* VERSION_H */
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index 725ac2047..aa6cf286a 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -46,7 +46,7 @@ static void
install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
const GLvertexformat *vfmt)
{
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
_mesa_install_arrayelt_vtxfmt(tab, vfmt);
SET_Color3f(tab, vfmt->Color3f);
SET_Color3fv(tab, vfmt->Color3fv);
@@ -59,7 +59,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
_mesa_install_eval_vtxfmt(tab, vfmt);
}
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
SET_Indexf(tab, vfmt->Indexf);
@@ -95,9 +95,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
if (ctx->API == API_OPENGL) {
_mesa_install_dlist_vtxfmt(tab, vfmt); /* glCallList / glCallLists */
- }
- if (ctx->API != API_OPENGL_CORE) {
SET_Begin(tab, vfmt->Begin);
SET_End(tab, vfmt->End);
SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV);
@@ -107,33 +105,48 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_DrawArrays(tab, vfmt->DrawArrays);
SET_DrawElements(tab, vfmt->DrawElements);
- SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
+ if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+ SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
+ }
+
SET_MultiDrawElementsEXT(tab, vfmt->MultiDrawElementsEXT);
- SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex);
- SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex);
- SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex);
- SET_DrawArraysInstancedARB(tab, vfmt->DrawArraysInstanced);
- SET_DrawArraysInstancedBaseInstance(tab, vfmt->DrawArraysInstancedBaseInstance);
- SET_DrawElementsInstancedARB(tab, vfmt->DrawElementsInstanced);
- SET_DrawElementsInstancedBaseInstance(tab, vfmt->DrawElementsInstancedBaseInstance);
- SET_DrawElementsInstancedBaseVertex(tab, vfmt->DrawElementsInstancedBaseVertex);
- SET_DrawElementsInstancedBaseVertexBaseInstance(tab, vfmt->DrawElementsInstancedBaseVertexBaseInstance);
- SET_DrawTransformFeedback(tab, vfmt->DrawTransformFeedback);
- SET_DrawTransformFeedbackStream(tab, vfmt->DrawTransformFeedbackStream);
- SET_DrawTransformFeedbackInstanced(tab,
- vfmt->DrawTransformFeedbackInstanced);
- SET_DrawTransformFeedbackStreamInstanced(tab,
- vfmt->DrawTransformFeedbackStreamInstanced);
+
+ if (ctx->API != API_OPENGLES2) {
+ SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex);
+ SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex);
+ SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex);
+ SET_DrawArraysInstancedBaseInstance(tab, vfmt->DrawArraysInstancedBaseInstance);
+ SET_DrawElementsInstancedBaseInstance(tab, vfmt->DrawElementsInstancedBaseInstance);
+ SET_DrawElementsInstancedBaseVertex(tab, vfmt->DrawElementsInstancedBaseVertex);
+ SET_DrawElementsInstancedBaseVertexBaseInstance(tab, vfmt->DrawElementsInstancedBaseVertexBaseInstance);
+ }
+
+ if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+ SET_DrawArraysInstancedARB(tab, vfmt->DrawArraysInstanced);
+ SET_DrawElementsInstancedARB(tab, vfmt->DrawElementsInstanced);
+ }
+
+ if (ctx->API != API_OPENGLES2) {
+ SET_DrawTransformFeedback(tab, vfmt->DrawTransformFeedback);
+ SET_DrawTransformFeedbackStream(tab, vfmt->DrawTransformFeedbackStream);
+ SET_DrawTransformFeedbackInstanced(tab,
+ vfmt->DrawTransformFeedbackInstanced);
+ SET_DrawTransformFeedbackStreamInstanced(tab,
+ vfmt->DrawTransformFeedbackStreamInstanced);
+ }
/* GL_NV_vertex_program */
- SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
- SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
- SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV);
- SET_VertexAttrib2fvNV(tab, vfmt->VertexAttrib2fvNV);
- SET_VertexAttrib3fNV(tab, vfmt->VertexAttrib3fNV);
- SET_VertexAttrib3fvNV(tab, vfmt->VertexAttrib3fvNV);
- SET_VertexAttrib4fNV(tab, vfmt->VertexAttrib4fNV);
- SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV);
+ if (ctx->API == API_OPENGL) {
+ SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
+ SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
+ SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV);
+ SET_VertexAttrib2fvNV(tab, vfmt->VertexAttrib2fvNV);
+ SET_VertexAttrib3fNV(tab, vfmt->VertexAttrib3fNV);
+ SET_VertexAttrib3fvNV(tab, vfmt->VertexAttrib3fvNV);
+ SET_VertexAttrib4fNV(tab, vfmt->VertexAttrib4fNV);
+ SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV);
+ }
+
SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB);
SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB);
SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB);
@@ -144,23 +157,28 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB);
/* GL_EXT_gpu_shader4 / OpenGL 3.0 */
- SET_VertexAttribI1iEXT(tab, vfmt->VertexAttribI1i);
- SET_VertexAttribI2iEXT(tab, vfmt->VertexAttribI2i);
- SET_VertexAttribI3iEXT(tab, vfmt->VertexAttribI3i);
- SET_VertexAttribI4iEXT(tab, vfmt->VertexAttribI4i);
- SET_VertexAttribI2ivEXT(tab, vfmt->VertexAttribI2iv);
- SET_VertexAttribI3ivEXT(tab, vfmt->VertexAttribI3iv);
- SET_VertexAttribI4ivEXT(tab, vfmt->VertexAttribI4iv);
-
- SET_VertexAttribI1uiEXT(tab, vfmt->VertexAttribI1ui);
- SET_VertexAttribI2uiEXT(tab, vfmt->VertexAttribI2ui);
- SET_VertexAttribI3uiEXT(tab, vfmt->VertexAttribI3ui);
- SET_VertexAttribI4uiEXT(tab, vfmt->VertexAttribI4ui);
- SET_VertexAttribI2uivEXT(tab, vfmt->VertexAttribI2uiv);
- SET_VertexAttribI3uivEXT(tab, vfmt->VertexAttribI3uiv);
- SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv);
-
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API != API_OPENGLES2) {
+ SET_VertexAttribI1iEXT(tab, vfmt->VertexAttribI1i);
+ SET_VertexAttribI2iEXT(tab, vfmt->VertexAttribI2i);
+ SET_VertexAttribI3iEXT(tab, vfmt->VertexAttribI3i);
+ SET_VertexAttribI2ivEXT(tab, vfmt->VertexAttribI2iv);
+ SET_VertexAttribI3ivEXT(tab, vfmt->VertexAttribI3iv);
+
+ SET_VertexAttribI1uiEXT(tab, vfmt->VertexAttribI1ui);
+ SET_VertexAttribI2uiEXT(tab, vfmt->VertexAttribI2ui);
+ SET_VertexAttribI3uiEXT(tab, vfmt->VertexAttribI3ui);
+ SET_VertexAttribI2uivEXT(tab, vfmt->VertexAttribI2uiv);
+ SET_VertexAttribI3uivEXT(tab, vfmt->VertexAttribI3uiv);
+ }
+
+ if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+ SET_VertexAttribI4iEXT(tab, vfmt->VertexAttribI4i);
+ SET_VertexAttribI4ivEXT(tab, vfmt->VertexAttribI4iv);
+ SET_VertexAttribI4uiEXT(tab, vfmt->VertexAttribI4ui);
+ SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv);
+ }
+
+ if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
/* GL_ARB_vertex_type_10_10_10_2_rev / GL 3.3 */
SET_VertexP2ui(tab, vfmt->VertexP2ui);
SET_VertexP2uiv(tab, vfmt->VertexP2uiv);
@@ -199,15 +217,17 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_SecondaryColorP3uiv(tab, vfmt->SecondaryColorP3uiv);
}
- SET_VertexAttribP1ui(tab, vfmt->VertexAttribP1ui);
- SET_VertexAttribP2ui(tab, vfmt->VertexAttribP2ui);
- SET_VertexAttribP3ui(tab, vfmt->VertexAttribP3ui);
- SET_VertexAttribP4ui(tab, vfmt->VertexAttribP4ui);
+ if (ctx->API != API_OPENGLES2) {
+ SET_VertexAttribP1ui(tab, vfmt->VertexAttribP1ui);
+ SET_VertexAttribP2ui(tab, vfmt->VertexAttribP2ui);
+ SET_VertexAttribP3ui(tab, vfmt->VertexAttribP3ui);
+ SET_VertexAttribP4ui(tab, vfmt->VertexAttribP4ui);
- SET_VertexAttribP1uiv(tab, vfmt->VertexAttribP1uiv);
- SET_VertexAttribP2uiv(tab, vfmt->VertexAttribP2uiv);
- SET_VertexAttribP3uiv(tab, vfmt->VertexAttribP3uiv);
- SET_VertexAttribP4uiv(tab, vfmt->VertexAttribP4uiv);
+ SET_VertexAttribP1uiv(tab, vfmt->VertexAttribP1uiv);
+ SET_VertexAttribP2uiv(tab, vfmt->VertexAttribP2uiv);
+ SET_VertexAttribP3uiv(tab, vfmt->VertexAttribP3uiv);
+ SET_VertexAttribP4uiv(tab, vfmt->VertexAttribP4uiv);
+ }
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c
index c2d756813..603c8d4b4 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_blit.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c
@@ -42,6 +42,7 @@
#include "st_atom.h"
#include "util/u_blit.h"
+#include "util/u_format.h"
void
@@ -60,84 +61,6 @@ st_destroy_blit(struct st_context *st)
static void
-st_BlitFramebuffer_resolve(struct gl_context *ctx,
- GLbitfield mask,
- struct pipe_resolve_info *info)
-{
- const GLbitfield depthStencil = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
-
- struct st_context *st = st_context(ctx);
-
- struct st_renderbuffer *srcRb, *dstRb;
-
- if (mask & GL_COLOR_BUFFER_BIT) {
- srcRb = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
- dstRb = st_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]);
-
- info->mask = PIPE_MASK_RGBA;
-
- info->src.res = srcRb->texture;
- info->src.layer = srcRb->surface->u.tex.first_layer;
- info->dst.res = dstRb->texture;
- info->dst.level = dstRb->surface->u.tex.level;
- info->dst.layer = dstRb->surface->u.tex.first_layer;
-
- st->pipe->resource_resolve(st->pipe, info);
- }
-
- if (mask & depthStencil) {
- struct gl_renderbuffer_attachment *srcDepth, *srcStencil;
- struct gl_renderbuffer_attachment *dstDepth, *dstStencil;
- boolean combined;
-
- srcDepth = &ctx->ReadBuffer->Attachment[BUFFER_DEPTH];
- dstDepth = &ctx->DrawBuffer->Attachment[BUFFER_DEPTH];
- srcStencil = &ctx->ReadBuffer->Attachment[BUFFER_STENCIL];
- dstStencil = &ctx->DrawBuffer->Attachment[BUFFER_STENCIL];
-
- combined =
- st_is_depth_stencil_combined(srcDepth, srcStencil) &&
- st_is_depth_stencil_combined(dstDepth, dstStencil);
-
- if ((mask & GL_DEPTH_BUFFER_BIT) || combined) {
- /* resolve depth and, if combined and requested, stencil as well */
- srcRb = st_renderbuffer(srcDepth->Renderbuffer);
- dstRb = st_renderbuffer(dstDepth->Renderbuffer);
-
- info->mask = (mask & GL_DEPTH_BUFFER_BIT) ? PIPE_MASK_Z : 0;
- if (combined && (mask & GL_STENCIL_BUFFER_BIT)) {
- mask &= ~GL_STENCIL_BUFFER_BIT;
- info->mask |= PIPE_MASK_S;
- }
-
- info->src.res = srcRb->texture;
- info->src.layer = srcRb->surface->u.tex.first_layer;
- info->dst.res = dstRb->texture;
- info->dst.level = dstRb->surface->u.tex.level;
- info->dst.layer = dstRb->surface->u.tex.first_layer;
-
- st->pipe->resource_resolve(st->pipe, info);
- }
-
- if (mask & GL_STENCIL_BUFFER_BIT) {
- /* resolve separate stencil buffer */
- srcRb = st_renderbuffer(srcStencil->Renderbuffer);
- dstRb = st_renderbuffer(dstStencil->Renderbuffer);
-
- info->mask = PIPE_MASK_S;
-
- info->src.res = srcRb->texture;
- info->src.layer = srcRb->surface->u.tex.first_layer;
- info->dst.res = dstRb->texture;
- info->dst.level = dstRb->surface->u.tex.level;
- info->dst.layer = dstRb->surface->u.tex.first_layer;
-
- st->pipe->resource_resolve(st->pipe, info);
- }
- }
-}
-
-static void
st_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
@@ -147,22 +70,62 @@ st_BlitFramebuffer(struct gl_context *ctx,
GL_STENCIL_BUFFER_BIT);
struct st_context *st = st_context(ctx);
const uint pFilter = ((filter == GL_NEAREST)
- ? PIPE_TEX_MIPFILTER_NEAREST
- : PIPE_TEX_MIPFILTER_LINEAR);
+ ? PIPE_TEX_FILTER_NEAREST
+ : PIPE_TEX_FILTER_LINEAR);
struct gl_framebuffer *readFB = ctx->ReadBuffer;
struct gl_framebuffer *drawFB = ctx->DrawBuffer;
+ struct {
+ GLint srcX0, srcY0, srcX1, srcY1;
+ GLint dstX0, dstY0, dstX1, dstY1;
+ } clip;
+ struct pipe_blit_info blit;
st_validate_state(st);
- if (!_mesa_clip_blit(ctx, &srcX0, &srcY0, &srcX1, &srcY1,
- &dstX0, &dstY0, &dstX1, &dstY1)) {
+ clip.srcX0 = srcX0;
+ clip.srcY0 = srcY0;
+ clip.srcX1 = srcX1;
+ clip.srcY1 = srcY1;
+ clip.dstX0 = dstX0;
+ clip.dstY0 = dstY0;
+ clip.dstX1 = dstX1;
+ clip.dstY1 = dstY1;
+
+ /* NOTE: If the src and dst dimensions don't match, we cannot simply adjust
+ * the integer coordinates to account for clipping (or scissors) because that
+ * would make us cut off fractional parts, affecting the result of the blit.
+ *
+ * XXX: This should depend on mask !
+ */
+ if (!_mesa_clip_blit(ctx,
+ &clip.srcX0, &clip.srcY0, &clip.srcX1, &clip.srcY1,
+ &clip.dstX0, &clip.dstY0, &clip.dstX1, &clip.dstY1)) {
return; /* nothing to draw/blit */
}
+ blit.scissor_enable =
+ (dstX0 != clip.dstX0) ||
+ (dstY0 != clip.dstY0) ||
+ (dstX1 != clip.dstX1) ||
+ (dstY1 != clip.dstY1);
if (st_fb_orientation(drawFB) == Y_0_TOP) {
/* invert Y for dest */
dstY0 = drawFB->Height - dstY0;
dstY1 = drawFB->Height - dstY1;
+ /* invert Y for clip */
+ clip.dstY0 = drawFB->Height - clip.dstY0;
+ clip.dstY1 = drawFB->Height - clip.dstY1;
+ }
+ if (blit.scissor_enable) {
+ blit.scissor.minx = MIN2(clip.dstX0, clip.dstX1);
+ blit.scissor.miny = MIN2(clip.dstY0, clip.dstY1);
+ blit.scissor.maxx = MAX2(clip.dstX0, clip.dstX1);
+ blit.scissor.maxy = MAX2(clip.dstY0, clip.dstY1);
+#if 0
+ debug_printf("scissor = (%i,%i)-(%i,%i)\n",
+ blit.scissor.minx,blit.scissor.miny,
+ blit.scissor.maxx,blit.scissor.maxy);
+#endif
}
if (st_fb_orientation(readFB) == Y_0_TOP) {
@@ -171,43 +134,6 @@ st_BlitFramebuffer(struct gl_context *ctx,
srcY1 = readFB->Height - srcY1;
}
- /* Disable conditional rendering. */
- if (st->render_condition) {
- st->pipe->render_condition(st->pipe, NULL, 0);
- }
-
- if (readFB->Visual.sampleBuffers > drawFB->Visual.sampleBuffers &&
- readFB->Visual.samples > 1) {
- struct pipe_resolve_info info;
-
- if (dstX0 < dstX1) {
- info.dst.x0 = dstX0;
- info.dst.x1 = dstX1;
- info.src.x0 = srcX0;
- info.src.x1 = srcX1;
- } else {
- info.dst.x0 = dstX1;
- info.dst.x1 = dstX0;
- info.src.x0 = srcX1;
- info.src.x1 = srcX0;
- }
- if (dstY0 < dstY1) {
- info.dst.y0 = dstY0;
- info.dst.y1 = dstY1;
- info.src.y0 = srcY0;
- info.src.y1 = srcY1;
- } else {
- info.dst.y0 = dstY1;
- info.dst.y1 = dstY0;
- info.src.y0 = srcY1;
- info.src.y1 = srcY0;
- }
-
- st_BlitFramebuffer_resolve(ctx, mask, &info); /* filter doesn't apply */
-
- goto done;
- }
-
if (srcY0 > srcY1 && dstY0 > dstY1) {
/* Both src and dst are upside down. Swap Y to make it
* right-side up to increase odds of using a fast path.
@@ -222,25 +148,64 @@ st_BlitFramebuffer(struct gl_context *ctx,
dstY1 = tmp;
}
+ blit.src.box.depth = 1;
+ blit.dst.box.depth = 1;
+
+ /* Destination dimensions have to be positive: */
+ if (dstX0 < dstX1) {
+ blit.dst.box.x = dstX0;
+ blit.src.box.x = srcX0;
+ blit.dst.box.width = dstX1 - dstX0;
+ blit.src.box.width = srcX1 - srcX0;
+ } else {
+ blit.dst.box.x = dstX1;
+ blit.src.box.x = srcX1;
+ blit.dst.box.width = dstX0 - dstX1;
+ blit.src.box.width = srcX0 - srcX1;
+ }
+ if (dstY0 < dstY1) {
+ blit.dst.box.y = dstY0;
+ blit.src.box.y = srcY0;
+ blit.dst.box.height = dstY1 - dstY0;
+ blit.src.box.height = srcY1 - srcY0;
+ } else {
+ blit.dst.box.y = dstY1;
+ blit.src.box.y = srcY1;
+ blit.dst.box.height = dstY0 - dstY1;
+ blit.src.box.height = srcY0 - srcY1;
+ }
+
+ blit.filter = pFilter;
+
if (mask & GL_COLOR_BUFFER_BIT) {
struct gl_renderbuffer_attachment *srcAtt =
&readFB->Attachment[readFB->_ColorReadBufferIndex];
- if(srcAtt->Type == GL_TEXTURE) {
+ blit.mask = PIPE_MASK_RGBA;
+
+ if (srcAtt->Type == GL_TEXTURE) {
struct st_texture_object *srcObj =
st_texture_object(srcAtt->Texture);
struct st_renderbuffer *dstRb =
st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
struct pipe_surface *dstSurf = dstRb->surface;
- if (!srcObj->pt)
- goto done;
+ assert(srcObj->pt);
+ if (!srcObj->pt) {
+ return;
+ }
+
+ blit.dst.resource = dstSurf->texture;
+ blit.dst.level = dstSurf->u.tex.level;
+ blit.dst.box.z = dstSurf->u.tex.first_layer;
+ blit.dst.format = util_format_linear(dstSurf->format);
- util_blit_pixels(st->blit, srcObj->pt, srcAtt->TextureLevel,
- srcX0, srcY0, srcX1, srcY1,
- srcAtt->Zoffset + srcAtt->CubeMapFace,
- dstSurf, dstX0, dstY0, dstX1, dstY1,
- 0.0, pFilter, TGSI_WRITEMASK_XYZW, 0);
+ blit.src.resource = srcObj->pt;
+ blit.src.level = srcAtt->TextureLevel;
+ blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace;
+ blit.src.format = util_format_linear(srcObj->pt->format);
+
+ st->pipe->blit(st->pipe, &blit);
}
else {
struct st_renderbuffer *srcRb =
@@ -250,12 +215,17 @@ st_BlitFramebuffer(struct gl_context *ctx,
struct pipe_surface *srcSurf = srcRb->surface;
struct pipe_surface *dstSurf = dstRb->surface;
- util_blit_pixels(st->blit,
- srcRb->texture, srcSurf->u.tex.level,
- srcX0, srcY0, srcX1, srcY1,
- srcSurf->u.tex.first_layer,
- dstSurf, dstX0, dstY0, dstX1, dstY1,
- 0.0, pFilter, TGSI_WRITEMASK_XYZW, 0);
+ blit.dst.resource = dstSurf->texture;
+ blit.dst.level = dstSurf->u.tex.level;
+ blit.dst.box.z = dstSurf->u.tex.first_layer;
+ blit.dst.format = util_format_linear(dstSurf->format);
+
+ blit.src.resource = srcSurf->texture;
+ blit.src.level = srcSurf->u.tex.level;
+ blit.src.box.z = srcSurf->u.tex.first_layer;
+ blit.src.format = util_format_linear(srcSurf->format);
+
+ st->pipe->blit(st->pipe, &blit);
}
}
@@ -286,64 +256,62 @@ st_BlitFramebuffer(struct gl_context *ctx,
struct pipe_surface *dstStencilSurf =
dstStencilRb ? dstStencilRb->surface : NULL;
- if ((mask & depthStencil) == depthStencil &&
- st_is_depth_stencil_combined(srcDepth, srcStencil) &&
+ if (st_is_depth_stencil_combined(srcDepth, srcStencil) &&
st_is_depth_stencil_combined(dstDepth, dstStencil)) {
-
- /* Blitting depth and stencil values between combined
- * depth/stencil buffers. This is the ideal case for such buffers.
- */
- util_blit_pixels(st->blit,
- srcDepthRb->texture,
- srcDepthRb->surface->u.tex.level,
- srcX0, srcY0, srcX1, srcY1,
- srcDepthRb->surface->u.tex.first_layer,
- dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
- 0.0, pFilter, 0,
- BLIT_WRITEMASK_Z |
- (st->has_stencil_export ? BLIT_WRITEMASK_STENCIL
- : 0));
-
- if (!st->has_stencil_export) {
- _mesa_problem(ctx, "st_BlitFramebuffer(STENCIL) "
- "software fallback not implemented");
- }
+ blit.mask = 0;
+ if (mask & GL_DEPTH_BUFFER_BIT)
+ blit.mask |= PIPE_MASK_Z;
+ if (mask & GL_STENCIL_BUFFER_BIT)
+ blit.mask |= PIPE_MASK_S;
+
+ blit.dst.resource = dstDepthSurf->texture;
+ blit.dst.level = dstDepthSurf->u.tex.level;
+ blit.dst.box.z = dstDepthSurf->u.tex.first_layer;
+ blit.dst.format = dstDepthSurf->format;
+
+ blit.src.resource = srcDepthRb->texture;
+ blit.src.level = srcDepthRb->surface->u.tex.level;
+ blit.src.box.z = srcDepthRb->surface->u.tex.first_layer;
+ blit.src.format = srcDepthRb->surface->format;
+
+ st->pipe->blit(st->pipe, &blit);
}
else {
/* blitting depth and stencil separately */
if (mask & GL_DEPTH_BUFFER_BIT) {
- util_blit_pixels(st->blit, srcDepthRb->texture,
- srcDepthRb->surface->u.tex.level,
- srcX0, srcY0, srcX1, srcY1,
- srcDepthRb->surface->u.tex.first_layer,
- dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
- 0.0, pFilter, 0, BLIT_WRITEMASK_Z);
+ blit.mask = PIPE_MASK_Z;
+
+ blit.dst.resource = dstDepthSurf->texture;
+ blit.dst.level = dstDepthSurf->u.tex.level;
+ blit.dst.box.z = dstDepthSurf->u.tex.first_layer;
+ blit.dst.format = dstDepthSurf->format;
+
+ blit.src.resource = srcDepthRb->texture;
+ blit.src.level = srcDepthRb->surface->u.tex.level;
+ blit.src.box.z = srcDepthRb->surface->u.tex.first_layer;
+ blit.src.format = srcDepthRb->surface->format;
+
+ st->pipe->blit(st->pipe, &blit);
}
if (mask & GL_STENCIL_BUFFER_BIT) {
- if (st->has_stencil_export) {
- util_blit_pixels(st->blit, srcStencilRb->texture,
- srcStencilRb->surface->u.tex.level,
- srcX0, srcY0, srcX1, srcY1,
- srcStencilRb->surface->u.tex.first_layer,
- dstStencilSurf, dstX0, dstY0, dstX1, dstY1,
- 0.0, pFilter, 0, BLIT_WRITEMASK_STENCIL);
- }
- else {
- _mesa_problem(ctx, "st_BlitFramebuffer(STENCIL) "
- "software fallback not implemented");
- }
+ blit.mask = PIPE_MASK_S;
+
+ blit.dst.resource = dstStencilSurf->texture;
+ blit.dst.level = dstStencilSurf->u.tex.level;
+ blit.dst.box.z = dstStencilSurf->u.tex.first_layer;
+ blit.dst.format = dstStencilSurf->format;
+
+ blit.src.resource = srcStencilRb->texture;
+ blit.src.level = srcStencilRb->surface->u.tex.level;
+ blit.src.box.z = srcStencilRb->surface->u.tex.first_layer;
+ blit.src.format = srcStencilRb->surface->format;
+
+ st->pipe->blit(st->pipe, &blit);
}
}
}
-
-done:
- /* Restore conditional rendering state. */
- if (st->render_condition) {
- st->pipe->render_condition(st->pipe, st->render_condition,
- st->condition_mode);
- }
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 5634a3e6e..473ff3a94 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -575,61 +575,40 @@ decompress_with_blit(struct gl_context * ctx,
struct pipe_context *pipe = st->pipe;
struct st_texture_image *stImage = st_texture_image(texImage);
struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
- struct pipe_sampler_view *src_view;
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
- struct pipe_surface *dst_surface;
struct pipe_resource *dst_texture;
struct pipe_transfer *tex_xfer;
- unsigned bind = (PIPE_BIND_RENDER_TARGET | /* util_blit may choose to render */
- PIPE_BIND_TRANSFER_READ);
+ struct pipe_blit_info blit;
+ unsigned bind = (PIPE_BIND_RENDER_TARGET | PIPE_BIND_TRANSFER_READ);
/* create temp / dest surface */
- if (!util_create_rgba_surface(pipe, width, height, bind,
- &dst_texture, &dst_surface)) {
- _mesa_problem(ctx, "util_create_rgba_surface() failed "
+ if (!util_create_rgba_texture(pipe, width, height, bind,
+ &dst_texture)) {
+ _mesa_problem(ctx, "util_create_rgba_texture() failed "
"in decompress_with_blit()");
return;
}
- /* Disable conditional rendering. */
- if (st->render_condition) {
- pipe->render_condition(pipe, NULL, 0);
- }
-
- /* Create sampler view that limits fetches to the source mipmap level */
- {
- struct pipe_sampler_view sv_temp;
-
- u_sampler_view_default_template(&sv_temp, stObj->pt, stObj->pt->format);
-
- sv_temp.format = util_format_linear(sv_temp.format);
- sv_temp.u.tex.first_level =
- sv_temp.u.tex.last_level = texImage->Level;
-
- src_view = pipe->create_sampler_view(pipe, stObj->pt, &sv_temp);
- if (!src_view) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
- return;
- }
- }
+ blit.src.resource = stObj->pt;
+ blit.src.level = texImage->Level;
+ blit.src.format = util_format_linear(stObj->pt->format);
+ blit.dst.resource = dst_texture;
+ blit.dst.level = 0;
+ blit.dst.format = dst_texture->format;
+ blit.src.box.x = blit.dst.box.x = 0;
+ blit.src.box.y = blit.dst.box.y = 0;
+ blit.src.box.z = 0; /* XXX compressed array textures? */
+ blit.dst.box.z = 0;
+ blit.src.box.width = blit.dst.box.width = width;
+ blit.src.box.height = blit.dst.box.height = height;
+ blit.src.box.depth = blit.dst.box.depth = 1;
+ blit.mask = PIPE_MASK_RGBA;
+ blit.filter = PIPE_TEX_FILTER_NEAREST;
+ blit.scissor_enable = FALSE;
/* blit/render/decompress */
- util_blit_pixels_tex(st->blit,
- src_view, /* pipe_resource (src) */
- 0, 0, /* src x0, y0 */
- width, height, /* src x1, y1 */
- dst_surface, /* pipe_surface (dst) */
- 0, 0, /* dst x0, y0 */
- width, height, /* dst x1, y1 */
- 0.0, /* z */
- PIPE_TEX_MIPFILTER_NEAREST);
-
- /* Restore conditional rendering state. */
- if (st->render_condition) {
- pipe->render_condition(pipe, st->render_condition,
- st->condition_mode);
- }
+ st->pipe->blit(st->pipe, &blit);
/* map the dst_surface so we can read from it */
tex_xfer = pipe_get_transfer(pipe,
@@ -691,10 +670,7 @@ end:
pipe->transfer_destroy(pipe, tex_xfer);
- /* destroy the temp / dest surface */
- util_destroy_rgba_surface(dst_texture, dst_surface);
-
- pipe_sampler_view_release(pipe, &src_view);
+ pipe_resource_reference(&dst_texture, NULL);
}