summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/unichrome
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/unichrome')
-rw-r--r--src/mesa/drivers/dri/unichrome/Makefile1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c39
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h8
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c17
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.h4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c51
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.h16
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.c25
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c30
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.c116
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tris.c7
11 files changed, 148 insertions, 166 deletions
diff --git a/src/mesa/drivers/dri/unichrome/Makefile b/src/mesa/drivers/dri/unichrome/Makefile
index 5fe00c1bd1..344d34fce3 100644
--- a/src/mesa/drivers/dri/unichrome/Makefile
+++ b/src/mesa/drivers/dri/unichrome/Makefile
@@ -29,4 +29,3 @@ ASM_SOURCES =
include ../Makefile.template
-symlinks:
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index 6eb19ac079..d17a160271 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -32,6 +32,7 @@
#include "main/glheader.h"
#include "main/context.h"
+#include "main/formats.h"
#include "main/matrix.h"
#include "main/state.h"
#include "main/simple_list.h"
@@ -65,7 +66,7 @@
#define need_GL_ARB_point_parameters
#define need_GL_EXT_fog_coord
#define need_GL_EXT_secondary_color
-#include "extension_helper.h"
+#include "main/remap_helper.h"
#define DRIVER_DATE "20060710"
@@ -147,7 +148,7 @@ viaRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,
static void
viaInitRenderbuffer(struct via_renderbuffer *vrb, GLenum format,
- __DRIdrawablePrivate *dPriv)
+ __DRIdrawable *dPriv)
{
const GLuint name = 0;
struct gl_renderbuffer *rb = & vrb->Base;
@@ -163,24 +164,28 @@ viaInitRenderbuffer(struct via_renderbuffer *vrb, GLenum format,
if (format == GL_RGBA) {
/* Color */
rb->_BaseFormat = GL_RGBA;
+ rb->Format = MESA_FORMAT_ARGB8888;
rb->DataType = GL_UNSIGNED_BYTE;
}
else if (format == GL_DEPTH_COMPONENT16) {
/* Depth */
rb->_BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
+ rb->Format = MESA_FORMAT_Z16;
rb->DataType = GL_UNSIGNED_INT;
}
else if (format == GL_DEPTH_COMPONENT24) {
/* Depth */
rb->_BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
+ rb->Format = MESA_FORMAT_Z32;
rb->DataType = GL_UNSIGNED_INT;
}
else {
/* Stencil */
ASSERT(format == GL_STENCIL_INDEX8_EXT);
rb->_BaseFormat = GL_STENCIL_INDEX;
+ rb->Format = MESA_FORMAT_S8;
rb->DataType = GL_UNSIGNED_BYTE;
}
@@ -202,7 +207,7 @@ viaInitRenderbuffer(struct via_renderbuffer *vrb, GLenum format,
static GLboolean
calculate_buffer_parameters(struct via_context *vmesa,
struct gl_framebuffer *fb,
- __DRIdrawablePrivate *dPriv)
+ __DRIdrawable *dPriv)
{
const unsigned shift = vmesa->viaScreen->bitsPerPixel / 16;
const unsigned extra = 32;
@@ -362,7 +367,7 @@ void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
/* Extension strings exported by the Unichrome driver.
*/
-const struct dri_extension card_extensions[] =
+static const struct dri_extension card_extensions[] =
{
{ "GL_ARB_multitexture", NULL },
{ "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
@@ -455,12 +460,12 @@ FreeBuffer(struct via_context *vmesa)
GLboolean
viaCreateContext(const __GLcontextModes *visual,
- __DRIcontextPrivate *driContextPriv,
+ __DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
GLcontext *ctx, *shareCtx;
struct via_context *vmesa;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
+ __DRIscreen *sPriv = driContextPriv->driScreenPriv;
viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private;
drm_via_sarea_t *saPriv = (drm_via_sarea_t *)
(((GLubyte *)sPriv->pSAREA) + viaScreen->sareaPrivOffset);
@@ -674,7 +679,7 @@ viaCreateContext(const __GLcontextModes *visual,
}
void
-viaDestroyContext(__DRIcontextPrivate *driContextPriv)
+viaDestroyContext(__DRIcontext *driContextPriv)
{
GET_CURRENT_CONTEXT(ctx);
struct via_context *vmesa =
@@ -724,8 +729,8 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv)
void viaXMesaWindowMoved(struct via_context *vmesa)
{
- __DRIdrawablePrivate *const drawable = vmesa->driDrawable;
- __DRIdrawablePrivate *const readable = vmesa->driReadable;
+ __DRIdrawable *const drawable = vmesa->driDrawable;
+ __DRIdrawable *const readable = vmesa->driReadable;
struct via_renderbuffer * draw_buffer;
struct via_renderbuffer * read_buffer;
GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3;
@@ -808,15 +813,15 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
}
GLboolean
-viaUnbindContext(__DRIcontextPrivate *driContextPriv)
+viaUnbindContext(__DRIcontext *driContextPriv)
{
return GL_TRUE;
}
GLboolean
-viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
+viaMakeCurrent(__DRIcontext *driContextPriv,
+ __DRIdrawable *driDrawPriv,
+ __DRIdrawable *driReadPriv)
{
if (VIA_DEBUG & DEBUG_DRI) {
fprintf(stderr, "driContextPriv = %016lx\n", (unsigned long)driContextPriv);
@@ -892,8 +897,8 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
void viaGetLock(struct via_context *vmesa, GLuint flags)
{
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- __DRIscreenPrivate *sPriv = vmesa->driScreen;
+ __DRIdrawable *dPriv = vmesa->driDrawable;
+ __DRIscreen *sPriv = vmesa->driScreen;
drmGetLock(vmesa->driFd, vmesa->hHWContext, flags);
@@ -923,9 +928,9 @@ void viaGetLock(struct via_context *vmesa, GLuint flags)
void
-viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
+viaSwapBuffers(__DRIdrawable *drawablePrivate)
{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *)drawablePrivate;
+ __DRIdrawable *dPriv = (__DRIdrawable *)drawablePrivate;
if (dPriv &&
dPriv->driContextPriv &&
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index 4cc9e475c2..4e1ab3a6ca 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -105,7 +105,7 @@ struct via_renderbuffer {
int drawW;
int drawH;
- __DRIdrawablePrivate *dPriv;
+ __DRIdrawable *dPriv;
};
@@ -294,14 +294,14 @@ struct via_context {
/**
* DRI drawable bound to this context for drawing.
*/
- __DRIdrawablePrivate *driDrawable;
+ __DRIdrawable *driDrawable;
/**
* DRI drawable bound to this context for reading.
*/
- __DRIdrawablePrivate *driReadable;
+ __DRIdrawable *driReadable;
- __DRIscreenPrivate *driScreen;
+ __DRIscreen *driScreen;
viaScreenPrivate *viaScreen;
drm_via_sarea_t *sarea;
volatile GLuint* regMMIOBase;
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index 6746f552ae..8d4edfa305 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -205,7 +205,7 @@ static void viaFillBuffer(struct via_context *vmesa,
static void viaClear(GLcontext *ctx, GLbitfield mask)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
+ __DRIdrawable *dPriv = vmesa->driDrawable;
struct via_renderbuffer *const vrb =
(struct via_renderbuffer *) dPriv->driverPrivate;
int flag = 0;
@@ -507,12 +507,12 @@ void viaWaitIdleLocked( struct via_context *vmesa, GLboolean light )
* except that WAIT_IDLE() will spin the CPU polling, while this is
* IRQ driven.
*/
-static void viaWaitIdleVBlank( __DRIdrawablePrivate *dPriv,
+static void viaWaitIdleVBlank( __DRIdrawable *dPriv,
struct via_context *vmesa,
GLuint value )
{
GLboolean missed_target;
- __DRIscreenPrivate *psp = dPriv->driScreenPriv;
+ __DRIscreen *psp = dPriv->driScreenPriv;
VIA_FLUSH_DMA(vmesa);
@@ -591,11 +591,11 @@ void viaResetPageFlippingLocked(struct via_context *vmesa)
/*
* Copy the back buffer to the front buffer.
*/
-void viaCopyBuffer(__DRIdrawablePrivate *dPriv)
+void viaCopyBuffer(__DRIdrawable *dPriv)
{
struct via_context *vmesa =
(struct via_context *)dPriv->driContextPriv->driverPrivate;
- __DRIscreenPrivate *psp = dPriv->driScreenPriv;
+ __DRIscreen *psp = dPriv->driScreenPriv;
if (VIA_DEBUG & DEBUG_IOCTL)
fprintf(stderr,
@@ -635,12 +635,12 @@ void viaCopyBuffer(__DRIdrawablePrivate *dPriv)
}
-void viaPageFlip(__DRIdrawablePrivate *dPriv)
+void viaPageFlip(__DRIdrawable *dPriv)
{
struct via_context *vmesa =
(struct via_context *)dPriv->driContextPriv->driverPrivate;
struct via_renderbuffer buffer_tmp;
- __DRIscreenPrivate *psp = dPriv->driScreenPriv;
+ __DRIscreen *psp = dPriv->driScreenPriv;
VIA_FLUSH_DMA(vmesa);
if (dPriv->vblFlags == VBLANK_FLAG_SYNC &&
@@ -885,9 +885,6 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags)
}
else if (vmesa->numClipRects) {
drm_clip_rect_t *pbox = vmesa->pClipRects;
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- struct via_renderbuffer *const vrb =
- (struct via_renderbuffer *) dPriv->driverPrivate;
for (i = 0; i < vmesa->numClipRects; i++) {
drm_clip_rect_t b;
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.h b/src/mesa/drivers/dri/unichrome/via_ioctl.h
index 14a833a97d..c6b32cf085 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.h
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.h
@@ -33,8 +33,8 @@ void viaFlushDma(struct via_context *vmesa);
void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags);
void viaInitIoctlFuncs(GLcontext *ctx);
-void viaCopyBuffer(__DRIdrawablePrivate *dpriv);
-void viaPageFlip(__DRIdrawablePrivate *dpriv);
+void viaCopyBuffer(__DRIdrawable *dpriv);
+void viaPageFlip(__DRIdrawable *dpriv);
void viaCheckDma(struct via_context *vmesa, GLuint bytes);
void viaResetPageFlippingLocked(struct via_context *vmesa);
void viaWaitIdle(struct via_context *vmesa, GLboolean light);
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 3dbb570571..2cfb98317d 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -62,8 +62,6 @@ DRI_CONF_BEGIN
DRI_CONF_END;
static const GLuint __driNConfigOptions = 3;
-extern const struct dri_extension card_extensions[];
-
static drmBufMapPtr via_create_empty_buffers(void)
{
drmBufMapPtr retval;
@@ -92,7 +90,7 @@ static void via_free_empty_buffers( drmBufMapPtr bufs )
static GLboolean
-viaInitDriver(__DRIscreenPrivate *sPriv)
+viaInitDriver(__DRIscreen *sPriv)
{
viaScreenPrivate *viaScreen;
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
@@ -186,7 +184,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
}
static void
-viaDestroyScreen(__DRIscreenPrivate *sPriv)
+viaDestroyScreen(__DRIscreen *sPriv)
{
viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private;
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
@@ -205,12 +203,14 @@ viaDestroyScreen(__DRIscreenPrivate *sPriv)
static GLboolean
-viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
+viaCreateBuffer(__DRIscreen *driScrnPriv,
+ __DRIdrawable *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap)
{
+#if 0
viaScreenPrivate *screen = (viaScreenPrivate *) driScrnPriv->private;
+#endif
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
mesaVis->depthBits != 24);
@@ -248,7 +248,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
/* XXX check/fix the offset/pitch parameters! */
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(frontRb, mesaVis);
@@ -257,7 +257,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(backRb, mesaVis);
@@ -266,7 +266,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_Z16, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(depthRb, mesaVis);
@@ -274,7 +274,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(depthRb, mesaVis);
@@ -282,7 +282,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 32) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_Z32, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(depthRb, mesaVis);
@@ -291,7 +291,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_S8, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(stencilRb, mesaVis);
@@ -314,13 +314,13 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
static void
-viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
+viaDestroyBuffer(__DRIdrawable *driDrawPriv)
{
_mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
static const __DRIconfig **
-viaFillInModes( __DRIscreenPrivate *psp,
+viaFillInModes( __DRIscreen *psp,
unsigned pixel_bits, GLboolean have_back_buffer )
{
__DRIconfig **configs;
@@ -377,7 +377,7 @@ viaFillInModes( __DRIscreenPrivate *psp,
* \return the __GLcontextModes supported by this driver
*/
static const __DRIconfig **
-viaInitScreen(__DRIscreenPrivate *psp)
+viaInitScreen(__DRIscreen *psp)
{
static const __DRIversion ddx_expected = { VIA_DRIDDX_VERSION_MAJOR,
VIA_DRIDDX_VERSION_MINOR,
@@ -393,18 +393,6 @@ viaInitScreen(__DRIscreenPrivate *psp)
&psp->drm_version, & drm_expected) )
return NULL;
- /* Calling driInitExtensions here, with a NULL context pointer,
- * does not actually enable the extensions. It just makes sure
- * that all the dispatch offsets for all the extensions that
- * *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is
- * called, but we can't enable the extensions until we have a
- * context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
-
if (!viaInitDriver(psp))
return NULL;
@@ -417,7 +405,7 @@ viaInitScreen(__DRIscreenPrivate *psp)
* Get information about previous buffer swaps.
*/
static int
-getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
+getSwapInfo( __DRIdrawable *dPriv, __DRIswapInfo * sInfo )
{
struct via_context *vmesa;
@@ -455,3 +443,10 @@ const struct __DriverAPIRec driDriverAPI = {
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
};
+
+/* This is the table of extensions that the loader will dlsym() for. */
+PUBLIC const __DRIextension *__driDriverExtensions[] = {
+ &driCoreExtension.base,
+ &driLegacyExtension.base,
+ NULL
+};
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h
index c3ef722ff0..aa662e01c0 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.h
+++ b/src/mesa/drivers/dri/unichrome/via_screen.h
@@ -61,7 +61,7 @@ typedef struct {
drmAddress agpLinearStart;
GLuint agpBase;
- __DRIscreenPrivate *driScrnPriv;
+ __DRIscreen *driScrnPriv;
drmBufMapPtr bufs;
unsigned int sareaPrivOffset;
/*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
@@ -77,21 +77,21 @@ typedef struct {
extern GLboolean
viaCreateContext(const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
+ __DRIcontext *driContextPriv,
void *sharedContextPrivate);
extern void
-viaDestroyContext(__DRIcontextPrivate *driContextPriv);
+viaDestroyContext(__DRIcontext *driContextPriv);
extern GLboolean
-viaUnbindContext(__DRIcontextPrivate *driContextPriv);
+viaUnbindContext(__DRIcontext *driContextPriv);
extern GLboolean
-viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv);
+viaMakeCurrent(__DRIcontext *driContextPriv,
+ __DRIdrawable *driDrawPriv,
+ __DRIdrawable *driReadPriv);
extern void
-viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate);
+viaSwapBuffers(__DRIdrawable *drawablePrivate);
#endif
diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c
index b908f0fb23..fa3cbf7a79 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.c
+++ b/src/mesa/drivers/dri/unichrome/via_span.c
@@ -23,6 +23,7 @@
*/
#include "main/glheader.h"
+#include "main/formats.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/colormac.h"
@@ -42,7 +43,7 @@
#undef LOCAL_VARS
#define LOCAL_VARS \
struct via_renderbuffer *vrb = (struct via_renderbuffer *) rb; \
- __DRIdrawablePrivate *dPriv = vrb->dPriv; \
+ __DRIdrawable *dPriv = vrb->dPriv; \
GLuint pitch = vrb->pitch; \
GLuint height = dPriv->h; \
GLint p = 0; \
@@ -79,7 +80,7 @@
*/
#define LOCAL_DEPTH_VARS \
struct via_renderbuffer *vrb = (struct via_renderbuffer *) rb; \
- __DRIdrawablePrivate *dPriv = vrb->dPriv; \
+ __DRIdrawable *dPriv = vrb->dPriv; \
GLuint depth_pitch = vrb->pitch; \
GLuint height = dPriv->h; \
char *buf = (char *)(vrb->map)
@@ -177,24 +178,22 @@ void viaInitSpanFuncs(GLcontext *ctx)
void
viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis)
{
- if (vrb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- viaInitPointers_565(&vrb->Base);
- }
- else {
- viaInitPointers_8888(&vrb->Base);
- }
+ if (vrb->Base.Format == MESA_FORMAT_RGB565) {
+ viaInitPointers_565(&vrb->Base);
}
- else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ else if (vrb->Base.Format == MESA_FORMAT_ARGB8888) {
+ viaInitPointers_8888(&vrb->Base);
+ }
+ else if (vrb->Base.Format == MESA_FORMAT_Z16) {
viaInitDepthPointers_z16(&vrb->Base);
}
- else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+ else if (vrb->Base.Format == MESA_FORMAT_Z24_S8) {
viaInitDepthPointers_z24_s8(&vrb->Base);
}
- else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
+ else if (vrb->Base.Format == MESA_FORMAT_Z32) {
viaInitDepthPointers_z32(&vrb->Base);
}
- else if (vrb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+ else if (vrb->Base.Format == MESA_FORMAT_S8) {
viaInitStencilPointers_z24_s8(&vrb->Base);
}
}
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index 840e4e42da..e6e5526d34 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -476,7 +476,7 @@ void viaEmitState(struct via_context *vmesa)
*/
if (ctx->Polygon.StippleFlag) {
GLuint *stipple = &ctx->PolygonStipple[0];
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
+ __DRIdrawable *dPriv = vmesa->driDrawable;
struct via_renderbuffer *const vrb =
(struct via_renderbuffer *) dPriv->driverPrivate;
GLint i;
@@ -722,7 +722,7 @@ static void viaColorMask(GLcontext *ctx,
void viaCalcViewport(GLcontext *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
+ __DRIdrawable *dPriv = vmesa->driDrawable;
struct via_renderbuffer *const vrb =
(struct via_renderbuffer *) dPriv->driverPrivate;
const GLfloat *v = ctx->Viewport._WindowMap.m;
@@ -891,10 +891,10 @@ static GLboolean viaChooseTextureState(GLcontext *ctx)
if (texObj->Image[0][texObj->BaseLevel]->Border > 0) {
vmesa->regHTXnTB[0] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T);
vmesa->regHTXnTBC[0] =
- PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]),
- FLOAT_TO_UBYTE(texObj->BorderColor[1]),
- FLOAT_TO_UBYTE(texObj->BorderColor[2]));
- vmesa->regHTXnTRAH[0] = FLOAT_TO_UBYTE(texObj->BorderColor[3]);
+ PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor.f[0]),
+ FLOAT_TO_UBYTE(texObj->BorderColor.f[1]),
+ FLOAT_TO_UBYTE(texObj->BorderColor.f[2]));
+ vmesa->regHTXnTRAH[0] = FLOAT_TO_UBYTE(texObj->BorderColor.f[3]);
}
if (texUnit0->LodBias != 0.0f) {
@@ -924,10 +924,10 @@ static GLboolean viaChooseTextureState(GLcontext *ctx)
if (texObj->Image[0][texObj->BaseLevel]->Border > 0) {
vmesa->regHTXnTB[1] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T);
vmesa->regHTXnTBC[1] =
- PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]),
- FLOAT_TO_UBYTE(texObj->BorderColor[1]),
- FLOAT_TO_UBYTE(texObj->BorderColor[2]));
- vmesa->regHTXnTRAH[1] = FLOAT_TO_UBYTE(texObj->BorderColor[3]);
+ PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor.f[0]),
+ FLOAT_TO_UBYTE(texObj->BorderColor.f[1]),
+ FLOAT_TO_UBYTE(texObj->BorderColor.f[2]));
+ vmesa->regHTXnTRAH[1] = FLOAT_TO_UBYTE(texObj->BorderColor.f[3]);
}
@@ -1238,12 +1238,12 @@ static void viaChooseColorState(GLcontext *ctx)
else
vmesa->regHROP = HC_HROP_P;
- vmesa->regHFBBMSKL = PACK_COLOR_888(ctx->Color.ColorMask[0],
- ctx->Color.ColorMask[1],
- ctx->Color.ColorMask[2]);
- vmesa->regHROP |= ctx->Color.ColorMask[3];
+ vmesa->regHFBBMSKL = PACK_COLOR_888(ctx->Color.ColorMask[0][0],
+ ctx->Color.ColorMask[0][1],
+ ctx->Color.ColorMask[0][2]);
+ vmesa->regHROP |= ctx->Color.ColorMask[0][3];
- if (ctx->Color.ColorMask[3])
+ if (ctx->Color.ColorMask[0][3])
vmesa->regEnable |= HC_HenAW_MASK;
else
vmesa->regEnable &= ~HC_HenAW_MASK;
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c
index 54073e7691..24924d2613 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -30,17 +30,17 @@
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/enums.h"
+#include "main/formats.h"
#include "main/colortab.h"
#include "main/convolve.h"
#include "main/context.h"
#include "main/mipmap.h"
+#include "main/mm.h"
#include "main/simple_list.h"
#include "main/texcompress.h"
-#include "main/texformat.h"
#include "main/texobj.h"
#include "main/texstore.h"
-#include "main/mm.h"
#include "via_context.h"
#include "via_fb.h"
#include "via_tex.h"
@@ -48,7 +48,7 @@
#include "via_ioctl.h"
#include "via_3d_reg.h"
-static const struct gl_texture_format *
+static gl_format
viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
@@ -65,56 +65,56 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
if ( format == GL_BGRA ) {
if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ||
type == GL_UNSIGNED_BYTE ) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
}
else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
}
else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
}
}
else if ( type == GL_UNSIGNED_BYTE ||
type == GL_UNSIGNED_INT_8_8_8_8_REV ||
type == GL_UNSIGNED_INT_8_8_8_8 ) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
}
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case 3:
case GL_RGB:
case GL_COMPRESSED_RGB:
if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
}
else if ( type == GL_UNSIGNED_BYTE ) {
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
}
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
case GL_RGBA8:
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
case GL_RGBA4:
case GL_RGBA2:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
case GL_RGB5:
case GL_RGB4:
case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_ALPHA:
case GL_ALPHA4:
@@ -122,7 +122,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
case GL_ALPHA12:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
+ return MESA_FORMAT_A8;
case 1:
case GL_LUMINANCE:
@@ -131,7 +131,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
+ return MESA_FORMAT_L8;
case 2:
case GL_LUMINANCE_ALPHA:
@@ -142,7 +142,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case GL_INTENSITY:
case GL_INTENSITY4:
@@ -150,35 +150,35 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
+ return MESA_FORMAT_I8;
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
+ return MESA_FORMAT_RGB_FXT1;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
+ return MESA_FORMAT_RGBA_FXT1;
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
@@ -187,16 +187,16 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
case GL_COLOR_INDEX8_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
+ return MESA_FORMAT_CI8;
default:
fprintf(stderr, "unexpected texture format %s in %s\n",
_mesa_lookup_enum_by_nr(internalFormat),
__FUNCTION__);
- return NULL;
+ return MESA_FORMAT_NONE;
}
- return NULL; /* never get here */
+ return MESA_FORMAT_NONE; /* never get here */
}
static int logbase2(int n)
@@ -457,7 +457,7 @@ static GLboolean viaSetTexImages(GLcontext *ctx,
GLuint widthExp = 0;
GLuint heightExp = 0;
- switch (baseImage->image.TexFormat->MesaFormat) {
+ switch (baseImage->image.TexFormat) {
case MESA_FORMAT_ARGB8888:
texFormat = HC_HTXnFM_ARGB8888;
break;
@@ -689,24 +689,7 @@ static void viaTexImage(GLcontext *ctx,
assert(texImage->TexFormat);
- if (dims == 1) {
- texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
- texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
- }
- else {
- texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
- texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
- }
- texelBytes = texImage->TexFormat->TexelBytes;
-
- if (texelBytes == 0) {
- /* compressed format */
- texImage->IsCompressed = GL_TRUE;
- texImage->CompressedSize =
- ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
- texImage->Height, texImage->Depth,
- texImage->TexFormat->MesaFormat);
- }
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* Minimum pitch of 32 bytes */
if (postConvWidth * texelBytes < 32) {
@@ -718,8 +701,11 @@ static void viaTexImage(GLcontext *ctx,
viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes);
/* allocate memory */
- if (texImage->IsCompressed)
- sizeInBytes = texImage->CompressedSize;
+ if (_mesa_is_format_compressed(texImage->TexFormat))
+ sizeInBytes = _mesa_format_image_size(texImage->TexFormat,
+ texImage->Width,
+ texImage->Height,
+ texImage->Depth);
else
sizeInBytes = postConvWidth * postConvHeight * texelBytes;
@@ -797,22 +783,22 @@ static void viaTexImage(GLcontext *ctx,
else {
GLint dstRowStride;
GLboolean success;
- if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
+ dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
}
else {
- dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes;
+ dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat);
}
- ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, dims,
- texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- format, type, pixels, packing);
+ success = _mesa_texstore(ctx, dims,
+ texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, 1,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
}
diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c
index 79e67620c9..01359d51ea 100644
--- a/src/mesa/drivers/dri/unichrome/via_tris.c
+++ b/src/mesa/drivers/dri/unichrome/via_tris.c
@@ -330,7 +330,8 @@ do { \
#define LOCAL_VARS(n) \
struct via_context *vmesa = VIA_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
+ GLuint color[n] = { 0 }; \
+ GLuint spec[n] = { 0 }; \
GLuint coloroffset = vmesa->coloroffset; \
GLuint specoffset = vmesa->specoffset; \
(void)color; (void)spec; (void)coloroffset; (void)specoffset;
@@ -832,13 +833,13 @@ static GLboolean viaCheckPTexHack( GLcontext *ctx )
RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->TexCoordPtr[0]->size == 4) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4) {
if (!RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_ATTRIB_TEX1, _TNL_LAST_TEX ))
ptexHack = GL_TRUE;
else
fallback = GL_TRUE;
}
- if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->TexCoordPtr[1]->size == 4)
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4)
fallback = GL_TRUE;
FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_PROJ_TEXTURE, fallback);