ソースを参照

more gldirect compile fixes. Getting near the linking stage now. No build file yet.

tags/mesa_20050504
Ben Crossman 20年前
コミット
509710cfd7

+ 5
- 5
src/mesa/drivers/windows/gldirect/dglcontext.c ファイルの表示

#include "dglcontext.h" #include "dglcontext.h"


// Get compile errors without this. KeithH // Get compile errors without this. KeithH
#include "scitech.h" // ibool, etc.
//#include "scitech.h" // ibool, etc.


#ifdef _USE_GLD3_WGL #ifdef _USE_GLD3_WGL
#include "gld_driver.h" #include "gld_driver.h"
HGLRC hGLRC = NULL; HGLRC hGLRC = NULL;
DGL_ctx* lpCtx = NULL; DGL_ctx* lpCtx = NULL;
int cmd = 0, dx1 = 0, dx2 = 0, i; int cmd = 0, dx1 = 0, dx2 = 0, i;
static ibool bAltPressed = false;
static ibool bCtrlPressed = false;
static ibool bShiftPressed = false;
static BOOL bAltPressed = FALSE;
static BOOL bCtrlPressed = FALSE;
static BOOL bShiftPressed = FALSE;
RECT r, rf, rc; RECT r, rf, rc;
POINT pt; POINT pt;
ibool bForceReshape = false;
BOOL bForceReshape = FALSE;


return CallNextHookEx(hKeyHook, code, wParam, lParam); return CallNextHookEx(hKeyHook, code, wParam, lParam);
} }

+ 1
- 1
src/mesa/drivers/windows/gldirect/dglwgl.c ファイルの表示

#include "gld_driver.h" #include "gld_driver.h"
#endif #endif


#include "glu.h" // MUST USE MICROSOFT'S GLU32!
#include "gl/glu.h" // MUST USE MICROSOFT'S GLU32!


#ifndef _USE_GLD3_WGL #ifndef _USE_GLD3_WGL
extern DGL_mesaFuncs mesaFuncs; extern DGL_mesaFuncs mesaFuncs;

+ 5
- 4
src/mesa/drivers/windows/gldirect/dll_main.c ファイルの表示



#include "dllmain.h" #include "dllmain.h"


#include "snap/graphics.h"
#include "drvlib/os/os.h"
//#include "snap/graphics.h"
//#include "drvlib/os/os.h"


#ifdef _USE_GLD3_WGL #ifdef _USE_GLD3_WGL
typedef void (APIENTRY *LPDGLSPLASHSCREEN)(int, int, char*); typedef void (APIENTRY *LPDGLSPLASHSCREEN)(int, int, char*);
if (bRegistryError || !bSuccess) if (bRegistryError || !bSuccess)
return FALSE; return FALSE;
else else
return TRUE; return TRUE;


#undef REG_READ_DWORD #undef REG_READ_DWORD
"Direct3D RGB SW", "Direct3D RGB SW",
"Direct3D HW", "Direct3D HW",
}; };
static ibool bWarnOnce = false;
static BOOL bWarnOnce = FALSE;


// Already initialized? // Already initialized?
if (bInitialized) if (bInitialized)
"Please run the configuration program\n" "Please run the configuration program\n"
"before using GLDirect with applications.\n", "before using GLDirect with applications.\n",
"GLDirect", MB_OK | MB_ICONWARNING); "GLDirect", MB_OK | MB_ICONWARNING);
bWarnOnce = true;
bWarnOnce = TRUE;
return FALSE; return FALSE;
} }



+ 1
- 1
src/mesa/drivers/windows/gldirect/dllmain.h ファイルの表示

#include "DirectGL.h" #include "DirectGL.h"
#endif // _USE_GLD3_WGL #endif // _USE_GLD3_WGL


#include "gldirect/regkeys.h"
//#include "gldirect/regkeys.h"
#include "dglglobals.h" #include "dglglobals.h"
#include "ddlog.h" #include "ddlog.h"
#ifndef _USE_GLD3_WGL #ifndef _USE_GLD3_WGL

+ 162
- 20
src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c ファイルの表示



