[Glide64] Clean up OGLglitchmain.cpp
This commit is contained in:
parent
c59b716e8b
commit
eab47fdd82
|
@ -242,7 +242,8 @@ static inline void opt_glCopyTexImage2D( GLenum target,
|
|||
//printf("resizing h --> %d\n", height);
|
||||
}
|
||||
glCopyTexSubImage2D(target, level, 0, 0, x, y, width, height);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//printf("copyteximage %dx%d fmt %x old %dx%d oldfmt %x\n", width, height, internalFormat, w, h, fmt);
|
||||
// glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, internalFormat, GL_UNSIGNED_BYTE, 0);
|
||||
// glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &fmt);
|
||||
|
@ -253,7 +254,6 @@ static inline void opt_glCopyTexImage2D( GLenum target,
|
|||
}
|
||||
#define glCopyTexImage2D opt_glCopyTexImage2D
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Some post-1.1 OpenGL functions can fail to be loaded through GL extensions
|
||||
|
@ -449,8 +449,6 @@ void APIENTRY dummy_glCompressedTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsiz
|
|||
}
|
||||
#endif // _WIN32
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int address;
|
||||
|
@ -669,7 +667,8 @@ grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy )
|
|||
if (maxy < miny) maxy = miny;
|
||||
glScissor(minx, miny + viewport_offset, maxx - minx, maxy - miny);
|
||||
//printf("gl scissor %d %d %d %d\n", minx, miny, maxx, maxy);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
glScissor(minx, (viewport_offset)+height - maxy, maxx - minx, maxy - miny);
|
||||
}
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
@ -1247,7 +1246,6 @@ grSstWinOpen(
|
|||
isExtensionSupported("GL_ARB_fragment_shader") &&
|
||||
isExtensionSupported("GL_ARB_vertex_shader"))
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)wglGetProcAddress("glCreateShaderObjectARB");
|
||||
glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)wglGetProcAddress("glShaderSourceARB");
|
||||
|
@ -1314,7 +1312,6 @@ grSstWinOpen(
|
|||
glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)dummy_glCompressedTexImage2D;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
glViewport(0, viewport_offset, width, height);
|
||||
viewport_width = width;
|
||||
|
@ -1384,7 +1381,8 @@ grSstWinOpen(
|
|||
if (ifmt != GL_RGB5_A1) {
|
||||
display_warning("ATI SUCKS %x\n", ifmt);
|
||||
ati_sucks = 1;
|
||||
} else
|
||||
}
|
||||
else
|
||||
ati_sucks = 0;
|
||||
}
|
||||
|
||||
|
@ -1487,7 +1485,6 @@ FX_ENTRY void FX_CALL grTextureBufferExt( GrChipID_t tmu,
|
|||
LOG("grTextureBufferExt(%d, %d, %d, %d %d, %d, %d)\r\n", tmu, startAddress, lodmin, lodmax, aspect, fmt, evenOdd);
|
||||
if (lodmin != lodmax) display_warning("grTextureBufferExt : loading more than one LOD");
|
||||
if (!use_fbo) {
|
||||
|
||||
if (!render_to_texture) { //initialization
|
||||
return;
|
||||
}
|
||||
|
@ -1513,7 +1510,8 @@ FX_ENTRY void FX_CALL grTextureBufferExt( GrChipID_t tmu,
|
|||
if (nbAuxBuffers > 0) {
|
||||
glDrawBuffer(GL_AUX0);
|
||||
current_buffer = GL_AUX0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
int tw, th;
|
||||
if (pBufferWidth < screen_width)
|
||||
tw = pBufferWidth;
|
||||
|
@ -1535,16 +1533,19 @@ FX_ENTRY void FX_CALL grTextureBufferExt( GrChipID_t tmu,
|
|||
save_w, viewport_offset, tw - save_w, save_h);
|
||||
save_w = tw;
|
||||
save_h = th;
|
||||
} else if (tw > save_w) {
|
||||
}
|
||||
else if (tw > save_w) {
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
|
||||
save_w, viewport_offset, tw - save_w, save_h);
|
||||
save_w = tw;
|
||||
} else if (th > save_h) {
|
||||
}
|
||||
else if (th > save_h) {
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
|
||||
0, viewport_offset + save_h, save_w, th - save_h);
|
||||
save_h = th;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
|
||||
0, viewport_offset, tw, th);
|
||||
save_w = tw;
|
||||
|
@ -1570,7 +1571,6 @@ FX_ENTRY void FX_CALL grTextureBufferExt( GrChipID_t tmu,
|
|||
// printf("tmu %d usage now %gMb - %gMb\n",
|
||||
// rtmu, tmu_usage[rtmu].min/1024.0f, tmu_usage[rtmu].max/1024.0f);
|
||||
|
||||
|
||||
width = pBufferWidth;
|
||||
height = pBufferHeight;
|
||||
|
||||
|
@ -1597,13 +1597,15 @@ FX_ENTRY void FX_CALL grTextureBufferExt( GrChipID_t tmu,
|
|||
//printf("viewport %dx%d\n", width, height);
|
||||
if (height > screen_height) {
|
||||
glViewport(0, viewport_offset + screen_height - height, width, height);
|
||||
} else
|
||||
}
|
||||
else
|
||||
glViewport(0, viewport_offset, width, height);
|
||||
|
||||
glScissor(0, viewport_offset, width, height);
|
||||
|
||||
grDisplayGLError("grTextureBufferExt :: A");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (!render_to_texture) //initialization
|
||||
{
|
||||
if (!fbs_init)
|
||||
|
@ -1715,7 +1717,8 @@ int CheckTextureBufferFormat(GrChipID_t tmu, FxU32 startAddress, GrTexInfo *info
|
|||
found = 1;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
found = i = 0;
|
||||
while (i < nb_fb)
|
||||
{
|
||||
|
@ -1761,7 +1764,8 @@ int CheckTextureBufferFormat(GrChipID_t tmu, FxU32 startAddress, GrTexInfo *info
|
|||
//printf("th %d rh %d ch %d\n", th, rh, ch);
|
||||
|
||||
invtex[tmu] = 1.0f - (th - rh) / (float)th;
|
||||
} else
|
||||
}
|
||||
else
|
||||
invtex[tmu] = 0;
|
||||
|
||||
if (info->format == GR_TEXFMT_ALPHA_INTENSITY_88) {
|
||||
|
@ -1787,10 +1791,8 @@ int CheckTextureBufferFormat(GrChipID_t tmu, FxU32 startAddress, GrTexInfo *info
|
|||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grTextureAuxBufferExt(GrChipID_t tmu,
|
||||
FxU32 startAddress,
|
||||
|
@ -2128,11 +2130,11 @@ FX_ENTRY void FX_CALL grFramebufferCopyExt(int /*x*/, int /*y*/, int /*w*/, int
|
|||
int from, int to, int mode)
|
||||
{
|
||||
if (mode == GR_FBCOPY_MODE_DEPTH) {
|
||||
|
||||
int tw = 1, th = 1;
|
||||
if (npot_support) {
|
||||
tw = width; th = height;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
while (tw < width) tw <<= 1;
|
||||
while (th < height) th <<= 1;
|
||||
}
|
||||
|
@ -2170,7 +2172,6 @@ FX_ENTRY void FX_CALL grFramebufferCopyExt(int /*x*/, int /*y*/, int /*w*/, int
|
|||
grDisplayGLError("grFramebufferCopyExt :: B");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2218,13 +2219,15 @@ grRenderBuffer( GrBuffer_t buffer )
|
|||
if (nbAuxBuffers > 0) {
|
||||
glDrawBuffer(GL_BACK);
|
||||
current_buffer = GL_BACK;
|
||||
} else if (save_w) {
|
||||
}
|
||||
else if (save_w) {
|
||||
int tw = 1, th = 1;
|
||||
//printf("restore %dx%d\n", save_w, save_h);
|
||||
if (npot_support) {
|
||||
tw = screen_width;
|
||||
th = screen_height;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
while (tw < screen_width) tw <<= 1;
|
||||
while (th < screen_height) th <<= 1;
|
||||
}
|
||||
|
@ -2269,7 +2272,8 @@ grRenderBuffer( GrBuffer_t buffer )
|
|||
glTranslatef(0, 0, 1 - zscale);
|
||||
glScalef(1, 1, zscale);
|
||||
inverted_culling = 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
float m[4 * 4] = { 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, -1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
|
@ -2309,7 +2313,8 @@ grAuxBufferExt( GrBuffer_t buffer )
|
|||
glDisable(GL_ALPHA_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
grTexFilterMode(GR_TMU1, GR_TEXTUREFILTER_POINT_SAMPLED, GR_TEXTUREFILTER_POINT_SAMPLED);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
need_to_compile = 1;
|
||||
}
|
||||
|
@ -2437,7 +2442,8 @@ grLfbLock( GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
|
|||
info->writeMode = GR_LFBWRITEMODE_888;
|
||||
info->origin = origin;
|
||||
glReadPixels(0, viewport_offset, width, height, GL_BGRA, GL_UNSIGNED_BYTE, frameBuffer);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
buf = (unsigned char*)malloc(width*height * 4);
|
||||
|
||||
info->lfbPtr = frameBuffer;
|
||||
|
@ -2658,7 +2664,6 @@ grLfbWriteRegion( GrBuffer_t dst_buffer,
|
|||
dst_x, dst_y,
|
||||
src_width, src_height,
|
||||
tex_width, tex_height, +1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3005,7 +3010,6 @@ grTexMultibaseAddress( GrChipID_t /*tmu*/,
|
|||
display_warning("grTexMultibaseAddress");
|
||||
}
|
||||
|
||||
|
||||
inline void MySleep(FxU32 ms)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -22,7 +22,6 @@ typedef struct _wrapper_config
|
|||
} wrapper_config;
|
||||
extern wrapper_config config;
|
||||
|
||||
|
||||
// VP added this utility function
|
||||
// returns the bytes per pixel of a given GR texture format
|
||||
int grTexFormatSize(int fmt);
|
||||
|
@ -176,7 +175,6 @@ int getFullScreenHeight();
|
|||
FX_ENTRY void FX_CALL grFramebufferCopyExt(int x, int y, int w, int h,
|
||||
int buffer_from, int buffer_to, int mode);
|
||||
|
||||
|
||||
// COMBINE extension
|
||||
|
||||
typedef FxU32 GrCCUColor_t;
|
||||
|
@ -210,7 +208,6 @@ typedef FxU32 GrCombineMode_t;
|
|||
#define GR_CMBX_TMU_CALPHA 0x10
|
||||
#define GR_CMBX_TMU_CCOLOR 0x11
|
||||
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grColorCombineExt(GrCCUColor_t a, GrCombineMode_t a_mode,
|
||||
GrCCUColor_t b, GrCombineMode_t b_mode,
|
||||
|
|
Loading…
Reference in New Issue