This commit is contained in:
David Rose 2016-02-22 16:02:52 -08:00
commit f30628bde6
3 changed files with 35 additions and 21 deletions

View File

@ -235,7 +235,13 @@ open_write_file(const Filename &file, bool truncate) {
if (truncate) { if (truncate) {
// Reset to an empty string. // Reset to an empty string.
f->_data.str(string()); f->_data.str(string());
f->_timestamp = time(NULL);
// Instead of setting the time, we ensure that we always store a newer time.
// This is a workarround for the case that a file is written twice per
// second, since the timer only has a one second precision. The proper
// solution to fix this would be to switch to a higher precision
// timer everywhere.
f->_timestamp = max(f->_timestamp + 1, time(NULL));
} }
return new OSubStream(&f->_wrapper, 0, 0); return new OSubStream(&f->_wrapper, 0, 0);
@ -275,7 +281,9 @@ open_read_write_file(const Filename &file, bool truncate) {
if (truncate) { if (truncate) {
// Reset to an empty string. // Reset to an empty string.
f->_data.str(string()); f->_data.str(string());
f->_timestamp = time(NULL);
// See open_write_file
f->_timestamp = max(f->_timestamp + 1, time(NULL));
} }
return new SubStream(&f->_wrapper, 0, 0); return new SubStream(&f->_wrapper, 0, 0);

View File

@ -1462,24 +1462,27 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
return; return;
} }
#ifndef OPENGLES #ifndef OPENGLES
case GL_IMAGE_1D_EXT: case GL_IMAGE_1D:
case GL_IMAGE_2D_EXT: case GL_IMAGE_2D:
case GL_IMAGE_3D_EXT: case GL_IMAGE_3D:
case GL_IMAGE_CUBE_EXT: case GL_IMAGE_CUBE:
case GL_IMAGE_2D_ARRAY_EXT: case GL_IMAGE_2D_ARRAY:
case GL_IMAGE_BUFFER_EXT: case GL_IMAGE_CUBE_MAP_ARRAY:
case GL_INT_IMAGE_1D_EXT: case GL_IMAGE_BUFFER:
case GL_INT_IMAGE_2D_EXT: case GL_INT_IMAGE_1D:
case GL_INT_IMAGE_3D_EXT: case GL_INT_IMAGE_2D:
case GL_INT_IMAGE_CUBE_EXT: case GL_INT_IMAGE_3D:
case GL_INT_IMAGE_2D_ARRAY_EXT: case GL_INT_IMAGE_CUBE:
case GL_INT_IMAGE_BUFFER_EXT: case GL_INT_IMAGE_2D_ARRAY:
case GL_UNSIGNED_INT_IMAGE_1D_EXT: case GL_INT_IMAGE_CUBE_MAP_ARRAY:
case GL_UNSIGNED_INT_IMAGE_2D_EXT: case GL_INT_IMAGE_BUFFER:
case GL_UNSIGNED_INT_IMAGE_3D_EXT: case GL_UNSIGNED_INT_IMAGE_1D:
case GL_UNSIGNED_INT_IMAGE_CUBE_EXT: case GL_UNSIGNED_INT_IMAGE_2D:
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT: case GL_UNSIGNED_INT_IMAGE_3D:
case GL_UNSIGNED_INT_IMAGE_BUFFER_EXT: case GL_UNSIGNED_INT_IMAGE_CUBE:
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
case GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY:
case GL_UNSIGNED_INT_IMAGE_BUFFER:
// This won't really change at runtime, so we might as well bind once // This won't really change at runtime, so we might as well bind once
// and then forget about it. // and then forget about it.
_glgsg->_glUniform1i(p, _glsl_img_inputs.size()); _glgsg->_glUniform1i(p, _glsl_img_inputs.size());

View File

@ -6232,7 +6232,10 @@ do_set_simple_ram_image(CData *cdata, CPTA_uchar image, int x_size, int y_size)
*/ */
int Texture:: int Texture::
do_get_expected_num_mipmap_levels(const CData *cdata) const { do_get_expected_num_mipmap_levels(const CData *cdata) const {
int size = max(cdata->_x_size, max(cdata->_y_size, cdata->_z_size)); int size = max(cdata->_x_size, cdata->_y_size);
if (cdata->_texture_type == Texture::TT_3d_texture) {
size = max(size, cdata->_z_size);
}
int count = 1; int count = 1;
while (size > 1) { while (size > 1) {
size >>= 1; size >>= 1;