static void gld_fetch_1d_texel_X8R8G8B8( static void gld_fetch_1d_texel_X8R8G8B8(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
GLchan *rgba = (GLchan *) texel;
GLchan *rgba = (GLchan *)texel;
rgba[RCOMP] = src[2]; rgba[RCOMP] = src[2];
rgba[GCOMP] = src[1]; rgba[GCOMP] = src[1];
rgba[BCOMP] = src[0]; rgba[BCOMP] = src[0];


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_1d_texel_f_X8R8G8B8(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_1d_texel_X1R5G5B5( static void gld_fetch_1d_texel_X1R5G5B5(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_1d_texel_f_X1R5G5B5(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_1d_texel_X4R4G4B4( static void gld_fetch_1d_texel_X4R4G4B4(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_1d_texel_f_X4R4G4B4(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

#undef CHAN_SRC #undef CHAN_SRC
#undef UBYTE_SRC #undef UBYTE_SRC
#undef USHORT_SRC #undef USHORT_SRC


static void gld_fetch_2d_texel_X8R8G8B8( static void gld_fetch_2d_texel_X8R8G8B8(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
GLchan *rgba = (GLchan *) texel;
GLchan *rgba = (GLchan *)texel;
rgba[RCOMP] = src[2]; rgba[RCOMP] = src[2];
rgba[GCOMP] = src[1]; rgba[GCOMP] = src[1];
rgba[BCOMP] = src[0]; rgba[BCOMP] = src[0];


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_2d_texel_f_X8R8G8B8(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_2d_texel_X1R5G5B5( static void gld_fetch_2d_texel_X1R5G5B5(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_2d_texel_f_X1R5G5B5(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_2d_texel_X4R4G4B4( static void gld_fetch_2d_texel_X4R4G4B4(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_2d_texel_f_X4R4G4B4(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

#undef CHAN_SRC #undef CHAN_SRC
#undef UBYTE_SRC #undef UBYTE_SRC
#undef USHORT_SRC #undef USHORT_SRC


static void gld_fetch_3d_texel_X8R8G8B8( static void gld_fetch_3d_texel_X8R8G8B8(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
GLchan *rgba = (GLchan *) texel;
GLchan *rgba = (GLchan *)texel;
rgba[RCOMP] = src[2]; rgba[RCOMP] = src[2];
rgba[GCOMP] = src[1]; rgba[GCOMP] = src[1];
rgba[BCOMP] = src[0]; rgba[BCOMP] = src[0];


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_3d_texel_f_X8R8G8B8(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_3d_texel_X1R5G5B5( static void gld_fetch_3d_texel_X1R5G5B5(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_3d_texel_f_X1R5G5B5(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_3d_texel_X4R4G4B4( static void gld_fetch_3d_texel_X4R4G4B4(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_3d_texel_f_X4R4G4B4(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

#undef CHAN_SRC #undef CHAN_SRC
#undef UBYTE_SRC #undef UBYTE_SRC
#undef USHORT_SRC #undef USHORT_SRC
const struct gl_texture_format _gld_texformat_X8R8G8B8 = { const struct gl_texture_format _gld_texformat_X8R8G8B8 = {
MESA_FORMAT_ARGB8888, /* MesaFormat */ MESA_FORMAT_ARGB8888, /* MesaFormat */
GL_RGBA, /* BaseFormat */ GL_RGBA, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
8, /* RedBits */ 8, /* RedBits */
8, /* GreenBits */ 8, /* GreenBits */
8, /* BlueBits */ 8, /* BlueBits */
0, /* IndexBits */ 0, /* IndexBits */
0, /* DepthBits */ 0, /* DepthBits */
4, /* TexelBytes */ 4, /* TexelBytes */
_mesa_texstore_argb8888, /* StoreTexImageFunc */
gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */ gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */
gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */ gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */
gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */ gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */
gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */
gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */
gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */
}; };


const struct gl_texture_format _gld_texformat_X1R5G5B5 = { const struct gl_texture_format _gld_texformat_X1R5G5B5 = {
MESA_FORMAT_ARGB1555, /* MesaFormat */ MESA_FORMAT_ARGB1555, /* MesaFormat */
GL_RGBA, /* BaseFormat */ GL_RGBA, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
5, /* RedBits */ 5, /* RedBits */
5, /* GreenBits */ 5, /* GreenBits */
5, /* BlueBits */ 5, /* BlueBits */
0, /* IndexBits */ 0, /* IndexBits */
0, /* DepthBits */ 0, /* DepthBits */
2, /* TexelBytes */ 2, /* TexelBytes */
_mesa_texstore_argb1555, /* StoreTexImageFunc */
gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */ gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */
gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */ gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */
gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */ gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */
gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */
gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */
gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */
}; };


const struct gl_texture_format _gld_texformat_X4R4G4B4 = { const struct gl_texture_format _gld_texformat_X4R4G4B4 = {
MESA_FORMAT_ARGB4444, /* MesaFormat */ MESA_FORMAT_ARGB4444, /* MesaFormat */
GL_RGBA, /* BaseFormat */ GL_RGBA, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /* RedBits */ 4, /* RedBits */
4, /* GreenBits */ 4, /* GreenBits */
4, /* BlueBits */ 4, /* BlueBits */
0, /* IndexBits */ 0, /* IndexBits */
0, /* DepthBits */ 0, /* DepthBits */
2, /* TexelBytes */ 2, /* TexelBytes */
_mesa_texstore_argb4444, /* StoreTexImageFunc */
gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */ gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */
gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */ gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */
gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */ gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */
gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */
gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */
gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */
}; };


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
D3DX_SURFACEFORMAT sf; D3DX_SURFACEFORMAT sf;
DWORD dwMipmaps; DWORD dwMipmaps;


const struct gl_texture_format *MesaFormat;

MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);

gldCtx = GLD_GET_CONTEXT(ctx); gldCtx = GLD_GET_CONTEXT(ctx);
gld = GLD_GET_DX7_DRIVER(gldCtx); gld = GLD_GET_DX7_DRIVER(gldCtx);


} }


// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(
MesaFormat->StoreImage(
ctx, ctx,
2, 2,
GL_RGBA, GL_RGBA,
// We need to flip the data. Yuck. // We need to flip the data. Yuck.
// Perhaps Mesa has a span packer we can use in future... // Perhaps Mesa has a span packer we can use in future...
for (i=0; i<height; i++) { for (i=0; i<height; i++) {
BYTE *pDestRow = (BYTE*)_mesa_image_address2d(pack, dest, width, height, format, type, 0, i, 0);
BYTE *pDestRow = (BYTE*)_mesa_image_address(2,pack, dest, width, height, format, type, 0, i, 0);
BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1)); BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1));
_mesa_transfer_teximage(
texImage->TexFormat->StoreImage(
ctx, ctx,
2, 2,
GL_RGBA, // base format GL_RGBA, // base format
for (i=0; i<height; i++) { for (i=0; i<height; i++) {
GLubyte byte; GLubyte byte;
pBits = (D3DCOLOR*)((BYTE*)ddsd.lpSurface + (i*ddsd.lPitch)); pBits = (D3DCOLOR*)((BYTE*)ddsd.lpSurface + (i*ddsd.lPitch));
src = (const GLubyte *) _mesa_image_address2d(
src = (const GLubyte *) _mesa_image_address(2,
&ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, &ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP,
0, i, 0); 0, i, 0);
for (j=0; j<(width>>3); j++) { for (j=0; j<(width>>3); j++) {
return; return;
} }
// unpack image, apply transfer ops and store in tempImage // unpack image, apply transfer ops and store in tempImage
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
&_mesa_texformat_argb8888, // dest format &_mesa_texformat_argb8888, // dest format
tempImage, tempImage,
width, height, 1, 0, 0, 0, width, height, 1, 0, 0, 0,
} }


// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(
texImage->TexFormat->StoreImage(
ctx, ctx,
2, 2,
texImage->Format, texImage->Format,
} }


// unpack image, apply transfer ops and store in tempImage // unpack image, apply transfer ops and store in tempImage
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
&_mesa_texformat_argb8888, // dest format &_mesa_texformat_argb8888, // dest format
tempImage, tempImage,
width, height, 1, 0, 0, 0, width, height, 1, 0, 0, 0,
} }


// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
_gldMesaFormatForD3DFormat(_gldD3DXFormatFromSurface(pSurface)), _gldMesaFormatForD3DFormat(_gldD3DXFormatFromSurface(pSurface)),
ddsd.lpSurface, ddsd.lpSurface,
width, height, 1, width, height, 1,

+ 2
- 35
src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c ファイルの表示

/* $Id: gld_vb_mesa_render_dx7.c,v 1.3 2005/04/14 16:58:25 bencrossman Exp $ */
/* $Id: gld_vb_mesa_render_dx7.c,v 1.4 2005/04/15 17:17:47 bencrossman Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
GLcontext *ctx, GLcontext *ctx,
struct tnl_pipeline_stage *stage) struct tnl_pipeline_stage *stage)
{ {
GLuint inputs = VERT_BIT_CLIP;
GLuint i;

if (ctx->Visual.rgbMode) {
inputs |= VERT_BIT_COLOR0;
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
inputs |= VERT_BIT_COLOR1; //VERT_BIT_SPEC_RGB;
//if (ctx->Texture._ReallyEnabled) {
for (i=0; i<ctx->Const.MaxTextureUnits; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled)
inputs |= VERT_BIT_TEX(i);
}
//}
} else {
inputs |= VERT_BIT_INDEX;
}

if (ctx->Point._Attenuated)
inputs |= VERT_BIT_POINT_SIZE;

/* How do drivers turn this off?
*/
if (ctx->Fog.Enabled)
inputs |= VERT_BIT_FOG; // VERT_FOG_COORD;

if (ctx->_TriangleCaps & DD_TRI_UNFILLED)
inputs |= VERT_BIT_EDGEFLAG;

if (ctx->RenderMode==GL_FEEDBACK)
inputs |= VERT_BITS_TEX_ANY;

stage->inputs = inputs;
stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
} }


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

+ 1
- 1
src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c ファイルの表示

// If CVA (Compiled Vertex Array) is used by an OpenGL app, then we // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we
// will need enough vertices to cater for Mesa::Const.MaxArrayLockSize. // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize.
// We'll use IMM_SIZE if it's larger (which it should not be). // We'll use IMM_SIZE if it's larger (which it should not be).
dwMaxVertices = (IMM_SIZE < MAX_ARRAY_LOCK_SIZE) ? MAX_ARRAY_LOCK_SIZE : IMM_SIZE;
dwMaxVertices = MAX_ARRAY_LOCK_SIZE;


// Max vertex buffer size limited in DX7. (DaveM) // Max vertex buffer size limited in DX7. (DaveM)
if (dwMaxVertices*9 > D3DMAXNUMVERTICES) if (dwMaxVertices*9 > D3DMAXNUMVERTICES)

+ 163
- 24
src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c ファイルの表示



static void gld_fetch_1d_texel_X8R8G8B8( static void gld_fetch_1d_texel_X8R8G8B8(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
GLchan *rgba = (GLchan *) texel;
GLchan *rgba = (GLchan *)texel;
rgba[RCOMP] = src[2]; rgba[RCOMP] = src[2];
rgba[GCOMP] = src[1]; rgba[GCOMP] = src[1];
rgba[BCOMP] = src[0]; rgba[BCOMP] = src[0];


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_1d_texel_f_X8R8G8B8(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_1d_texel_X1R5G5B5( static void gld_fetch_1d_texel_X1R5G5B5(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_1d_texel_f_X1R5G5B5(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_1d_texel_X4R4G4B4( static void gld_fetch_1d_texel_X4R4G4B4(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_1d_texel_f_X4R4G4B4(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

#undef CHAN_SRC #undef CHAN_SRC
#undef UBYTE_SRC #undef UBYTE_SRC
#undef USHORT_SRC #undef USHORT_SRC


static void gld_fetch_2d_texel_X8R8G8B8( static void gld_fetch_2d_texel_X8R8G8B8(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
GLchan *rgba = (GLchan *) texel;
GLchan *rgba = (GLchan *)texel;
rgba[RCOMP] = src[2]; rgba[RCOMP] = src[2];
rgba[GCOMP] = src[1]; rgba[GCOMP] = src[1];
rgba[BCOMP] = src[0]; rgba[BCOMP] = src[0];


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_2d_texel_f_X8R8G8B8(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_2d_texel_X1R5G5B5( static void gld_fetch_2d_texel_X1R5G5B5(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_2d_texel_f_X1R5G5B5(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_2d_texel_X4R4G4B4( static void gld_fetch_2d_texel_X4R4G4B4(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_2d_texel_f_X4R4G4B4(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

#undef CHAN_SRC #undef CHAN_SRC
#undef UBYTE_SRC #undef UBYTE_SRC
#undef USHORT_SRC #undef USHORT_SRC


static void gld_fetch_3d_texel_X8R8G8B8( static void gld_fetch_3d_texel_X8R8G8B8(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
GLchan *rgba = (GLchan *) texel;
GLchan *rgba = (GLchan *)texel;
rgba[RCOMP] = src[2]; rgba[RCOMP] = src[2];
rgba[GCOMP] = src[1]; rgba[GCOMP] = src[1];
rgba[BCOMP] = src[0]; rgba[BCOMP] = src[0];


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_3d_texel_f_X8R8G8B8(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_3d_texel_X1R5G5B5( static void gld_fetch_3d_texel_X1R5G5B5(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_3d_texel_f_X1R5G5B5(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_3d_texel_X4R4G4B4( static void gld_fetch_3d_texel_X4R4G4B4(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_3d_texel_f_X4R4G4B4(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

#undef CHAN_SRC #undef CHAN_SRC
#undef UBYTE_SRC #undef UBYTE_SRC
#undef USHORT_SRC #undef USHORT_SRC
const struct gl_texture_format _gld_texformat_X8R8G8B8 = { const struct gl_texture_format _gld_texformat_X8R8G8B8 = {
MESA_FORMAT_ARGB8888, /* MesaFormat */ MESA_FORMAT_ARGB8888, /* MesaFormat */
GL_RGBA, /* BaseFormat */ GL_RGBA, /* BaseFormat */
// GL_UNSIGNED_BYTE, /* Type */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
8, /* RedBits */ 8, /* RedBits */
8, /* GreenBits */ 8, /* GreenBits */
8, /* BlueBits */ 8, /* BlueBits */
0, /* IndexBits */ 0, /* IndexBits */
0, /* DepthBits */ 0, /* DepthBits */
4, /* TexelBytes */ 4, /* TexelBytes */
_mesa_texstore_argb8888, /* StoreTexImageFunc */
gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */ gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */
gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */ gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */
gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */ gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */
gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */
gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */
gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */
}; };


const struct gl_texture_format _gld_texformat_X1R5G5B5 = { const struct gl_texture_format _gld_texformat_X1R5G5B5 = {
MESA_FORMAT_ARGB1555, /* MesaFormat */ MESA_FORMAT_ARGB1555, /* MesaFormat */
GL_RGBA, /* BaseFormat */ GL_RGBA, /* BaseFormat */
// GL_UNSIGNED_SHORT_1_5_5_5_REV, /* Type */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
5, /* RedBits */ 5, /* RedBits */
5, /* GreenBits */ 5, /* GreenBits */
5, /* BlueBits */ 5, /* BlueBits */
0, /* IndexBits */ 0, /* IndexBits */
0, /* DepthBits */ 0, /* DepthBits */
2, /* TexelBytes */ 2, /* TexelBytes */
_mesa_texstore_argb1555, /* StoreTexImageFunc */
gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */ gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */
gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */ gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */
gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */ gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */
gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */
gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */
gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */
}; };


const struct gl_texture_format _gld_texformat_X4R4G4B4 = { const struct gl_texture_format _gld_texformat_X4R4G4B4 = {
MESA_FORMAT_ARGB4444, /* MesaFormat */ MESA_FORMAT_ARGB4444, /* MesaFormat */
GL_RGBA, /* BaseFormat */ GL_RGBA, /* BaseFormat */
// GL_UNSIGNED_SHORT_4_4_4_4_REV, /* Type */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /* RedBits */ 4, /* RedBits */
4, /* GreenBits */ 4, /* GreenBits */
4, /* BlueBits */ 4, /* BlueBits */
0, /* IndexBits */ 0, /* IndexBits */
0, /* DepthBits */ 0, /* DepthBits */
2, /* TexelBytes */ 2, /* TexelBytes */
_mesa_texstore_argb4444, /* StoreTexImageFunc */
gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */ gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */
gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */ gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */
gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */ gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */
gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */
gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */
gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */
}; };


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
HRESULT hr; HRESULT hr;
D3DLOCKED_RECT d3dLockedRect; D3DLOCKED_RECT d3dLockedRect;


const struct gl_texture_format *MesaFormat;

gldCtx = GLD_GET_CONTEXT(ctx); gldCtx = GLD_GET_CONTEXT(ctx);
gld = GLD_GET_DX8_DRIVER(gldCtx); gld = GLD_GET_DX8_DRIVER(gldCtx);


return; return;
} }


MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);

// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(
MesaFormat->StoreImage(
ctx, ctx,
2, 2,
GL_RGBA, GL_RGBA,
// We need to flip the data. Yuck. // We need to flip the data. Yuck.
// Perhaps Mesa has a span packer we can use in future... // Perhaps Mesa has a span packer we can use in future...
for (i=0; i<height; i++) { for (i=0; i<height; i++) {
BYTE *pDestRow = (BYTE*)_mesa_image_address2d(pack, dest, width, height, format, type, 0, i, 0);
BYTE *pDestRow = (BYTE*)_mesa_image_address(2,pack, dest, width, height, format, type, 0, i, 0);
BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1)); BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1));
_mesa_transfer_teximage(
MesaFormat->StoreImage(
ctx, ctx,
2, 2,
GL_RGBA, // base format GL_RGBA, // base format
for (i=0; i<height; i++) { for (i=0; i<height; i++) {
GLubyte byte; GLubyte byte;
pBits = (D3DCOLOR*)((BYTE*)d3dLockedRect.pBits + (i*d3dLockedRect.Pitch)); pBits = (D3DCOLOR*)((BYTE*)d3dLockedRect.pBits + (i*d3dLockedRect.Pitch));
src = (const GLubyte *) _mesa_image_address2d(
src = (const GLubyte *) _mesa_image_address(2,
&ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, &ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP,
0, i, 0); 0, i, 0);
for (j=0; j<(width>>3); j++) { for (j=0; j<(width>>3); j++) {


/* /*
// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(
texImage->TexFormat->StoreImage(
ctx, ctx,
2, 2,
GL_BITMAP, GL_BITMAP,
return; return;
} }
// unpack image, apply transfer ops and store in tempImage // unpack image, apply transfer ops and store in tempImage
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
&_mesa_texformat_argb8888, // dest format &_mesa_texformat_argb8888, // dest format
tempImage, tempImage,
width, height, 1, 0, 0, 0, width, height, 1, 0, 0, 0,
} }


// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(
texImage->TexFormat->StoreImage(
ctx, ctx,
2, 2,
texImage->Format, texImage->Format,
} }


// unpack image, apply transfer ops and store in tempImage // unpack image, apply transfer ops and store in tempImage
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
&_mesa_texformat_argb8888, // dest format &_mesa_texformat_argb8888, // dest format
tempImage, tempImage,
width, height, 1, 0, 0, 0, width, height, 1, 0, 0, 0,
} }


// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
_gldMesaFormatForD3DFormat(d3dsd.Format), _gldMesaFormatForD3DFormat(d3dsd.Format),
d3dLockedRect.pBits, d3dLockedRect.pBits,
width, height, 1, width, height, 1,

+ 2
- 35
src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c ファイルの表示

/* $Id: gld_vb_mesa_render_dx8.c,v 1.3 2005/04/14 16:58:25 bencrossman Exp $ */
/* $Id: gld_vb_mesa_render_dx8.c,v 1.4 2005/04/15 17:17:47 bencrossman Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
GLcontext *ctx, GLcontext *ctx,
struct tnl_pipeline_stage *stage) struct tnl_pipeline_stage *stage)
{ {
GLuint inputs = VERT_BIT_CLIP;
GLuint i;

if (ctx->Visual.rgbMode) {
inputs |= VERT_BIT_COLOR0;
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
inputs |= VERT_BIT_COLOR1; //VERT_BIT_SPEC_RGB;
//if (ctx->Texture._ReallyEnabled) {
for (i=0; i<ctx->Const.MaxTextureUnits; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled)
inputs |= VERT_BIT_TEX(i);
}
//}
} else {
inputs |= VERT_BIT_INDEX;
}

if (ctx->Point._Attenuated)
inputs |= VERT_BIT_POINT_SIZE;

/* How do drivers turn this off?
*/
if (ctx->Fog.Enabled)
inputs |= VERT_BIT_FOG; // VERT_FOG_COORD;

if (ctx->_TriangleCaps & DD_TRI_UNFILLED)
inputs |= VERT_BIT_EDGEFLAG;

if (ctx->RenderMode==GL_FEEDBACK)
inputs |= VERT_BITS_TEX_ANY;

stage->inputs = inputs;
stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
} }


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

+ 1
- 1
src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c ファイルの表示

// If CVA (Compiled Vertex Array) is used by an OpenGL app, then we // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we
// will need enough vertices to cater for Mesa::Const.MaxArrayLockSize. // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize.
// We'll use IMM_SIZE if it's larger (which it should not be). // We'll use IMM_SIZE if it's larger (which it should not be).
dwMaxVertices = (IMM_SIZE < MAX_ARRAY_LOCK_SIZE) ? MAX_ARRAY_LOCK_SIZE : IMM_SIZE;
dwMaxVertices = MAX_ARRAY_LOCK_SIZE;


// Now calculate how many vertices to allow for in total // Now calculate how many vertices to allow for in total
// 1 per point, 2 per line, 6 per quad = 9 // 1 per point, 2 per line, 6 per quad = 9

+ 163
- 24
src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c ファイルの表示



static void gld_fetch_1d_texel_X8R8G8B8( static void gld_fetch_1d_texel_X8R8G8B8(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
GLchan *rgba = (GLchan *) texel;
GLchan *rgba = (GLchan *)texel;
rgba[RCOMP] = src[2]; rgba[RCOMP] = src[2];
rgba[GCOMP] = src[1]; rgba[GCOMP] = src[1];
rgba[BCOMP] = src[0]; rgba[BCOMP] = src[0];


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_1d_texel_f_X8R8G8B8(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_1d_texel_X1R5G5B5( static void gld_fetch_1d_texel_X1R5G5B5(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_1d_texel_f_X1R5G5B5(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_1d_texel_X4R4G4B4( static void gld_fetch_1d_texel_X4R4G4B4(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_1d_texel_f_X4R4G4B4(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

#undef CHAN_SRC #undef CHAN_SRC
#undef UBYTE_SRC #undef UBYTE_SRC
#undef USHORT_SRC #undef USHORT_SRC


static void gld_fetch_2d_texel_X8R8G8B8( static void gld_fetch_2d_texel_X8R8G8B8(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
GLchan *rgba = (GLchan *) texel;
GLchan *rgba = (GLchan *)texel;
rgba[RCOMP] = src[2]; rgba[RCOMP] = src[2];
rgba[GCOMP] = src[1]; rgba[GCOMP] = src[1];
rgba[BCOMP] = src[0]; rgba[BCOMP] = src[0];


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_2d_texel_f_X8R8G8B8(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_2d_texel_X1R5G5B5( static void gld_fetch_2d_texel_X1R5G5B5(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_2d_texel_f_X1R5G5B5(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_2d_texel_X4R4G4B4( static void gld_fetch_2d_texel_X4R4G4B4(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_2d_texel_f_X4R4G4B4(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

#undef CHAN_SRC #undef CHAN_SRC
#undef UBYTE_SRC #undef UBYTE_SRC
#undef USHORT_SRC #undef USHORT_SRC


static void gld_fetch_3d_texel_X8R8G8B8( static void gld_fetch_3d_texel_X8R8G8B8(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
GLchan *rgba = (GLchan *) texel;
GLchan *rgba = (GLchan *)texel;
rgba[RCOMP] = src[2]; rgba[RCOMP] = src[2];
rgba[GCOMP] = src[1]; rgba[GCOMP] = src[1];
rgba[BCOMP] = src[0]; rgba[BCOMP] = src[0];


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_3d_texel_f_X8R8G8B8(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_3d_texel_X1R5G5B5( static void gld_fetch_3d_texel_X1R5G5B5(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_3d_texel_f_X1R5G5B5(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

static void gld_fetch_3d_texel_X4R4G4B4( static void gld_fetch_3d_texel_X4R4G4B4(
const struct gl_texture_image *texImage, const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid *texel )
GLint i, GLint j, GLint k, GLchan *texel )
{ {
const GLushort *src = USHORT_SRC( texImage, i, j, k ); const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLchan *rgba = (GLchan *) texel; GLushort s = *src; GLchan *rgba = (GLchan *) texel; GLushort s = *src;


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------


static void gld_fetch_3d_texel_f_X4R4G4B4(
const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
GLushort s = *src;
texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
texel[ACOMP] = 1.f;
}

//---------------------------------------------------------------------------

#undef CHAN_SRC #undef CHAN_SRC
#undef UBYTE_SRC #undef UBYTE_SRC
#undef USHORT_SRC #undef USHORT_SRC
const struct gl_texture_format _gld_texformat_X8R8G8B8 = { const struct gl_texture_format _gld_texformat_X8R8G8B8 = {
MESA_FORMAT_ARGB8888, /* MesaFormat */ MESA_FORMAT_ARGB8888, /* MesaFormat */
GL_RGBA, /* BaseFormat */ GL_RGBA, /* BaseFormat */
// GL_UNSIGNED_BYTE, /* Type */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
8, /* RedBits */ 8, /* RedBits */
8, /* GreenBits */ 8, /* GreenBits */
8, /* BlueBits */ 8, /* BlueBits */
0, /* IndexBits */ 0, /* IndexBits */
0, /* DepthBits */ 0, /* DepthBits */
4, /* TexelBytes */ 4, /* TexelBytes */
_mesa_texstore_argb8888, /* StoreTexImageFunc */
gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */ gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */
gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */ gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */
gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */ gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */
gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */
gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */
gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */
}; };


const struct gl_texture_format _gld_texformat_X1R5G5B5 = { const struct gl_texture_format _gld_texformat_X1R5G5B5 = {
MESA_FORMAT_ARGB1555, /* MesaFormat */ MESA_FORMAT_ARGB1555, /* MesaFormat */
GL_RGBA, /* BaseFormat */ GL_RGBA, /* BaseFormat */
// GL_UNSIGNED_SHORT_1_5_5_5_REV, /* Type */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
5, /* RedBits */ 5, /* RedBits */
5, /* GreenBits */ 5, /* GreenBits */
5, /* BlueBits */ 5, /* BlueBits */
0, /* IndexBits */ 0, /* IndexBits */
0, /* DepthBits */ 0, /* DepthBits */
2, /* TexelBytes */ 2, /* TexelBytes */
_mesa_texstore_argb1555, /* StoreTexImageFunc */
gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */ gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */
gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */ gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */
gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */ gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */
gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */
gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */
gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */
}; };


const struct gl_texture_format _gld_texformat_X4R4G4B4 = { const struct gl_texture_format _gld_texformat_X4R4G4B4 = {
MESA_FORMAT_ARGB4444, /* MesaFormat */ MESA_FORMAT_ARGB4444, /* MesaFormat */
GL_RGBA, /* BaseFormat */ GL_RGBA, /* BaseFormat */
// GL_UNSIGNED_SHORT_4_4_4_4_REV, /* Type */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /* RedBits */ 4, /* RedBits */
4, /* GreenBits */ 4, /* GreenBits */
4, /* BlueBits */ 4, /* BlueBits */
0, /* IndexBits */ 0, /* IndexBits */
0, /* DepthBits */ 0, /* DepthBits */
2, /* TexelBytes */ 2, /* TexelBytes */
_mesa_texstore_argb4444, /* StoreTexImageFunc */
gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */ gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */
gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */ gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */
gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */ gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */
gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */
gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */
gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */
}; };


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
HRESULT hr; HRESULT hr;
D3DLOCKED_RECT d3dLockedRect; D3DLOCKED_RECT d3dLockedRect;


const struct gl_texture_format *MesaFormat;

MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);

// Mesa does not currently handle this format. // Mesa does not currently handle this format.
if (format == GL_BGR) if (format == GL_BGR)
return; return;
} }


// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(
MesaFormat->StoreImage(
ctx, ctx,
2, 2,
GL_RGBA, GL_RGBA,
// We need to flip the data. Yuck. // We need to flip the data. Yuck.
// Perhaps Mesa has a span packer we can use in future... // Perhaps Mesa has a span packer we can use in future...
for (i=0; i<height; i++) { for (i=0; i<height; i++) {
BYTE *pDestRow = (BYTE*)_mesa_image_address2d(pack, dest, width, height, format, type, 0, i, 0);
BYTE *pDestRow = (BYTE*)_mesa_image_address(2,pack, dest, width, height, format, type, 0, i, 0);
BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1)); BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1));
_mesa_transfer_teximage(
MesaFormat->StoreImage(
ctx, ctx,
2, 2,
GL_RGBA, // base format GL_RGBA, // base format
for (i=0; i<height; i++) { for (i=0; i<height; i++) {
GLubyte byte; GLubyte byte;
pBits = (D3DCOLOR*)((BYTE*)d3dLockedRect.pBits + (i*d3dLockedRect.Pitch)); pBits = (D3DCOLOR*)((BYTE*)d3dLockedRect.pBits + (i*d3dLockedRect.Pitch));
src = (const GLubyte *) _mesa_image_address2d(
src = (const GLubyte *) _mesa_image_address(2,
&ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, &ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP,
0, i, 0); 0, i, 0);
for (j=0; j<(width>>3); j++) { for (j=0; j<(width>>3); j++) {


/* /*
// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(
texImage->TexFormat->StoreImage(
ctx, ctx,
2, 2,
GL_BITMAP, GL_BITMAP,
return; return;
} }
// unpack image, apply transfer ops and store in tempImage // unpack image, apply transfer ops and store in tempImage
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
&_mesa_texformat_argb8888, // dest format &_mesa_texformat_argb8888, // dest format
tempImage, tempImage,
width, height, 1, 0, 0, 0, width, height, 1, 0, 0, 0,
} }


// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(
texImage->TexFormat->StoreImage(
ctx, ctx,
2, 2,
texImage->Format, texImage->Format,
} }


// unpack image, apply transfer ops and store in tempImage // unpack image, apply transfer ops and store in tempImage
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
&_mesa_texformat_argb8888, // dest format &_mesa_texformat_argb8888, // dest format
tempImage, tempImage,
width, height, 1, 0, 0, 0, width, height, 1, 0, 0, 0,
} }


// unpack image, apply transfer ops and store directly in texture // unpack image, apply transfer ops and store directly in texture
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
_gldMesaFormatForD3DFormat(d3dsd.Format), _gldMesaFormatForD3DFormat(d3dsd.Format),
d3dLockedRect.pBits, d3dLockedRect.pBits,
width, height, 1, width, height, 1,

+ 2
- 35
src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c ファイルの表示

/* $Id: gld_vb_mesa_render_dx9.c,v 1.3 2005/04/14 16:58:25 bencrossman Exp $ */
/* $Id: gld_vb_mesa_render_dx9.c,v 1.4 2005/04/15 17:17:47 bencrossman Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
GLcontext *ctx, GLcontext *ctx,
struct tnl_pipeline_stage *stage) struct tnl_pipeline_stage *stage)
{ {
GLuint inputs = VERT_BIT_CLIP;
GLuint i;

if (ctx->Visual.rgbMode) {
inputs |= VERT_BIT_COLOR0;
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
inputs |= VERT_BIT_COLOR1; //VERT_BIT_SPEC_RGB;
//if (ctx->Texture._ReallyEnabled) {
for (i=0; i<ctx->Const.MaxTextureUnits; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled)
inputs |= VERT_BIT_TEX(i);
}
//}
} else {
inputs |= VERT_BIT_INDEX;
}

if (ctx->Point._Attenuated)
inputs |= VERT_BIT_POINT_SIZE;

/* How do drivers turn this off?
*/
if (ctx->Fog.Enabled)
inputs |= VERT_BIT_FOG; // VERT_FOG_COORD;

if (ctx->_TriangleCaps & DD_TRI_UNFILLED)
inputs |= VERT_BIT_EDGEFLAG;

if (ctx->RenderMode==GL_FEEDBACK)
inputs |= VERT_BITS_TEX_ANY;

stage->inputs = inputs;
stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
} }


//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

+ 1
- 1
src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c ファイルの表示

// If CVA (Compiled Vertex Array) is used by an OpenGL app, then we // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we
// will need enough vertices to cater for Mesa::Const.MaxArrayLockSize. // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize.
// We'll use IMM_SIZE if it's larger (which it should not be). // We'll use IMM_SIZE if it's larger (which it should not be).
dwMaxVertices = (IMM_SIZE < MAX_ARRAY_LOCK_SIZE) ? MAX_ARRAY_LOCK_SIZE : IMM_SIZE;
dwMaxVertices = MAX_ARRAY_LOCK_SIZE;


// Now calculate how many vertices to allow for in total // Now calculate how many vertices to allow for in total
// 1 per point, 2 per line, 6 per quad = 9 // 1 per point, 2 per line, 6 per quad = 9

+ 2
- 1
src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c ファイルの表示

#include "mtypes.h" #include "mtypes.h"
#include "texformat.h" #include "texformat.h"
#include "texstore.h" #include "texstore.h"
#include "teximage.h"
#include "array_cache/acache.h" #include "array_cache/acache.h"
#include "swrast/swrast.h" #include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h" #include "swrast_setup/swrast_setup.h"
if ((mask & (DD_FRONT_LEFT_BIT | DD_BACK_RIGHT_BIT)) && if ((mask & (DD_FRONT_LEFT_BIT | DD_BACK_RIGHT_BIT)) &&
ctx->DrawBuffer->UseSoftwareAlphaBuffers && ctx->DrawBuffer->UseSoftwareAlphaBuffers &&
ctx->Color.ColorMask[ACOMP]) { ctx->Color.ColorMask[ACOMP]) {
_mesa_clear_alpha_buffers( ctx );
_swrast_clear_alpha_buffers( ctx );
} }
if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) { if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) {

読み込み中…
キャンセル
保存