mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
dxgsg9: don't attempt to restore gamma if it wasn't modified
This commit is contained in:
parent
b656b0bbf9
commit
e13719132b
@ -5269,6 +5269,7 @@ calc_fb_properties(DWORD cformat, DWORD dformat,
|
|||||||
#define GAMMA_1 (255.0 * 256.0)
|
#define GAMMA_1 (255.0 * 256.0)
|
||||||
|
|
||||||
static bool _gamma_table_initialized = false;
|
static bool _gamma_table_initialized = false;
|
||||||
|
static bool _gamma_changed = false;
|
||||||
static unsigned short _original_gamma_table [256 * 3];
|
static unsigned short _original_gamma_table [256 * 3];
|
||||||
|
|
||||||
void _create_gamma_table_dx9 (PN_stdfloat gamma, unsigned short *original_red_table, unsigned short *original_green_table, unsigned short *original_blue_table, unsigned short *red_table, unsigned short *green_table, unsigned short *blue_table) {
|
void _create_gamma_table_dx9 (PN_stdfloat gamma, unsigned short *original_red_table, unsigned short *original_green_table, unsigned short *original_blue_table, unsigned short *red_table, unsigned short *green_table, unsigned short *blue_table) {
|
||||||
@ -5366,6 +5367,7 @@ static_set_gamma(bool restore, PN_stdfloat gamma) {
|
|||||||
|
|
||||||
if (SetDeviceGammaRamp (hdc, ramp)) {
|
if (SetDeviceGammaRamp (hdc, ramp)) {
|
||||||
set = true;
|
set = true;
|
||||||
|
_gamma_changed = !restore;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReleaseDC (nullptr, hdc);
|
ReleaseDC (nullptr, hdc);
|
||||||
@ -5403,8 +5405,10 @@ restore_gamma() {
|
|||||||
void DXGraphicsStateGuardian9::
|
void DXGraphicsStateGuardian9::
|
||||||
atexit_function(void) {
|
atexit_function(void) {
|
||||||
set_cg_device(nullptr);
|
set_cg_device(nullptr);
|
||||||
|
if (_gamma_changed) {
|
||||||
static_set_gamma(true, 1.0f);
|
static_set_gamma(true, 1.0f);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this particular GSG supports the specified Cg Shader
|
* Returns true if this particular GSG supports the specified Cg Shader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user