update_texture()

This commit is contained in:
David Rose 2008-09-04 22:16:02 +00:00
parent e499287e8c
commit d6eef63f61
2 changed files with 16 additions and 14 deletions

View File

@ -1497,7 +1497,7 @@ update_texture(TextureContext *tc, bool force) {
if (gtc->was_image_modified() || gltex->num_levels == 0) {
// If the texture image was modified, reload the texture.
bool okflag = upload_texture(gtc);
bool okflag = upload_texture(gtc, force);
if (!okflag) {
tinydisplay_cat.error()
<< "Could not load " << *gtc->get_texture() << "\n";
@ -2076,21 +2076,23 @@ apply_texture(TextureContext *tc) {
// the texture has no image.
////////////////////////////////////////////////////////////////////
bool TinyGraphicsStateGuardian::
upload_texture(TinyTextureContext *gtc) {
upload_texture(TinyTextureContext *gtc, bool force) {
Texture *tex = gtc->get_texture();
if (_incomplete_render &&
!tex->has_uncompressed_ram_image() && tex->might_have_ram_image() &&
tex->has_simple_ram_image() &&
!_loader.is_null()) {
// If we don't have the texture data right now, go get it, but in
// the meantime load a temporary simple image in its place.
async_reload_texture(gtc);
if (!tex->has_ram_image()) {
if (gtc->was_simple_image_modified()) {
return upload_simple_texture(gtc);
if (_incomplete_render && !force) {
bool has_image = _supports_compressed_texture ? tex->has_ram_image() : tex->has_uncompressed_ram_image();
if (!has_image && tex->might_have_ram_image() &&
tex->has_simple_ram_image() &&
!_loader.is_null()) {
// If we don't have the texture data right now, go get it, but in
// the meantime load a temporary simple image in its place.
async_reload_texture(gtc);
if (!tex->has_ram_image()) {
if (gtc->was_simple_image_modified()) {
return upload_simple_texture(gtc);
}
return true;
}
return true;
}
}

View File

@ -108,7 +108,7 @@ private:
void set_scissor(float left, float right, float bottom, float top);
bool apply_texture(TextureContext *tc);
bool upload_texture(TinyTextureContext *gtc);
bool upload_texture(TinyTextureContext *gtc, bool force);
bool upload_simple_texture(TinyTextureContext *gtc);
bool setup_gltex(GLTexture *gltex, int x_size, int y_size, int num_levels);
int get_tex_shift(int orig_size);