mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
Fixed a bug when trying to use windows sofware renderer
This commit is contained in:
parent
4ada6f355d
commit
172f8f7386
@ -2763,8 +2763,10 @@ extract_texture_data(Texture *tex) {
|
|||||||
// Also get the mipmap levels.
|
// Also get the mipmap levels.
|
||||||
GLint num_expected_levels = tex->get_expected_num_mipmap_levels();
|
GLint num_expected_levels = tex->get_expected_num_mipmap_levels();
|
||||||
GLint highest_level = num_expected_levels;
|
GLint highest_level = num_expected_levels;
|
||||||
GLP(GetTexParameteriv)(target, GL_TEXTURE_MAX_LEVEL, &highest_level);
|
if (is_at_least_version(1, 2)) {
|
||||||
highest_level = min(highest_level, num_expected_levels);
|
GLP(GetTexParameteriv)(target, GL_TEXTURE_MAX_LEVEL, &highest_level);
|
||||||
|
highest_level = min(highest_level, num_expected_levels);
|
||||||
|
}
|
||||||
for (int n = 1; n <= highest_level; ++n) {
|
for (int n = 1; n <= highest_level; ++n) {
|
||||||
if (!extract_texture_image(image, page_size, tex, target, page_target,
|
if (!extract_texture_image(image, page_size, tex, target, page_target,
|
||||||
type, compression, n)) {
|
type, compression, n)) {
|
||||||
@ -7114,6 +7116,7 @@ upload_texture_image(CLP(TextureContext) *gtc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int highest_level = 0;
|
int highest_level = 0;
|
||||||
|
report_my_gl_errors();
|
||||||
|
|
||||||
|
|
||||||
if (!gtc->_already_applied ||
|
if (!gtc->_already_applied ||
|
||||||
@ -7210,6 +7213,7 @@ upload_texture_image(CLP(TextureContext) *gtc,
|
|||||||
|
|
||||||
highest_level = n;
|
highest_level = n;
|
||||||
}
|
}
|
||||||
|
report_my_gl_errors();
|
||||||
} else {
|
} else {
|
||||||
// We can reload the image over the previous image, possibly
|
// We can reload the image over the previous image, possibly
|
||||||
// saving on texture memory fragmentation.
|
// saving on texture memory fragmentation.
|
||||||
@ -7288,21 +7292,27 @@ upload_texture_image(CLP(TextureContext) *gtc,
|
|||||||
|
|
||||||
highest_level = n;
|
highest_level = n;
|
||||||
}
|
}
|
||||||
|
report_my_gl_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (load_ram_mipmaps) {
|
report_my_gl_errors();
|
||||||
// By the time we get here, we have successfully loaded a certain
|
if (is_at_least_version(1, 2)) {
|
||||||
// number of mipmap levels. Tell the GL that's all it's going to
|
if (load_ram_mipmaps) {
|
||||||
// get.
|
// By the time we get here, we have successfully loaded a certain
|
||||||
GLP(TexParameteri)(texture_target, GL_TEXTURE_MAX_LEVEL, highest_level - mipmap_bias);
|
// number of mipmap levels. Tell the GL that's all it's going to
|
||||||
|
// get.
|
||||||
|
cerr << " 1 texture_target=" << texture_target << " hi level = " << highest_level << " mip bias = " << mipmap_bias << "\n";
|
||||||
|
GLP(TexParameteri)(texture_target, GL_TEXTURE_MAX_LEVEL, highest_level - mipmap_bias);
|
||||||
|
|
||||||
} else if (uses_mipmaps) {
|
} else if (uses_mipmaps) {
|
||||||
// Since the mipmap levels were auto-generated and are therefore
|
// Since the mipmap levels were auto-generated and are therefore
|
||||||
// complete, make sure the GL doesn't remember some previous value
|
// complete, make sure the GL doesn't remember some previous value
|
||||||
// for GL_TEXTURE_MAX_LEVEL from the above call--set it to the
|
// for GL_TEXTURE_MAX_LEVEL from the above call--set it to the
|
||||||
// full count of mipmap levels.
|
// full count of mipmap levels.
|
||||||
GLP(TexParameteri)(texture_target, GL_TEXTURE_MAX_LEVEL, tex->get_expected_num_mipmap_levels() - mipmap_bias - 1);
|
GLP(TexParameteri)(texture_target, GL_TEXTURE_MAX_LEVEL, tex->get_expected_num_mipmap_levels() - mipmap_bias - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
report_my_gl_errors();
|
||||||
|
|
||||||
// Report the error message explicitly if the GL texture creation
|
// Report the error message explicitly if the GL texture creation
|
||||||
// failed.
|
// failed.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user