Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into r600_state_predict

This commit is contained in:
Pauli Nieminen
2009-08-25 02:36:13 +03:00
41 changed files with 1538 additions and 1132 deletions
+2 -1
View File
@@ -237,7 +237,8 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/glapi/*.[chS] \
$(DIRECTORY)/src/mesa/math/*.[ch] \
$(DIRECTORY)/src/mesa/math/descrip.mms \
$(DIRECTORY)/src/mesa/shader/*.[ch] \
$(DIRECTORY)/src/mesa/shader/*.[chly] \
$(DIRECTORY)/src/mesa/shader/Makefile \
$(DIRECTORY)/src/mesa/shader/descrip.mms \
$(DIRECTORY)/src/mesa/shader/grammar/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
+2
View File
@@ -50,6 +50,8 @@ tbd
<li>Fixed minor GLX memory leaks.
<li>Fixed some texture env / fragment program state bugs.
<li>Fixed some Gallium glBlitFramebuffer() bugs
<li>Empty glBegin/glEnd() pair could cause divide by zero (bug 23489)
<li>Fixed Gallium glBitmap() Z position bug
</ul>
+10 -5
View File
@@ -16,19 +16,24 @@ INCLUDE_DIRS = \
$(shell pkg-config --cflags-only-I libdrm) \
-I$(TOP)/include \
-I$(TOP)/include/GL/internal \
-I$(TOP)/src/mesa \
-I$(TOP)/src/mesa/glapi \
-I$(TOP)/src/mesa/drivers/dri/common \
-I$(TOP)/src/egl/main \
-I$(TOP)/src/glx/x11
SOURCES = egl_xdri.c
HEADERS = glxinit.h driinit.h
SOURCES = egl_xdri.c glxinit.c driinit.c
DRI_SOURCES = dri_common.c XF86dri.c dri2.c dri2_glx.c dri_glx.c
DRI_SOURCES := $(addprefix ../../../glx/x11/,$(DRI_SOURCES))
SOURCES += $(DRI_SOURCES)
OBJECTS = $(SOURCES:.c=.o)
DRM_LIB = `pkg-config --libs libdrm`
MISC_LIBS = -ldl -lXext -lGL
CFLAGS += -DGLX_DIRECT_RENDERING
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
@@ -50,7 +55,7 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
-major 1 -minor 0 \
-L$(TOP)/$(LIB_DIR) \
-install $(TOP)/$(LIB_DIR) \
$(OBJECTS) $(DRM_LIB) $(MISC_LIBS)
$(OBJECTS) $(DRM_LIB) $(GL_LIB_DEPS)
install:
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
+67
View File
@@ -0,0 +1,67 @@
/**
* DRI initialization. The DRI loaders are defined in src/glx/x11/.
*/
#include <sys/time.h>
#include "glxclient.h"
#include "driinit.h"
/* for __DRI_SYSTEM_TIME extension */
_X_HIDDEN int
__glXGetUST(int64_t * ust)
{
struct timeval tv;
if (ust == NULL) {
return -EFAULT;
}
if (gettimeofday(&tv, NULL) == 0) {
ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
return 0;
}
else {
return -errno;
}
}
_X_HIDDEN GLboolean
__driGetMscRateOML(__DRIdrawable * draw,
int32_t * numerator, int32_t * denominator, void *private)
{
return GL_FALSE;
}
/* ignore glx extensions */
_X_HIDDEN void
__glXEnableDirectExtension(__GLXscreenConfigs * psc, const char *name)
{
}
_X_HIDDEN __GLXDRIdisplay *
__driCreateDisplay(__GLXdisplayPrivate *dpyPriv, int *version)
{
__GLXDRIdisplay *driDisplay;
int ver = 0;
/* try DRI2 first */
driDisplay = dri2CreateDisplay(dpyPriv->dpy);
if (driDisplay) {
/* fill in the required field */
dpyPriv->dri2Display = driDisplay;
ver = 2;
}
else {
/* try DRI */
driDisplay = driCreateDisplay(dpyPriv->dpy);
if (driDisplay) {
dpyPriv->driDisplay = driDisplay;
ver = 1;
}
}
if (version)
*version = ver;
return driDisplay;
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef DRIINIT_INCLUDED
#define DRIINIT_INCLUDED
#include "glxclient.h"
extern __GLXDRIdisplay *
__driCreateDisplay(__GLXdisplayPrivate *dpyPriv, int *version);
#endif /* DRIINIT_INCLUDED */
File diff suppressed because it is too large Load Diff
+626
View File
@@ -0,0 +1,626 @@
/**
* GLX initialization. Code based on glxext.c, glx_query.c, and
* glcontextmodes.c under src/glx/x11/. The major difference is that no DRI
* related code here.
*
*/
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
#include <sys/time.h>
#include "glxinit.h"
typedef struct GLXGenericGetString
{
CARD8 reqType;
CARD8 glxCode;
CARD16 length B16;
CARD32 for_whom B32;
CARD32 name B32;
} xGLXGenericGetStringReq;
#define sz_xGLXGenericGetStringReq 12
#define X_GLXGenericGetString 0
/* Extension required boiler plate */
static char *__glXExtensionName = GLX_EXTENSION_NAME;
static XExtensionInfo *__glXExtensionInfo = NULL;
static /* const */ XExtensionHooks __glXExtensionHooks = { NULL };
static
XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
__glXExtensionName, &__glXExtensionHooks,
__GLX_NUMBER_EVENTS, NULL)
static GLint
_gl_convert_from_x_visual_type(int visualType)
{
#define NUM_VISUAL_TYPES 6
static const int glx_visual_types[NUM_VISUAL_TYPES] = {
GLX_STATIC_GRAY, GLX_GRAY_SCALE,
GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
GLX_TRUE_COLOR, GLX_DIRECT_COLOR
};
return ((unsigned) visualType < NUM_VISUAL_TYPES)
? glx_visual_types[visualType] : GLX_NONE;
}
static __GLcontextModes *
_gl_context_modes_create(unsigned count, size_t minimum_size)
{
const size_t size = (minimum_size > sizeof(__GLcontextModes))
? minimum_size : sizeof(__GLcontextModes);
__GLcontextModes *base = NULL;
__GLcontextModes **next;
unsigned i;
next = &base;
for (i = 0; i < count; i++) {
*next = (__GLcontextModes *) Xmalloc(size);
if (*next == NULL) {
_gl_context_modes_destroy(base);
base = NULL;
break;
}
memset(*next, 0, size);
(*next)->visualID = GLX_DONT_CARE;
(*next)->visualType = GLX_DONT_CARE;
(*next)->visualRating = GLX_NONE;
(*next)->transparentPixel = GLX_NONE;
(*next)->transparentRed = GLX_DONT_CARE;
(*next)->transparentGreen = GLX_DONT_CARE;
(*next)->transparentBlue = GLX_DONT_CARE;
(*next)->transparentAlpha = GLX_DONT_CARE;
(*next)->transparentIndex = GLX_DONT_CARE;
(*next)->xRenderable = GLX_DONT_CARE;
(*next)->fbconfigID = GLX_DONT_CARE;
(*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
(*next)->bindToTextureRgb = GLX_DONT_CARE;
(*next)->bindToTextureRgba = GLX_DONT_CARE;
(*next)->bindToMipmapTexture = GLX_DONT_CARE;
(*next)->bindToTextureTargets = GLX_DONT_CARE;
(*next)->yInverted = GLX_DONT_CARE;
next = &((*next)->next);
}
return base;
}
_X_HIDDEN void
_gl_context_modes_destroy(__GLcontextModes * modes)
{
while (modes != NULL) {
__GLcontextModes *const next = modes->next;
Xfree(modes);
modes = next;
}
}
_X_HIDDEN char *
__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
{
xGLXGenericGetStringReq *req;
xGLXSingleReply reply;
int length;
int numbytes;
char *buf;
CARD32 for_whom = screen;
CARD32 glxCode = X_GLXQueryServerString;
LockDisplay(dpy);
/* All of the GLX protocol requests for getting a string from the server
* look the same. The exact meaning of the for_whom field is usually
* either the screen number (for glXQueryServerString) or the context tag
* (for GLXSingle).
*/
GetReq(GLXGenericGetString, req);
req->reqType = opcode;
req->glxCode = glxCode;
req->for_whom = for_whom;
req->name = name;
_XReply(dpy, (xReply *) & reply, 0, False);
length = reply.length * 4;
numbytes = reply.size;
buf = (char *) Xmalloc(numbytes);
if (buf != NULL) {
_XRead(dpy, buf, numbytes);
length -= numbytes;
}
_XEatData(dpy, length);
UnlockDisplay(dpy);
SyncHandle();
return buf;
}
/************************************************************************/
/*
** Free the per screen configs data as well as the array of
** __glXScreenConfigs.
*/
static void
FreeScreenConfigs(__GLXdisplayPrivate * priv)
{
__GLXscreenConfigs *psc;
GLint i, screens;
/* Free screen configuration information */
psc = priv->screenConfigs;
screens = ScreenCount(priv->dpy);
for (i = 0; i < screens; i++, psc++) {
if (psc->configs) {
_gl_context_modes_destroy(psc->configs);
psc->configs = NULL; /* NOTE: just for paranoia */
}
if (psc->visuals) {
_gl_context_modes_destroy(psc->visuals);
psc->visuals = NULL; /* NOTE: just for paranoia */
}
Xfree((char *) psc->serverGLXexts);
}
XFree((char *) priv->screenConfigs);
priv->screenConfigs = NULL;
}
/************************************************************************/
/*
** Query the version of the GLX extension. This procedure works even if
** the client extension is not completely set up.
*/
static Bool
QueryVersion(Display * dpy, int opcode, int *major, int *minor)
{
xGLXQueryVersionReq *req;
xGLXQueryVersionReply reply;
/* Send the glXQueryVersion request */
LockDisplay(dpy);
GetReq(GLXQueryVersion, req);
req->reqType = opcode;
req->glxCode = X_GLXQueryVersion;
req->majorVersion = GLX_MAJOR_VERSION;
req->minorVersion = GLX_MINOR_VERSION;
_XReply(dpy, (xReply *) & reply, 0, False);
UnlockDisplay(dpy);
SyncHandle();
if (reply.majorVersion != GLX_MAJOR_VERSION) {
/*
** The server does not support the same major release as this
** client.
*/
return GL_FALSE;
}
*major = reply.majorVersion;
*minor = min(reply.minorVersion, GLX_MINOR_VERSION);
return GL_TRUE;
}
_X_HIDDEN void
__glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
const INT32 * bp, Bool tagged_only,
Bool fbconfig_style_tags)
{
int i;
if (!tagged_only) {
/* Copy in the first set of properties */
config->visualID = *bp++;
config->visualType = _gl_convert_from_x_visual_type(*bp++);
config->rgbMode = *bp++;
config->redBits = *bp++;
config->greenBits = *bp++;
config->blueBits = *bp++;
config->alphaBits = *bp++;
config->accumRedBits = *bp++;
config->accumGreenBits = *bp++;
config->accumBlueBits = *bp++;
config->accumAlphaBits = *bp++;
config->doubleBufferMode = *bp++;
config->stereoMode = *bp++;
config->rgbBits = *bp++;
config->depthBits = *bp++;
config->stencilBits = *bp++;
config->numAuxBuffers = *bp++;
config->level = *bp++;
count -= __GLX_MIN_CONFIG_PROPS;
}
/*
** Additional properties may be in a list at the end
** of the reply. They are in pairs of property type
** and property value.
*/
#define FETCH_OR_SET(tag) \
config-> tag = ( fbconfig_style_tags ) ? *bp++ : 1
for (i = 0; i < count; i += 2) {
switch (*bp++) {
case GLX_RGBA:
FETCH_OR_SET(rgbMode);
break;
case GLX_BUFFER_SIZE:
config->rgbBits = *bp++;
break;
case GLX_LEVEL:
config->level = *bp++;
break;
case GLX_DOUBLEBUFFER:
FETCH_OR_SET(doubleBufferMode);
break;
case GLX_STEREO:
FETCH_OR_SET(stereoMode);
break;
case GLX_AUX_BUFFERS:
config->numAuxBuffers = *bp++;
break;
case GLX_RED_SIZE:
config->redBits = *bp++;
break;
case GLX_GREEN_SIZE:
config->greenBits = *bp++;
break;
case GLX_BLUE_SIZE:
config->blueBits = *bp++;
break;
case GLX_ALPHA_SIZE:
config->alphaBits = *bp++;
break;
case GLX_DEPTH_SIZE:
config->depthBits = *bp++;
break;
case GLX_STENCIL_SIZE:
config->stencilBits = *bp++;
break;
case GLX_ACCUM_RED_SIZE:
config->accumRedBits = *bp++;
break;
case GLX_ACCUM_GREEN_SIZE:
config->accumGreenBits = *bp++;
break;
case GLX_ACCUM_BLUE_SIZE:
config->accumBlueBits = *bp++;
break;
case GLX_ACCUM_ALPHA_SIZE:
config->accumAlphaBits = *bp++;
break;
case GLX_VISUAL_CAVEAT_EXT:
config->visualRating = *bp++;
break;
case GLX_X_VISUAL_TYPE:
config->visualType = *bp++;
break;
case GLX_TRANSPARENT_TYPE:
config->transparentPixel = *bp++;
break;
case GLX_TRANSPARENT_INDEX_VALUE:
config->transparentIndex = *bp++;
break;
case GLX_TRANSPARENT_RED_VALUE:
config->transparentRed = *bp++;
break;
case GLX_TRANSPARENT_GREEN_VALUE:
config->transparentGreen = *bp++;
break;
case GLX_TRANSPARENT_BLUE_VALUE:
config->transparentBlue = *bp++;
break;
case GLX_TRANSPARENT_ALPHA_VALUE:
config->transparentAlpha = *bp++;
break;
case GLX_VISUAL_ID:
config->visualID = *bp++;
break;
case GLX_DRAWABLE_TYPE:
config->drawableType = *bp++;
break;
case GLX_RENDER_TYPE:
config->renderType = *bp++;
break;
case GLX_X_RENDERABLE:
config->xRenderable = *bp++;
break;
case GLX_FBCONFIG_ID:
config->fbconfigID = *bp++;
break;
case GLX_MAX_PBUFFER_WIDTH:
config->maxPbufferWidth = *bp++;
break;
case GLX_MAX_PBUFFER_HEIGHT:
config->maxPbufferHeight = *bp++;
break;
case GLX_MAX_PBUFFER_PIXELS:
config->maxPbufferPixels = *bp++;
break;
case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
config->optimalPbufferWidth = *bp++;
break;
case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
config->optimalPbufferHeight = *bp++;
break;
case GLX_VISUAL_SELECT_GROUP_SGIX:
config->visualSelectGroup = *bp++;
break;
case GLX_SWAP_METHOD_OML:
config->swapMethod = *bp++;
break;
case GLX_SAMPLE_BUFFERS_SGIS:
config->sampleBuffers = *bp++;
break;
case GLX_SAMPLES_SGIS:
config->samples = *bp++;
break;
case GLX_BIND_TO_TEXTURE_RGB_EXT:
config->bindToTextureRgb = *bp++;
break;
case GLX_BIND_TO_TEXTURE_RGBA_EXT:
config->bindToTextureRgba = *bp++;
break;
case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
config->bindToMipmapTexture = *bp++;
break;
case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
config->bindToTextureTargets = *bp++;
break;
case GLX_Y_INVERTED_EXT:
config->yInverted = *bp++;
break;
case None:
i = count;
break;
default:
break;
}
}
config->renderType =
(config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
config->haveAccumBuffer = ((config->accumRedBits +
config->accumGreenBits +
config->accumBlueBits +
config->accumAlphaBits) > 0);
config->haveDepthBuffer = (config->depthBits > 0);
config->haveStencilBuffer = (config->stencilBits > 0);
}
static __GLcontextModes *
createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
int screen, GLboolean tagged_only)
{
INT32 buf[__GLX_TOTAL_CONFIG], *props;
unsigned prop_size;
__GLcontextModes *modes, *m;
int i;
if (nprops == 0)
return NULL;
/* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for FBconfigs? */
/* Check number of properties */
if (nprops < __GLX_MIN_CONFIG_PROPS || nprops > __GLX_MAX_CONFIG_PROPS)
return NULL;
/* Allocate memory for our config structure */
modes = _gl_context_modes_create(nvisuals, sizeof(__GLcontextModes));
if (!modes)
return NULL;
prop_size = nprops * __GLX_SIZE_INT32;
if (prop_size <= sizeof(buf))
props = buf;
else
props = Xmalloc(prop_size);
/* Read each config structure and convert it into our format */
m = modes;
for (i = 0; i < nvisuals; i++) {
_XRead(dpy, (char *) props, prop_size);
/* Older X servers don't send this so we default it here. */
m->drawableType = GLX_WINDOW_BIT;
__glXInitializeVisualConfigFromTags(m, nprops, props,
tagged_only, GL_TRUE);
m->screen = screen;
m = m->next;
}
if (props != buf)
Xfree(props);
return modes;
}
static GLboolean
getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
{
xGLXGetVisualConfigsReq *req;
__GLXscreenConfigs *psc;
xGLXGetVisualConfigsReply reply;
LockDisplay(dpy);
psc = priv->screenConfigs + screen;
psc->visuals = NULL;
GetReq(GLXGetVisualConfigs, req);
req->reqType = priv->majorOpcode;
req->glxCode = X_GLXGetVisualConfigs;
req->screen = screen;
if (!_XReply(dpy, (xReply *) & reply, 0, False))
goto out;
psc->visuals = createConfigsFromProperties(dpy,
reply.numVisuals,
reply.numProps,
screen, GL_FALSE);
out:
UnlockDisplay(dpy);
return psc->visuals != NULL;
}
static GLboolean
getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
{
xGLXGetFBConfigsReq *fb_req;
xGLXGetFBConfigsSGIXReq *sgi_req;
xGLXVendorPrivateWithReplyReq *vpreq;
xGLXGetFBConfigsReply reply;
__GLXscreenConfigs *psc;
psc = priv->screenConfigs + screen;
psc->serverGLXexts =
__glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);
LockDisplay(dpy);
psc->configs = NULL;
if (atof(priv->serverGLXversion) >= 1.3) {
GetReq(GLXGetFBConfigs, fb_req);
fb_req->reqType = priv->majorOpcode;
fb_req->glxCode = X_GLXGetFBConfigs;
fb_req->screen = screen;
}
else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) {
GetReqExtra(GLXVendorPrivateWithReply,
sz_xGLXGetFBConfigsSGIXReq +
sz_xGLXVendorPrivateWithReplyReq, vpreq);
sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
sgi_req->reqType = priv->majorOpcode;
sgi_req->glxCode = X_GLXVendorPrivateWithReply;
sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
sgi_req->screen = screen;
}
else
goto out;
if (!_XReply(dpy, (xReply *) & reply, 0, False))
goto out;
psc->configs = createConfigsFromProperties(dpy,
reply.numFBConfigs,
reply.numAttribs * 2,
screen, GL_TRUE);
out:
UnlockDisplay(dpy);
return psc->configs != NULL;
}
static GLboolean
AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
{
__GLXscreenConfigs *psc;
GLint i, screens;
/*
** First allocate memory for the array of per screen configs.
*/
screens = ScreenCount(dpy);
psc = (__GLXscreenConfigs *) Xmalloc(screens * sizeof(__GLXscreenConfigs));
if (!psc) {
return GL_FALSE;
}
memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
priv->screenConfigs = psc;
priv->serverGLXversion =
__glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION);
if (priv->serverGLXversion == NULL) {
FreeScreenConfigs(priv);
return GL_FALSE;
}
for (i = 0; i < screens; i++, psc++) {
getFBConfigs(dpy, priv, i);
getVisualConfigs(dpy, priv, i);
psc->scr = i;
psc->dpy = dpy;
}
SyncHandle();
return GL_TRUE;
}
_X_HIDDEN void
__glXRelease(__GLXdisplayPrivate *dpyPriv)
{
FreeScreenConfigs(dpyPriv);
if (dpyPriv->serverGLXvendor) {
Xfree((char *) dpyPriv->serverGLXvendor);
dpyPriv->serverGLXvendor = NULL;
}
if (dpyPriv->serverGLXversion) {
Xfree((char *) dpyPriv->serverGLXversion);
dpyPriv->serverGLXversion = NULL;
}
Xfree(dpyPriv);
}
_X_HIDDEN __GLXdisplayPrivate *
__glXInitialize(Display * dpy)
{
XExtDisplayInfo *info = __glXFindDisplay(dpy);
__GLXdisplayPrivate *dpyPriv;
int major, minor;
if (!XextHasExtension(info))
return NULL;
/* See if the versions are compatible */
if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor))
return NULL;
dpyPriv = (__GLXdisplayPrivate *) Xcalloc(1, sizeof(__GLXdisplayPrivate));
if (!dpyPriv)
return NULL;
/*
** Init the display private and then read in the screen config
** structures from the server.
*/
dpyPriv->majorOpcode = info->codes->major_opcode;
dpyPriv->majorVersion = major;
dpyPriv->minorVersion = minor;
dpyPriv->dpy = dpy;
dpyPriv->serverGLXvendor = NULL;
dpyPriv->serverGLXversion = NULL;
if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
Xfree(dpyPriv);
return NULL;
}
return dpyPriv;
}
+14
View File
@@ -0,0 +1,14 @@
#ifndef GLXINIT_INCLUDED
#define GLXINIT_INCLUDED
#include <X11/Xlib.h>
#include "glxclient.h"
/* this is used by DRI loaders */
extern void
_gl_context_modes_destroy(__GLcontextModes * modes);
extern void
__glXRelease(__GLXdisplayPrivate *dpyPriv);
#endif /* GLXINIT_INCLUDED */
+1 -1
View File
@@ -868,7 +868,7 @@ static VGboolean transform_cb(struct path *p,
vg_float_to_datatype(td->datatype, common_data, data, num_coords);
array_append_data(td->segments, &segment, 1);
array_append_data(td->segments, &pd->segment, 1);
array_append_data(td->coords, common_data, num_coords);
return VG_TRUE;
}
@@ -1,5 +1,36 @@
#include "xorg_composite.h"
struct xorg_composite_blend {
int op:8;
unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */
unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */
unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */
unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */
};
static const struct xorg_composite_blend xorg_blends[] = {
{ PictOpClear,
PIPE_BLENDFACTOR_CONST_COLOR, PIPE_BLENDFACTOR_CONST_ALPHA,
PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO },
{ PictOpSrc,
PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE,
PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO },
{ PictOpDst,
PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO,
PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE },
{ PictOpOver,
PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE,
PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA },
{ PictOpOverReverse,
PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE,
PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA },
};
boolean xorg_composite_accelerated(int op,
PicturePtr pSrcPicture,
@@ -633,10 +633,6 @@ LeaveVT(int scrnIndex, int flags)
RestoreHWState(pScrn);
if (drmDropMaster(ms->fd))
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"drmDropMaster failed: %s\n", strerror(errno));
pScrn->vtSema = FALSE;
}
@@ -649,17 +645,6 @@ EnterVT(int scrnIndex, int flags)
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
modesettingPtr ms = modesettingPTR(pScrn);
if (drmSetMaster(ms->fd)) {
if (errno == EINVAL) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"drmSetMaster failed: 2.6.29 or newer kernel required for "
"multi-server DRI\n");
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"drmSetMaster failed: %s\n", strerror(errno));
}
}
/*
* Only save state once per server generation since that's what most
* drivers do. Could change this to save state at each VT enter.
+37 -26
View File
@@ -42,6 +42,8 @@
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
#include "cso_cache/cso_context.h"
#include "util/u_rect.h"
/*
@@ -516,6 +518,11 @@ xorg_exa_close(ScrnInfoPtr pScrn)
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa = ms->exa;
if (exa->cso) {
cso_release_all(exa->cso);
cso_destroy_context(exa->cso);
}
if (exa->ctx)
exa->ctx->destroy(exa->ctx);
@@ -541,33 +548,35 @@ xorg_exa_init(ScrnInfoPtr pScrn)
}
memset(pExa, 0, sizeof(*pExa));
pExa->exa_major = 2;
pExa->exa_minor = 2;
pExa->memoryBase = 0;
pExa->memorySize = 0;
pExa->offScreenBase = 0;
pExa->exa_major = 2;
pExa->exa_minor = 2;
pExa->memoryBase = 0;
pExa->memorySize = 0;
pExa->offScreenBase = 0;
pExa->pixmapOffsetAlign = 0;
pExa->pixmapPitchAlign = 1;
pExa->flags = EXA_OFFSCREEN_PIXMAPS | EXA_HANDLES_PIXMAPS;
pExa->maxX = 8191; /* FIXME */
pExa->maxY = 8191; /* FIXME */
pExa->WaitMarker = ExaWaitMarker;
pExa->MarkSync = ExaMarkSync;
pExa->PrepareSolid = ExaPrepareSolid;
pExa->Solid = ExaSolid;
pExa->DoneSolid = ExaDone;
pExa->PrepareCopy = ExaPrepareCopy;
pExa->Copy = ExaCopy;
pExa->DoneCopy = ExaDone;
pExa->CheckComposite = ExaCheckComposite;
pExa->PrepareComposite = ExaPrepareComposite;
pExa->Composite = ExaComposite;
pExa->DoneComposite = ExaDoneComposite;
pExa->PixmapIsOffscreen = ExaPixmapIsOffscreen;
pExa->PrepareAccess = ExaPrepareAccess;
pExa->FinishAccess = ExaFinishAccess;
pExa->CreatePixmap = ExaCreatePixmap;
pExa->DestroyPixmap = ExaDestroyPixmap;
pExa->pixmapPitchAlign = 1;
pExa->flags = EXA_OFFSCREEN_PIXMAPS | EXA_HANDLES_PIXMAPS;
pExa->maxX = 8191; /* FIXME */
pExa->maxY = 8191; /* FIXME */
pExa->WaitMarker = ExaWaitMarker;
pExa->MarkSync = ExaMarkSync;
pExa->PrepareSolid = ExaPrepareSolid;
pExa->Solid = ExaSolid;
pExa->DoneSolid = ExaDone;
pExa->PrepareCopy = ExaPrepareCopy;
pExa->Copy = ExaCopy;
pExa->DoneCopy = ExaDone;
pExa->CheckComposite = ExaCheckComposite;
pExa->PrepareComposite = ExaPrepareComposite;
pExa->Composite = ExaComposite;
pExa->DoneComposite = ExaDoneComposite;
pExa->PixmapIsOffscreen = ExaPixmapIsOffscreen;
pExa->PrepareAccess = ExaPrepareAccess;
pExa->FinishAccess = ExaFinishAccess;
pExa->CreatePixmap = ExaCreatePixmap;
pExa->DestroyPixmap = ExaDestroyPixmap;
pExa->ModifyPixmapHeader = ExaModifyPixmapHeader;
if (!exaDriverInit(pScrn->pScreen, pExa)) {
@@ -579,6 +588,8 @@ xorg_exa_init(ScrnInfoPtr pScrn)
/* Share context with DRI */
ms->ctx = exa->ctx;
exa->cso = cso_create_context(exa->ctx);
return (void *)exa;
out_err:
+13 -10
View File
@@ -3,25 +3,28 @@
#include "xorg_tracker.h"
struct cso_context;
struct exa_context
{
ExaDriverPtr pExa;
struct pipe_context *ctx;
struct pipe_screen *scrn;
ExaDriverPtr pExa;
struct pipe_context *ctx;
struct pipe_screen *scrn;
struct cso_context *cso;
};
struct exa_pixmap_priv
{
int flags;
int tex_flags;
int flags;
int tex_flags;
struct pipe_texture *tex;
unsigned int color;
struct pipe_surface *src_surf; /* for copies */
struct pipe_texture *tex;
unsigned int color;
struct pipe_surface *src_surf; /* for copies */
struct pipe_transfer *map_transfer;
unsigned map_count;
struct pipe_transfer *map_transfer;
unsigned map_count;
};
@@ -0,0 +1,158 @@
#include "xorg_exa_tgsi.h"
/*### stupidity defined in X11/extensions/XI.h */
#undef Absolute
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_memory.h"
#include "util/u_simple_shaders.h"
#include "tgsi/tgsi_ureg.h"
#include "cso_cache/cso_context.h"
#define UNSUPPORTED_OP 0
struct shader_id {
int op : 8;
int mask : 1;
int component_alpha : 1;
int is_fill : 1;
};
/* SAMP[0] = dst
* SAMP[1] = src
* SAMP[2] = mask
* IN[0] = pos dst
* IN[1] = pos src
* IN[2] = pos mask
* CONST[0] = (0, 0, 0, 1)
*/
struct xorg_render_ops_tgsi {
int op;
};
static const char over_op[] =
"SUB TEMP[3], CONST[0].wwww, TEMP[1].wwww\n"
"MUL TEMP[3], TEMP[0], TEMP[3]\n"
"ADD TEMP[0], TEMP[3], TEMP[0]\n";
static const struct xorg_render_ops_tgsi ops_map[] = {
{PictOpClear},
{PictOpSrc},
{PictOpDst},
{PictOpOver},
{PictOpOverReverse},
{PictOpIn},
{PictOpInReverse},
{PictOpOut},
{PictOpOutReverse},
{PictOpAtop},
{PictOpAtopReverse},
{PictOpXor},
{PictOpAdd},
{PictOpSaturate},
};
static INLINE void
create_preamble(struct ureg_program *ureg)
{
}
static INLINE void
src_in_mask(struct ureg_program *ureg,
struct ureg_dst dst,
struct ureg_src src,
struct ureg_src mask)
{
/* MUL dst, src, mask.wwww */
ureg_MUL(ureg, dst, src,
ureg_scalar(mask, TGSI_SWIZZLE_W));
}
static INLINE
struct shader_id shader_state(int op,
PicturePtr src_picture,
PicturePtr mask_picture,
PicturePtr dst_picture)
{
struct shader_id sid;
sid.op = op;
sid.mask = (mask_picture != 0);
sid.component_alpha = (mask_picture->componentAlpha);
sid.is_fill = (src_picture->pSourcePict != 0);
if (sid.is_fill) {
sid.is_fill =
(src_picture->pSourcePict->type == SourcePictTypeSolidFill);
}
return sid;
}
struct xorg_shader xorg_shader_construct(struct exa_context *exa,
int op,
PicturePtr src_picture,
PicturePtr mask_picture,
PicturePtr dst_picture)
{
struct ureg_program *ureg;
struct ureg_src dst_sampler, src_sampler, mask_sampler;
struct ureg_src dst_pos, src_pos, mask_pos;
struct ureg_src src, mask;
struct shader_id sid = shader_state(op, src_picture,
mask_picture,
dst_picture);
struct xorg_shader shader = {0};
ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
if (ureg == NULL)
return shader;
if (sid.is_fill)
return shader;
#if 0 /* unused right now */
dst_sampler = ureg_DECL_sampler(ureg);
dst_pos = ureg_DECL_fs_input(ureg,
TGSI_SEMANTIC_POSITION,
0,
TGSI_INTERPOLATE_PERSPECTIVE);
#endif
src_sampler = ureg_DECL_sampler(ureg);
src_pos = ureg_DECL_fs_input(ureg,
TGSI_SEMANTIC_POSITION,
1,
TGSI_INTERPOLATE_PERSPECTIVE);
if (sid.mask) {
mask_sampler = ureg_DECL_sampler(ureg);
src_pos = ureg_DECL_fs_input(ureg,
TGSI_SEMANTIC_POSITION,
2,
TGSI_INTERPOLATE_PERSPECTIVE);
}
ureg_TEX(ureg, ureg_dst(src),
TGSI_TEXTURE_2D, src_pos, src_sampler);
if (sid.mask) {
ureg_TEX(ureg, ureg_dst(mask),
TGSI_TEXTURE_2D, mask_pos, mask_sampler);
/* src IN mask */
src_in_mask(ureg, ureg_dst(src), src, mask);
}
ureg_END(ureg);
return shader;
}
@@ -0,0 +1,17 @@
#ifndef XORG_EXA_TGSI_H
#define XORG_EXA_TGSI_H
#include "xorg_exa.h"
struct xorg_shader {
void *fs;
void *vs;
};
struct xorg_shader xorg_shader_construct(struct exa_context *exa,
int op,
PicturePtr src_picture,
PicturePtr mask_picture,
PicturePtr dst_picture);
#endif
+1
View File
@@ -303,6 +303,7 @@ xm_flush_frontbuffer(struct pipe_winsys *pws,
*/
XMesaContext xmctx = (XMesaContext) context_private;
xlib_softpipe_display_surface(xmctx->xm_buffer, surf);
xmesa_check_and_update_buffer_size(xmctx, xmctx->xm_buffer);
}
+11 -17
View File
@@ -238,8 +238,8 @@ static void r300_emit_query_finish(radeonContextPtr radeon)
struct radeon_query_object *query = radeon->query.current;
BATCH_LOCALS(radeon);
BEGIN_BATCH_NO_AUTOSTATE(3 * 2 *r300->num_z_pipes + 2);
switch (r300->num_z_pipes) {
BEGIN_BATCH_NO_AUTOSTATE(3 * 2 *r300->radeon.radeonScreen->num_gb_pipes + 2);
switch (r300->radeon.radeonScreen->num_gb_pipes) {
case 4:
OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_3);
OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
@@ -265,7 +265,7 @@ static void r300_emit_query_finish(radeonContextPtr radeon)
}
OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_ALL);
END_BATCH();
query->curr_offset += r300->num_z_pipes * sizeof(uint32_t);
query->curr_offset += r300->radeon.radeonScreen->num_gb_pipes * sizeof(uint32_t);
assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE);
query->emitted_begin = GL_FALSE;
}
@@ -287,14 +287,12 @@ static void rv530_emit_query_finish_single_z(radeonContextPtr radeon)
query->emitted_begin = GL_FALSE;
}
#if 0
static void rv530_emit_query_finish_double_z(radeonContextPtr radeon)
{
r300ContextPtr r300 = (r300ContextPtr)radeon;
BATCH_LOCALS(radeon);
struct radeon_query_object *query = radeon->query.current;
BEGIN_BATCH_NO_AUTOSTATE(6);
BEGIN_BATCH_NO_AUTOSTATE(14);
OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
OUT_BATCH_RELOC(0, query->bo, query->curr_offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
@@ -308,7 +306,6 @@ static void rv530_emit_query_finish_double_z(radeonContextPtr radeon)
assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE);
query->emitted_begin = GL_FALSE;
}
#endif
static void r300_init_vtbl(radeonContextPtr radeon)
{
@@ -318,11 +315,12 @@ static void r300_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.swtcl_flush = r300_swtcl_flush;
radeon->vtbl.pre_emit_atoms = r300_vtbl_pre_emit_atoms;
radeon->vtbl.fallback = r300_fallback;
if (radeon->radeonScreen->chip_family == CHIP_FAMILY_RV530)
/* single Z gives me correct results on my hw need to check if we ever need
* double z */
radeon->vtbl.emit_query_finish = rv530_emit_query_finish_single_z;
else
if (radeon->radeonScreen->chip_family == CHIP_FAMILY_RV530) {
if (radeon->radeonScreen->num_z_pipes == 2)
radeon->vtbl.emit_query_finish = rv530_emit_query_finish_double_z;
else
radeon->vtbl.emit_query_finish = rv530_emit_query_finish_single_z;
} else
radeon->vtbl.emit_query_finish = r300_emit_query_finish;
}
@@ -396,10 +394,6 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
}
if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV530)
r300->num_z_pipes = 2;
else
r300->num_z_pipes = r300->radeon.radeonScreen->num_gb_pipes;
}
static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen)
@@ -436,7 +430,7 @@ static void r300InitGLExtensions(GLcontext *ctx)
if (r300->options.stencil_two_side_disabled)
_mesa_disable_extension(ctx, "GL_EXT_stencil_two_side");
if (ctx->Mesa_DXTn && !r300->options.s3tc_force_enabled) {
if (r300->options.s3tc_force_enabled) {
_mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
_mesa_enable_extension(ctx, "GL_S3_s3tc");
} else if (r300->options.s3tc_force_disabled) {
-1
View File
@@ -529,7 +529,6 @@ struct r300_context {
uint32_t fallback;
DECLARE_RENDERINPUTS(render_inputs_bitset);
int num_z_pipes;
};
#define R300_CONTEXT(ctx) ((r300ContextPtr)(ctx->DriverCtx))
+1 -7
View File
@@ -185,13 +185,7 @@ static void r600_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmes
static void r600_vtbl_pre_emit_atoms(radeonContextPtr radeon)
{
context_t *context = (context_t *)radeon;
/* always emit CB base to prevent
* lock ups on some chips.
*/
R600_STATECHANGE(context, cb_target);
r700Start3D(context);
r700Start3D((context_t *)radeon);
}
static void r600_fallback(GLcontext *ctx, GLuint bit, GLboolean mode)
+67 -7
View File
@@ -230,6 +230,9 @@ static void r700SendVTXState(GLcontext *ctx, struct radeon_state_atom *atom)
unsigned int i, j = 0;
BATCH_LOCALS(&context->radeon);
if (context->radeon.tcl.aos_count == 0)
return;
BEGIN_BATCH_NO_AUTOSTATE(6);
R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1));
R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX);
@@ -989,11 +992,60 @@ static int check_always(GLcontext *ctx, struct radeon_state_atom *atom)
return atom->cmd_size;
}
static int check_cb(GLcontext *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
int count = 7;
if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770)
count += 11;
return count;
}
static int check_blnd(GLcontext *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
unsigned int ui;
int count = 3;
if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770)
count += 3;
if (context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) {
for (ui = 0; ui < R700_MAX_RENDER_TARGETS; ui++) {
if (r700->render_target[ui].enabled)
count += 3;
}
}
return count;
}
static int check_ucp(GLcontext *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
int i;
int count = 0;
for (i = 0; i < R700_MAX_UCP; i++) {
if (r700->ucp[i].enabled)
count += 6;
}
return count;
}
static int check_vtx(GLcontext *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
int count = context->radeon.tcl.aos_count * 18;
return context->radeon.tcl.aos_count * 18;
if (count)
count += 6;
return count;
}
static int check_tx(GLcontext *ctx, struct radeon_state_atom *atom)
@@ -1014,16 +1066,24 @@ static int check_ps_consts(GLcontext *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
int count = r700->ps.num_consts * 4;
return 2 + (r700->ps.num_consts * 4);
if (count)
count += 2;
return count;
}
static int check_vs_consts(GLcontext *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
int count = r700->vs.num_consts * 4;
return 2 + (r700->vs.num_consts * 4);
if (count)
count += 2;
return count;
}
#define ALLOC_STATE( ATOM, CHK, SZ, EMIT ) \
@@ -1056,12 +1116,12 @@ void r600InitAtoms(context_t *context)
ALLOC_STATE(aa, always, 12, r700SendAAState);
ALLOC_STATE(cl, always, 12, r700SendCLState);
ALLOC_STATE(gb, always, 6, r700SendGBState);
ALLOC_STATE(ucp, always, 36, r700SendUCPState);
ALLOC_STATE(ucp, ucp, (R700_MAX_UCP * 6), r700SendUCPState);
ALLOC_STATE(su, always, 9, r700SendSUState);
ALLOC_STATE(poly, always, 10, r700SendPolyState);
ALLOC_STATE(cb, always, 18, r700SendCBState);
ALLOC_STATE(cb, cb, 18, r700SendCBState);
ALLOC_STATE(clrcmp, always, 6, r700SendCBCLRCMPState);
ALLOC_STATE(blnd, always, 30, r700SendCBBlendState);
ALLOC_STATE(blnd, blnd, (6 + (R700_MAX_RENDER_TARGETS * 3)), r700SendCBBlendState);
ALLOC_STATE(blnd_clr, always, 6, r700SendCBBlendColorState);
ALLOC_STATE(cb_target, always, 25, r700SendRenderTargetState);
ALLOC_STATE(sx, always, 9, r700SendSXState);
@@ -1073,7 +1133,7 @@ void r600InitAtoms(context_t *context)
ALLOC_STATE(ps, always, 21, r700SendPSState);
ALLOC_STATE(vs_consts, vs_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendVSConsts);
ALLOC_STATE(ps_consts, ps_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendPSConsts);
ALLOC_STATE(vtx, vtx, (VERT_ATTRIB_MAX * 18), r700SendVTXState);
ALLOC_STATE(vtx, vtx, (6 + (VERT_ATTRIB_MAX * 18)), r700SendVTXState);
ALLOC_STATE(tx, tx, (R700_TEXTURE_NUMBERUNITS * 20), r700SendTexState);
ALLOC_STATE(tx_smplr, tx, (R700_TEXTURE_NUMBERUNITS * 5), r700SendTexSamplerState);
ALLOC_STATE(tx_brdr_clr, tx, (R700_TEXTURE_NUMBERUNITS * 6), r700SendTexBorderColorState);
+17 -4
View File
@@ -121,13 +121,13 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm,
pAsm->pR700Shader->depthIsExported = 1;
}
pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports);
pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports);
for(ui=0; ui<pAsm->number_of_exports; ui++)
{
pAsm->pucOutMask[ui] = 0x0;
}
pAsm->uFirstHelpReg = pAsm->number_used_registers;
pAsm->uFirstHelpReg = pAsm->number_used_registers;
}
GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp,
@@ -258,6 +258,19 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
return GL_TRUE;
}
void r700SelectFragmentShader(GLcontext *ctx)
{
context_t *context = R700_CONTEXT(ctx);
struct r700_fragment_program *fp = (struct r700_fragment_program *)
(ctx->FragmentProgram._Current);
if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770)
{
fp->r700AsmCode.bR6xx = 1;
}
r700TranslateFragmentShader(fp, &(fp->mesa_program));
}
void * r700GetActiveFpShaderBo(GLcontext * ctx)
{
struct r700_fragment_program *fp = (struct r700_fragment_program *)
@@ -283,7 +296,7 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx)
if(GL_FALSE == fp->loaded)
{
if(fp->r700Shader.bNeedsAssembly == GL_TRUE)
if(fp->r700Shader.bNeedsAssembly == GL_TRUE)
{
Assemble( &(fp->r700Shader) );
}
+7 -4
View File
@@ -49,13 +49,16 @@ struct r700_fragment_program
/* Internal */
void Map_Fragment_Program(r700_AssemblerBase *pAsm,
struct gl_fragment_program *mesa_fp);
struct gl_fragment_program *mesa_fp);
GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp,
struct gl_fragment_program *mesa_fp);
struct gl_fragment_program *mesa_fp);
GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
struct gl_fragment_program *mesa_vp);
/* Interface */
extern GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
struct gl_fragment_program *mesa_vp);
extern void r700SelectFragmentShader(GLcontext *ctx);
extern GLboolean r700SetupFragmentProgram(GLcontext * ctx);
extern void * r700GetActiveFpShaderBo(GLcontext * ctx);
+7
View File
@@ -347,6 +347,13 @@ static GLboolean r700RunRender(GLcontext * ctx,
fprintf(stderr, "%s: cs begin at %d\n",
__func__, context->radeon.cmdbuf.cs->cdw);
/* always emit CB base to prevent
* lock ups on some chips.
*/
R600_STATECHANGE(context, cb_target);
/* mark vtx as dirty since it changes per-draw */
R600_STATECHANGE(context, vtx);
r700UpdateShaders(ctx);
r700SetScissor(context);
r700SetupVertexProgram(ctx);
+29 -77
View File
@@ -71,65 +71,37 @@ void r700SetDefaultStates(context_t *context) //--------------------
void r700UpdateShaders (GLcontext * ctx) //----------------------------------
{
context_t *context = R700_CONTEXT(ctx);
GLvector4f dummy_attrib[_TNL_ATTRIB_MAX];
GLvector4f *temp_attrib[_TNL_ATTRIB_MAX];
int i;
if (ctx->FragmentProgram._Current) {
struct r700_fragment_program *fp = (struct r700_fragment_program *)
(ctx->FragmentProgram._Current);
if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770)
{
fp->r700AsmCode.bR6xx = 1;
/* should only happenen once, just after context is created */
/* TODO: shouldn't we fallback to sw here? */
if (!ctx->FragmentProgram._Current) {
_mesa_fprintf(stderr, "No ctx->FragmentProgram._Current!!\n");
return;
}
r700SelectFragmentShader(ctx);
if (context->radeon.NewGLState) {
for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
/* mat states from state var not array for sw */
dummy_attrib[i].stride = 0;
temp_attrib[i] = TNL_CONTEXT(ctx)->vb.AttribPtr[i];
TNL_CONTEXT(ctx)->vb.AttribPtr[i] = &(dummy_attrib[i]);
}
if(GL_FALSE == fp->translated)
{
if( GL_FALSE == r700TranslateFragmentShader(fp, &(fp->mesa_program)) )
{
//return GL_TRUE;
}
_tnl_UpdateFixedFunctionProgram(ctx);
for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
TNL_CONTEXT(ctx)->vb.AttribPtr[i] = temp_attrib[i];
}
}
if (context->radeon.NewGLState)
{
struct r700_vertex_program *vp;
context->radeon.NewGLState = 0;
for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++)
{
/* mat states from state var not array for sw */
dummy_attrib[i].stride = 0;
temp_attrib[i] = TNL_CONTEXT(ctx)->vb.AttribPtr[i];
TNL_CONTEXT(ctx)->vb.AttribPtr[i] = &(dummy_attrib[i]);
}
_tnl_UpdateFixedFunctionProgram(ctx);
for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++)
{
TNL_CONTEXT(ctx)->vb.AttribPtr[i] = temp_attrib[i];
}
r700SelectVertexShader(ctx);
vp = (struct r700_vertex_program *)ctx->VertexProgram._Current;
if (vp->translated == GL_FALSE)
{
// TODO
//fprintf(stderr, "Failing back to sw-tcl\n");
//hw_tcl_on = future_hw_tcl_on = 0;
//r300ResetHwState(rmesa);
//
r700UpdateStateParameters(ctx, _NEW_PROGRAM);
return;
}
}
r700UpdateStateParameters(ctx, _NEW_PROGRAM);
r700SelectVertexShader(ctx);
r700UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
context->radeon.NewGLState = 0;
}
/*
@@ -176,45 +148,25 @@ void r700UpdateDrawBuffer(GLcontext * ctx) /* TODO */ //---------------------
r700SetDepthTarget(context);
}
static void r700FetchStateParameter(GLcontext * ctx,
const gl_state_index state[STATE_LENGTH],
GLfloat * value)
{
/* TODO */
}
void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state) //--------------------
{
struct r700_fragment_program *fp;
struct r700_fragment_program *fp =
(struct r700_fragment_program *)ctx->FragmentProgram._Current;
struct gl_program_parameter_list *paramList;
GLuint i;
if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM)))
if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS)))
return;
fp = (struct r700_fragment_program *)ctx->FragmentProgram._Current;
if (!fp)
{
if (!ctx->FragmentProgram._Current || !fp)
return;
}
paramList = fp->mesa_program.Base.Parameters;
paramList = ctx->FragmentProgram._Current->Base.Parameters;
if (!paramList)
{
return;
}
for (i = 0; i < paramList->NumParameters; i++)
{
if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR)
{
r700FetchStateParameter(ctx,
paramList->Parameters[i].
StateIndexes,
paramList->ParameterValues[i]);
}
}
_mesa_load_state_parameters(ctx, paramList);
}
/**
+12 -14
View File
@@ -296,16 +296,16 @@ void r700SelectVertexShader(GLcontext *ctx)
context_t *context = R700_CONTEXT(ctx);
struct r700_vertex_program *vpc
= (struct r700_vertex_program *)ctx->VertexProgram._Current;
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *vb = &tnl->vb;
unsigned int unBit;
unsigned int i;
if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770)
{
vpc->r700AsmCode.bR6xx = 1;
}
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *vb = &tnl->vb;
unsigned int unBit;
unsigned int i;
for(i=0; i<VERT_ATTRIB_MAX; i++)
{
unBit = 1 << i;
@@ -317,11 +317,9 @@ void r700SelectVertexShader(GLcontext *ctx)
}
}
if(GL_FALSE == vpc->translated)
{
r700TranslateVertexShader(vpc,
&(vpc->mesa_program) );
}
if(GL_FALSE == vpc->translated) {
r700TranslateVertexShader(vpc, &(vpc->mesa_program) );
}
}
void * r700GetActiveVpShaderBo(GLcontext * ctx)
@@ -345,17 +343,17 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx)
if(GL_FALSE == vp->loaded)
{
if(vp->r700Shader.bNeedsAssembly == GL_TRUE)
if(vp->r700Shader.bNeedsAssembly == GL_TRUE)
{
Assemble( &(vp->r700Shader) );
}
/* Load vp to gpu */
r600EmitShader(ctx,
&(vp->shaderbo),
r600EmitShader(ctx,
&(vp->shaderbo),
(GLvoid *)(vp->r700Shader.pProgram),
vp->r700Shader.uShaderBinaryDWORDSize,
"VS");
"VS");
vp->loaded = GL_TRUE;
}
+11 -11
View File
@@ -62,23 +62,23 @@ struct r700_vertex_program
//Internal
unsigned int Map_Vertex_Output(r700_AssemblerBase *pAsm,
struct gl_vertex_program *mesa_vp,
unsigned int unStart);
struct gl_vertex_program *mesa_vp,
unsigned int unStart);
unsigned int Map_Vertex_Input(r700_AssemblerBase *pAsm,
struct gl_vertex_program *mesa_vp,
unsigned int unStart);
struct gl_vertex_program *mesa_vp,
unsigned int unStart);
GLboolean Process_Vertex_Program_Vfetch_Instructions(
struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
void Map_Vertex_Program(struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
struct gl_vertex_program *mesa_vp);
GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
struct gl_vertex_program *mesa_vp);
GLboolean r700TranslateVertexShader(struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
/* Interface */
extern GLboolean r700TranslateVertexShader(struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
extern void r700SelectVertexShader(GLcontext *ctx);
extern GLboolean r700SetupVertexProgram(GLcontext * ctx);
@@ -45,6 +45,10 @@ struct drm_radeon_info {
#define RADEON_PARAM_DEVICE_ID 16
#endif
#ifndef RADEON_PARAM_NUM_Z_PIPES
#define RADEON_PARAM_NUM_Z_PIPES 17
#endif
#ifndef RADEON_INFO_DEVICE_ID
#define RADEON_INFO_DEVICE_ID 0
#endif
@@ -52,6 +56,10 @@ struct drm_radeon_info {
#define RADEON_INFO_NUM_GB_PIPES 0
#endif
#ifndef RADEON_INFO_NUM_Z_PIPES
#define RADEON_INFO_NUM_Z_PIPES 0
#endif
#ifndef DRM_RADEON_INFO
#define DRM_RADEON_INFO 0x1
#endif
+2 -1
View File
@@ -178,12 +178,13 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
width, height);
}
else {
uint32_t size = width * height * cpp;
uint32_t size;
uint32_t pitch = ((cpp * width + 63) & ~63) / cpp;
fprintf(stderr,"Allocating %d x %d radeon RBO (pitch %d)\n", width,
height, pitch);
size = pitch * height * cpp;
rrb->pitch = pitch * cpp;
rrb->cpp = cpp;
rrb->bo = radeon_bo_open(radeon->radeonScreen->bom,
@@ -267,6 +267,9 @@ radeonGetParam(__DRIscreenPrivate *sPriv, int param, void *value)
case RADEON_PARAM_NUM_GB_PIPES:
info.request = RADEON_INFO_NUM_GB_PIPES;
break;
case RADEON_PARAM_NUM_Z_PIPES:
info.request = RADEON_INFO_NUM_Z_PIPES;
break;
default:
return -EINVAL;
}
@@ -1171,6 +1174,15 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
default:
break;
}
if ( sPriv->drm_version.minor >= 31 ) {
ret = radeonGetParam(sPriv, RADEON_PARAM_NUM_Z_PIPES, &temp);
if (ret)
screen->num_z_pipes = 2;
else
screen->num_z_pipes = temp;
} else
screen->num_z_pipes = 2;
}
if ( sPriv->drm_version.minor >= 10 ) {
@@ -1372,6 +1384,12 @@ radeonCreateScreen2(__DRIscreenPrivate *sPriv)
break;
}
ret = radeonGetParam(sPriv, RADEON_PARAM_NUM_Z_PIPES, &temp);
if (ret)
screen->num_z_pipes = 2;
else
screen->num_z_pipes = temp;
}
i = 0;
@@ -108,6 +108,7 @@ typedef struct radeon_screen {
const __DRIextension *extensions[16];
int num_gb_pipes;
int num_z_pipes;
int kernel_mm;
drm_radeon_sarea_t *sarea; /* Private SAREA data */
struct radeon_bo_manager *bom;
+61 -50
View File
@@ -160,26 +160,20 @@ static GLint NoOpUnused(void)
* the variables \c _glapi_Dispatch and \c _glapi_Context are used for this
* purpose.
*
* In the "normal" threaded case, the variables \c _glapi_Dispatch and
* \c _glapi_Context will be \c NULL if an application is detected as being
* multithreaded. Single-threaded applications will use \c _glapi_Dispatch
* and \c _glapi_Context just like the case without any threading support.
* When \c _glapi_Dispatch and \c _glapi_Context are \c NULL, the thread state
* data \c _gl_DispatchTSD and \c ContextTSD are used. Drivers and the
* static dispatch functions access these variables via \c _glapi_get_dispatch
* and \c _glapi_get_context.
* In the "normal" threaded case, the variable \c _glapi_SingleThreaded will be
* \c GL_FALSE if an application is detected as being multithreaded.
* Single-threaded applications will use \c _glapi_Dispatch and \c
* _glapi_Context just like the case without any threading support. When \c
* _glapi_SingleThreaded is \c GL_FALSE, the thread state data \c
* _gl_DispatchTSD and \c ContextTSD are used. Drivers and the static dispatch
* functions access these variables via \c _glapi_get_dispatch and \c
* _glapi_get_context.
*
* There is a race condition in setting \c _glapi_Dispatch to \c NULL. It is
* possible for the original thread to be setting it at the same instant a new
* thread, perhaps running on a different processor, is clearing it. Because
* of that, \c ThreadSafe, which can only ever be changed to \c GL_TRUE, is
* used to determine whether or not the application is multithreaded.
*
* In the TLS case, the variables \c _glapi_Dispatch and \c _glapi_Context are
* hardcoded to \c NULL. Instead the TLS variables \c _glapi_tls_Dispatch and
* \c _glapi_tls_Context are used. Having \c _glapi_Dispatch and
* \c _glapi_Context be hardcoded to \c NULL maintains binary compatability
* between TLS enabled loaders and non-TLS DRI drivers.
* \c _glapi_tls_Context are used. The variable \c _glapi_SingleThreaded,
* though not used, is defined and hardcoded to \c GL_FALSE to maintain binary
* compatability between TLS enabled loaders and non-TLS DRI drivers.
*/
/*@{*/
#if defined(GLX_USE_TLS)
@@ -194,13 +188,26 @@ PUBLIC __thread void * _glapi_tls_Context
PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL;
PUBLIC const void *_glapi_Context = NULL;
/* Unused, but maintain binary compatability with non-TLS DRI drivers */
GLboolean _glapi_SingleThreaded = GL_FALSE;
#else
#if defined(THREADS)
static GLboolean ThreadSafe = GL_FALSE; /**< In thread-safe mode? */
_glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */
static _glthread_TSD ContextTSD; /**< Per-thread context pointer */
#ifdef WIN32_THREADS
/* _glthread_DECLARE_STATIC_MUTEX is broken on windows. There will be race! */
#define CHECK_MULTITHREAD_LOCK()
#define CHECK_MULTITHREAD_UNLOCK()
#else
_glthread_DECLARE_STATIC_MUTEX(ThreadCheckMutex);
#define CHECK_MULTITHREAD_LOCK() _glthread_LOCK_MUTEX(ThreadCheckMutex)
#define CHECK_MULTITHREAD_UNLOCK() _glthread_UNLOCK_MUTEX(ThreadCheckMutex)
#endif
GLboolean _glapi_SingleThreaded = GL_TRUE; /**< In single-thread mode? */
_glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */
static _glthread_TSD ContextTSD; /**< Per-thread context pointer */
#if defined(WIN32_THREADS)
void FreeTSD(_glthread_TSD *p);
@@ -231,23 +238,30 @@ void
_glapi_check_multithread(void)
{
#if defined(THREADS) && !defined(GLX_USE_TLS)
if (!ThreadSafe) {
static unsigned long knownID;
static GLboolean firstCall = GL_TRUE;
if (firstCall) {
knownID = _glthread_GetID();
firstCall = GL_FALSE;
}
else if (knownID != _glthread_GetID()) {
ThreadSafe = GL_TRUE;
_glapi_set_dispatch(NULL);
_glapi_set_context(NULL);
}
static unsigned long knownID;
static GLboolean firstCall = GL_TRUE;
if (!_glapi_SingleThreaded)
return;
CHECK_MULTITHREAD_LOCK();
if (firstCall) {
/* initialize TSDs */
(void) _glthread_GetTSD(&ContextTSD);
(void) _glthread_GetTSD(&_gl_DispatchTSD);
knownID = _glthread_GetID();
firstCall = GL_FALSE;
}
else if (!_glapi_get_dispatch()) {
/* make sure that this thread's dispatch pointer isn't null */
_glapi_set_dispatch(NULL);
else if (knownID != _glthread_GetID()) {
/*
* switch to thread-safe mode. _glapi_Context and _glapi_Dispatch are no
* longer accessed after this point, except for raced by the first
* thread. Because of the race, they cannot be reset to NULL.
*/
_glapi_SingleThreaded = GL_FALSE;
}
CHECK_MULTITHREAD_UNLOCK();
#endif
}
@@ -265,8 +279,10 @@ _glapi_set_context(void *context)
#if defined(GLX_USE_TLS)
_glapi_tls_Context = context;
#elif defined(THREADS)
if (_glapi_SingleThreaded)
_glapi_Context = context;
/* always update TSD because we might switch to it at any time */
_glthread_SetTSD(&ContextTSD, context);
_glapi_Context = (ThreadSafe) ? NULL : context;
#else
_glapi_Context = context;
#endif
@@ -285,12 +301,8 @@ _glapi_get_context(void)
#if defined(GLX_USE_TLS)
return _glapi_tls_Context;
#elif defined(THREADS)
if (ThreadSafe) {
return _glthread_GetTSD(&ContextTSD);
}
else {
return _glapi_Context;
}
return (_glapi_SingleThreaded)
? _glapi_Context : _glthread_GetTSD(&ContextTSD);
#else
return _glapi_Context;
#endif
@@ -505,8 +517,9 @@ _glapi_set_dispatch(struct _glapi_table *dispatch)
#if defined(GLX_USE_TLS)
_glapi_tls_Dispatch = dispatch;
#elif defined(THREADS)
if (_glapi_SingleThreaded)
_glapi_Dispatch = dispatch;
_glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
_glapi_Dispatch = (ThreadSafe) ? NULL : dispatch;
#else /*THREADS*/
_glapi_Dispatch = dispatch;
#endif /*THREADS*/
@@ -520,17 +533,15 @@ _glapi_set_dispatch(struct _glapi_table *dispatch)
PUBLIC struct _glapi_table *
_glapi_get_dispatch(void)
{
struct _glapi_table * api;
#if defined(GLX_USE_TLS)
api = _glapi_tls_Dispatch;
return _glapi_tls_Dispatch;
#elif defined(THREADS)
api = (ThreadSafe)
? (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD)
: _glapi_Dispatch;
return (_glapi_SingleThreaded)
? _glapi_Dispatch
: (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD);
#else
api = _glapi_Dispatch;
return _glapi_Dispatch;
#endif
return api;
}
+4 -1
View File
@@ -94,7 +94,10 @@ extern void *_glapi_Context;
extern struct _glapi_table *_glapi_Dispatch;
# ifdef THREADS
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context())
/* this variable is here only for quick access to current context/dispatch */
extern GLboolean _glapi_SingleThreaded;
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) \
((_glapi_SingleThreaded) ? _glapi_Context : _glapi_get_context())
# else
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context
# endif
+1 -1
View File
@@ -322,7 +322,7 @@ extern __thread struct _glapi_table * _glapi_tls_Dispatch
#elif !defined(GL_CALL)
# if defined(THREADS)
# define GET_DISPATCH() \
((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \
((__builtin_expect(_glapi_SingleThreaded, 1)) \
? _glapi_Dispatch : _glapi_get_dispatch())
# else
# define GET_DISPATCH() _glapi_Dispatch
+3
View File
@@ -1001,6 +1001,9 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(pname)");
return;
}
} else {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(pname)");
return;
}
}
+8 -4
View File
@@ -106,7 +106,11 @@ copy_indirect_accessed_array(struct gl_program_parameter_list *src,
}
int
/**
* XXX description???
* \return GL_TRUE for success, GL_FALSE for failure
*/
GLboolean
_mesa_layout_parameters(struct asm_parser_state *state)
{
struct gl_program_parameter_list *layout;
@@ -128,12 +132,12 @@ _mesa_layout_parameters(struct asm_parser_state *state)
*/
if (!inst->SrcReg[i].Symbol->pass1_done) {
const int new_begin =
copy_indirect_accessed_array(state->prog->Parameters, layout,
copy_indirect_accessed_array(state->prog->Parameters, layout,
inst->SrcReg[i].Symbol->param_binding_begin,
inst->SrcReg[i].Symbol->param_binding_length);
if (new_begin < 0) {
return 0;
return GL_FALSE;
}
inst->SrcReg[i].Symbol->param_binding_begin = new_begin;
@@ -209,5 +213,5 @@ _mesa_layout_parameters(struct asm_parser_state *state)
_mesa_free_parameter_list(state->prog->Parameters);
state->prog->Parameters = layout;
return 1;
return GL_TRUE;
}
+2 -1
View File
@@ -36,6 +36,7 @@
extern unsigned _mesa_combine_swizzles(unsigned base, unsigned applied);
struct asm_parser_state;
extern int _mesa_layout_parameters(struct asm_parser_state *state);
extern GLboolean _mesa_layout_parameters(struct asm_parser_state *state);
#endif /* PROG_PARAMETER_LAYOUT_H */
+6 -6
View File
@@ -5156,12 +5156,12 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
? & ctx->Const.VertexProgram
: & ctx->Const.FragmentProgram;
state->MaxTextureImageUnits = 16;
state->MaxTextureCoordUnits = 8;
state->MaxTextureUnits = 8;
state->MaxClipPlanes = 6;
state->MaxLights = 8;
state->MaxProgramMatrices = 8;
state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
state->MaxLights = ctx->Const.MaxLights;
state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
+6 -6
View File
@@ -2287,12 +2287,12 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
? & ctx->Const.VertexProgram
: & ctx->Const.FragmentProgram;
state->MaxTextureImageUnits = 16;
state->MaxTextureCoordUnits = 8;
state->MaxTextureUnits = 8;
state->MaxClipPlanes = 6;
state->MaxLights = 8;
state->MaxProgramMatrices = 8;
state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
state->MaxLights = ctx->Const.MaxLights;
state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
+1 -1
View File
@@ -436,7 +436,7 @@ emit_statevars(const char *name, int array_len,
struct gl_program_parameter_list *paramList)
{
if (type->type == SLANG_SPEC_ARRAY) {
GLint i, pos;
GLint i, pos = -1;
assert(array_len > 0);
if (strcmp(name, "gl_ClipPlane") == 0) {
tokens[0] = STATE_CLIPPLANE;
+11 -5
View File
@@ -94,6 +94,9 @@ struct bitmap_cache
GLfloat color[4];
/** Bitmap's Z position */
GLfloat zpos;
struct pipe_texture *texture;
struct pipe_transfer *trans;
@@ -104,6 +107,8 @@ struct bitmap_cache
};
/** Epsilon for Z comparisons */
#define Z_EPSILON 1e-06
/**
@@ -538,9 +543,7 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
}
/* draw textured quad */
offset = setup_bitmap_vertex_data(st, x, y, width, height,
ctx->Current.RasterPos[2],
color);
offset = setup_bitmap_vertex_data(st, x, y, width, height, z, color);
util_draw_vertex_buffer(pipe, st->bitmap.vbuf, offset,
PIPE_PRIM_TRIANGLE_FAN,
@@ -647,7 +650,7 @@ st_flush_bitmap_cache(struct st_context *st)
draw_bitmap_quad(st->ctx,
cache->xpos,
cache->ypos,
st->ctx->Current.RasterPos[2],
cache->zpos,
BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
cache->texture,
cache->color);
@@ -687,6 +690,7 @@ accum_bitmap(struct st_context *st,
{
struct bitmap_cache *cache = st->bitmap.cache;
int px = -999, py;
const GLfloat z = st->ctx->Current.RasterPos[2];
if (width > BITMAP_CACHE_WIDTH ||
height > BITMAP_CACHE_HEIGHT)
@@ -697,7 +701,8 @@ accum_bitmap(struct st_context *st,
py = y - cache->ypos;
if (px < 0 || px + width > BITMAP_CACHE_WIDTH ||
py < 0 || py + height > BITMAP_CACHE_HEIGHT ||
!TEST_EQ_4V(st->ctx->Current.RasterColor, cache->color)) {
!TEST_EQ_4V(st->ctx->Current.RasterColor, cache->color) ||
((fabs(z - cache->zpos) > Z_EPSILON))) {
/* This bitmap would extend beyond cache bounds, or the bitmap
* color is changing
* so flush and continue.
@@ -712,6 +717,7 @@ accum_bitmap(struct st_context *st,
py = (BITMAP_CACHE_HEIGHT - height) / 2;
cache->xpos = x;
cache->ypos = y - py;
cache->zpos = z;
cache->empty = GL_FALSE;
COPY_4FV(cache->color, st->ctx->Current.RasterColor);
}
+1 -1
View File
@@ -398,7 +398,7 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap )
vbo_exec_vtx_unmap( exec );
}
if (unmap)
if (unmap || exec->vtx.vertex_size == 0)
exec->vtx.max_vert = 0;
else
exec->vtx.max_vert = ((VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) /