mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
glgsg: Slight optimization, don't get texture type more than once
This commit is contained in:
parent
967fbbc49e
commit
42d292ee17
@ -12846,15 +12846,14 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
||||
image = tex->get_uncompressed_ram_image();
|
||||
}
|
||||
|
||||
bool is_buffer_texture = tex->get_texture_type() == Texture::TT_buffer_texture;
|
||||
|
||||
Texture::TextureType texture_type = tex->get_texture_type();
|
||||
Texture::CompressionMode image_compression;
|
||||
if (image.is_null()) {
|
||||
image_compression = Texture::CM_off;
|
||||
} else {
|
||||
image_compression = tex->get_ram_image_compression();
|
||||
|
||||
if (is_buffer_texture ||
|
||||
if (texture_type == Texture::TT_buffer_texture ||
|
||||
!get_supports_compressed_texture_format(image_compression)) {
|
||||
image = tex->get_uncompressed_ram_image();
|
||||
image_compression = Texture::CM_off;
|
||||
@ -12874,7 +12873,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
||||
// If we'll use immutable texture storage, we have to pick a sized image
|
||||
// format.
|
||||
bool force_sized = (gl_immutable_texture_storage && _supports_tex_storage) ||
|
||||
(is_buffer_texture);
|
||||
(texture_type == Texture::TT_buffer_texture);
|
||||
|
||||
GLint internal_format = get_internal_image_format(tex, force_sized);
|
||||
GLint external_format = get_external_image_format(tex);
|
||||
@ -12903,7 +12902,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
||||
int max_dimension_y;
|
||||
int max_dimension_z;
|
||||
|
||||
switch (tex->get_texture_type()) {
|
||||
switch (texture_type) {
|
||||
case Texture::TT_3d_texture:
|
||||
max_dimension_x = _max_3d_texture_dimension;
|
||||
max_dimension_y = _max_3d_texture_dimension;
|
||||
@ -13008,7 +13007,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
GLenum target = get_texture_target(tex->get_texture_type());
|
||||
GLenum target = get_texture_target(texture_type);
|
||||
uses_mipmaps = (uses_mipmaps && !gl_ignore_mipmaps) || gl_force_mipmaps;
|
||||
#ifndef OPENGLES
|
||||
if (target == GL_TEXTURE_BUFFER) {
|
||||
@ -13184,7 +13183,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
||||
<< ", uses_mipmaps = " << uses_mipmaps << "\n";
|
||||
}
|
||||
|
||||
switch (tex->get_texture_type()) {
|
||||
switch (texture_type) {
|
||||
case Texture::TT_buffer_texture:
|
||||
// Won't get here, but squelch compiler warning
|
||||
case Texture::TT_1d_texture:
|
||||
@ -13232,7 +13231,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
||||
}
|
||||
|
||||
bool success = true;
|
||||
if (tex->get_texture_type() == Texture::TT_cube_map) {
|
||||
if (texture_type == Texture::TT_cube_map) {
|
||||
// A cube map must load six different 2-d images (which are stored as the
|
||||
// six pages of the system ram image).
|
||||
if (!_supports_cube_map) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user