A minor optimization involving pad regions

This commit is contained in:
Josh Yelon 2007-10-26 21:55:13 +00:00
parent 7d695c64c5
commit 1ed7f72e86
2 changed files with 7 additions and 1 deletions

View File

@ -178,7 +178,7 @@ rebuild_bitplanes() {
}
int bitplane_x = _x_size;
int bitplane_y = _y_size;
if (!glgsg->get_supports_tex_non_pow2()) {
if (textures_power_2 != ATS_none) {
bitplane_x = Texture::up_to_power_2(bitplane_x);
bitplane_y = Texture::up_to_power_2(bitplane_y);
}
@ -282,6 +282,7 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
// Bind the texture to the slot.
tex->set_x_size(_rb_size_x);
tex->set_y_size(_rb_size_y);
tex->set_pad_size(_rb_size_x - _x_size, _rb_size_y - _y_size);
if (attachpoint == GL_DEPTH_ATTACHMENT_EXT) {
tex->set_format(Texture::F_depth_stencil);
TextureContext *tc = tex->prepare_now(glgsg->get_prepared_objects(), glgsg);

View File

@ -7157,6 +7157,11 @@ upload_texture_image(CLP(TextureContext) *gtc,
default:
if (image_compression == Texture::CM_off) {
if (n==0) {
// It's unfortunate that we can't adjust the width, too,
// but TexSubImage2D doesn't accept a row-stride parameter.
height = tex->get_y_size() - tex->get_pad_y_size();
}
GLP(TexSubImage2D)(page_target, n - mipmap_bias, 0, 0, width, height,
external_format, component_type, image_ptr);
} else {