From 1b6515a7146050e09d9ff34544c641d6a5e415fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 8 Sep 2006 12:56:41 +0000 Subject: [PATCH] deactivated SSE for now cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18778 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/opengl/mesa/Jamfile | 2 +- src/add-ons/opengl/mesa/MesaSoftRenderer.cpp | 278 ++++++++++--------- src/kits/opengl/Jamfile | 2 +- src/kits/opengl/mesa/Jamfile | 2 +- 4 files changed, 144 insertions(+), 140 deletions(-) diff --git a/src/add-ons/opengl/mesa/Jamfile b/src/add-ons/opengl/mesa/Jamfile index e124000a47..6fd45cb48b 100644 --- a/src/add-ons/opengl/mesa/Jamfile +++ b/src/add-ons/opengl/mesa/Jamfile @@ -13,7 +13,7 @@ if $(TARGET_PLATFORM) != haiku { defines = BEOS_THREADS GNU_ASSEMBLER ; if $(TARGET_ARCH) = x86 { - defines += USE_X86_ASM USE_MMX_ASM USE_3DNOW_ASM USE_SSE_ASM ; + defines += USE_X86_ASM USE_MMX_ASM USE_3DNOW_ASM ; #USE_SSE_ASM ; } else { # Not yet supported, as current Mesa3D PPC assembly is Linux-dependent! # defines += USE_PPC_ASM ; diff --git a/src/add-ons/opengl/mesa/MesaSoftRenderer.cpp b/src/add-ons/opengl/mesa/MesaSoftRenderer.cpp index 4a1ec7b8e7..9024b487ce 100644 --- a/src/add-ons/opengl/mesa/MesaSoftRenderer.cpp +++ b/src/add-ons/opengl/mesa/MesaSoftRenderer.cpp @@ -9,7 +9,7 @@ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. */ -#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__) +#define CALLED() //printf("CALLED %s\n",__PRETTY_FUNCTION__) #include "MesaSoftRenderer.h" extern "C" { @@ -182,6 +182,7 @@ MesaSoftRenderer::SwapBuffers(bool VSync = false) _mesa_notifySwapBuffers(fContext); if (fBitmap) { + CALLED(); GLView()->LockLooper(); GLView()->DrawBitmap(fBitmap); GLView()->UnlockLooper(); @@ -332,16 +333,15 @@ MesaSoftRenderer::Clear(GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height) { - if (mask & DD_FRONT_LEFT_BIT) + CALLED(); + if (mask & DD_FRONT_LEFT_BIT) ClearFront(ctx, all, x, y, width, height); - if (mask & DD_BACK_LEFT_BIT) + if (mask & DD_BACK_LEFT_BIT) ClearBack(ctx, all, x, y, width, height); mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT); if (mask) _swrast_Clear( ctx, mask, all, x, y, width, height ); - - return; } @@ -352,42 +352,41 @@ MesaSoftRenderer::ClearFront(GLcontext *ctx, { CALLED(); - MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; - BGLView *bglview = mr->GLView(); - assert(bglview); + MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; + BGLView *bglview = mr->GLView(); + assert(bglview); - bglview->SetHighColor(mr->fClearColor[BE_RCOMP], - mr->fClearColor[BE_GCOMP], - mr->fClearColor[BE_BCOMP], - mr->fClearColor[BE_ACOMP]); - bglview->SetLowColor(mr->fClearColor[BE_RCOMP], - mr->fClearColor[BE_GCOMP], - mr->fClearColor[BE_BCOMP], - mr->fClearColor[BE_ACOMP]); - if (all) { - BRect b = bglview->Bounds(); - bglview->FillRect(b); - } - else { - // XXX untested - BRect b; - b.left = x; - b.right = x + width; - b.bottom = mr->fHeight - y - 1; - b.top = b.bottom - height; - bglview->FillRect(b); - } + bglview->SetHighColor(mr->fClearColor[BE_RCOMP], + mr->fClearColor[BE_GCOMP], + mr->fClearColor[BE_BCOMP], + mr->fClearColor[BE_ACOMP]); + bglview->SetLowColor(mr->fClearColor[BE_RCOMP], + mr->fClearColor[BE_GCOMP], + mr->fClearColor[BE_BCOMP], + mr->fClearColor[BE_ACOMP]); + if (all) { + BRect b = bglview->Bounds(); + bglview->FillRect(b); + } else { + // XXX untested + BRect b; + b.left = x; + b.right = x + width; + b.bottom = mr->fHeight - y - 1; + b.top = b.bottom - height; + bglview->FillRect(b); + } - // restore drawing color + // restore drawing color #if 0 - bglview->SetHighColor(md->mColor[BE_RCOMP], - md->mColor[BE_GCOMP], - md->mColor[BE_BCOMP], - md->mColor[BE_ACOMP]); - bglview->SetLowColor(md->mColor[BE_RCOMP], - md->mColor[BE_GCOMP], - md->mColor[BE_BCOMP], - md->mColor[BE_ACOMP]); + bglview->SetHighColor(md->mColor[BE_RCOMP], + md->mColor[BE_GCOMP], + md->mColor[BE_BCOMP], + md->mColor[BE_ACOMP]); + bglview->SetLowColor(md->mColor[BE_RCOMP], + md->mColor[BE_GCOMP], + md->mColor[BE_BCOMP], + md->mColor[BE_ACOMP]); #endif } @@ -408,27 +407,25 @@ MesaSoftRenderer::ClearBack(GLcontext *ctx, const GLuint *clearPixelPtr = (const GLuint *) mr->fClearColor; const GLuint clearPixel = B_LENDIAN_TO_HOST_INT32(*clearPixelPtr); - if (all) { - const int numPixels = mr->fWidth * mr->fHeight; - if (clearPixel == 0) { - memset(start, 0, numPixels * 4); - } - else { - for (int i = 0; i < numPixels; i++) { - start[i] = clearPixel; - } - } - } - else { - // XXX untested - start += y * mr->fWidth + x; - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { - start[j] = clearPixel; - } - start += mr->fWidth; - } - } + if (all) { + const int numPixels = mr->fWidth * mr->fHeight; + if (clearPixel == 0) { + memset(start, 0, numPixels * 4); + } else { + for (int i = 0; i < numPixels; i++) { + start[i] = clearPixel; + } + } + } else { + // XXX untested + start += y * mr->fWidth + x; + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + start[j] = clearPixel; + } + start += mr->fWidth; + } + } } @@ -527,9 +524,9 @@ MesaSoftRenderer::SetBuffer(GLcontext *ctx, GLframebuffer *buffer, // This is only used when drawing to the front buffer. inline void Plot(BGLView *bglview, int x, int y) { - // XXX There's got to be a better way! - BPoint p(x, y), q(x+1, y); - bglview->StrokeLine(p, q); + // XXX There's got to be a better way! + BPoint p(x, y), q(x+1, y); + bglview->StrokeLine(p, q); } @@ -621,6 +618,7 @@ MesaSoftRenderer::WriteRGBAPixelsFront(const GLcontext *ctx, CONST GLubyte rgba[][4], const GLubyte mask[] ) { + CALLED(); MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; BGLView *bglview = mr->GLView(); assert(bglview); @@ -646,6 +644,7 @@ MesaSoftRenderer::WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n, const GLchan color[4], const GLubyte mask[]) { + CALLED(); MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; BGLView *bglview = mr->GLView(); assert(bglview); @@ -756,6 +755,7 @@ MesaSoftRenderer::WriteRGBASpanBack(const GLcontext *ctx, GLuint n, CONST GLubyte rgba[][4], const GLubyte mask[]) { + //CALLED(); MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; BBitmap *bitmap = mr->fBitmap; @@ -787,6 +787,7 @@ MesaSoftRenderer::WriteRGBSpanBack(const GLcontext *ctx, GLuint n, CONST GLubyte rgb[][3], const GLubyte mask[]) { + CALLED(); MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; BBitmap *bitmap = mr->fBitmap; @@ -819,6 +820,7 @@ MesaSoftRenderer::WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]) { + CALLED(); MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; BBitmap *bitmap = mr->fBitmap; @@ -849,6 +851,7 @@ MesaSoftRenderer::WriteRGBAPixelsBack(const GLcontext *ctx, CONST GLubyte rgba[][4], const GLubyte mask[] ) { + //CALLED(); MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; BBitmap *bitmap = mr->fBitmap; @@ -865,28 +868,27 @@ MesaSoftRenderer::WriteRGBAPixelsBack(const GLcontext *ctx, rgba++; }; #else - if (mask) { - for (GLuint i = 0; i < n; i++) { - if (mask[i]) { - GLubyte *pixel = (GLubyte *) bitmap->Bits() - + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; - pixel[BE_RCOMP] = rgba[i][RCOMP]; - pixel[BE_GCOMP] = rgba[i][GCOMP]; - pixel[BE_BCOMP] = rgba[i][BCOMP]; - pixel[BE_ACOMP] = rgba[i][ACOMP]; - } - } - } - else { - for (GLuint i = 0; i < n; i++) { - GLubyte *pixel = (GLubyte *) bitmap->Bits() - + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; - pixel[BE_RCOMP] = rgba[i][RCOMP]; - pixel[BE_GCOMP] = rgba[i][GCOMP]; - pixel[BE_BCOMP] = rgba[i][BCOMP]; - pixel[BE_ACOMP] = rgba[i][ACOMP]; - } - } + if (mask) { + for (GLuint i = 0; i < n; i++) { + if (mask[i]) { + GLubyte *pixel = (GLubyte *) bitmap->Bits() + + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; + pixel[BE_RCOMP] = rgba[i][RCOMP]; + pixel[BE_GCOMP] = rgba[i][GCOMP]; + pixel[BE_BCOMP] = rgba[i][BCOMP]; + pixel[BE_ACOMP] = rgba[i][ACOMP]; + } + } + } else { + for (GLuint i = 0; i < n; i++) { + GLubyte *pixel = (GLubyte *) bitmap->Bits() + + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; + pixel[BE_RCOMP] = rgba[i][RCOMP]; + pixel[BE_GCOMP] = rgba[i][GCOMP]; + pixel[BE_BCOMP] = rgba[i][BCOMP]; + pixel[BE_ACOMP] = rgba[i][ACOMP]; + } + } #endif } @@ -897,6 +899,7 @@ MesaSoftRenderer::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, const GLchan color[4], const GLubyte mask[]) { + CALLED(); MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; BBitmap *bitmap = mr->fBitmap; @@ -915,22 +918,21 @@ MesaSoftRenderer::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, y++; }; #else - if (mask) { - for (GLuint i = 0; i < n; i++) { - if (mask[i]) { - GLubyte * ptr = (GLubyte *) bitmap->Bits() - + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; - *((uint32 *) ptr) = pixel_color; - } - } - } - else { - for (GLuint i = 0; i < n; i++) { - GLubyte * ptr = (GLubyte *) bitmap->Bits() - + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; - *((uint32 *) ptr) = pixel_color; - } - } + if (mask) { + for (GLuint i = 0; i < n; i++) { + if (mask[i]) { + GLubyte * ptr = (GLubyte *) bitmap->Bits() + + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; + *((uint32 *) ptr) = pixel_color; + } + } + } else { + for (GLuint i = 0; i < n; i++) { + GLubyte * ptr = (GLubyte *) bitmap->Bits() + + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; + *((uint32 *) ptr) = pixel_color; + } + } #endif } @@ -995,20 +997,21 @@ void MesaSoftRenderer::ReadRGBASpanBack( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { - MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; - const BBitmap *bitmap = mr->fBitmap; - assert(bitmap); - int row = mr->fBottom - y; - const GLubyte *pixel = (GLubyte *) bitmap->Bits() - + (row * bitmap->BytesPerRow()) + x * 4; + CALLED(); + MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; + const BBitmap *bitmap = mr->fBitmap; + assert(bitmap); + int row = mr->fBottom - y; + const GLubyte *pixel = (GLubyte *) bitmap->Bits() + + (row * bitmap->BytesPerRow()) + x * 4; - for (GLuint i = 0; i < n; i++) { - rgba[i][RCOMP] = pixel[BE_RCOMP]; - rgba[i][GCOMP] = pixel[BE_GCOMP]; - rgba[i][BCOMP] = pixel[BE_BCOMP]; - rgba[i][ACOMP] = pixel[BE_ACOMP]; - pixel += 4; - } + for (GLuint i = 0; i < n; i++) { + rgba[i][RCOMP] = pixel[BE_RCOMP]; + rgba[i][GCOMP] = pixel[BE_GCOMP]; + rgba[i][BCOMP] = pixel[BE_BCOMP]; + rgba[i][ACOMP] = pixel[BE_ACOMP]; + pixel += 4; + } } @@ -1027,30 +1030,31 @@ MesaSoftRenderer::ReadRGBAPixelsBack( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { - MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; - const BBitmap *bitmap = mr->fBitmap; - assert(bitmap); + CALLED(); + MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx; + const BBitmap *bitmap = mr->fBitmap; + assert(bitmap); - if (mask) { - for (GLuint i = 0; i < n; i++) { - if (mask[i]) { - GLubyte *pixel = (GLubyte *) bitmap->Bits() - + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; - rgba[i][RCOMP] = pixel[BE_RCOMP]; - rgba[i][GCOMP] = pixel[BE_GCOMP]; - rgba[i][BCOMP] = pixel[BE_BCOMP]; - rgba[i][ACOMP] = pixel[BE_ACOMP]; - }; - }; - } else { - for (GLuint i = 0; i < n; i++) { - GLubyte *pixel = (GLubyte *) bitmap->Bits() - + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; - rgba[i][RCOMP] = pixel[BE_RCOMP]; - rgba[i][GCOMP] = pixel[BE_GCOMP]; - rgba[i][BCOMP] = pixel[BE_BCOMP]; - rgba[i][ACOMP] = pixel[BE_ACOMP]; - }; - }; + if (mask) { + for (GLuint i = 0; i < n; i++) { + if (mask[i]) { + GLubyte *pixel = (GLubyte *) bitmap->Bits() + + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; + rgba[i][RCOMP] = pixel[BE_RCOMP]; + rgba[i][GCOMP] = pixel[BE_GCOMP]; + rgba[i][BCOMP] = pixel[BE_BCOMP]; + rgba[i][ACOMP] = pixel[BE_ACOMP]; + }; + }; + } else { + for (GLuint i = 0; i < n; i++) { + GLubyte *pixel = (GLubyte *) bitmap->Bits() + + ((mr->fBottom - y[i]) * bitmap->BytesPerRow()) + x[i] * 4; + rgba[i][RCOMP] = pixel[BE_RCOMP]; + rgba[i][GCOMP] = pixel[BE_GCOMP]; + rgba[i][BCOMP] = pixel[BE_BCOMP]; + rgba[i][ACOMP] = pixel[BE_ACOMP]; + }; + }; } diff --git a/src/kits/opengl/Jamfile b/src/kits/opengl/Jamfile index 57b4009113..b38646d7e7 100644 --- a/src/kits/opengl/Jamfile +++ b/src/kits/opengl/Jamfile @@ -24,7 +24,7 @@ UseHeaders [ FDirName $(SUBDIR) mesa swrast_setup ] ; defines = BEOS_THREADS GNU_ASSEMBLER ; if $(TARGET_ARCH) = x86 { - defines += USE_X86_ASM USE_MMX_ASM USE_3DNOW_ASM USE_SSE_ASM ; + defines += USE_X86_ASM USE_MMX_ASM USE_3DNOW_ASM ; #USE_SSE_ASM ; } else if $(TARGET_ARCH) = ppc { # Not yet supported, as current Mesa3D PPC assembly is Linux-dependent! # defines += USE_PPC_ASM ; diff --git a/src/kits/opengl/mesa/Jamfile b/src/kits/opengl/mesa/Jamfile index aec7cd65c5..039644005d 100644 --- a/src/kits/opengl/mesa/Jamfile +++ b/src/kits/opengl/mesa/Jamfile @@ -32,7 +32,7 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) tnl ] ; defines = BEOS_THREADS GNU_ASSEMBLER ; if $(TARGET_ARCH) = x86 { - defines += USE_X86_ASM USE_MMX_ASM USE_3DNOW_ASM USE_SSE_ASM ; + defines += USE_X86_ASM USE_MMX_ASM USE_3DNOW_ASM ; #USE_SSE_ASM ; } else { # Not yet supported, as current Mesa3D PPC assembly is Linux-dependent! # defines += USE_PPC_ASM ;