[Glide64] Fix up to work on android
This commit is contained in:
parent
a7a0974b88
commit
52aea8738f
|
@ -261,6 +261,9 @@ extern "C" {
|
|||
uint32_t * VI_Y_SCALE_REG;
|
||||
|
||||
void(*CheckInterrupts)(void);
|
||||
#ifdef ANDROID
|
||||
void(CALL *SwapBuffers)(void);
|
||||
#endif
|
||||
} GFX_INFO;
|
||||
|
||||
extern GFX_INFO gfx;
|
||||
|
@ -490,6 +493,22 @@ extern "C" {
|
|||
*******************************************************************/
|
||||
EXPORT void CALL ViWidthChanged(void);
|
||||
|
||||
#ifdef ANDROID
|
||||
/******************************************************************
|
||||
Function: SurfaceCreated
|
||||
Purpose: this function is called when the surface is created.
|
||||
input: none
|
||||
output: none
|
||||
*******************************************************************/
|
||||
EXPORT void CALL SurfaceCreated(void);
|
||||
/******************************************************************
|
||||
Function: SurfaceChanged
|
||||
Purpose: this function is called when the surface is has changed.
|
||||
input: none
|
||||
output: none
|
||||
*******************************************************************/
|
||||
EXPORT void CALL SurfaceChanged(int width, int height);
|
||||
#endif
|
||||
/******************************************************************
|
||||
Function: FrameBufferWrite
|
||||
Purpose: This function is called to notify the dll that the
|
||||
|
|
|
@ -44,22 +44,21 @@ typedef FxU32 GrCombineMode_t;
|
|||
|
||||
#define GR_TEXTURE_UMA_EXT 0x06
|
||||
//wrapper specific
|
||||
#ifdef _WIN32
|
||||
FX_ENTRY void FX_CALL grConfigWrapperExt(FxI32, FxI32, FxBool, FxBool);
|
||||
#else
|
||||
FX_ENTRY void FX_CALL grConfigWrapperExt(FxI32, FxBool, FxBool);
|
||||
#endif
|
||||
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32*, FxU32*);
|
||||
FX_ENTRY char ** FX_CALL grQueryResolutionsExt(int32_t*);
|
||||
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key);
|
||||
FX_ENTRY void FX_CALL grGetGammaTableExt(FxU32, FxU32*, FxU32*, FxU32*);
|
||||
|
||||
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);
|
||||
#ifdef _WIN32
|
||||
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);
|
||||
#else
|
||||
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);
|
||||
#endif
|
||||
|
||||
//color combiner
|
||||
FX_ENTRY void FX_CALL
|
||||
|
|
|
@ -281,7 +281,11 @@ void ChangeSize()
|
|||
|
||||
void ConfigWrapper()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
grConfigWrapperExt(g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic);
|
||||
#else
|
||||
grConfigWrapperExt(g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic);
|
||||
#endif
|
||||
}
|
||||
|
||||
void UseUnregisteredSetting(int /*SettingID*/)
|
||||
|
@ -290,20 +294,31 @@ void UseUnregisteredSetting(int /*SettingID*/)
|
|||
DebugBreak();
|
||||
#endif
|
||||
}
|
||||
#ifdef ANDROID
|
||||
extern int g_width, g_height;
|
||||
#endif
|
||||
|
||||
void ReadSettings()
|
||||
{
|
||||
g_settings->card_id = GetSetting(Set_CardId);
|
||||
#ifdef ANDROID
|
||||
g_settings->scr_res_x = g_settings->res_x = g_width;
|
||||
g_settings->scr_res_y = g_settings->res_y = g_height;
|
||||
#else
|
||||
g_settings->res_data = (uint32_t)GetSetting(Set_Resolution);
|
||||
if (g_settings->res_data >= 24) g_settings->res_data = 12;
|
||||
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
|
||||
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
|
||||
g_settings->wrpResolution = GetSetting(Set_wrpResolution);
|
||||
#endif
|
||||
g_settings->vsync = GetSetting(Set_vsync);
|
||||
g_settings->ssformat = (uint8_t)GetSetting(Set_ssformat);
|
||||
g_settings->show_fps = (uint8_t)GetSetting(Set_ShowFps);
|
||||
g_settings->clock = GetSetting(Set_clock);
|
||||
g_settings->clock_24_hr = GetSetting(Set_clock_24_hr);
|
||||
#ifdef ANDROID
|
||||
g_settings->rotate = GetSetting(Set_Rotate);
|
||||
#endif
|
||||
g_settings->advanced_options = Set_basic_mode ? !GetSystemSetting(Set_basic_mode) : 0;
|
||||
g_settings->texenh_options = GetSetting(Set_texenh_options);
|
||||
g_settings->use_hotkeys = GetSetting(Set_hotkeys);
|
||||
|
@ -532,6 +547,9 @@ void WriteSettings(bool saveEmulationSettings)
|
|||
SetSetting(Set_ShowFps, g_settings->show_fps);
|
||||
SetSetting(Set_clock, g_settings->clock);
|
||||
SetSetting(Set_clock_24_hr, g_settings->clock_24_hr);
|
||||
#ifdef ANDROID
|
||||
SetSetting(Set_Rotate, g_settings->rotate);
|
||||
#endif
|
||||
//SetSetting(Set_advanced_options,g_settings->advanced_options);
|
||||
SetSetting(Set_texenh_options, g_settings->texenh_options);
|
||||
|
||||
|
@ -866,6 +884,10 @@ int InitGfx()
|
|||
grGlideShutdown();
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
gfx_context = grSstWinOpen(GR_REFRESH_60Hz, 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
|
||||
|
||||
GfxInitDone = TRUE;
|
||||
|
@ -1379,7 +1401,9 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
|
|||
ReadSettings();
|
||||
char name[21] = "DEFAULT";
|
||||
ReadSpecialSettings(name);
|
||||
#ifdef _WIN32
|
||||
g_settings->res_data_org = g_settings->res_data;
|
||||
#endif
|
||||
|
||||
#ifdef FPS
|
||||
fps_last.SetToNow();
|
||||
|
@ -1406,7 +1430,11 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
|
|||
if (fb_depth_render_enabled)
|
||||
ZLUT_init();
|
||||
|
||||
#ifdef _WIN32
|
||||
grConfigWrapperExt(g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic);
|
||||
#else
|
||||
grConfigWrapperExt(g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic);
|
||||
#endif
|
||||
|
||||
grGlideInit();
|
||||
grSstSelect(0);
|
||||
|
@ -1473,7 +1501,12 @@ void CALL PluginLoaded(void)
|
|||
general_setting(Set_texenh_options, "texenh_options", 0);
|
||||
general_setting(Set_hotkeys, "hotkeys", 1);
|
||||
general_setting(Set_wrpVRAM, "wrpVRAM", 0);
|
||||
#ifndef ANDROID
|
||||
general_setting(Set_wrpFBO, "wrpFBO", 0);
|
||||
#else
|
||||
general_setting(Set_Rotate, "rotate", 0);
|
||||
general_setting(Set_wrpFBO, "wrpFBO", 1);
|
||||
#endif
|
||||
general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0);
|
||||
general_setting(Set_autodetect_ucode, "autodetect_ucode", 1);
|
||||
general_setting(Set_ucode, "ucode", 2);
|
||||
|
@ -2322,6 +2355,33 @@ void CALL ViWidthChanged(void)
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
/******************************************************************
|
||||
Function: SurfaceCreated
|
||||
Purpose: this function is called when the surface is created.
|
||||
input: none
|
||||
output: none
|
||||
*******************************************************************/
|
||||
void CALL SurfaceCreated(void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
Function: SurfaceChanged
|
||||
Purpose: this function is called when the surface is has changed.
|
||||
input: none
|
||||
output: none
|
||||
*******************************************************************/
|
||||
void init_combiner();
|
||||
|
||||
void CALL SurfaceChanged(int width, int height)
|
||||
{
|
||||
g_width = width;
|
||||
g_height = height;
|
||||
init_combiner();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WINPROC_OVERRIDE
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
@ -2407,4 +2467,11 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
|
|||
|
||||
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
void Android_JNI_SwapWindow()
|
||||
{
|
||||
gfx.SwapBuffers();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,97 +1,104 @@
|
|||
#include "Gfx_1.3.h"
|
||||
|
||||
CSettings::CSettings() :
|
||||
card_id(0),
|
||||
res_x(640),
|
||||
scr_res_x(640),
|
||||
res_y(480),
|
||||
scr_res_y(480),
|
||||
res_data(GR_RESOLUTION_640x480),
|
||||
res_data_org(GR_RESOLUTION_640x480),
|
||||
advanced_options(0),
|
||||
texenh_options(0),
|
||||
ssformat(0),
|
||||
vsync(0),
|
||||
|
||||
show_fps(0),
|
||||
clock(0),
|
||||
clock_24_hr(0),
|
||||
|
||||
filtering(0),
|
||||
fog(0),
|
||||
buff_clear(0),
|
||||
swapmode(0),
|
||||
lodmode(0),
|
||||
aspectmode(0),
|
||||
use_hotkeys(0),
|
||||
#ifdef TEXTURE_FILTER
|
||||
//Texture filtering options
|
||||
texture_dir(""),
|
||||
ghq_fltr(0),
|
||||
ghq_enht(0),
|
||||
ghq_cmpr(0),
|
||||
ghq_hirs(0),
|
||||
ghq_use(0),
|
||||
ghq_enht_cmpr(0),
|
||||
ghq_enht_tile(0),
|
||||
ghq_enht_f16bpp(0),
|
||||
ghq_enht_gz(0),
|
||||
ghq_enht_nobg(0),
|
||||
ghq_hirs_cmpr(0),
|
||||
ghq_hirs_tile(0),
|
||||
ghq_hirs_f16bpp(0),
|
||||
ghq_hirs_gz(0),
|
||||
ghq_hirs_altcrc(0),
|
||||
ghq_cache_save(0),
|
||||
ghq_cache_size(0),
|
||||
ghq_hirs_let_texartists_fly(0),
|
||||
ghq_hirs_dump(0),
|
||||
card_id(0),
|
||||
res_x(640),
|
||||
scr_res_x(640),
|
||||
res_y(480),
|
||||
scr_res_y(480),
|
||||
#ifdef _WIN32
|
||||
res_data(GR_RESOLUTION_640x480),
|
||||
res_data_org(GR_RESOLUTION_640x480),
|
||||
#endif
|
||||
autodetect_ucode(0),
|
||||
ucode(0),
|
||||
logging(0),
|
||||
elogging(0),
|
||||
log_clear(0),
|
||||
run_in_window(0),
|
||||
filter_cache(0),
|
||||
unk_as_red(0),
|
||||
log_unk(0),
|
||||
unk_clear(0),
|
||||
wireframe(0),
|
||||
wfmode(0),
|
||||
advanced_options(0),
|
||||
texenh_options(0),
|
||||
ssformat(0),
|
||||
vsync(0),
|
||||
|
||||
// Special fixes
|
||||
offset_x(0),
|
||||
offset_y(0),
|
||||
scale_x(0),
|
||||
scale_y(0),
|
||||
fast_crc(0),
|
||||
alt_tex_size(0),
|
||||
use_sts1_only(0),
|
||||
flame_corona(0), //hack for zeldas flame's corona
|
||||
increase_texrect_edge(0), // add 1 to lower right corner coordinates of texrect
|
||||
decrease_fillrect_edge(0), // sub 1 from lower right corner coordinates of fillrect
|
||||
texture_correction(0), // enable perspective texture correction emulation. is on by default
|
||||
stipple_mode(0), //used for dithered alpha emulation
|
||||
stipple_pattern(0), //used for dithered alpha emulation
|
||||
force_microcheck(0), //check microcode each frame, for mixed F3DEX-S2DEX games
|
||||
force_quad3d(0), //force 0xb5 command to be quad, not line 3d
|
||||
clip_zmin(0), //enable near z clipping
|
||||
clip_zmax(0), //enable far plane clipping;
|
||||
adjust_aspect(0), //adjust screen aspect for wide screen mode
|
||||
force_calc_sphere(0), //use spheric mapping only, Ridge Racer 64
|
||||
pal230(0), //set special scale for PAL games
|
||||
correct_viewport(0), //correct viewport values
|
||||
zmode_compare_less(0), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
|
||||
old_style_adither(0), //apply alpha dither regardless of alpha_dither_mode
|
||||
n64_z_scale(0), //scale vertex z value before writing to depth buffer, as N64 does.
|
||||
show_fps(0),
|
||||
clock(0),
|
||||
clock_24_hr(0),
|
||||
#ifdef ANDROID
|
||||
rotate(0),
|
||||
#endif
|
||||
|
||||
hacks(0),
|
||||
filtering(0),
|
||||
fog(0),
|
||||
buff_clear(0),
|
||||
swapmode(0),
|
||||
lodmode(0),
|
||||
aspectmode(0),
|
||||
use_hotkeys(0),
|
||||
#ifdef TEXTURE_FILTER
|
||||
//Texture filtering options
|
||||
texture_dir(""),
|
||||
ghq_fltr(0),
|
||||
ghq_enht(0),
|
||||
ghq_cmpr(0),
|
||||
ghq_hirs(0),
|
||||
ghq_use(0),
|
||||
ghq_enht_cmpr(0),
|
||||
ghq_enht_tile(0),
|
||||
ghq_enht_f16bpp(0),
|
||||
ghq_enht_gz(0),
|
||||
ghq_enht_nobg(0),
|
||||
ghq_hirs_cmpr(0),
|
||||
ghq_hirs_tile(0),
|
||||
ghq_hirs_f16bpp(0),
|
||||
ghq_hirs_gz(0),
|
||||
ghq_hirs_altcrc(0),
|
||||
ghq_cache_save(0),
|
||||
ghq_cache_size(0),
|
||||
ghq_hirs_let_texartists_fly(0),
|
||||
ghq_hirs_dump(0),
|
||||
#endif
|
||||
autodetect_ucode(0),
|
||||
ucode(0),
|
||||
logging(0),
|
||||
elogging(0),
|
||||
log_clear(0),
|
||||
run_in_window(0),
|
||||
filter_cache(0),
|
||||
unk_as_red(0),
|
||||
log_unk(0),
|
||||
unk_clear(0),
|
||||
wireframe(0),
|
||||
wfmode(0),
|
||||
|
||||
//wrapper settings
|
||||
wrpResolution(0),
|
||||
wrpVRAM(0),
|
||||
wrpFBO(0),
|
||||
wrpAnisotropic(0)
|
||||
// Special fixes
|
||||
offset_x(0),
|
||||
offset_y(0),
|
||||
scale_x(0),
|
||||
scale_y(0),
|
||||
fast_crc(0),
|
||||
alt_tex_size(0),
|
||||
use_sts1_only(0),
|
||||
flame_corona(0), //hack for zeldas flame's corona
|
||||
increase_texrect_edge(0), // add 1 to lower right corner coordinates of texrect
|
||||
decrease_fillrect_edge(0), // sub 1 from lower right corner coordinates of fillrect
|
||||
texture_correction(0), // enable perspective texture correction emulation. is on by default
|
||||
stipple_mode(0), //used for dithered alpha emulation
|
||||
stipple_pattern(0), //used for dithered alpha emulation
|
||||
force_microcheck(0), //check microcode each frame, for mixed F3DEX-S2DEX games
|
||||
force_quad3d(0), //force 0xb5 command to be quad, not line 3d
|
||||
clip_zmin(0), //enable near z clipping
|
||||
clip_zmax(0), //enable far plane clipping;
|
||||
adjust_aspect(0), //adjust screen aspect for wide screen mode
|
||||
force_calc_sphere(0), //use spheric mapping only, Ridge Racer 64
|
||||
pal230(0), //set special scale for PAL games
|
||||
correct_viewport(0), //correct viewport values
|
||||
zmode_compare_less(0), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
|
||||
old_style_adither(0), //apply alpha dither regardless of alpha_dither_mode
|
||||
n64_z_scale(0), //scale vertex z value before writing to depth buffer, as N64 does.
|
||||
|
||||
hacks(0),
|
||||
|
||||
//wrapper settings
|
||||
#ifdef _WIN32
|
||||
wrpResolution(0),
|
||||
#endif
|
||||
wrpVRAM(0),
|
||||
wrpFBO(0),
|
||||
wrpAnisotropic(0)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ public:
|
|||
|
||||
uint32_t res_x, scr_res_x;
|
||||
uint32_t res_y, scr_res_y;
|
||||
#ifdef _WIN32
|
||||
uint32_t res_data, res_data_org;
|
||||
#endif
|
||||
|
||||
int advanced_options;
|
||||
int texenh_options;
|
||||
|
@ -19,6 +21,9 @@ public:
|
|||
int show_fps;
|
||||
int clock;
|
||||
int clock_24_hr;
|
||||
#ifdef ANDROID
|
||||
int rotate;
|
||||
#endif
|
||||
|
||||
int filtering;
|
||||
int fog;
|
||||
|
@ -152,7 +157,9 @@ public:
|
|||
uint32_t hacks;
|
||||
|
||||
//wrapper settings
|
||||
#ifdef _WIN32
|
||||
int wrpResolution;
|
||||
#endif
|
||||
int wrpVRAM;
|
||||
int wrpFBO;
|
||||
int wrpAnisotropic;
|
||||
|
|
|
@ -44,15 +44,13 @@ void SetupTrace(void)
|
|||
g_AndroidLogger = new AndroidLogger();
|
||||
}
|
||||
TraceAddModule(g_AndroidLogger);
|
||||
|
||||
TraceSetMaxModule(MaxTraceModuleGlide64, TraceVerbose);
|
||||
#else
|
||||
#endif
|
||||
#ifdef _DEBUG
|
||||
TraceSetMaxModule(MaxTraceModuleGlide64, TraceInfo);
|
||||
#else
|
||||
TraceSetMaxModule(MaxTraceModuleGlide64, TraceError);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
TraceSetModuleName(TraceMD5, "MD5");
|
||||
TraceSetModuleName(TraceSettings, "Settings");
|
||||
|
@ -64,6 +62,7 @@ void SetupTrace(void)
|
|||
TraceSetModuleName(TraceRDP, "RDP");
|
||||
TraceSetModuleName(TraceTLUT, "TLUT");
|
||||
TraceSetModuleName(TracePNG, "PNG");
|
||||
TraceSetModuleName(TraceOGLWrapper, "OGL Wrapper");
|
||||
|
||||
char log_dir[260];
|
||||
memset(log_dir, 0, sizeof(log_dir));
|
||||
|
|
|
@ -13,6 +13,7 @@ enum TraceModuleGlide64
|
|||
TraceRDP,
|
||||
TraceTLUT,
|
||||
TracePNG,
|
||||
TraceOGLWrapper,
|
||||
MaxTraceModuleGlide64,
|
||||
};
|
||||
|
||||
|
|
|
@ -54,11 +54,18 @@
|
|||
<ClCompile Include="OGLEStextures.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OGLESwrappers.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'=='Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OGLgeometry.cpp" />
|
||||
<ClCompile Include="OGLglitchmain.cpp" />
|
||||
<ClCompile Include="OGLtextures.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="glitchmain.h" />
|
||||
<ClInclude Include="OGLESwrappers.h">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opengl.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -35,10 +35,19 @@
|
|||
<ClCompile Include="OGLEStextures.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OGLESwrappers.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="glitchmain.h">
|
||||
<Filter>Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OGLESwrappers.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opengl.h">
|
||||
<Filter>Headers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -26,8 +26,11 @@
|
|||
#endif // _WIN32
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "glide.h"
|
||||
#include "glitchmain.h"
|
||||
#include <Glide64/trace.h>
|
||||
#include <Glide64/Settings.h>
|
||||
|
||||
void vbo_draw();
|
||||
|
||||
|
@ -68,6 +71,7 @@ static GLuint vertex_shader_object;
|
|||
static GLuint program_object_default;
|
||||
static GLuint program_object_depth;
|
||||
static GLuint program_object;
|
||||
static GLuint rotation_matrix_location;
|
||||
static int constant_color_location;
|
||||
static int ccolor0_location;
|
||||
static int ccolor1_location;
|
||||
|
@ -176,6 +180,7 @@ SHADER_HEADER
|
|||
"uniform vec3 vertexOffset; \n" //Moved some calculations from grDrawXXX to shader
|
||||
"uniform vec4 textureSizes; \n"
|
||||
"uniform vec3 fogModeEndScale; \n" //0 = Mode, 1 = gl_Fog.end, 2 = gl_Fog.scale
|
||||
"uniform mat4 rotation_matrix; \n"
|
||||
SHADER_VARYING
|
||||
" \n"
|
||||
"void main() \n"
|
||||
|
@ -187,6 +192,7 @@ SHADER_VARYING
|
|||
" gl_Position.z = aVertex.z / Z_MAX; \n"
|
||||
" gl_Position.w = 1.0; \n"
|
||||
" gl_Position /= q; \n"
|
||||
" gl_Position = rotation_matrix * gl_Position; \n"
|
||||
" gl_FrontColor = aColor.bgra; \n"
|
||||
" \n"
|
||||
" gl_TexCoord[0] = vec4(aMultiTexCoord0.xy / q / textureSizes.xy,0,1); \n"
|
||||
|
@ -220,7 +226,7 @@ void check_compile(GLuint shader)
|
|||
{
|
||||
char log[1024];
|
||||
glGetShaderInfoLog(shader, 1024, NULL, log);
|
||||
LOGINFO(log);
|
||||
//LOGINFO(log);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,16 +238,79 @@ void check_link(GLuint program)
|
|||
{
|
||||
char log[1024];
|
||||
glGetProgramInfoLog(program, 1024, NULL, log);
|
||||
LOGINFO(log);
|
||||
//LOGINFO(log);
|
||||
}
|
||||
}
|
||||
|
||||
void set_rotation_matrix(GLuint loc, int rotate)
|
||||
{
|
||||
GLfloat mat[16];
|
||||
|
||||
/* first setup everything which is the same everytime */
|
||||
/* (X, X, 0, 0)
|
||||
* (X, X, 0, 0)
|
||||
* (0, 0, 1, 0)
|
||||
* (0, 0, 0, 1)
|
||||
*/
|
||||
|
||||
//mat[0] = cos(angle);
|
||||
//mat[1] = sin(angle);
|
||||
mat[2] = 0;
|
||||
mat[3] = 0;
|
||||
|
||||
//mat[4] = -sin(angle);
|
||||
//mat[5] = cos(angle);
|
||||
mat[6] = 0;
|
||||
mat[7] = 0;
|
||||
|
||||
mat[8] = 0;
|
||||
mat[9] = 0;
|
||||
mat[10] = 1;
|
||||
mat[11] = 0;
|
||||
|
||||
mat[12] = 0;
|
||||
mat[13] = 0;
|
||||
mat[14] = 0;
|
||||
mat[15] = 1;
|
||||
|
||||
/* now set the actual rotation */
|
||||
if (1 == rotate) // 90 degree
|
||||
{
|
||||
mat[0] = 0;
|
||||
mat[1] = 1;
|
||||
mat[4] = -1;
|
||||
mat[5] = 0;
|
||||
}
|
||||
else if (2 == rotate) // 180 degree
|
||||
{
|
||||
mat[0] = -1;
|
||||
mat[1] = 0;
|
||||
mat[4] = 0;
|
||||
mat[5] = -1;
|
||||
}
|
||||
else if (3 == rotate) // 270 degree
|
||||
{
|
||||
mat[0] = 0;
|
||||
mat[1] = -1;
|
||||
mat[4] = 1;
|
||||
mat[5] = 0;
|
||||
}
|
||||
else /* 0 degree, also fallback if input is wrong) */
|
||||
{
|
||||
mat[0] = 1;
|
||||
mat[1] = 0;
|
||||
mat[4] = 0;
|
||||
mat[5] = 1;
|
||||
}
|
||||
|
||||
glUniformMatrix4fv(loc, 1, GL_FALSE, mat);
|
||||
}
|
||||
|
||||
void init_combiner()
|
||||
{
|
||||
int texture[4] = { 0, 0, 0, 0 };
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
// creating a fake texture
|
||||
glBindTexture(GL_TEXTURE_2D, default_texture);
|
||||
|
@ -251,8 +320,8 @@ void init_combiner()
|
|||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, default_texture);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
int rotation_matrix_location;
|
||||
int texture0_location;
|
||||
int texture1_location;
|
||||
char *fragment_shader;
|
||||
|
@ -299,6 +368,7 @@ void init_combiner()
|
|||
check_compile(vertex_shader_object);
|
||||
|
||||
// depth program
|
||||
#ifndef ANDROID
|
||||
program_object = glCreateProgram();
|
||||
program_object_depth = program_object;
|
||||
glAttachShader(program_object, fragment_depth_shader_object);
|
||||
|
@ -314,10 +384,14 @@ void init_combiner()
|
|||
check_link(program_object);
|
||||
glUseProgram(program_object);
|
||||
|
||||
rotation_matrix_location = glGetUniformLocation(program_object, "rotation_matrix");
|
||||
set_rotation_matrix(rotation_matrix_location, g_settings->rotate);
|
||||
|
||||
texture0_location = glGetUniformLocation(program_object, "texture0");
|
||||
texture1_location = glGetUniformLocation(program_object, "texture1");
|
||||
glUniform1i(texture0_location, 0);
|
||||
glUniform1i(texture1_location, 1);
|
||||
#endif
|
||||
|
||||
// default program
|
||||
program_object = glCreateProgram();
|
||||
|
@ -334,6 +408,8 @@ void init_combiner()
|
|||
glLinkProgram(program_object);
|
||||
check_link(program_object);
|
||||
glUseProgram(program_object);
|
||||
rotation_matrix_location = glGetUniformLocation(program_object, "rotation_matrix");
|
||||
set_rotation_matrix(rotation_matrix_location, g_settings->rotate);
|
||||
|
||||
texture0_location = glGetUniformLocation(program_object, "texture0");
|
||||
texture1_location = glGetUniformLocation(program_object, "texture1");
|
||||
|
@ -410,6 +486,7 @@ typedef struct _shader_program_key
|
|||
int blackandwhite1;
|
||||
GLuint fragment_shader_object;
|
||||
GLuint program_object;
|
||||
int rotation_matrix_location;
|
||||
int texture0_location;
|
||||
int texture1_location;
|
||||
int vertexOffset_location;
|
||||
|
@ -469,6 +546,11 @@ void update_uniforms(shader_program_key prog)
|
|||
glUniform1i(prog.ditherTex_location, 2);
|
||||
}
|
||||
|
||||
rotation_matrix_location = glGetUniformLocation(program_object, "rotation_matrix");
|
||||
set_rotation_matrix(rotation_matrix_location, g_settings->rotate);
|
||||
rotation_matrix_location = glGetUniformLocation(program_object, "rotation_matrix");
|
||||
set_rotation_matrix(rotation_matrix_location, g_settings->rotate);
|
||||
|
||||
set_lambda();
|
||||
}
|
||||
|
||||
|
@ -480,6 +562,7 @@ void disable_textureSizes()
|
|||
|
||||
void compile_shader()
|
||||
{
|
||||
int rotation_matrix_location;
|
||||
int texture0_location;
|
||||
int texture1_location;
|
||||
int ditherTex_location;
|
||||
|
@ -582,6 +665,7 @@ void compile_shader()
|
|||
check_link(program_object);
|
||||
glUseProgram(program_object);
|
||||
|
||||
shader_programs[number_of_programs].rotation_matrix_location = glGetUniformLocation(program_object, "rotation_matrix");
|
||||
shader_programs[number_of_programs].texture0_location = glGetUniformLocation(program_object, "texture0");
|
||||
shader_programs[number_of_programs].texture1_location = glGetUniformLocation(program_object, "texture1");
|
||||
shader_programs[number_of_programs].vertexOffset_location = glGetUniformLocation(program_object, "vertexOffset");
|
||||
|
@ -589,6 +673,7 @@ void compile_shader()
|
|||
shader_programs[number_of_programs].fogModeEndScale_location = glGetUniformLocation(program_object, "fogModeEndScale");
|
||||
shader_programs[number_of_programs].fogColor_location = glGetUniformLocation(program_object, "fogColor");
|
||||
shader_programs[number_of_programs].alphaRef_location = glGetUniformLocation(program_object, "alphaRef");
|
||||
shader_programs[number_of_programs].chroma_color_location = glGetUniformLocation(program_object, "chroma_color");
|
||||
|
||||
update_uniforms(shader_programs[number_of_programs]);
|
||||
|
||||
|
@ -639,7 +724,7 @@ void set_lambda()
|
|||
FX_ENTRY void FX_CALL
|
||||
grConstantColorValue(GrColor_t value)
|
||||
{
|
||||
LOG("grConstantColorValue(%d)\r\n", value);
|
||||
WriteTrace(TraceResolution, TraceDebug, "value: %d", value);
|
||||
switch (lfb_color_fmt)
|
||||
{
|
||||
case GR_COLORFORMAT_ARGB:
|
||||
|
@ -752,7 +837,7 @@ GrCombineFunction_t function, GrCombineFactor_t factor,
|
|||
GrCombineLocal_t local, GrCombineOther_t other,
|
||||
FxBool invert)
|
||||
{
|
||||
LOG("grColorCombine(%d,%d,%d,%d,%d)\r\n", function, factor, local, other, invert);
|
||||
WriteTrace(TraceResolution, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
|
||||
static int last_function = 0;
|
||||
static int last_factor = 0;
|
||||
static int last_local = 0;
|
||||
|
@ -962,7 +1047,7 @@ GrCombineLocal_t local, GrCombineOther_t other,
|
|||
FxBool invert
|
||||
)
|
||||
{
|
||||
LOG("grAlphaCombine(%d,%d,%d,%d,%d)\r\n", function, factor, local, other, invert);
|
||||
WriteTrace(TraceResolution, TraceDebug, "function: %d factor: %d local: %d other: %d invert: %d", function, factor, local, other, invert);
|
||||
static int last_function = 0;
|
||||
static int last_factor = 0;
|
||||
static int last_local = 0;
|
||||
|
@ -1200,7 +1285,7 @@ FxBool rgb_invert,
|
|||
FxBool alpha_invert
|
||||
)
|
||||
{
|
||||
LOG("grTexCombine(%d,%d,%d,%d,%d,%d,%d)\r\n", tmu, rgb_function, rgb_factor, alpha_function, alpha_factor, rgb_invert, alpha_invert);
|
||||
WriteTrace(TraceResolution, TraceDebug, "tmu: %d rgb_function: %d rgb_factor: %d alpha_function: %d alpha_factor: %d rgb_invert: %d alpha_invert: %d", tmu, rgb_function, rgb_factor, alpha_function, alpha_factor, rgb_invert, alpha_invert);
|
||||
int num_tex;
|
||||
|
||||
if (tmu == GR_TMU0) num_tex = 1;
|
||||
|
@ -1451,7 +1536,7 @@ GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df
|
|||
)
|
||||
{
|
||||
int sfactorRGB = 0, dfactorRGB = 0, sfactorAlpha = 0, dfactorAlpha = 0;
|
||||
LOG("grAlphaBlendFunction(%d,%d,%d,%d)\r\n", rgb_sf, rgb_df, alpha_sf, alpha_df);
|
||||
WriteTrace(TraceResolution, TraceDebug, "rgb_sf: %d rgb_df: %d alpha_sf: %d alpha_df: %d", rgb_sf, rgb_df, alpha_sf, alpha_df);
|
||||
|
||||
switch (rgb_sf)
|
||||
{
|
||||
|
@ -1525,7 +1610,7 @@ GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df
|
|||
FX_ENTRY void FX_CALL
|
||||
grAlphaTestReferenceValue(GrAlpha_t value)
|
||||
{
|
||||
LOG("grAlphaTestReferenceValue(%d)\r\n", value);
|
||||
WriteTrace(TraceResolution, TraceDebug, "value: %d", value);
|
||||
alpha_ref = value;
|
||||
grAlphaTestFunction(alpha_func);
|
||||
}
|
||||
|
@ -1533,7 +1618,7 @@ grAlphaTestReferenceValue(GrAlpha_t value)
|
|||
FX_ENTRY void FX_CALL
|
||||
grAlphaTestFunction(GrCmpFnc_t function)
|
||||
{
|
||||
LOG("grAlphaTestFunction(%d)\r\n", function);
|
||||
WriteTrace(TraceResolution, TraceDebug, "function: %d", function);
|
||||
alpha_func = function;
|
||||
switch (function)
|
||||
{
|
||||
|
@ -1561,7 +1646,7 @@ grAlphaTestFunction(GrCmpFnc_t function)
|
|||
FX_ENTRY void FX_CALL
|
||||
grFogMode(GrFogMode_t mode)
|
||||
{
|
||||
LOG("grFogMode(%d)\r\n", mode);
|
||||
WriteTrace(TraceResolution, TraceDebug, "mode: %d", mode);
|
||||
switch (mode)
|
||||
{
|
||||
case GR_FOG_DISABLE:
|
||||
|
@ -1587,7 +1672,7 @@ grFogMode(GrFogMode_t mode)
|
|||
FX_ENTRY float FX_CALL
|
||||
guFogTableIndexToW(int i)
|
||||
{
|
||||
LOG("guFogTableIndexToW(%d)\r\n", i);
|
||||
WriteTrace(TraceResolution, TraceDebug, "i: %d", i);
|
||||
return (float)(pow(2.0, 3.0 + (double)(i >> 2)) / (8 - (i & 3)));
|
||||
}
|
||||
|
||||
|
@ -1595,7 +1680,7 @@ FX_ENTRY void FX_CALL
|
|||
guFogGenerateLinear(GrFog_t *fogtable,
|
||||
float nearZ, float farZ)
|
||||
{
|
||||
LOG("guFogGenerateLinear(%f,%f)\r\n", nearZ, farZ);
|
||||
WriteTrace(TraceResolution, TraceDebug, "nearZ: %f farZ: %f", nearZ, farZ);
|
||||
/*
|
||||
glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
|
||||
|
@ -1607,15 +1692,15 @@ float nearZ, float farZ)
|
|||
}
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grFogTable(const GrFog_t ft[])
|
||||
grFogTable(const GrFog_t /*ft */[])
|
||||
{
|
||||
LOG("grFogTable()\r\n");
|
||||
WriteTrace(TraceResolution, TraceDebug, "-");
|
||||
}
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grFogColorValue(GrColor_t fogcolor)
|
||||
{
|
||||
LOG("grFogColorValue(%x)\r\n", fogcolor);
|
||||
WriteTrace(TraceResolution, TraceDebug, "fogcolor: %x", fogcolor);
|
||||
|
||||
switch (lfb_color_fmt)
|
||||
{
|
||||
|
@ -1643,7 +1728,7 @@ grFogColorValue(GrColor_t fogcolor)
|
|||
FX_ENTRY void FX_CALL
|
||||
grChromakeyMode(GrChromakeyMode_t mode)
|
||||
{
|
||||
LOG("grChromakeyMode(%d)\r\n", mode);
|
||||
WriteTrace(TraceResolution, TraceDebug, "mode: %d", mode);
|
||||
switch (mode)
|
||||
{
|
||||
case GR_CHROMAKEY_DISABLE:
|
||||
|
@ -1661,7 +1746,7 @@ grChromakeyMode(GrChromakeyMode_t mode)
|
|||
FX_ENTRY void FX_CALL
|
||||
grChromakeyValue(GrColor_t value)
|
||||
{
|
||||
LOG("grChromakeyValue(%x)\r\n", value);
|
||||
WriteTrace(TraceResolution, TraceDebug, "value: %d", value);
|
||||
int chroma_color_location;
|
||||
|
||||
switch (lfb_color_fmt)
|
||||
|
@ -1716,19 +1801,17 @@ static void setPattern()
|
|||
}
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, 33 * 1024 * 1024);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, 4, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grStipplePattern(
|
||||
GrStipplePattern_t stipple)
|
||||
{
|
||||
LOG("grStipplePattern(%x)\r\n", stipple);
|
||||
WriteTrace(TraceResolution, TraceDebug, "value: %x", stipple);
|
||||
srand(stipple);
|
||||
setPattern();
|
||||
}
|
||||
|
@ -1736,25 +1819,22 @@ GrStipplePattern_t stipple)
|
|||
FX_ENTRY void FX_CALL
|
||||
grStippleMode(GrStippleMode_t mode)
|
||||
{
|
||||
LOG("grStippleMode(%d)\r\n", mode);
|
||||
WriteTrace(TraceResolution, TraceDebug, "mode: %d", mode);
|
||||
switch (mode)
|
||||
{
|
||||
case GR_STIPPLE_DISABLE:
|
||||
dither_enabled = 0;
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
break;
|
||||
case GR_STIPPLE_PATTERN:
|
||||
setPattern();
|
||||
dither_enabled = 1;
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
break;
|
||||
case GR_STIPPLE_ROTATE:
|
||||
setPattern();
|
||||
dither_enabled = 1;
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
break;
|
||||
default:
|
||||
WriteTrace(TraceGlitch, TraceWarning, "grStippleMode:%x", mode);
|
||||
|
@ -1769,7 +1849,7 @@ GrCCUColor_t c, FxBool c_invert,
|
|||
GrCCUColor_t d, FxBool d_invert,
|
||||
FxU32 shift, FxBool invert)
|
||||
{
|
||||
LOG("grColorCombineExt(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d)\r\n", a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
|
||||
WriteTrace(TraceResolution, TraceDebug, "a: %d a_mode: %d b: %d b_mode: %d c: %d c_invert: %d d: %d d_invert: %d shift: %d invert: %d", a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
|
||||
if (invert) WriteTrace(TraceGlitch, TraceWarning, "grColorCombineExt : inverted result");
|
||||
if (shift) WriteTrace(TraceGlitch, TraceWarning, "grColorCombineExt : shift = %d", shift);
|
||||
|
||||
|
@ -1951,7 +2031,7 @@ GrACUColor_t c, FxBool c_invert,
|
|||
GrACUColor_t d, FxBool d_invert,
|
||||
FxU32 shift, FxBool invert)
|
||||
{
|
||||
LOG("grAlphaCombineExt(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)\r\n", a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
|
||||
WriteTrace(TraceResolution, TraceDebug, "a: %d a_mode: %d b: %d b_mode: %d c: %d c_invert: %d d: %d d_invert: %d shift: %d invert: %d", a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
|
||||
if (invert) WriteTrace(TraceGlitch, TraceWarning, "grAlphaCombineExt : inverted result");
|
||||
if (shift) WriteTrace(TraceGlitch, TraceWarning, "grAlphaCombineExt : shift = %d", shift);
|
||||
|
||||
|
@ -2105,7 +2185,7 @@ GrTCCUColor_t d, FxBool d_invert,
|
|||
FxU32 shift, FxBool invert)
|
||||
{
|
||||
int num_tex;
|
||||
LOG("grTexColorCombineExt(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)\r\n", tmu, a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
|
||||
WriteTrace(TraceResolution, TraceDebug, "tmu: %d a: %d a_mode: %d b: %d b_mode: %d c: %d c_invert: %d d: %d d_invert: %d shift: %d invert: %d", tmu, a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
|
||||
|
||||
if (invert) WriteTrace(TraceGlitch, TraceWarning, "grTexColorCombineExt : inverted result");
|
||||
if (shift) WriteTrace(TraceGlitch, TraceWarning, "grTexColorCombineExt : shift = %d", shift);
|
||||
|
@ -2470,7 +2550,7 @@ GrTACUColor_t d, FxBool d_invert,
|
|||
FxU32 shift, FxBool invert)
|
||||
{
|
||||
int num_tex;
|
||||
LOG("grTexAlphaCombineExt(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)\r\n", tmu, a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
|
||||
WriteTrace(TraceResolution, TraceDebug, "tmu: %d a: %d a_mode: %d b: %d b_mode: %d c: %d c_invert: %d d: %d d_invert: %d shift, invert: %d", tmu, a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
|
||||
|
||||
if (invert) WriteTrace(TraceGlitch, TraceWarning, "grTexAlphaCombineExt : inverted result");
|
||||
if (shift) WriteTrace(TraceGlitch, TraceWarning, "grTexAlphaCombineExt : shift = %d", shift);
|
||||
|
@ -2750,7 +2830,7 @@ grConstantColorValueExt(GrChipID_t tmu,
|
|||
GrColor_t value)
|
||||
{
|
||||
int num_tex;
|
||||
LOG("grConstantColorValueExt(%d,%d)\r\n", tmu, value);
|
||||
WriteTrace(TraceResolution, TraceDebug, "tmu: %d value: %d", tmu, value);
|
||||
|
||||
if (tmu == GR_TMU0) num_tex = 1;
|
||||
else num_tex = 0;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -26,6 +26,7 @@
|
|||
#include "glide.h"
|
||||
#include "glitchmain.h"
|
||||
#include <stdio.h>
|
||||
#include <Glide64/trace.h>
|
||||
|
||||
/* Napalm extensions to GrTextureFormat_t */
|
||||
#define GR_TEXFMT_ARGB_CMP_FXT1 0x11
|
||||
|
@ -160,7 +161,7 @@ void free_textures()
|
|||
FX_ENTRY FxU32 FX_CALL
|
||||
grTexMinAddress( GrChipID_t tmu )
|
||||
{
|
||||
LOG("grTexMinAddress(%d)\r\n", tmu);
|
||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d", tmu);
|
||||
if (UMAmode)
|
||||
return 0;
|
||||
else
|
||||
|
@ -170,7 +171,7 @@ grTexMinAddress( GrChipID_t tmu )
|
|||
FX_ENTRY FxU32 FX_CALL
|
||||
grTexMaxAddress( GrChipID_t tmu )
|
||||
{
|
||||
LOG("grTexMaxAddress(%d)\r\n", tmu);
|
||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d", tmu);
|
||||
if (UMAmode)
|
||||
return TMU_SIZE*2 - 1;
|
||||
else
|
||||
|
@ -181,8 +182,8 @@ FX_ENTRY FxU32 FX_CALL
|
|||
grTexTextureMemRequired( FxU32 evenOdd,
|
||||
GrTexInfo *info )
|
||||
{
|
||||
WriteTrace(TraceGlitch, TraceDebug, "evenOdd = %d", evenOdd);
|
||||
int width, height;
|
||||
LOG("grTextureMemRequired(%d)\r\n", evenOdd);
|
||||
if (info->largeLodLog2 != info->smallLodLog2) WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : loading more than one LOD");
|
||||
|
||||
if (info->aspectRatioLog2 < 0)
|
||||
|
@ -231,8 +232,8 @@ grTexCalcMemRequired(
|
|||
GrLOD_t lodmin, GrLOD_t lodmax,
|
||||
GrAspectRatio_t aspect, GrTextureFormat_t fmt)
|
||||
{
|
||||
WriteTrace(TraceGlitch, TraceDebug, "lodmin = %d, lodmax: %d aspect: %d fmt: %d", lodmin, lodmax, aspect, fmt);
|
||||
int width, height;
|
||||
LOG("grTexCalcMemRequired(%d, %d, %d, %d)\r\n", lodmin, lodmax, aspect, fmt);
|
||||
if (lodmax != lodmin) WriteTrace(TraceGlitch, TraceWarning, "grTexCalcMemRequired : loading more than one LOD");
|
||||
|
||||
if (aspect < 0)
|
||||
|
@ -413,11 +414,11 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
|||
FxU32 evenOdd,
|
||||
GrTexInfo *info )
|
||||
{
|
||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);
|
||||
int width, height, i, j;
|
||||
int factor;
|
||||
int glformat = 0;
|
||||
int gltexfmt, glpixfmt, glpackfmt;
|
||||
LOG("grTexDownloadMipMap(%d,%d,%d)\r\n", tmu, startAddress, evenOdd);
|
||||
if (info->largeLodLog2 != info->smallLodLog2) WriteTrace(TraceGlitch, TraceWarning, "grTexDownloadMipMap : loading more than one LOD");
|
||||
|
||||
if (info->aspectRatioLog2 < 0)
|
||||
|
@ -679,7 +680,7 @@ grTexSource( GrChipID_t tmu,
|
|||
FxU32 evenOdd,
|
||||
GrTexInfo *info )
|
||||
{
|
||||
LOG("grTexSource(%d,%d,%d)\r\n", tmu, startAddress, evenOdd);
|
||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);
|
||||
|
||||
if (tmu == GR_TMU1 || nbTextureUnits <= 2)
|
||||
{
|
||||
|
@ -762,7 +763,7 @@ grTexDetailControl(
|
|||
float detail_max
|
||||
)
|
||||
{
|
||||
LOG("grTexDetailControl(%d,%d,%d,%d)\r\n", tmu, lod_bias, detail_scale, detail_max);
|
||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, lod_bias: %d detail_scale: %d detail_max: %d", tmu, lod_bias, detail_scale, detail_max);
|
||||
if (lod_bias != 31 && detail_scale != 7)
|
||||
{
|
||||
if (!lod_bias && !detail_scale && !detail_max) return;
|
||||
|
@ -782,7 +783,7 @@ grTexDetailControl(
|
|||
FX_ENTRY void FX_CALL
|
||||
grTexLodBiasValue(GrChipID_t tmu, float bias )
|
||||
{
|
||||
LOG("grTexLodBiasValue(%d,%f)\r\n", tmu, bias);
|
||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, bias: %f", tmu, bias);
|
||||
}
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
|
@ -792,7 +793,7 @@ grTexFilterMode(
|
|||
GrTextureFilterMode_t magfilter_mode
|
||||
)
|
||||
{
|
||||
LOG("grTexFilterMode(%d,%d,%d)\r\n", tmu, minfilter_mode, magfilter_mode);
|
||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, bias: %d magfilter_mode: %d", tmu, minfilter_mode, magfilter_mode);
|
||||
if (tmu == GR_TMU1 || nbTextureUnits <= 2)
|
||||
{
|
||||
if (tmu == GR_TMU1 && nbTextureUnits <= 2) return;
|
||||
|
@ -827,7 +828,7 @@ grTexClampMode(
|
|||
GrTextureClampMode_t t_clampmode
|
||||
)
|
||||
{
|
||||
LOG("grTexClampMode(%d, %d, %d)\r\n", tmu, s_clampmode, t_clampmode);
|
||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, s_clampmode: %d t_clampmode: %d", tmu, s_clampmode, t_clampmode);
|
||||
if (tmu == GR_TMU1 || nbTextureUnits <= 2)
|
||||
{
|
||||
if (tmu == GR_TMU1 && nbTextureUnits <= 2) return;
|
||||
|
|
|
@ -0,0 +1,415 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "glitchmain.h"
|
||||
|
||||
#undef glActiveTexture
|
||||
#undef glBindTexture
|
||||
#undef glBlendEquation
|
||||
#undef glBlendEquationSeparate
|
||||
#undef glBlendFunc
|
||||
#undef glBlendFuncSeparate
|
||||
#undef glClearColor
|
||||
#undef glClearDepthf
|
||||
#undef glCullFace
|
||||
#undef glDepthFunc
|
||||
#undef glDepthMask
|
||||
#undef glDepthRangef
|
||||
#undef glDisable
|
||||
#undef glEnable
|
||||
#undef glFrontFace
|
||||
#undef glPolygonOffset
|
||||
#undef glScissor
|
||||
#undef glUseProgram
|
||||
#undef glViewport
|
||||
|
||||
void vbo_draw();
|
||||
|
||||
void cache_glActiveTexture (GLenum texture)
|
||||
{
|
||||
static GLenum cached_texture;
|
||||
|
||||
if(texture != cached_texture)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "texture: %d",texture);
|
||||
vbo_draw();
|
||||
glActiveTexture(texture);
|
||||
cached_texture = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - texture: %d",texture);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glBindTexture (GLenum target, GLuint texture)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "target: %d texture: %d",target, texture);
|
||||
vbo_draw();
|
||||
glBindTexture(target, texture);
|
||||
}
|
||||
|
||||
void cache_glBlendEquation ( GLenum mode )
|
||||
{
|
||||
static GLenum cached_mode;
|
||||
|
||||
if(mode != cached_mode)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "mode: %d",mode);
|
||||
vbo_draw();
|
||||
glBlendEquation(mode);
|
||||
cached_mode = mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - mode: %d",mode);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha)
|
||||
{
|
||||
static GLenum cached_modeRGB;
|
||||
static GLenum cached_modeAlpha;
|
||||
|
||||
if(modeRGB != cached_modeRGB || modeAlpha != cached_modeAlpha)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "modeRGB: %d cached_modeAlpha: %d",modeRGB, cached_modeAlpha);
|
||||
vbo_draw();
|
||||
glBlendEquationSeparate(modeRGB, modeAlpha);
|
||||
cached_modeRGB = modeRGB;
|
||||
cached_modeAlpha = modeAlpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - modeRGB: %d cached_modeAlpha: %d",modeRGB, cached_modeAlpha);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void cache_glBlendFunc (GLenum sfactor, GLenum dfactor)
|
||||
{
|
||||
static GLenum cached_sfactor;
|
||||
static GLenum cached_dfactor;
|
||||
|
||||
if(sfactor != cached_sfactor || dfactor != cached_dfactor)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "sfactor: %d dfactor: %d",sfactor, dfactor);
|
||||
vbo_draw();
|
||||
glBlendFunc(sfactor, dfactor);
|
||||
cached_sfactor = sfactor;
|
||||
cached_dfactor = dfactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - sfactor: %d dfactor: %d",sfactor, dfactor);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
|
||||
{
|
||||
static GLenum cached_BlendFuncSeparate_srcRGB;
|
||||
static GLenum cached_BlendFuncSeparate_dstRGB;
|
||||
static GLenum cached_BlendFuncSeparate_srcAlpha;
|
||||
static GLenum cached_BlendFuncSeparate_dstAlpha;
|
||||
|
||||
if(srcRGB != cached_BlendFuncSeparate_srcRGB || dstRGB != cached_BlendFuncSeparate_dstRGB || srcAlpha != cached_BlendFuncSeparate_srcAlpha || dstAlpha != cached_BlendFuncSeparate_dstAlpha)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "srcRGB: %d dstRGB: %d srcAlpha: %d dstAlpha: %d",srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
vbo_draw();
|
||||
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
cached_BlendFuncSeparate_srcRGB = srcRGB;
|
||||
cached_BlendFuncSeparate_dstRGB = dstRGB;
|
||||
cached_BlendFuncSeparate_srcAlpha = srcAlpha;
|
||||
cached_BlendFuncSeparate_dstAlpha = dstAlpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - srcRGB: %d dstRGB: %d srcAlpha: %d dstAlpha: %d",srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glClearDepthf (GLclampf depth)
|
||||
{
|
||||
static GLclampf cached_depth;
|
||||
|
||||
if(depth != cached_depth)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "depth: %d",depth);
|
||||
vbo_draw();
|
||||
glClearDepthf(depth);
|
||||
cached_depth = depth;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - depth: %d",depth);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glCullFace (GLenum mode)
|
||||
{
|
||||
static GLenum cached_CullFace_mode;
|
||||
|
||||
if(mode != cached_CullFace_mode)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "mode: %d",mode);
|
||||
vbo_draw();
|
||||
glCullFace(mode);
|
||||
cached_CullFace_mode = mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - mode: %d",mode);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glDepthFunc (GLenum func)
|
||||
{
|
||||
static GLenum cached_func;
|
||||
|
||||
if(func != cached_func)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "func: %d",func);
|
||||
vbo_draw();
|
||||
glDepthFunc(func);
|
||||
cached_func = func;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - func: %d",func);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glDepthMask (GLboolean flag)
|
||||
{
|
||||
static GLboolean cached_DepthMask_flag;
|
||||
|
||||
if(flag != cached_DepthMask_flag)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "flag: %d",(int)flag);
|
||||
vbo_draw();
|
||||
glDepthMask(flag);
|
||||
cached_DepthMask_flag = flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - flag: %d",(int)flag);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glDepthRangef (GLclampf zNear, GLclampf zFar)
|
||||
{
|
||||
static GLclampf cached_zNear;
|
||||
static GLclampf cached_zFar;
|
||||
if(zNear != cached_zNear || zFar != cached_zFar)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "zNear: %d zFar: %d",zNear, zFar);
|
||||
vbo_draw();
|
||||
glDepthRangef(zNear, zFar);
|
||||
cached_zNear = zNear;
|
||||
cached_zFar = zFar;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - zNear: %d zFar: %d",zNear, zFar);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cache_glEnableDisableItem (GLenum cap, bool enable, bool & cached_state, const char * StateName)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
if(!cached_state)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "glEnable(%s)",StateName);
|
||||
vbo_draw();
|
||||
glEnable(cap);
|
||||
cached_state = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - glEnable(%s)",StateName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cached_state)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "glDisable(%s)",StateName);
|
||||
vbo_draw();
|
||||
glDisable(cap);
|
||||
cached_state = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - glEnable(%s)",StateName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glEnableDisable (GLenum cap, bool enable)
|
||||
{
|
||||
static bool cached_BLEND = false;
|
||||
static bool cached_CULL_FACE = false;
|
||||
static bool cached_DEPTH_TEST = false;
|
||||
static bool cached_DITHER = false;
|
||||
static bool cached_POLYGON_OFFSET_FILL = false;
|
||||
static bool cached_SAMPLE_ALPHA_TO_COVERAGE = false;
|
||||
static bool cached_SAMPLE_COVERAGE = false;
|
||||
static bool cached_SCISSOR_TEST = false;
|
||||
static bool cached_STENCIL_TEST = false;
|
||||
|
||||
if(cap == GL_BLEND) { cache_glEnableDisableItem(cap, enable, cached_BLEND, "GL_BLEND"); }
|
||||
else if(cap == GL_CULL_FACE) { cache_glEnableDisableItem(cap, enable, cached_CULL_FACE, "GL_CULL_FACE"); }
|
||||
else if(cap == GL_DEPTH_TEST) { cache_glEnableDisableItem(cap, enable, cached_DEPTH_TEST, "GL_DEPTH_TEST"); }
|
||||
else if(cap == GL_DITHER) { cache_glEnableDisableItem(cap, enable, cached_DITHER, "GL_DITHER"); }
|
||||
else if(cap == GL_POLYGON_OFFSET_FILL) { cache_glEnableDisableItem(cap, enable, cached_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL"); }
|
||||
else if(cap == GL_SAMPLE_ALPHA_TO_COVERAGE) { cache_glEnableDisableItem(cap, enable, cached_SAMPLE_ALPHA_TO_COVERAGE, "GL_SAMPLE_ALPHA_TO_COVERAGE"); }
|
||||
else if(cap == GL_SAMPLE_COVERAGE) { cache_glEnableDisableItem(cap, enable, cached_SAMPLE_COVERAGE, "GL_SAMPLE_COVERAGE"); }
|
||||
else if(cap == GL_SCISSOR_TEST) { cache_glEnableDisableItem(cap, enable, cached_SCISSOR_TEST, "GL_SCISSOR_TEST"); }
|
||||
else if(cap == GL_STENCIL_TEST) { cache_glEnableDisableItem(cap, enable, cached_STENCIL_TEST, "GL_STENCIL_TEST"); }
|
||||
else
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "glEnable(%d)",cap);
|
||||
vbo_draw();
|
||||
glEnable(cap);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "glDisable(%d)",cap);
|
||||
vbo_draw();
|
||||
glDisable(cap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glFrontFace (GLenum mode)
|
||||
{
|
||||
static GLenum cached_FrontFace_mode;
|
||||
if(mode != cached_FrontFace_mode)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "mode: %d",mode);
|
||||
vbo_draw();
|
||||
glFrontFace(mode);
|
||||
cached_FrontFace_mode = mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - mode: %d",mode);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glPolygonOffset (GLfloat factor, GLfloat units)
|
||||
{
|
||||
static GLfloat cached_factor;
|
||||
static GLfloat cached_units;
|
||||
if(factor != cached_factor || units != cached_units)
|
||||
{
|
||||
vbo_draw();
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "factor: %f units: %f",factor, units);
|
||||
glPolygonOffset(factor, units);
|
||||
cached_factor = factor;
|
||||
cached_units = units;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - factor: %f units: %f",factor, units);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
|
||||
{
|
||||
static GLclampf cached_red, cached_green, cached_blue, cached_alpha;
|
||||
|
||||
if(red != cached_red || green != cached_green || blue != cached_blue || alpha != cached_alpha)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "red: %f, green: %f, blue: %f, alpha: %f", red, green, blue, alpha);
|
||||
vbo_draw();
|
||||
glClearColor(red, green, blue, alpha);
|
||||
cached_red = red;
|
||||
cached_green = green;
|
||||
cached_blue = blue;
|
||||
cached_alpha = alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - red: %f, green: %f, blue: %f, alpha: %f", red, green, blue, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glScissor (GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
{
|
||||
static GLint cached_x, cached_y;
|
||||
static GLsizei cached_width, cached_height;
|
||||
|
||||
if(x != cached_x || y != cached_y || width != cached_width || height != cached_height)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "x: %d, y: %d, width: %d, height: %d", x, y, width, height);
|
||||
vbo_draw();
|
||||
glScissor(x, y, width, height);
|
||||
cached_x = x;
|
||||
cached_y = y;
|
||||
cached_width = width;
|
||||
cached_height = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - x: %d, y: %d, width: %d, height: %d", x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glUseProgram (GLuint program)
|
||||
{
|
||||
static GLuint cached_program;
|
||||
if(program != cached_program)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "program: %d", program);
|
||||
vbo_draw();
|
||||
glUseProgram(program);
|
||||
cached_program = program;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "Ignored - program: %d", program);
|
||||
}
|
||||
}
|
||||
|
||||
void cache_glViewport (GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
{
|
||||
static GLint cached_x = 0, cached_y = 0;
|
||||
static GLsizei cached_width = 0, cached_height = 0;
|
||||
|
||||
if(x != cached_x || y != cached_y || width != cached_width || height != cached_height)
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "x: %d, y: %d, width: %d, height: %d", x, y, width, height);
|
||||
vbo_draw();
|
||||
glViewport(x, y, width, height);
|
||||
cached_x = x;
|
||||
cached_y = y;
|
||||
cached_width = width;
|
||||
cached_height = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceOGLWrapper, TraceDebug, "ignored x: %d, y: %d, width: %d, height: %d", x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
#include "opengl.h"
|
||||
void vbo_draw();
|
||||
|
||||
void cache_glActiveTexture (GLenum texture);
|
||||
void cache_glBindTexture (GLenum target, GLuint texture);
|
||||
void cache_glBlendEquation ( GLenum mode );
|
||||
void cache_glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
|
||||
void cache_glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
void cache_glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
void cache_glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
void cache_glClearDepthf (GLclampf depth);
|
||||
void cache_glCullFace (GLenum mode);
|
||||
void cache_glDepthFunc (GLenum func);
|
||||
void cache_glDepthMask (GLboolean flag);
|
||||
void cache_glDepthRangef (GLclampf zNear, GLclampf zFar);
|
||||
void cache_glEnableDisable (GLenum cap, bool enable);
|
||||
void cache_glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
void cache_glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void cache_glUseProgram (GLuint program);
|
||||
void cache_glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
#define glActiveTexture(texture) cache_glActiveTexture(texture)
|
||||
#define glBindTexture(target, texture) cache_glBindTexture(target, texture)
|
||||
#define glBlendEquation(mode) cache_glBlendEquation(mode)
|
||||
#define glBlendEquationSeparate(modeRGB, modeAlpha) cache_glBlendEquationSeparate(modeRGB, modeAlpha)
|
||||
#define glBlendFunc(sfactor, dfactor) cache_glBlendFunc(sfactor, dfactor)
|
||||
#define glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha) cache_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha)
|
||||
#define glClearColor(red, green, blue, alpha) cache_glClearColor(red, green, blue, alpha)
|
||||
#define glClearDepthf(depth) cache_glClearDepthf(depth)
|
||||
#define glCullFace(mode) cache_glCullFace(mode)
|
||||
#define glDepthFunc(func) cache_glDepthFunc(func)
|
||||
#define glDepthMask(flag) cache_glDepthMask(flag)
|
||||
#define glDepthRangef(zNear, zFar) cache_glDepthRangef(zNear, zFar)
|
||||
#define glDisable(cap) cache_glEnableDisable(cap, false)
|
||||
#define glEnable(cap) cache_glEnableDisable(cap, true)
|
||||
#define glFrontFace(mode) cache_glFrontFace(mode)
|
||||
#define glPolygonOffset(factor, units) cache_glPolygonOffset(factor, units)
|
||||
#define glScissor(x, y, width, height) cache_glScissor(x, y, width, height)
|
||||
#define glUseProgram(program) cache_glUseProgram(program)
|
||||
#define glViewport(x, y, width, height) cache_glViewport(x, y, width, height)
|
||||
|
|
@ -17,7 +17,9 @@ extern int dumping;
|
|||
|
||||
typedef struct _wrapper_config
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int res;
|
||||
#endif
|
||||
int fbo;
|
||||
int anisofilter;
|
||||
int vram_size;
|
||||
|
@ -117,6 +119,17 @@ extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
|
|||
extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
|
||||
extern PFNGLSECONDARYCOLOR3FPROC glSecondaryColor3f;
|
||||
#endif
|
||||
void check_compile(GLuint shader);
|
||||
void check_link(GLuint program);
|
||||
void vbo_enable();
|
||||
void vbo_disable();
|
||||
|
||||
//Vertex Attribute Locations
|
||||
#define POSITION_ATTR 0
|
||||
#define COLOUR_ATTR 1
|
||||
#define TEXCOORD_0_ATTR 2
|
||||
#define TEXCOORD_1_ATTR 3
|
||||
#define FOG_ATTR 4
|
||||
|
||||
extern int w_buffer_mode;
|
||||
extern int nbTextureUnits;
|
||||
|
@ -154,11 +167,15 @@ void free_combiners();
|
|||
void compile_shader();
|
||||
void set_lambda();
|
||||
void set_copy_shader();
|
||||
void disable_textureSizes();
|
||||
|
||||
// config functions
|
||||
|
||||
//FX_ENTRY void FX_CALL grConfigWrapperExt(HINSTANCE instance, HWND hwnd);
|
||||
#ifdef _WIN32
|
||||
FX_ENTRY void FX_CALL grConfigWrapperExt(FxI32, FxI32, FxBool, FxBool);
|
||||
#else
|
||||
FX_ENTRY void FX_CALL grConfigWrapperExt(FxI32, FxBool, FxBool);
|
||||
#endif
|
||||
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32*, FxU32*);
|
||||
FX_ENTRY char ** FX_CALL grQueryResolutionsExt(int32_t*);
|
||||
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key);
|
||||
|
|
|
@ -623,15 +623,11 @@ grFinish(void);
|
|||
FX_ENTRY void FX_CALL
|
||||
grFlush(void);
|
||||
|
||||
FX_ENTRY GrContext_t FX_CALL
|
||||
grSstWinOpen(
|
||||
HWND hWnd,
|
||||
GrScreenResolution_t screen_resolution,
|
||||
GrScreenRefresh_t refresh_rate,
|
||||
GrColorFormat_t color_format,
|
||||
GrOriginLocation_t origin_location,
|
||||
int nColBuffers,
|
||||
int nAuxBuffers);
|
||||
#ifdef _WIN32
|
||||
FX_ENTRY GrContext_t FX_CALL grSstWinOpen( HWND hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers);
|
||||
#else
|
||||
FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers);
|
||||
#endif
|
||||
|
||||
FX_ENTRY FxBool FX_CALL
|
||||
grSstWinClose( GrContext_t context );
|
||||
|
|
Loading…
Reference in New Issue