mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
Various GL tweaks
This commit is contained in:
parent
8764cb8222
commit
a24531ff7b
@ -1277,7 +1277,7 @@ open_buffer() {
|
||||
|
||||
// Actually, let's always get a colour buffer for now until we
|
||||
// figure out why Intel HD Graphics cards complain otherwise.
|
||||
if (_fb_properties.get_color_bits() == 0) {
|
||||
if (gl_force_fbo_color && _fb_properties.get_color_bits() == 0) {
|
||||
_fb_properties.set_color_bits(1);
|
||||
}
|
||||
|
||||
|
@ -11116,7 +11116,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
||||
gtc->_height = height;
|
||||
gtc->_depth = depth;
|
||||
|
||||
gtc->update_data_size_bytes(get_texture_memory_size(tex));
|
||||
gtc->update_data_size_bytes(get_texture_memory_size(gtc));
|
||||
}
|
||||
|
||||
nassertr(gtc->_has_storage, false);
|
||||
@ -11665,7 +11665,8 @@ upload_simple_texture(CLP(TextureContext) *gtc) {
|
||||
// currently-selected texture).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
size_t CLP(GraphicsStateGuardian)::
|
||||
get_texture_memory_size(Texture *tex) {
|
||||
get_texture_memory_size(CLP(TextureContext) *gtc) {
|
||||
Texture *tex = gtc->get_texture();
|
||||
#ifdef OPENGLES // Texture querying not supported on OpenGL ES.
|
||||
int width = tex->get_x_size();
|
||||
int height = tex->get_y_size();
|
||||
@ -11692,10 +11693,6 @@ get_texture_memory_size(Texture *tex) {
|
||||
return tex->get_expected_ram_image_size();
|
||||
}
|
||||
|
||||
GLint minfilter;
|
||||
glGetTexParameteriv(target, GL_TEXTURE_MIN_FILTER, &minfilter);
|
||||
bool has_mipmaps = is_mipmap_filter(minfilter);
|
||||
|
||||
clear_my_gl_errors();
|
||||
|
||||
GLint internal_format;
|
||||
@ -11755,7 +11752,7 @@ get_texture_memory_size(Texture *tex) {
|
||||
#endif // OPENGLES
|
||||
|
||||
size_t result = num_bytes * width * height * depth * scale;
|
||||
if (has_mipmaps) {
|
||||
if (gtc->_uses_mipmaps) {
|
||||
result = (result * 4) / 3;
|
||||
}
|
||||
|
||||
@ -11770,7 +11767,7 @@ get_texture_memory_size(Texture *tex) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CLP(GraphicsStateGuardian)::
|
||||
check_nonresident_texture(BufferContextChain &chain) {
|
||||
#ifndef OPENGLES // Residency queries not supported by OpenGL ES.
|
||||
#if defined(SUPPORT_FIXED_FUNCTION) && !defined(OPENGLES) // Residency queries not supported by OpenGL ES.
|
||||
size_t num_textures = chain.get_count();
|
||||
if (num_textures == 0) {
|
||||
return;
|
||||
|
@ -548,7 +548,7 @@ protected:
|
||||
Texture::CompressionMode image_compression);
|
||||
bool upload_simple_texture(CLP(TextureContext) *gtc);
|
||||
|
||||
size_t get_texture_memory_size(Texture *tex);
|
||||
size_t get_texture_memory_size(CLP(TextureContext) *gtc);
|
||||
void check_nonresident_texture(BufferContextChain &chain);
|
||||
bool do_extract_texture_data(CLP(TextureContext) *gtc);
|
||||
bool extract_texture_image(PTA_uchar &image, size_t &page_size,
|
||||
|
@ -187,6 +187,12 @@ ConfigVariableBool gl_force_depth_stencil
|
||||
("gl-force-depth-stencil", false,
|
||||
PRC_DESC("Temporary hack variable 7x00 vs 8x00 nVidia bug. See glGraphicsStateGuardian_src.cxx."));
|
||||
|
||||
ConfigVariableBool gl_force_fbo_color
|
||||
("gl-force-fbo-color", true,
|
||||
PRC_DESC("This is set to true to force all FBOs to have at least one "
|
||||
"color attachment. This is to work around an Intel driver "
|
||||
"issue. Set to false to allow depth-only FBOs."));
|
||||
|
||||
ConfigVariableBool gl_check_errors
|
||||
("gl-check-errors", false,
|
||||
PRC_DESC("Regularly call glGetError() to check for OpenGL errors. "
|
||||
|
@ -65,6 +65,7 @@ extern ConfigVariableBool gl_debug_object_labels;
|
||||
extern ConfigVariableBool gl_debug_buffers;
|
||||
extern ConfigVariableBool gl_finish;
|
||||
extern ConfigVariableBool gl_force_depth_stencil;
|
||||
extern ConfigVariableBool gl_force_fbo_color;
|
||||
extern ConfigVariableBool gl_check_errors;
|
||||
extern ConfigVariableBool gl_force_flush;
|
||||
extern ConfigVariableBool gl_separate_specular_color;
|
||||
|
Loading…
x
Reference in New Issue
Block a user