[Xquartz-changes] mesa: Branch 'master' - 27 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Fri Jun 17 12:30:07 PDT 2011
Rebased ref, commits from common ancestor:
commit 7b1821ec463cdf90ba8af98db2b180a38b682f99
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Jun 17 12:24:55 2011 -0700
glx: Bind to our context before __glXSetCurrentContext
We want to bind to our context before calling __glXSetCurrentContext or
messing with the gc rect in order to properly handle error conditions.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 0f39ee5..6f048ae 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -212,7 +212,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
{
struct glx_context *gc = (struct glx_context *) gc_user;
struct glx_context *oldGC = __glXGetCurrentContext();
- int ret = Success;
/* XXX: If this is left out, then libGL ends up not having this
* symbol, and drivers using it fail to load. Compare the
@@ -259,15 +258,28 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
}
if (gc) {
+ /* Attempt to bind the context. We do this before mucking with
+ * gc and __glXSetCurrentContext to properly handle our state in
+ * case of an error.
+ *
+ * If an error occurs, set the Null context since we've already
+ * blown away our old context. The caller is responsible for
+ * figuring out how to handle setting a valid context.
+ */
+ if (gc->vtable->bind(gc, oldGC, draw, read) != Success) {
+ __glXSetCurrentContextNull();
+ __glXUnlock();
+ __glXGenerateError(dpy, None, GLXBadContext, X_GLXMakeContextCurrent);
+ return GL_FALSE;
+ }
+
if (gc->thread_refcount == 0)
gc->currentDpy = dpy;
- __glXSetCurrentContext(gc);
- ret = gc->vtable->bind(gc, oldGC, draw, read);
- if (gc->thread_refcount == 0) {
gc->currentDrawable = draw;
gc->currentReadable = read;
}
gc->thread_refcount++;
+ __glXSetCurrentContext(gc);
} else {
__glXSetCurrentContextNull();
}
@@ -281,11 +293,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
__glXUnlock();
- if (ret) {
- __glXGenerateError(dpy, None, ret, X_GLXMakeContextCurrent);
- return GL_FALSE;
- }
-
return GL_TRUE;
}
commit 3036979e49f190df42767df3044422bc14dff090
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Fri Jun 17 12:28:05 2011 -0700
glx: Destroy the old context only after the new one has been bound
This fixes a regression introduced by 49d7e48b33264d94e30af6129c281b6acafa9427
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 9eb7d5a..0f39ee5 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -255,13 +255,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
if (--oldGC->thread_refcount == 0) {
oldGC->vtable->unbind(oldGC, gc);
oldGC->currentDpy = 0;
-
- if (oldGC->xid == None && oldGC != gc) {
- /* We are switching away from a context that was
- * previously destroyed, so we need to free the memory
- * for the old handle. */
- oldGC->vtable->destroy(oldGC);
- }
}
}
@@ -279,6 +272,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
__glXSetCurrentContextNull();
}
+ if (oldGC->thread_refcount == 0 && oldGC != &dummyContext && oldGC->xid == None) {
+ /* We are switching away from a context that was
+ * previously destroyed, so we need to free the memory
+ * for the old handle. */
+ oldGC->vtable->destroy(oldGC);
+ }
+
__glXUnlock();
if (ret) {
commit 7e3e256193742d05a3528617bfcfb376997e617d
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Wed Jun 15 00:27:55 2011 -0700
glx: Allow a context-specific fallback for glXGetProcAddress
In applegl, GLX advertises the same extensions provided by OpenGL.framework
even if such extensions are not provided by glapi. This allows a client
to get access to such API.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c
index 4bf4672..8766c88 100644
--- a/src/glx/applegl_glx.c
+++ b/src/glx/applegl_glx.c
@@ -34,10 +34,12 @@
#if defined(GLX_USE_APPLEGL)
#include <stdbool.h>
+#include <dlfcn.h>
#include "glxclient.h"
#include "apple_glx_context.h"
#include "apple_glx.h"
+#include "apple_cgl.h"
#include "glx_error.h"
static void
@@ -82,6 +84,12 @@ applegl_wait_x(struct glx_context *gc)
apple_glx_waitx(dpy, gc->driContext);
}
+static void *
+applegl_get_proc_address(const char *symbol)
+{
+ return dlsym(apple_cgl_get_dl_handle(), symbol);
+}
+
static const struct glx_context_vtable applegl_context_vtable = {
applegl_destroy_context,
applegl_bind_context,
@@ -91,6 +99,7 @@ static const struct glx_context_vtable applegl_context_vtable = {
DRI_glXUseXFont,
NULL, /* bind_tex_image, */
NULL, /* release_tex_image, */
+ applegl_get_proc_address,
};
struct glx_context *
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index e7c18ff..80e4da3 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -767,6 +767,7 @@ static const struct glx_context_vtable dri2_context_vtable = {
DRI_glXUseXFont,
dri2_bind_tex_image,
dri2_release_tex_image,
+ NULL, /* get_proc_address */
};
static void
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index d59784c..6f3b2b8 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -558,6 +558,7 @@ static const struct glx_context_vtable dri_context_vtable = {
DRI_glXUseXFont,
NULL,
NULL,
+ NULL, /* get_proc_address */
};
static struct glx_context *
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 0075695..07d4955 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -296,6 +296,7 @@ static const struct glx_context_vtable drisw_context_vtable = {
DRI_glXUseXFont,
NULL,
NULL,
+ NULL, /* get_proc_address */
};
static struct glx_context *
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 88a6edd..0641528 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -224,7 +224,7 @@ struct glx_context_vtable {
GLXDrawable drawable,
int buffer, const int *attrib_list);
void (*release_tex_image)(Display * dpy, GLXDrawable drawable, int buffer);
-
+ void * (*get_proc_address)(const char *symbol);
};
extern void
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index cd8bc97..e6816ea 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -2521,6 +2521,12 @@ _X_EXPORT void (*glXGetProcAddressARB(const GLubyte * procName)) (void)
#endif
if (!f)
f = (gl_function) _glapi_get_proc_address((const char *) procName);
+ if (!f) {
+ struct glx_context *gc = __glXGetCurrentContext();
+
+ if (gc != NULL && gc->vtable->get_proc_address != NULL)
+ f = gc->vtable->get_proc_address((const char *) procName);
+ }
}
return f;
}
diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index b4f16c7..7b542dd 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -335,6 +335,7 @@ static const struct glx_context_vtable indirect_context_vtable = {
indirect_use_x_font,
indirect_bind_tex_image,
indirect_release_tex_image,
+ NULL, /* get_proc_address */
};
/**
commit 2b618e8d3f5f530e5bcd053c7fdb0c0aee122ccc
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Wed Jun 15 17:30:56 2011 -0700
glapi: Update specs to correctly list FramebufferTextureLayerARB as an alias of FramebufferTextureLayerEXT
FramebufferTextureLayer is an alias of FramebufferTextureLayerEXT, so
FramebufferTextureLayerARB needs to be listed as an alias of
FramebufferTextureLayerEXT rather than FramebufferTextureLayer.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/src/mapi/glapi/gen/ARB_geometry_shader4.xml b/src/mapi/glapi/gen/ARB_geometry_shader4.xml
index ca9a101..d9e540f 100644
--- a/src/mapi/glapi/gen/ARB_geometry_shader4.xml
+++ b/src/mapi/glapi/gen/ARB_geometry_shader4.xml
@@ -38,7 +38,7 @@
<param name="texture" type="GLuint"/>
<param name="level" type="GLint"/>
</function>
- <function name="FramebufferTextureLayerARB" alias="FramebufferTextureLayer">
+ <function name="FramebufferTextureLayerARB" alias="FramebufferTextureLayerEXT">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="texture" type="GLuint"/>
commit cb5a5f055b6a9f05aed927d28a242bde81dd5bfc
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Wed Jun 15 00:22:00 2011 -0700
apple: Use apple_cgl_get_dl_handle() rather than opening a new handle
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/src/glx/apple/apple_glapi.c b/src/glx/apple/apple_glapi.c
index 0c89f46..34f726e 100644
--- a/src/glx/apple/apple_glapi.c
+++ b/src/glx/apple/apple_glapi.c
@@ -44,38 +44,18 @@
#include "apple_glx.h"
#include "apple_xgl_api.h"
-
-#ifndef OPENGL_FRAMEWORK_PATH
-#define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/OpenGL"
-#endif
+#include "apple_cgl.h"
struct _glapi_table * __ogl_framework_api = NULL;
struct _glapi_table * __applegl_api = NULL;
void apple_glapi_set_dispatch(void) {
- static void *handle;
- const char *opengl_framework_path;
-
if(__applegl_api) {
_glapi_set_dispatch(__applegl_api);
return;
}
- opengl_framework_path = getenv("OPENGL_FRAMEWORK_PATH");
- if (!opengl_framework_path) {
- opengl_framework_path = OPENGL_FRAMEWORK_PATH;
- }
-
- (void) dlerror(); /*drain dlerror */
- handle = dlopen(opengl_framework_path, RTLD_LOCAL);
-
- if (!handle) {
- fprintf(stderr, "error: unable to dlopen %s : %s\n",
- opengl_framework_path, dlerror());
- abort();
- }
-
- __ogl_framework_api = _glapi_create_table_from_handle(handle, "gl");
+ __ogl_framework_api = _glapi_create_table_from_handle(apple_cgl_get_dl_handle(), "gl");
assert(__ogl_framework_api);
__applegl_api = malloc(sizeof(struct _glapi_table));
commit 10562fbc5c630b7f1a97344bc3d6b2649c7393a5
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Jun 17 20:11:50 2011 +0100
scons: List all targets.
diff --git a/SConstruct b/SConstruct
index 6b725c4..029daa1 100644
--- a/SConstruct
+++ b/SConstruct
@@ -143,3 +143,18 @@ SConscript(
duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
)
+
+########################################################################
+# List all aliases
+
+try:
+ from SCons.Node.Alias import default_ans
+except ImportError:
+ pass
+else:
+ aliases = default_ans.keys()
+ aliases.sort()
+ env.Help('\n')
+ env.Help('Recognized targets:\n')
+ for alias in aliases:
+ env.Help(' %s\n' % alias)
commit ef4bf40db03ff1df2bae2db8f4a65421bf4a7c06
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Jun 17 20:11:35 2011 +0100
scons: Remember the options set on the command line.
Save them in config.py
diff --git a/SConstruct b/SConstruct
index 104cc38..6b725c4 100644
--- a/SConstruct
+++ b/SConstruct
@@ -40,6 +40,8 @@ env = Environment(
ENV = os.environ,
)
+opts.Save('config.py', env)
+
# Backwards compatability with old target configuration variable
try:
targets = ARGUMENTS['targets']
commit c9be435c79e2bbc883701c5533ae0490780495be
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Jun 17 20:07:12 2011 +0100
scons: Don't list MSVS_VERSION option outside windows platforms.
diff --git a/common.py b/common.py
index f218e6f..8f13186 100644
--- a/common.py
+++ b/common.py
@@ -91,4 +91,5 @@ def AddOptions(opts):
opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
opts.Add(BoolOption('quiet', 'DEPRECATED: quiet command lines', 'yes'))
- opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
+ if host_platform == 'windows':
+ opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
commit d6a0fe19e8da0cb12d73977e4e3ece596a26320f
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Jun 17 19:23:06 2011 +0100
scons: Correct glapi USE_xxx_ASM flags.
diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript
index 276b216..a776474 100644
--- a/src/mapi/glapi/SConscript
+++ b/src/mapi/glapi/SConscript
@@ -52,30 +52,23 @@ if env['platform'] != 'winddk':
if env['gcc'] and env['platform'] != 'windows':
if env['machine'] == 'x86':
env.Append(CPPDEFINES = [
- 'USE_X86_ASM',
- 'USE_MMX_ASM',
- 'USE_3DNOW_ASM',
- 'USE_SSE_ASM',
+ 'USE_X86_ASM',
])
glapi_sources += [
'glapi_x86.S',
]
elif env['machine'] == 'x86_64':
env.Append(CPPDEFINES = [
- 'USE_X86_64_ASM',
+ 'USE_X86_64_ASM',
])
glapi_sources += [
'glapi_x86-64.S'
]
- elif env['machine'] == 'ppc':
+ elif env['machine'] == 'sparc':
env.Append(CPPDEFINES = [
- 'USE_PPC_ASM',
- 'USE_VMX_ASM',
+ 'USE_SPARC_ASM',
])
glapi_sources += [
- ]
- elif env['machine'] == 'sparc':
- glapi_sources += [
'glapi_sparc.S'
]
else:
commit c7bd0fa4851187c3102948f5f4d70c26d1b55a5e
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Jun 17 18:42:39 2011 +0100
scons: Accept verbose=yes instead of quiet=no.
'verbose' is affirmative, and much more common name for this sort of option.
diff --git a/common.py b/common.py
index 052929e..f218e6f 100644
--- a/common.py
+++ b/common.py
@@ -79,7 +79,7 @@ def AddOptions(opts):
from SCons.Options.EnumOption import EnumOption
opts.Add(EnumOption('build', 'build type', 'debug',
allowed_values=('debug', 'checked', 'profile', 'release')))
- opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
+ opts.Add(BoolOption('verbose', 'verbose output', 'no'))
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', host_platform,
@@ -90,4 +90,5 @@ def AddOptions(opts):
opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
+ opts.Add(BoolOption('quiet', 'DEPRECATED: quiet command lines', 'yes'))
opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
diff --git a/scons/custom.py b/scons/custom.py
index a2c690f..029f99b 100644
--- a/scons/custom.py
+++ b/scons/custom.py
@@ -157,7 +157,8 @@ def createCodeGenerateMethod(env):
def generate(env):
"""Common environment generation code"""
- if env.get('quiet', True):
+ verbose = env.get('verbose', False) or not env.get('quiet', True)
+ if not verbose:
quietCommandLines(env)
# Custom builders and methods
commit bf69ce37f0dcbb479078ee676d5100ac63e20750
Author: Stéphane Marchesin <marcheu at chromium.org>
Date: Wed Jun 15 15:09:12 2011 -0700
glx: implement drawable refcounting.
The current dri context unbind logic will leak drawables until the process
dies (they will then get released by the GEM code). There are two ways to fix
this: either always call driReleaseDrawables every time we unbind a context
(but that costs us round trips to the X server at getbuffers() time) or
implement proper drawable refcounting. This patch implements the latter.
Signed-off-by: Antoine Labour <piman at chromium.org>
Signed-off-by: Stéphane Marchesin <marcheu at chromium.org>
Reviewed-by: Adam Jackson <ajax at redhat.com>
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 506754c..e7c18ff 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -143,6 +143,8 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw);
pread = (struct dri2_drawable *) driFetchDrawable(context, read);
+ driReleaseDrawables(&pcp->base);
+
if (pdraw == NULL || pread == NULL)
return GLXBadDrawable;
@@ -170,9 +172,6 @@ dri2_unbind_context(struct glx_context *context, struct glx_context *new)
struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc;
(*psc->core->unbindContext) (pcp->driContext);
-
- if (context == new)
- driReleaseDrawables(&pcp->base);
}
static struct glx_context *
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 06a73e4..bac0c9e 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -369,8 +369,10 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
if (priv->drawHash == NULL)
return NULL;
- if (__glxHashLookup(priv->drawHash, glxDrawable, (void *) &pdraw) == 0)
+ if (__glxHashLookup(priv->drawHash, glxDrawable, (void *) &pdraw) == 0) {
+ pdraw->refcount ++;
return pdraw;
+ }
pdraw = psc->driScreen->createDrawable(psc, glxDrawable,
glxDrawable, gc->config);
@@ -378,6 +380,7 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
(*pdraw->destroyDrawable) (pdraw);
return NULL;
}
+ pdraw->refcount = 1;
return pdraw;
}
@@ -394,19 +397,28 @@ driReleaseDrawables(struct glx_context *gc)
if (__glxHashLookup(priv->drawHash,
gc->currentDrawable, (void *) &pdraw) == 0) {
if (pdraw->drawable == pdraw->xDrawable) {
- (*pdraw->destroyDrawable)(pdraw);
- __glxHashDelete(priv->drawHash, gc->currentDrawable);
+ pdraw->refcount --;
+ if (pdraw->refcount == 0) {
+ (*pdraw->destroyDrawable)(pdraw);
+ __glxHashDelete(priv->drawHash, gc->currentDrawable);
+ }
}
}
- if (gc->currentDrawable != gc->currentReadable &&
- __glxHashLookup(priv->drawHash,
+ if (__glxHashLookup(priv->drawHash,
gc->currentReadable, (void *) &pdraw) == 0) {
if (pdraw->drawable == pdraw->xDrawable) {
- (*pdraw->destroyDrawable)(pdraw);
- __glxHashDelete(priv->drawHash, gc->currentReadable);
+ pdraw->refcount --;
+ if (pdraw->refcount == 0) {
+ (*pdraw->destroyDrawable)(pdraw);
+ __glxHashDelete(priv->drawHash, gc->currentReadable);
+ }
}
}
+
+ gc->currentDrawable = None;
+ gc->currentReadable = None;
+
}
#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index ff027dc..d59784c 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -503,6 +503,8 @@ dri_destroy_context(struct glx_context * context)
struct dri_context *pcp = (struct dri_context *) context;
struct dri_screen *psc = (struct dri_screen *) context->psc;
+ driReleaseDrawables(&pcp->base);
+
if (context->xid)
glx_send_destroy_context(psc->base.dpy, context->xid);
@@ -526,6 +528,8 @@ dri_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct dri_drawable *) driFetchDrawable(context, draw);
pread = (struct dri_drawable *) driFetchDrawable(context, read);
+ driReleaseDrawables(&pcp->base);
+
if (pdraw == NULL || pread == NULL)
return GLXBadDrawable;
@@ -543,8 +547,6 @@ dri_unbind_context(struct glx_context *context, struct glx_context *new)
struct dri_screen *psc = (struct dri_screen *) pcp->base.psc;
(*psc->core->unbindContext) (pcp->driContext);
-
- driReleaseDrawables(&pcp->base);
}
static const struct glx_context_vtable dri_context_vtable = {
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 2eaa3c5..0075695 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -242,6 +242,8 @@ drisw_destroy_context(struct glx_context *context)
struct drisw_context *pcp = (struct drisw_context *) context;
struct drisw_screen *psc = (struct drisw_screen *) context->psc;
+ driReleaseDrawables(&pcp->base);
+
if (context->xid)
glx_send_destroy_context(psc->base.dpy, context->xid);
@@ -264,6 +266,8 @@ drisw_bind_context(struct glx_context *context, struct glx_context *old,
pdraw = (struct drisw_drawable *) driFetchDrawable(context, draw);
pread = (struct drisw_drawable *) driFetchDrawable(context, read);
+ driReleaseDrawables(&pcp->base);
+
if (pdraw == NULL || pread == NULL)
return GLXBadDrawable;
@@ -281,8 +285,6 @@ drisw_unbind_context(struct glx_context *context, struct glx_context *new)
struct drisw_screen *psc = (struct drisw_screen *) pcp->base.psc;
(*psc->core->unbindContext) (pcp->driContext);
-
- driReleaseDrawables(&pcp->base);
}
static const struct glx_context_vtable drisw_context_vtable = {
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index fa2e2d3..88a6edd 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -138,6 +138,7 @@ struct __GLXDRIdrawableRec
GLenum textureTarget;
GLenum textureFormat; /* EXT_texture_from_pixmap support */
unsigned long eventMask;
+ int refcount;
};
/*
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 064fd71..9eb7d5a 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -255,8 +255,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
if (--oldGC->thread_refcount == 0) {
oldGC->vtable->unbind(oldGC, gc);
oldGC->currentDpy = 0;
- oldGC->currentDrawable = None;
- oldGC->currentReadable = None;
if (oldGC->xid == None && oldGC != gc) {
/* We are switching away from a context that was
@@ -268,13 +266,15 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
}
if (gc) {
- if (gc->thread_refcount++ == 0) {
- gc->currentDpy = dpy;
- gc->currentDrawable = draw;
- gc->currentReadable = read;
- }
+ if (gc->thread_refcount == 0)
+ gc->currentDpy = dpy;
__glXSetCurrentContext(gc);
ret = gc->vtable->bind(gc, oldGC, draw, read);
+ if (gc->thread_refcount == 0) {
+ gc->currentDrawable = draw;
+ gc->currentReadable = read;
+ }
+ gc->thread_refcount++;
} else {
__glXSetCurrentContextNull();
}
commit 8173471fc25f4c768cab54fa840fd4c53d1c3c0f
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Jun 17 16:28:27 2011 +0100
scons: Move all env setup to scons/gallium.py
diff --git a/SConstruct b/SConstruct
index dc5fd77..104cc38 100644
--- a/SConstruct
+++ b/SConstruct
@@ -80,27 +80,6 @@ env.Append(CPPPATH = [
if env['msvc']:
env.Append(CPPPATH = ['#include/c99'])
-# Posix
-if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
- env.Append(CPPDEFINES = [
- '_POSIX_SOURCE',
- ('_POSIX_C_SOURCE', '199309L'),
- '_SVID_SOURCE',
- '_BSD_SOURCE',
- '_GNU_SOURCE',
- 'PTHREADS',
- 'HAVE_POSIX_MEMALIGN',
- ])
- if env['gcc']:
- env.Append(CFLAGS = ['-fvisibility=hidden'])
- if env['platform'] == 'darwin':
- env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
- env.Append(LIBS = [
- 'm',
- 'pthread',
- 'dl',
- ])
-
# for debugging
#print env.Dump()
diff --git a/scons/gallium.py b/scons/gallium.py
index 57acfe0..9d08efd 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -279,6 +279,18 @@ def generate(env):
cppdefines += ['NDEBUG']
if env['build'] == 'profile':
cppdefines += ['PROFILE']
+ if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
+ cppdefines += [
+ '_POSIX_SOURCE',
+ ('_POSIX_C_SOURCE', '199309L'),
+ '_SVID_SOURCE',
+ '_BSD_SOURCE',
+ '_GNU_SOURCE',
+ 'PTHREADS',
+ 'HAVE_POSIX_MEMALIGN',
+ ]
+ if env['platform'] == 'darwin':
+ cppdefines += ['_DARWIN_C_SOURCE']
if platform == 'windows':
cppdefines += [
'WIN32',
@@ -405,6 +417,8 @@ def generate(env):
ccflags += ['-m64']
if platform == 'darwin':
ccflags += ['-fno-common']
+ if env['platform'] != 'windows':
+ ccflags += ['-fvisibility=hidden']
# See also:
# - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
ccflags += [
@@ -597,7 +611,10 @@ def generate(env):
env['LINK'] = env['CXX']
# Default libs
- env.Append(LIBS = [])
+ libs = []
+ if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
+ libs += ['m', 'pthread', 'dl']
+ env.Append(LIBS = libs)
# Load tools
env.Tool('lex')
commit 41750107496858a047afa8d81d20fe903f285a78
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Jun 17 14:48:28 2011 +0100
scons: make embedding orthogonal to the platform
To enable embedding in platforms other than linux.
diff --git a/SConstruct b/SConstruct
index 8607d2c..dc5fd77 100644
--- a/SConstruct
+++ b/SConstruct
@@ -80,23 +80,6 @@ env.Append(CPPPATH = [
if env['msvc']:
env.Append(CPPPATH = ['#include/c99'])
-# Embedded
-if env['platform'] == 'embedded':
- env.Append(CPPDEFINES = [
- '_POSIX_SOURCE',
- ('_POSIX_C_SOURCE', '199309L'),
- '_SVID_SOURCE',
- '_BSD_SOURCE',
- '_GNU_SOURCE',
-
- 'PTHREADS',
- ])
- env.Append(LIBS = [
- 'm',
- 'pthread',
- 'dl',
- ])
-
# Posix
if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
env.Append(CPPDEFINES = [
@@ -130,7 +113,7 @@ if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
#
# Create host environent
-if env['crosscompile'] and env['platform'] != 'embedded':
+if env['crosscompile'] and not env['embedded']:
host_env = Environment(
options = opts,
# no tool used
diff --git a/common.py b/common.py
index 0a3dcdc..052929e 100644
--- a/common.py
+++ b/common.py
@@ -83,7 +83,8 @@ def AddOptions(opts):
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', host_platform,
- allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos', 'freebsd8')))
+ allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'cygwin', 'sunos', 'freebsd8')))
+ opts.Add(BoolOption('embedded', 'embedded build', 'no'))
opts.Add('toolchain', 'compiler toolchain', default_toolchain)
opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support', 'no'))
opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
diff --git a/scons/gallium.py b/scons/gallium.py
index a94bf73..57acfe0 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -247,6 +247,8 @@ def generate(env):
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
build_topdir = 'build'
build_subdir = env['platform']
+ if env['embedded']:
+ build_subdir = 'embedded-' + build_subdir
if env['machine'] != 'generic':
build_subdir += '-' + env['machine']
if env['build'] != 'release':
@@ -349,8 +351,8 @@ def generate(env):
if platform == 'wince':
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE']
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL']
- if platform == 'embedded':
- cppdefines += ['PIPE_OS_EMBEDDED']
+ if env['embedded']:
+ cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED']
env.Append(CPPDEFINES = cppdefines)
# C compiler options
diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index 428bc31..3072ee9 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -53,7 +53,7 @@ if env['drm']:
# Needed by some state trackers
SConscript('winsys/sw/null/SConscript')
-if env['platform'] != 'embedded':
+if not env['embedded']:
SConscript('state_trackers/vega/SConscript')
SConscript('state_trackers/egl/SConscript')
@@ -66,8 +66,8 @@ if env['platform'] != 'embedded':
if env['dri'] and env['xorg']:
SConscript('state_trackers/xorg/SConscript')
-if env['platform'] == 'windows':
- SConscript('state_trackers/wgl/SConscript')
+ if env['platform'] == 'windows':
+ SConscript('state_trackers/wgl/SConscript')
#
# Winsys
@@ -83,55 +83,55 @@ SConscript([
'targets/graw-null/SConscript',
])
-if env['platform'] != 'embedded':
+if not env['embedded']:
SConscript([
'targets/egl-static/SConscript'
])
-if env['x11']:
- SConscript([
- 'targets/graw-xlib/SConscript',
- 'targets/libgl-xlib/SConscript',
- ])
+ if env['x11']:
+ SConscript([
+ 'targets/graw-xlib/SConscript',
+ 'targets/libgl-xlib/SConscript',
+ ])
-if env['platform'] == 'windows':
- SConscript([
- 'targets/graw-gdi/SConscript',
- 'targets/libgl-gdi/SConscript',
- ])
+ if env['platform'] == 'windows':
+ SConscript([
+ 'targets/graw-gdi/SConscript',
+ 'targets/libgl-gdi/SConscript',
+ ])
-if env['dri']:
- SConscript([
- 'targets/SConscript.dri',
- 'targets/dri-swrast/SConscript',
- 'targets/dri-vmwgfx/SConscript',
- #'targets/dri-nouveau/SConscript',
- ])
- if env['drm_intel']:
+ if env['dri']:
SConscript([
- 'targets/dri-i915/SConscript',
- 'targets/dri-i965/SConscript',
+ 'targets/SConscript.dri',
+ 'targets/dri-swrast/SConscript',
+ 'targets/dri-vmwgfx/SConscript',
+ #'targets/dri-nouveau/SConscript',
])
- if env['drm_radeon']:
+ if env['drm_intel']:
+ SConscript([
+ 'targets/dri-i915/SConscript',
+ 'targets/dri-i965/SConscript',
+ ])
+ if env['drm_radeon']:
+ SConscript([
+ 'targets/dri-r300/SConscript',
+ 'targets/dri-r600/SConscript',
+ ])
+
+ if env['xorg'] and env['drm']:
SConscript([
- 'targets/dri-r300/SConscript',
- 'targets/dri-r600/SConscript',
+ #'targets/xorg-i915/SConscript',
+ #'targets/xorg-i965/SConscript',
+ #'targets/xorg-nouveau/SConscript',
+ #'targets/xorg-radeon/SConscript',
+ 'targets/xorg-vmwgfx/SConscript',
])
-if env['xorg'] and env['drm']:
- SConscript([
- #'targets/xorg-i915/SConscript',
- #'targets/xorg-i965/SConscript',
- #'targets/xorg-nouveau/SConscript',
- #'targets/xorg-radeon/SConscript',
- 'targets/xorg-vmwgfx/SConscript',
- ])
-
#
# Unit tests & tools
#
-if env['platform'] != 'embedded':
+if not env['embedded']:
SConscript('tests/unit/SConscript')
SConscript('tests/graw/SConscript')
diff --git a/src/gallium/auxiliary/os/os_memory.h b/src/gallium/auxiliary/os/os_memory.h
index 556662d..91a84a2 100644
--- a/src/gallium/auxiliary/os/os_memory.h
+++ b/src/gallium/auxiliary/os/os_memory.h
@@ -39,7 +39,7 @@
#include "pipe/p_compiler.h"
-#if defined(PIPE_OS_EMBEDDED)
+#if defined(PIPE_SUBSYSTEM_EMBEDDED)
#ifdef __cplusplus
extern "C" {
diff --git a/src/gallium/auxiliary/os/os_misc.h b/src/gallium/auxiliary/os/os_misc.h
index d59f981..48522da 100644
--- a/src/gallium/auxiliary/os/os_misc.h
+++ b/src/gallium/auxiliary/os/os_misc.h
@@ -58,8 +58,6 @@ extern "C" {
# define os_break() __debugbreak()
#elif defined(PIPE_OS_UNIX)
# define os_break() kill(getpid(), SIGTRAP)
-#elif defined(PIPE_OS_EMBEDDED)
-void os_break(void);
#else
# define os_break() abort()
#endif
@@ -70,8 +68,6 @@ void os_break(void);
*/
#if defined(DEBUG) || defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
# define os_abort() os_break()
-#elif defined(PIPE_OS_EMBEDDED)
-void os_abort(void);
#else
# define os_abort() abort()
#endif
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index 6b4281a..8f1245b 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -40,7 +40,7 @@
#include "util/u_debug.h" /* for assert */
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
#include <pthread.h> /* POSIX threads headers */
#include <stdio.h> /* for perror() */
@@ -314,7 +314,7 @@ typedef int64_t pipe_condvar;
* pipe_barrier
*/
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
typedef pthread_barrier_t pipe_barrier;
@@ -442,7 +442,7 @@ pipe_semaphore_wait(pipe_semaphore *sema)
*/
typedef struct {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
pthread_key_t key;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
DWORD key;
@@ -457,7 +457,7 @@ typedef struct {
static INLINE void
pipe_tsd_init(pipe_tsd *tsd)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
perror("pthread_key_create(): failed to allocate key for thread specific data");
exit(-1);
@@ -474,7 +474,7 @@ pipe_tsd_get(pipe_tsd *tsd)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
return pthread_getspecific(tsd->key);
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
assert(0);
@@ -491,7 +491,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
if (pthread_setspecific(tsd->key, value) != 0) {
perror("pthread_set_specific() failed");
exit(-1);
diff --git a/src/gallium/auxiliary/os/os_time.c b/src/gallium/auxiliary/os/os_time.c
index 325f316..73d8629 100644
--- a/src/gallium/auxiliary/os/os_time.c
+++ b/src/gallium/auxiliary/os/os_time.c
@@ -35,8 +35,6 @@
#include "pipe/p_config.h"
-#if !defined(PIPE_OS_EMBEDDED)
-
#if defined(PIPE_OS_UNIX)
# include <sys/time.h> /* timeval */
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
@@ -123,6 +121,3 @@ os_time_sleep(int64_t usecs)
}
#endif
-
-
-#endif /* !PIPE_OS_EMBEDDED */
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index 36ce4b5..004df43 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -48,7 +48,7 @@
void _debug_vprintf(const char *format, va_list ap)
{
-#if defined(PIPE_OS_WINDOWS) || defined(PIPE_OS_EMBEDDED)
+#if defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_EMBEDDED)
/* We buffer until we find a newline. */
static char buf[4096] = {'\0'};
size_t len = strlen(buf);
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
index c10a8cb..d6b20ce 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -79,7 +79,7 @@ llvmpipe = env.ConvenienceLibrary(
env.Alias('llvmpipe', llvmpipe)
-if env['platform'] != 'embedded':
+if not env['embedded']:
env = env.Clone()
env.Prepend(LIBS = [llvmpipe] + gallium)
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 036a6e0..4b2ae14 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -423,7 +423,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
lp_jit_screen_init(screen);
screen->num_threads = util_cpu_caps.nr_cpus > 1 ? util_cpu_caps.nr_cpus : 0;
-#ifdef PIPE_OS_EMBEDDED
+#ifdef PIPE_SUBSYSTEM_EMBEDDED
screen->num_threads = 0;
#endif
screen->num_threads = debug_get_num_option("LP_NUM_THREADS", screen->num_threads);
diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h
index 40f6f2b..eea3d79 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -134,8 +134,6 @@
#error Unknown Endianness
#endif
-#if !defined(PIPE_OS_EMBEDDED)
-
/*
* Auto-detect the operating system family.
*
@@ -222,7 +220,5 @@
#endif
#endif /* PIPE_OS_WINDOWS */
-#endif /* !PIPE_OS_EMBEDDED */
-
#endif /* P_CONFIG_H_ */
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index c325583..1441cc7 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -102,7 +102,7 @@ if env['msvc']:
env.Prepend(CPPPATH = ['#/src/getopt'])
env.PrependUnique(LIBS = [getopt])
-if env['crosscompile'] and env['platform'] != 'embedded':
+if env['crosscompile'] and not env['embedded']:
Import('builtin_glsl_function')
else:
# Copy these files to avoid generation object files into src/mesa/program
@@ -156,7 +156,7 @@ Export('glsl')
# Skip building these programs as they will cause SCons error "Two environments
# with different actions were specified for the same target"
-if env['crosscompile'] or env['platform'] == 'embedded':
+if env['crosscompile'] or env['embedded']:
Return()
env = env.Clone()
commit fc8c4a3a7b92a1134cd3a9312063abba9e14b0fe
Author: Brian Paul <brianp at vmware.com>
Date: Thu Jun 16 07:31:58 2011 -0600
mesa: use helper functions to distinguish between user/winsys FBOs
And replace IS_CUBE_FACE() macro w/ inline function.
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 2230b26..07853e0 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -78,9 +78,32 @@ static struct gl_renderbuffer DummyRenderbuffer;
static struct gl_framebuffer IncompleteFramebuffer;
-#define IS_CUBE_FACE(TARGET) \
- ((TARGET) >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && \
- (TARGET) <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)
+static INLINE GLboolean
+is_cube_face(GLenum target)
+{
+ return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
+}
+
+
+/**
+ * Is the given FBO a user-created FBO?
+ */
+static INLINE GLboolean
+is_user_fbo(const struct gl_framebuffer *fb)
+{
+ return fb->Name != 0;
+}
+
+
+/**
+ * Is the given FBO a window system FBO (like an X window)?
+ */
+static INLINE GLboolean
+is_winsys_fbo(const struct gl_framebuffer *fb)
+{
+ return fb->Name == 0;
+}
static void
@@ -196,7 +219,7 @@ _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
{
GLuint i;
- assert(fb->Name > 0);
+ assert(is_user_fbo(fb));
switch (attachment) {
case GL_COLOR_ATTACHMENT0_EXT:
@@ -244,7 +267,7 @@ static struct gl_renderbuffer_attachment *
_mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
GLenum attachment)
{
- assert(fb->Name == 0);
+ assert(is_winsys_fbo(fb));
switch (attachment) {
case GL_FRONT_LEFT:
@@ -669,7 +692,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
GLint i;
GLuint j;
- assert(fb->Name != 0);
+ assert(is_user_fbo(fb));
numImages = 0;
fb->Width = 0;
@@ -968,10 +991,11 @@ _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers)
_mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
}
- if (ctx->DrawBuffer->Name) {
+ if (is_user_fbo(ctx->DrawBuffer)) {
detach_renderbuffer(ctx, ctx->DrawBuffer, rb);
}
- if (ctx->ReadBuffer->Name && ctx->ReadBuffer != ctx->DrawBuffer) {
+ if (is_user_fbo(ctx->ReadBuffer)
+ && ctx->ReadBuffer != ctx->DrawBuffer) {
detach_renderbuffer(ctx, ctx->ReadBuffer, rb);
}
@@ -1203,7 +1227,7 @@ invalidate_rb(GLuint key, void *data, void *userData)
struct gl_renderbuffer *rb = (struct gl_renderbuffer *) userData;
/* If this is a user-created FBO */
- if (fb->Name) {
+ if (is_user_fbo(fb)) {
GLuint i;
for (i = 0; i < BUFFER_COUNT; i++) {
struct gl_renderbuffer_attachment *att = fb->Attachment + i;
@@ -1532,7 +1556,7 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
GLuint i;
ASSERT(ctx->Driver.RenderTexture);
- if (fb->Name == 0)
+ if (is_winsys_fbo(fb));
return; /* can't render to texture with winsys framebuffers */
for (i = 0; i < BUFFER_COUNT; i++) {
@@ -1552,7 +1576,7 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
static void
check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
{
- if (fb->Name == 0)
+ if (is_winsys_fbo(fb));
return; /* can't render to texture with winsys framebuffers */
if (ctx->Driver.FinishRenderTexture) {
@@ -1805,7 +1829,7 @@ _mesa_CheckFramebufferStatusEXT(GLenum target)
return 0;
}
- if (buffer->Name == 0) {
+ if (is_winsys_fbo(buffer)) {
/* The window system / default framebuffer is always complete */
return GL_FRAMEBUFFER_COMPLETE_EXT;
}
@@ -1843,7 +1867,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
}
/* check framebuffer binding */
- if (fb->Name == 0) {
+ if (is_winsys_fbo(fb)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glFramebufferTexture%sEXT", caller);
return;
@@ -1866,7 +1890,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
}
else {
err = (texObj->Target == GL_TEXTURE_CUBE_MAP)
- ? !IS_CUBE_FACE(textarget)
+ ? !is_cube_face(textarget)
: (texObj->Target != textarget);
}
}
@@ -1970,7 +1994,7 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
if ((texture != 0) &&
(textarget != GL_TEXTURE_2D) &&
(textarget != GL_TEXTURE_RECTANGLE_ARB) &&
- (!IS_CUBE_FACE(textarget))) {
+ (!is_cube_face(textarget))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glFramebufferTexture2DEXT(textarget=0x%x)", textarget);
return;
@@ -2034,7 +2058,7 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
return;
}
- if (fb->Name == 0) {
+ if (is_winsys_fbo(fb)) {
/* Can't attach new renderbuffers to a window system framebuffer */
_mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT");
return;
@@ -2111,7 +2135,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
return;
}
- if (buffer->Name == 0) {
+ if (is_winsys_fbo(buffer)) {
/* the default / window-system FBO */
att = _mesa_get_fb0_attachment(ctx, buffer, attachment);
}
@@ -2143,7 +2167,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
switch (pname) {
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
- *params = buffer->Name == 0 ? GL_FRAMEBUFFER_DEFAULT : att->Type;
+ *params = is_winsys_fbo(buffer) ? GL_FRAMEBUFFER_DEFAULT : att->Type;
return;
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT:
if (att->Type == GL_RENDERBUFFER_EXT) {
commit 37e6ab7b2de90ee90c06ceb08974423248fa6ee5
Author: Brian Paul <brianp at vmware.com>
Date: Thu Jun 16 07:31:58 2011 -0600
mesa: refactor, create _mesa_update_draw_buffers() helper
Move this code out of _mesa_make_current() and put it into a
helper function.
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 63f53e2..a75c9c2 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -462,6 +462,27 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
/**
+ * Update the current drawbuffer's _ColorDrawBufferIndex[] list, etc.
+ * from the context's Color.DrawBuffer[] state.
+ * Use when changing contexts.
+ */
+void
+_mesa_update_draw_buffers(struct gl_context *ctx)
+{
+ GLenum buffers[MAX_DRAW_BUFFERS];
+ GLuint i;
+
+ /* should be a window system FBO */
+ assert(ctx->DrawBuffer->Name == 0);
+
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++)
+ buffers[i] = ctx->Color.DrawBuffer[i];
+
+ _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers, buffers, NULL);
+}
+
+
+/**
* Like \sa _mesa_drawbuffers(), this is a helper function for setting
* GL_READ_BUFFER state in the context and current FBO.
* \param ctx the rendering context
diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h
index 1404112..8083bc3 100644
--- a/src/mesa/main/buffers.h
+++ b/src/mesa/main/buffers.h
@@ -50,6 +50,10 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
extern void
_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex);
+extern void
+_mesa_update_draw_buffers(struct gl_context *ctx);
+
+
extern void GLAPIENTRY
_mesa_ReadBuffer( GLenum mode );
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index ef79f1f..b83a5d6 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1456,21 +1456,12 @@ _mesa_make_current( struct gl_context *newCtx,
* or not bound to a user-created FBO.
*/
if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
+ _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
/* Update the FBO's list of drawbuffers/renderbuffers.
* For winsys FBOs this comes from the GL state (which may have
* changed since the last time this FBO was bound).
*/
- unsigned int i;
- GLenum buffers[MAX_DRAW_BUFFERS];
-
- _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
-
- for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) {
- buffers[i] = newCtx->Color.DrawBuffer[i];
- }
-
- _mesa_drawbuffers(newCtx, newCtx->Const.MaxDrawBuffers,
- buffers, NULL);
+ _mesa_update_draw_buffers(newCtx);
}
if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {
_mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);
commit 296052681601f98e16c701299d2b2a6d9bd5eeab
Author: Brian Paul <brianp at vmware.com>
Date: Thu Jun 16 07:31:58 2011 -0600
mesa: updated comments in _make_current()
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index ea13bdd..ef79f1f 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1430,7 +1430,8 @@ _mesa_make_current( struct gl_context *newCtx,
}
if (curCtx &&
- (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && /* make sure this context is valid for flushing */
+ (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) &&
+ /* make sure this context is valid for flushing */
curCtx != newCtx)
_mesa_flush(curCtx);
@@ -1445,8 +1446,6 @@ _mesa_make_current( struct gl_context *newCtx,
_glapi_set_dispatch(newCtx->CurrentDispatch);
if (drawBuffer && readBuffer) {
- /* TODO: check if newCtx and buffer's visual match??? */
-
ASSERT(drawBuffer->Name == 0);
ASSERT(readBuffer->Name == 0);
_mesa_reference_framebuffer(&newCtx->WinSysDrawBuffer, drawBuffer);
@@ -1457,11 +1456,9 @@ _mesa_make_current( struct gl_context *newCtx,
* or not bound to a user-created FBO.
*/
if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
- /* KW: merge conflict here, revisit.
- */
- /* fix up the fb fields - these will end up wrong otherwise
- * if the DRIdrawable changes, and everything relies on them.
- * This is a bit messy (same as needed in _mesa_BindFramebufferEXT)
+ /* Update the FBO's list of drawbuffers/renderbuffers.
+ * For winsys FBOs this comes from the GL state (which may have
+ * changed since the last time this FBO was bound).
*/
unsigned int i;
GLenum buffers[MAX_DRAW_BUFFERS];
commit 016621ee142682153cb292cd3774e6d9377871ae
Author: Vadim Girlin <vadimgirlin at gmail.com>
Date: Tue Jun 14 21:11:04 2011 +0400
r600: fix SPI inputs setup on r600/r700
Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
Signed-off-by: Dave Airlie <airlied at redhat.com>
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index fa0c5cb..5f9f398 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -351,7 +351,7 @@ static void r600_spi_update(struct r600_pipe_context *rctx)
struct r600_pipe_shader *shader = rctx->ps_shader;
struct r600_pipe_state *rstate = &rctx->spi;
struct r600_shader *rshader = &shader->shader;
- unsigned i, tmp;
+ unsigned i, tmp, sid;
if (rctx->spi.id == 0)
r600_spi_block_init(rctx, &rctx->spi);
@@ -360,9 +360,14 @@ static void r600_spi_update(struct r600_pipe_context *rctx)
for (i = 0; i < rshader->ninput; i++) {
if (rshader->input[i].name == TGSI_SEMANTIC_POSITION ||
rshader->input[i].name == TGSI_SEMANTIC_FACE)
- continue;
-
- tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i));
+ if (rctx->family >= CHIP_CEDAR)
+ continue;
+ else
+ sid=0;
+ else
+ sid=r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i);
+
+ tmp = S_028644_SEMANTIC(sid);
if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
commit 8875dd58719b978283e89acf04422a4eaf9b021d
Author: Chad Versace <chad at chad-versace.us>
Date: Tue Jun 14 12:56:49 2011 -0700
intel: Fix typo in intel_offset_S8 comments
Signed-off-by: Chad Versace <chad at chad-versace.us>
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 9343f40..fdf687a 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -148,7 +148,7 @@ intel_set_span_functions(struct intel_context *intel,
* x | y | byte offset
* --------------------------
* 0 | 0 | 0
- * 0 | 0 | 1
+ * 0 | 1 | 1
* 1 | 0 | 2
* 1 | 1 | 3
* ... | ... | ...
commit d105f6684dfbfe596e57ddeb9377e7f9e4e57dcb
Author: Chad Versace <chad at chad-versace.us>
Date: Wed Jun 8 21:51:10 2011 -0700
i965/gen5,6: Fix hang when emitting hiz buffer without stencil buffer
When emitting either a hiz or stencil buffer, the 'separate stencil
enable' and 'hiz enable' bits are set in 3DSTATE_DEPTH_BUFFER. Therefore
we must emit both 3DSTATE_HIER_DEPTH_BUFFER and 3DSTATE_STENCIL_BUFFER.
Even if there is no stencil buffer, 3DSTATE_STENCIL_BUFFER must be
emitted; failure to do so causes a hang on gen5 and a stall on gen6.
This also fixes a silly, obvious segfault that occured when a hiz buffer
xor separate stencil buffer existed.
Fixes the piglit tests below on Gen5 when hiz and separate stencil are
manually enabled:
fbo-alphatest-nocolor
fbo-depth-sample-compare
fbo
hiz-depth-read-fbo-d24-s0
hiz-depth-stencil-test-fbo-d24-s0
hiz-depth-test-fbo-d24-s0
hiz-stencil-read-fbo-d0-s8
hiz-stencil-test-fbo-d0-s8
fbo-missing-attachment-clear
fbo-clear-formats
fbo-depth-*
Changes piglit test result from crash to fail:
hiz-depth-stencil-test-fbo-d0-s8
Signed-off-by: Chad Versace <chad at chad-versace.us>
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 2b5ec8a..1f3b64f 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -355,26 +355,48 @@ static void emit_depthbuffer(struct brw_context *brw)
ADVANCE_BATCH();
}
- /* Emit hiz buffer. */
if (hiz_region || stencil_irb) {
- BEGIN_BATCH(3);
- OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER << 16) | (3 - 2));
- OUT_BATCH(hiz_region->pitch * hiz_region->cpp - 1);
- OUT_RELOC(hiz_region->buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- 0);
- ADVANCE_BATCH();
- }
+ /*
+ * In the 3DSTATE_DEPTH_BUFFER batch emitted above, the 'separate
+ * stencil enable' and 'hiz enable' bits were set. Therefore we must
+ * emit 3DSTATE_HIER_DEPTH_BUFFER and 3DSTATE_STENCIL_BUFFER. Even if
+ * there is no stencil buffer, 3DSTATE_STENCIL_BUFFER must be emitted;
+ * failure to do so causes hangs on gen5 and a stall on gen6.
+ */
- /* Emit stencil buffer. */
- if (hiz_region || stencil_irb) {
- BEGIN_BATCH(3);
- OUT_BATCH((_3DSTATE_STENCIL_BUFFER << 16) | (3 - 2));
- OUT_BATCH(stencil_irb->region->pitch * stencil_irb->region->cpp - 1);
- OUT_RELOC(stencil_irb->region->buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- 0);
- ADVANCE_BATCH();
+ /* Emit hiz buffer. */
+ if (hiz_region) {
+ BEGIN_BATCH(3);
+ OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER << 16) | (3 - 2));
+ OUT_BATCH(hiz_region->pitch * hiz_region->cpp - 1);
+ OUT_RELOC(hiz_region->buffer,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ 0);
+ ADVANCE_BATCH();
+ } else {
+ BEGIN_BATCH(3);
+ OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER << 16) | (3 - 2));
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+ }
+
+ /* Emit stencil buffer. */
+ if (stencil_irb) {
+ BEGIN_BATCH(3);
+ OUT_BATCH((_3DSTATE_STENCIL_BUFFER << 16) | (3 - 2));
+ OUT_BATCH(stencil_irb->region->pitch * stencil_irb->region->cpp - 1);
+ OUT_RELOC(stencil_irb->region->buffer,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ 0);
+ ADVANCE_BATCH();
+ } else {
+ BEGIN_BATCH(3);
+ OUT_BATCH((_3DSTATE_STENCIL_BUFFER << 16) | (3 - 2));
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+ }
}
/*
commit 6f243ec25d88589747c7a595903e201b90a4d767
Author: Marek Olšák <maraeo at gmail.com>
Date: Wed Jun 15 14:26:41 2011 +0200
r600g: disable render condition for some blitter operations
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index e9f35c1..043c875 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -27,9 +27,18 @@
enum r600_blitter_op /* bitmask */
{
- R600_CLEAR = 1,
- R600_CLEAR_SURFACE = 2,
- R600_COPY = 4
+ R600_SAVE_TEXTURES = 1,
+ R600_SAVE_FRAMEBUFFER = 2,
+ R600_DISABLE_RENDER_COND = 4,
+
+ R600_CLEAR = 0,
+
+ R600_CLEAR_SURFACE = R600_SAVE_FRAMEBUFFER,
+
+ R600_COPY = R600_SAVE_FRAMEBUFFER | R600_SAVE_TEXTURES |
+ R600_DISABLE_RENDER_COND,
+
+ R600_DECOMPRESS = R600_SAVE_FRAMEBUFFER | R600_DISABLE_RENDER_COND,
};
static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op)
@@ -58,10 +67,10 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op
rctx->vbuf_mgr->nr_vertex_buffers,
rctx->vbuf_mgr->vertex_buffer);
- if (op & (R600_CLEAR_SURFACE | R600_COPY))
+ if (op & R600_SAVE_FRAMEBUFFER)
util_blitter_save_framebuffer(rctx->blitter, &rctx->framebuffer);
- if (op & R600_COPY) {
+ if (op & R600_SAVE_TEXTURES) {
util_blitter_save_fragment_sampler_states(
rctx->blitter, rctx->ps_samplers.n_samplers,
(void**)rctx->ps_samplers.samplers);
@@ -71,11 +80,23 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op
(struct pipe_sampler_view**)rctx->ps_samplers.views);
}
+ if ((op & R600_DISABLE_RENDER_COND) && rctx->current_render_cond) {
+ rctx->saved_render_cond = rctx->current_render_cond;
+ rctx->saved_render_cond_mode = rctx->current_render_cond_mode;
+ rctx->context.render_condition(&rctx->context, NULL, 0);
+ }
+
}
static void r600_blitter_end(struct pipe_context *ctx)
{
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ if (rctx->saved_render_cond) {
+ rctx->context.render_condition(&rctx->context,
+ rctx->saved_render_cond,
+ rctx->saved_render_cond_mode);
+ rctx->saved_render_cond = NULL;
+ }
r600_context_queries_resume(&rctx->ctx);
rctx->blit = false;
}
@@ -107,7 +128,7 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t
rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
depth = 0.0f;
- r600_blitter_begin(ctx, R600_CLEAR_SURFACE);
+ r600_blitter_begin(ctx, R600_DECOMPRESS);
util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth);
r600_blitter_end(ctx);
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 5e534ca..84a45be 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -191,6 +191,10 @@ struct r600_pipe_context {
struct r600_pipe_rasterizer *rasterizer;
struct r600_pipe_state vgt;
struct r600_pipe_state spi;
+ struct pipe_query *current_render_cond;
+ unsigned current_render_cond_mode;
+ struct pipe_query *saved_render_cond;
+ unsigned saved_render_cond_mode;
/* shader information */
unsigned sprite_coord_enable;
boolean flatshade;
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 181ea3f..bedb48b 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -75,6 +75,9 @@ static void r600_render_condition(struct pipe_context *ctx,
struct r600_query *rquery = (struct r600_query *)query;
int wait_flag = 0;
+ rctx->current_render_cond = query;
+ rctx->current_render_cond_mode = mode;
+
if (!query) {
rctx->ctx.predicate_drawing = false;
r600_query_predication(&rctx->ctx, NULL, PREDICATION_OP_CLEAR, 1);
commit 40aec11b7569fcdd2d884629b172af3db3fbaf1d
Author: Mike Kaplinskiy <mike.kaplinskiy at gmail.com>
Date: Wed Jun 15 16:56:10 2011 +1000
r600g: fix TXD src regs needing fetching.
[airlied: final chunk of Mike's patch from bug 37476
this uses a loop to emit the GRADIENTS and does a check to
see if we need to fetch to a temporary register. It also
increases the context src gpr to 4 which is needed here.]
Signed-off-by: Dave Airlie <airlied at redhat.com>
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 0eb776c..b8a86b0 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -186,7 +186,7 @@ struct r600_shader_ctx {
struct r600_shader_tgsi_instruction *inst_info;
struct r600_bc *bc;
struct r600_shader *shader;
- struct r600_shader_src src[3];
+ struct r600_shader_src src[4];
u32 *literals;
u32 nliterals;
u32 max_driver_temp_used;
@@ -1768,7 +1768,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
struct r600_bc_tex tex;
struct r600_bc_alu alu;
unsigned src_gpr;
- int r, i;
+ int r, i, j;
int opcode;
/* Texture fetch instructions can only use gprs as source.
* Also they cannot negate the source or take the absolute value */
@@ -1782,51 +1782,55 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
/* TGSI moves the sampler to src reg 3 for TXD */
sampler_src_reg = 3;
- /* set gradients h/v */
- memset(&tex, 0, sizeof(struct r600_bc_tex));
- tex.inst = SQ_TEX_INST_SET_GRADIENTS_H;
- tex.sampler_id = tgsi_tex_get_src_gpr(ctx, sampler_src_reg);
- tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
- tex.src_gpr = tgsi_tex_get_src_gpr(ctx, 1);
- tex.src_sel_x = ctx->src[1].swizzle[0];
- tex.src_sel_y = ctx->src[1].swizzle[1];
- tex.src_sel_z = ctx->src[1].swizzle[2];
- tex.src_sel_w = ctx->src[1].swizzle[3];
- tex.src_rel = ctx->src[1].rel;
- tex.dst_gpr = ctx->temp_reg; /* just to avoid confusing the asm scheduler */
- tex.dst_sel_x = tex.dst_sel_y = tex.dst_sel_z = tex.dst_sel_w = 7;
- if (inst->Texture.Texture != TGSI_TEXTURE_RECT) {
- tex.coord_type_x = 1;
- tex.coord_type_y = 1;
- tex.coord_type_z = 1;
- tex.coord_type_w = 1;
- }
- r = r600_bc_add_tex(ctx->bc, &tex);
- if (r)
- return r;
+ for (i = 1; i < 3; i++) {
+ /* set gradients h/v */
+ memset(&tex, 0, sizeof(struct r600_bc_tex));
+ tex.inst = (i == 1) ? SQ_TEX_INST_SET_GRADIENTS_H :
+ SQ_TEX_INST_SET_GRADIENTS_V;
+ tex.sampler_id = tgsi_tex_get_src_gpr(ctx, sampler_src_reg);
+ tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
+
+ if (tgsi_tex_src_requires_loading(ctx, i)) {
+ tex.src_gpr = r600_get_temp(ctx);
+ tex.src_sel_x = 0;
+ tex.src_sel_y = 1;
+ tex.src_sel_z = 2;
+ tex.src_sel_w = 3;
+
+ for (j = 0; j < 4; j++) {
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
+ r600_bc_src(&alu.src[0], &ctx->src[i], j);
+ alu.dst.sel = tex.src_gpr;
+ alu.dst.chan = j;
+ if (j == 3)
+ alu.last = 1;
+ alu.dst.write = 1;
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+ }
- /* set gradients h/v */
- memset(&tex, 0, sizeof(struct r600_bc_tex));
- tex.inst = SQ_TEX_INST_SET_GRADIENTS_V;
- tex.sampler_id = tgsi_tex_get_src_gpr(ctx, sampler_src_reg);
- tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
- tex.src_gpr = tgsi_tex_get_src_gpr(ctx, 2);
- tex.src_sel_x = ctx->src[2].swizzle[0];
- tex.src_sel_y = ctx->src[2].swizzle[1];
- tex.src_sel_z = ctx->src[2].swizzle[2];
- tex.src_sel_w = ctx->src[2].swizzle[3];
- tex.src_rel = ctx->src[2].rel;
- tex.dst_gpr = ctx->temp_reg; /* just to avoid confusing the asm scheduler */
- tex.dst_sel_x = tex.dst_sel_y = tex.dst_sel_z = tex.dst_sel_w = 7;
- if (inst->Texture.Texture != TGSI_TEXTURE_RECT) {
- tex.coord_type_x = 1;
- tex.coord_type_y = 1;
- tex.coord_type_z = 1;
- tex.coord_type_w = 1;
- }
- r = r600_bc_add_tex(ctx->bc, &tex);
- if (r)
- return r;
+ } else {
+ tex.src_gpr = tgsi_tex_get_src_gpr(ctx, i);
+ tex.src_sel_x = ctx->src[i].swizzle[0];
+ tex.src_sel_y = ctx->src[i].swizzle[1];
+ tex.src_sel_z = ctx->src[i].swizzle[2];
+ tex.src_sel_w = ctx->src[i].swizzle[3];
+ tex.src_rel = ctx->src[i].rel;
+ }
+ tex.dst_gpr = ctx->temp_reg; /* just to avoid confusing the asm scheduler */
+ tex.dst_sel_x = tex.dst_sel_y = tex.dst_sel_z = tex.dst_sel_w = 7;
+ if (inst->Texture.Texture != TGSI_TEXTURE_RECT) {
+ tex.coord_type_x = 1;
+ tex.coord_type_y = 1;
+ tex.coord_type_z = 1;
+ tex.coord_type_w = 1;
+ }
+ r = r600_bc_add_tex(ctx->bc, &tex);
+ if (r)
+ return r;
+ }
} else if (inst->Instruction.Opcode == TGSI_OPCODE_TXP) {
int out_chan;
/* Add perspective divide */
commit 6415f256637306fcbaa94fbdaf1bd7692070dce1
Author: Mike Kaplinskiy <mike.kaplinskiy at gmail.com>
Date: Wed Jun 15 16:26:17 2011 +1000
r600g: use inlines for some common tex instr setup code.
[airlied: taken from Mike's patch in bug 37476]
Signed-off-by: Dave Airlie <airlied at redhat.com>
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 4a08887..0eb776c 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1745,6 +1745,22 @@ static int tgsi_dp(struct r600_shader_ctx *ctx)
return 0;
}
+static inline boolean tgsi_tex_src_requires_loading(struct r600_shader_ctx *ctx,
+ unsigned index)
+{
+ struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
+ return (inst->Src[index].Register.File != TGSI_FILE_TEMPORARY &&
+ inst->Src[index].Register.File != TGSI_FILE_INPUT) ||
+ ctx->src[index].neg || ctx->src[index].abs;
+}
+
+static inline unsigned tgsi_tex_get_src_gpr(struct r600_shader_ctx *ctx,
+ unsigned index)
+{
+ struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
+ return ctx->file_offset[inst->Src[index].Register.File] + inst->Src[index].Register.Index;
+}
+
static int tgsi_tex(struct r600_shader_ctx *ctx)
{
static float one_point_five = 1.5f;
@@ -1756,14 +1772,11 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
int opcode;
/* Texture fetch instructions can only use gprs as source.
* Also they cannot negate the source or take the absolute value */
- const boolean src_requires_loading =
- (inst->Src[0].Register.File != TGSI_FILE_TEMPORARY &&
- inst->Src[0].Register.File != TGSI_FILE_INPUT) ||
- ctx->src[0].neg || ctx->src[0].abs;
+ const boolean src_requires_loading = tgsi_tex_src_requires_loading(ctx, 0);
boolean src_loaded = FALSE;
unsigned sampler_src_reg = 1;
- src_gpr = ctx->file_offset[inst->Src[0].Register.File] + inst->Src[0].Register.Index;
+ src_gpr = tgsi_tex_get_src_gpr(ctx, 0);
if (inst->Instruction.Opcode == TGSI_OPCODE_TXD) {
/* TGSI moves the sampler to src reg 3 for TXD */
@@ -1772,9 +1785,9 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
/* set gradients h/v */
memset(&tex, 0, sizeof(struct r600_bc_tex));
tex.inst = SQ_TEX_INST_SET_GRADIENTS_H;
- tex.sampler_id = ctx->file_offset[inst->Src[sampler_src_reg].Register.File] + inst->Src[sampler_src_reg].Register.Index;
+ tex.sampler_id = tgsi_tex_get_src_gpr(ctx, sampler_src_reg);
tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
- tex.src_gpr = ctx->file_offset[inst->Src[1].Register.File] + inst->Src[1].Register.Index;
+ tex.src_gpr = tgsi_tex_get_src_gpr(ctx, 1);
tex.src_sel_x = ctx->src[1].swizzle[0];
tex.src_sel_y = ctx->src[1].swizzle[1];
tex.src_sel_z = ctx->src[1].swizzle[2];
@@ -1795,9 +1808,9 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
/* set gradients h/v */
memset(&tex, 0, sizeof(struct r600_bc_tex));
tex.inst = SQ_TEX_INST_SET_GRADIENTS_V;
- tex.sampler_id = ctx->file_offset[inst->Src[sampler_src_reg].Register.File] + inst->Src[sampler_src_reg].Register.Index;
+ tex.sampler_id = tgsi_tex_get_src_gpr(ctx, sampler_src_reg);
tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
- tex.src_gpr = ctx->file_offset[inst->Src[2].Register.File] + inst->Src[2].Register.Index;
+ tex.src_gpr = tgsi_tex_get_src_gpr(ctx, 2);
tex.src_sel_x = ctx->src[2].swizzle[0];
tex.src_sel_y = ctx->src[2].swizzle[1];
tex.src_sel_z = ctx->src[2].swizzle[2];
@@ -2017,8 +2030,8 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
memset(&tex, 0, sizeof(struct r600_bc_tex));
tex.inst = opcode;
-
- tex.sampler_id = ctx->file_offset[inst->Src[sampler_src_reg].Register.File] + inst->Src[sampler_src_reg].Register.Index;
+
+ tex.sampler_id = tgsi_tex_get_src_gpr(ctx, sampler_src_reg);
tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
tex.src_gpr = src_gpr;
tex.dst_gpr = ctx->file_offset[inst->Dst[0].Register.File] + inst->Dst[0].Register.Index;
commit ef8f6a8c59e88fb7498f3a0f7440bcc4ec1e8a98
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Tue Jun 14 21:36:43 2011 -0700
glsl/builtins: Actually implement int/ivec variants of abs().
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
NOTE: This is a candidate for stable release branches (and don't forget
to re-run "make builtins" after cherry-picking.)
diff --git a/src/glsl/builtins/ir/abs b/src/glsl/builtins/ir/abs
index 9048453..d07d1d9 100644
--- a/src/glsl/builtins/ir/abs
+++ b/src/glsl/builtins/ir/abs
@@ -18,4 +18,24 @@
(parameters
(declare (in) vec4 arg0))
((return (expression vec4 abs (var_ref arg0)))))
+
+ (signature int
+ (parameters
+ (declare (in) int arg0))
+ ((return (expression int abs (var_ref arg0)))))
+
+ (signature ivec2
+ (parameters
+ (declare (in) ivec2 arg0))
+ ((return (expression ivec2 abs (var_ref arg0)))))
+
+ (signature ivec3
+ (parameters
+ (declare (in) ivec3 arg0))
+ ((return (expression ivec3 abs (var_ref arg0)))))
+
+ (signature ivec4
+ (parameters
+ (declare (in) ivec4 arg0))
+ ((return (expression ivec4 abs (var_ref arg0)))))
))
commit de91ea1c06d3208edfb132fa8bea76bbd883f05c
Author: Mike Kaplinskiy <mike.kaplinskiy at gmai.com>
Date: Wed Jun 15 15:54:21 2011 +1000
r600g: fix TXD when shadowing is enabled.
Mike had actually done a lot of the TXD support in a patch in bug
37476 which I see now, I'll add the bits of his work that I didn't think
to add to my work.
Signed-off-by: Dave Airlie <airlied at redhat.com>
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 9a0df23..4a08887 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -2001,9 +2001,19 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
}
opcode = ctx->inst_info->r600_opcode;
- if (opcode == SQ_TEX_INST_SAMPLE &&
- (inst->Texture.Texture == TGSI_TEXTURE_SHADOW1D || inst->Texture.Texture == TGSI_TEXTURE_SHADOW2D))
- opcode = SQ_TEX_INST_SAMPLE_C;
+ if (inst->Texture.Texture == TGSI_TEXTURE_SHADOW1D || inst->Texture.Texture == TGSI_TEXTURE_SHADOW2D) {
+ switch (opcode) {
+ case SQ_TEX_INST_SAMPLE:
+ opcode = SQ_TEX_INST_SAMPLE_C;
+ break;
+ case SQ_TEX_INST_SAMPLE_L:
+ opcode = SQ_TEX_INST_SAMPLE_C_L;
+ break;
+ case SQ_TEX_INST_SAMPLE_G:
+ opcode = SQ_TEX_INST_SAMPLE_C_G;
+ break;
+ }
+ }
memset(&tex, 0, sizeof(struct r600_bc_tex));
tex.inst = opcode;
diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h
index 95672b1..6373572 100644
--- a/src/gallium/drivers/r600/r600d.h
+++ b/src/gallium/drivers/r600/r600d.h
@@ -3465,13 +3465,14 @@
#define SQ_TEX_INST_LD 0x03
#define SQ_TEX_INST_GET_GRADIENTS_H 0x7
#define SQ_TEX_INST_GET_GRADIENTS_V 0x8
+#define SQ_TEX_INST_SET_GRADIENTS_H 0xB
+#define SQ_TEX_INST_SET_GRADIENTS_V 0xC
#define SQ_TEX_INST_SAMPLE 0x10
#define SQ_TEX_INST_SAMPLE_L 0x11
#define SQ_TEX_INST_SAMPLE_G 0x14
#define SQ_TEX_INST_SAMPLE_C 0x18
-
-#define SQ_TEX_INST_SET_GRADIENTS_H 0xB
-#define SQ_TEX_INST_SET_GRADIENTS_V 0xC
+#define SQ_TEX_INST_SAMPLE_C_L 0x19
+#define SQ_TEX_INST_SAMPLE_C_G 0x1C
#endif
commit 13c9a8552bc83b1ad91442caacf847cb6cead2b5
Author: Dave Airlie <airlied at redhat.com>
Date: Wed Jun 15 15:15:41 2011 +1000
r600g: add TXD support.
This at least passes the piglit arb_shader_texture_lod-texgrad test,
the AMD shader analyzer seems to multiply the V component by an unspecified
constant value no idea why.
Signed-off-by: Dave Airlie <airlied at redhat.com>
diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index aeb1175..c447a03 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -1383,6 +1383,9 @@ int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex)
break;
}
}
+ /* slight hack to make gradients always go into same cf */
+ if (ntex->inst == SQ_TEX_INST_SET_GRADIENTS_H)
+ bc->force_add_cf = 1;
}
/* cf can contains only alu or only vtx or only tex */
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 4cf11dc..16fe6c5 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -375,6 +375,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+ case PIPE_CAP_SM3:
return 1;
/* Supported except the original R600. */
@@ -395,7 +396,6 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_INSTANCEID:
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
- case PIPE_CAP_SM3:
return 0;
case PIPE_CAP_ARRAY_TEXTURES:
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 1b9f663..9a0df23 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1761,10 +1761,60 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
inst->Src[0].Register.File != TGSI_FILE_INPUT) ||
ctx->src[0].neg || ctx->src[0].abs;
boolean src_loaded = FALSE;
+ unsigned sampler_src_reg = 1;
src_gpr = ctx->file_offset[inst->Src[0].Register.File] + inst->Src[0].Register.Index;
- if (inst->Instruction.Opcode == TGSI_OPCODE_TXP) {
+ if (inst->Instruction.Opcode == TGSI_OPCODE_TXD) {
+ /* TGSI moves the sampler to src reg 3 for TXD */
+ sampler_src_reg = 3;
+
+ /* set gradients h/v */
+ memset(&tex, 0, sizeof(struct r600_bc_tex));
+ tex.inst = SQ_TEX_INST_SET_GRADIENTS_H;
+ tex.sampler_id = ctx->file_offset[inst->Src[sampler_src_reg].Register.File] + inst->Src[sampler_src_reg].Register.Index;
+ tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
+ tex.src_gpr = ctx->file_offset[inst->Src[1].Register.File] + inst->Src[1].Register.Index;
+ tex.src_sel_x = ctx->src[1].swizzle[0];
+ tex.src_sel_y = ctx->src[1].swizzle[1];
+ tex.src_sel_z = ctx->src[1].swizzle[2];
+ tex.src_sel_w = ctx->src[1].swizzle[3];
+ tex.src_rel = ctx->src[1].rel;
+ tex.dst_gpr = ctx->temp_reg; /* just to avoid confusing the asm scheduler */
+ tex.dst_sel_x = tex.dst_sel_y = tex.dst_sel_z = tex.dst_sel_w = 7;
+ if (inst->Texture.Texture != TGSI_TEXTURE_RECT) {
+ tex.coord_type_x = 1;
+ tex.coord_type_y = 1;
+ tex.coord_type_z = 1;
+ tex.coord_type_w = 1;
+ }
+ r = r600_bc_add_tex(ctx->bc, &tex);
+ if (r)
+ return r;
+
+ /* set gradients h/v */
+ memset(&tex, 0, sizeof(struct r600_bc_tex));
+ tex.inst = SQ_TEX_INST_SET_GRADIENTS_V;
+ tex.sampler_id = ctx->file_offset[inst->Src[sampler_src_reg].Register.File] + inst->Src[sampler_src_reg].Register.Index;
+ tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
+ tex.src_gpr = ctx->file_offset[inst->Src[2].Register.File] + inst->Src[2].Register.Index;
+ tex.src_sel_x = ctx->src[2].swizzle[0];
+ tex.src_sel_y = ctx->src[2].swizzle[1];
+ tex.src_sel_z = ctx->src[2].swizzle[2];
+ tex.src_sel_w = ctx->src[2].swizzle[3];
+ tex.src_rel = ctx->src[2].rel;
+ tex.dst_gpr = ctx->temp_reg; /* just to avoid confusing the asm scheduler */
+ tex.dst_sel_x = tex.dst_sel_y = tex.dst_sel_z = tex.dst_sel_w = 7;
+ if (inst->Texture.Texture != TGSI_TEXTURE_RECT) {
+ tex.coord_type_x = 1;
+ tex.coord_type_y = 1;
+ tex.coord_type_z = 1;
+ tex.coord_type_w = 1;
+ }
+ r = r600_bc_add_tex(ctx->bc, &tex);
+ if (r)
+ return r;
+ } else if (inst->Instruction.Opcode == TGSI_OPCODE_TXP) {
int out_chan;
/* Add perspective divide */
if (ctx->bc->chiprev == CHIPREV_CAYMAN) {
@@ -1957,7 +2007,8 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
memset(&tex, 0, sizeof(struct r600_bc_tex));
tex.inst = opcode;
- tex.sampler_id = ctx->file_offset[inst->Src[1].Register.File] + inst->Src[1].Register.Index;
+
+ tex.sampler_id = ctx->file_offset[inst->Src[sampler_src_reg].Register.File] + inst->Src[sampler_src_reg].Register.Index;
tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
tex.src_gpr = src_gpr;
tex.dst_gpr = ctx->file_offset[inst->Dst[0].Register.File] + inst->Dst[0].Register.Index;
@@ -3082,7 +3133,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = {
{TGSI_OPCODE_SNE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE, tgsi_op2},
{TGSI_OPCODE_STR, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_TEX, 0, SQ_TEX_INST_SAMPLE, tgsi_tex},
- {TGSI_OPCODE_TXD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TXD, 0, SQ_TEX_INST_SAMPLE_G, tgsi_tex},
{TGSI_OPCODE_TXP, 0, SQ_TEX_INST_SAMPLE, tgsi_tex},
{TGSI_OPCODE_UP2H, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_UP2US, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
@@ -3240,7 +3291,7 @@ static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] = {
{TGSI_OPCODE_SNE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE, tgsi_op2},
{TGSI_OPCODE_STR, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_TEX, 0, SQ_TEX_INST_SAMPLE, tgsi_tex},
- {TGSI_OPCODE_TXD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TXD, 0, SQ_TEX_INST_SAMPLE_G, tgsi_tex},
{TGSI_OPCODE_TXP, 0, SQ_TEX_INST_SAMPLE, tgsi_tex},
{TGSI_OPCODE_UP2H, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_UP2US, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
@@ -3398,7 +3449,7 @@ static struct r600_shader_tgsi_instruction cm_shader_tgsi_instruction[] = {
{TGSI_OPCODE_SNE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE, tgsi_op2},
{TGSI_OPCODE_STR, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_TEX, 0, SQ_TEX_INST_SAMPLE, tgsi_tex},
- {TGSI_OPCODE_TXD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TXD, 0, SQ_TEX_INST_SAMPLE_G, tgsi_tex},
{TGSI_OPCODE_TXP, 0, SQ_TEX_INST_SAMPLE, tgsi_tex},
{TGSI_OPCODE_UP2H, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_UP2US, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h
index 9281b08..95672b1 100644
--- a/src/gallium/drivers/r600/r600d.h
+++ b/src/gallium/drivers/r600/r600d.h
@@ -3468,6 +3468,10 @@
#define SQ_TEX_INST_SAMPLE 0x10
#define SQ_TEX_INST_SAMPLE_L 0x11
+#define SQ_TEX_INST_SAMPLE_G 0x14
#define SQ_TEX_INST_SAMPLE_C 0x18
+#define SQ_TEX_INST_SET_GRADIENTS_H 0xB
+#define SQ_TEX_INST_SET_GRADIENTS_V 0xC
+
#endif
commit 34a774797c17855043c8e1f701ada7f7aca39701
Author: Brian Paul <brianp at vmware.com>
Date: Tue Jun 14 20:47:47 2011 -0600
i915g: add const qualifier to silence warning
diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c
index bf6b30a..392ba19 100644
--- a/src/gallium/drivers/i915/i915_state_derived.c
+++ b/src/gallium/drivers/i915/i915_state_derived.c
@@ -35,7 +35,7 @@
#include "i915_debug.h"
#include "i915_reg.h"
-static uint find_mapping(struct i915_fragment_shader* fs, int unit)
+static uint find_mapping(const struct i915_fragment_shader* fs, int unit)
{
int i;
for (i = 0; i < I915_TEX_UNITS ; i++)
commit d9ca94836ee99c87841e24bfa23a6fab9464d04d
Author: Marek Olšák <maraeo at gmail.com>
Date: Wed Jun 15 04:16:05 2011 +0200
r600g: also set TILE_MODE of the base level
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 1972799..d927e4a 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -467,7 +467,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
pitch = align(tmp->pitch_in_blocks[offset_level] *
util_format_get_blockwidth(state->format), 8);
- array_mode = tmp->array_mode[0];
+ array_mode = tmp->array_mode[offset_level];
tile_type = tmp->tile_type;
if (texture->target == PIPE_TEXTURE_1D_ARRAY) {
More information about the Xquartz-changes
mailing list