[Glide64] Remove passing HWND to grSstWinOpen

This commit is contained in:
zilmar 2017-01-29 06:27:50 +11:00
parent 5a13b9e8c6
commit 4f566ff9bc
6 changed files with 22 additions and 78 deletions

View File

@ -53,17 +53,7 @@ uint32_t grWrapperFullScreenResolutionExt(uint32_t *, uint32_t *);
char ** grQueryResolutionsExt(int32_t*);
FX_ENTRY void FX_CALL grGetGammaTableExt(FxU32, FxU32*, FxU32*, FxU32*);
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(
#ifndef ANDROID
HWND hWnd,
#endif
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
GrPixelFormat_t pixelformat,
int nColBuffers,
int nAuxBuffers
);
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(GrColorFormat_t color_format, GrOriginLocation_t origin_location, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers );
//color combiner
FX_ENTRY void FX_CALL

View File

@ -61,6 +61,10 @@
#include "trace.h"
#include "ScreenResolution.h"
#ifdef _WIN32
#include <commctrl.h>
#endif
#include <stdarg.h>
GFX_INFO gfx;
@ -74,8 +78,9 @@ int exception = FALSE;
int evoodoo = 0;
int ev_fullscreen = 0;
extern int viewport_offset;
#ifdef _WIN32
#include <commctrl.h>
HINSTANCE hinstDLL = NULL;
#endif
@ -86,15 +91,11 @@ int64 perf_next;
uint32_t region = 0;
// ref rate
// 60=0x0, 70=0x1, 72=0x2, 75=0x3, 80=0x4, 90=0x5, 100=0x6, 85=0x7, 120=0x8, none=0xff
unsigned int BMASK = 0x7FFFFF;
// Reality display processor structure
RDP rdp;
CSettings * g_settings = NULL;
extern int viewport_offset;
VOODOO voodoo = { 0, 0, 0, 0,
0, 0, 0, 0,
@ -666,7 +667,7 @@ int InitGfx()
#ifndef ANDROID
SetWindowDisplaySize(gfx.hWnd);
gfx_context = grSstWinOpen(gfx.hWnd, GR_REFRESH_60Hz, GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
gfx_context = grSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
if (!gfx_context)
{
#ifdef _WIN32
@ -678,7 +679,7 @@ int InitGfx()
return FALSE;
}
#else
gfx_context = grSstWinOpen(GR_REFRESH_60Hz, GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
gfx_context = grSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
g_settings->scr_res_x = g_settings->res_x = g_width;
g_settings->scr_res_y = g_settings->res_y = g_height;
#endif

View File

@ -60,9 +60,8 @@ uint8_t *texture_buffer = tex1;
#include "TexModCI.h"
#include "CRC.h"
extern int ghq_dmptex_toggle_key;
typedef struct TEXINFO_t {
typedef struct TEXINFO_t
{
int real_image_width, real_image_height; // FOR ALIGNMENT PURPOSES ONLY!!!
int tile_width, tile_height;
int mask_width, mask_height;
@ -1581,41 +1580,6 @@ void LoadTex(int id, int tmu)
{
if (g_settings->ghq_use)
{
if (!ghqTexInfo.data && ghq_dmptex_toggle_key) {
unsigned char *tmpbuf = (unsigned char*)texture;
int tmpwidth = real_x;
if (texinfo[id].splits > 1) {
int dstpixoffset, srcpixoffset;
int shift;
switch (LOWORD(result) & 0x7fff) { // XXX is there a better way of determining the pixel color depth?
case GR_TEXFMT_ARGB_8888:
shift = 3;
break;
case GR_TEXFMT_ALPHA_INTENSITY_44:
case GR_TEXFMT_ALPHA_8:
shift = 0;
break;
default:
shift = 1;
}
tmpwidth = texinfo[id].real_image_width;
tmpbuf = (unsigned char*)malloc((256 * 256) << 3); // XXX performance overhead
for (int i = 0; i < cache->splitheight; i++) {
dstpixoffset = texinfo[id].real_image_width * i;
srcpixoffset = 256 * i;
for (int k = 0; k < texinfo[id].splits; k++) {
memcpy(tmpbuf + (dstpixoffset << shift), texture + (srcpixoffset << shift), (256 << shift));
dstpixoffset += 256;
srcpixoffset += (256 * cache->splitheight);
}
}
}
ext_ghq_dmptx(tmpbuf, (int)texinfo[id].real_image_width, (int)texinfo[id].real_image_height, (int)tmpwidth, (unsigned short)LOWORD(result), (unsigned short)((cache->format << 8) | (cache->size)), cache->ricecrc);
if (tmpbuf != texture && tmpbuf) {
free(tmpbuf);
}
}
if (!ghqTexInfo.data)
if (!g_settings->ghq_enht_nobg || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256))
ext_ghq_txfilter((unsigned char*)texture, (int)real_x, (int)real_y, LOWORD(result), (uint64)g64_crc, &ghqTexInfo);

View File

@ -367,10 +367,10 @@ int isWglExtensionSupported(const char *extension)
#define GrPixelFormat_t int
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers)
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(GrColorFormat_t color_format, GrOriginLocation_t origin_location, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers)
{
WriteTrace(TraceGlitch, TraceDebug, "refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(color_format, origin_location, nColBuffers, nAuxBuffers);
}
#ifdef _WIN32
@ -380,7 +380,7 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(GrScreenRefresh_t refresh_rate, GrC
# endif
#endif
FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers)
FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers)
{
static int show_warning = 1;
@ -392,7 +392,7 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrScreenRefresh_t refresh_rate, GrCol
color_texture = free_texture++;
depth_texture = free_texture++;
WriteTrace(TraceGlitch, TraceDebug, "refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "g_width: %d, g_height: %d fullscreen: %d", g_width, g_height, fullscreen);
//viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20;
@ -1061,7 +1061,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
if (plength < 4 || params == NULL) return 0;
if (!nbTextureUnits)
{
grSstWinOpen(0, GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinClose(0);
}
#ifdef VOODOO1

View File

@ -472,17 +472,14 @@ int isWglExtensionSupported(const char *extension)
FX_ENTRY GrContext_t FX_CALL
grSstWinOpenExt(
HWND hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
GrPixelFormat_t /*pixelformat*/,
int nColBuffers,
int nAuxBuffers)
{
WriteTrace(TraceGlitch, TraceDebug, "hWnd: %d, refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(hWnd, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(color_format, origin_location, nColBuffers, nAuxBuffers);
}
#ifdef _WIN32
@ -495,8 +492,6 @@ extern HWND g_hwnd_win;
FX_ENTRY GrContext_t FX_CALL
grSstWinOpen(
HWND hWnd,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
int nColBuffers,
@ -529,7 +524,7 @@ int nAuxBuffers)
fputs("ERROR: No GLX yet to start GL on [Free]BSD, Linux etc.\n", stderr);
#endif // _WIN32
WriteTrace(TraceGlitch, TraceDebug, "hWnd: %d, refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", hWnd, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers);
#ifdef _WIN32
TMU_SIZE = (config.vram_size - g_width * g_height * 4 * 3) / 2;
@ -1315,7 +1310,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
if (plength < 4 || params == NULL) return 0;
if (!nbTextureUnits)
{
grSstWinOpen((unsigned long)NULL, 0, GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinClose(0);
}
#ifdef VOODOO1

View File

@ -623,13 +623,7 @@ grFinish(void);
FX_ENTRY void FX_CALL
grFlush(void);
FX_ENTRY GrContext_t FX_CALL grSstWinOpen(
#ifdef ANDROID
GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers
#else
HWND hWnd, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers
#endif
);
FX_ENTRY GrContext_t FX_CALL grSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers);
FX_ENTRY FxBool FX_CALL
grSstWinClose( GrContext_t context );