From aa4a73af7d695cc85d3cc4a504c73d3130da3401 Mon Sep 17 00:00:00 2001 From: tobspr Date: Sat, 20 Feb 2016 19:11:23 +0100 Subject: [PATCH 1/3] Support for imageCubeArray, remove _EXT suffix This PR adds support for the imageCubeArray GLSL type (GL_IMAGE_CUBE_MAP_ARRAY). Also, the _EXT suffix is removed from the GL_IMAGE types. --- panda/src/glstuff/glShaderContext_src.cxx | 39 ++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 94cef280d7..708347a119 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -1462,24 +1462,27 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) { return; } #ifndef OPENGLES - case GL_IMAGE_1D_EXT: - case GL_IMAGE_2D_EXT: - case GL_IMAGE_3D_EXT: - case GL_IMAGE_CUBE_EXT: - case GL_IMAGE_2D_ARRAY_EXT: - case GL_IMAGE_BUFFER_EXT: - case GL_INT_IMAGE_1D_EXT: - case GL_INT_IMAGE_2D_EXT: - case GL_INT_IMAGE_3D_EXT: - case GL_INT_IMAGE_CUBE_EXT: - case GL_INT_IMAGE_2D_ARRAY_EXT: - case GL_INT_IMAGE_BUFFER_EXT: - case GL_UNSIGNED_INT_IMAGE_1D_EXT: - case GL_UNSIGNED_INT_IMAGE_2D_EXT: - case GL_UNSIGNED_INT_IMAGE_3D_EXT: - case GL_UNSIGNED_INT_IMAGE_CUBE_EXT: - case GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT: - case GL_UNSIGNED_INT_IMAGE_BUFFER_EXT: + case GL_IMAGE_1D: + case GL_IMAGE_2D: + case GL_IMAGE_3D: + case GL_IMAGE_CUBE: + case GL_IMAGE_2D_ARRAY: + case GL_IMAGE_CUBE_MAP_ARRAY: + case GL_IMAGE_BUFFER: + case GL_INT_IMAGE_1D: + case GL_INT_IMAGE_2D: + case GL_INT_IMAGE_3D: + case GL_INT_IMAGE_CUBE: + case GL_INT_IMAGE_2D_ARRAY: + case GL_INT_IMAGE_CUBE_MAP_ARRAY: + case GL_INT_IMAGE_BUFFER: + case GL_UNSIGNED_INT_IMAGE_1D: + case GL_UNSIGNED_INT_IMAGE_2D: + case GL_UNSIGNED_INT_IMAGE_3D: + 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 // and then forget about it. _glgsg->_glUniform1i(p, _glsl_img_inputs.size()); From 1795a7c8dd86c70e485ff0eefc93f502ca8f7786 Mon Sep 17 00:00:00 2001 From: tobspr Date: Sat, 20 Feb 2016 19:55:49 +0100 Subject: [PATCH 2/3] Work arround timestamp precision in ramdisks This fixes the timestamp precision when mounting RamDisks, by ensuring that the modified timestamp is always greater than the original timestamp. --- panda/src/express/virtualFileMountRamdisk.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/panda/src/express/virtualFileMountRamdisk.cxx b/panda/src/express/virtualFileMountRamdisk.cxx index 9f10931985..244f5c79df 100644 --- a/panda/src/express/virtualFileMountRamdisk.cxx +++ b/panda/src/express/virtualFileMountRamdisk.cxx @@ -235,7 +235,13 @@ open_write_file(const Filename &file, bool truncate) { if (truncate) { // Reset to an empty 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); @@ -275,7 +281,9 @@ open_read_write_file(const Filename &file, bool truncate) { if (truncate) { // Reset to an empty 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); From 844a284925a97a111f010a53c1c2ff6627689cea Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 22 Feb 2016 19:47:08 +0100 Subject: [PATCH 3/3] Fix mipmap level count calculation for texture arrays --- panda/src/gobj/texture.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 539195dcfd..e61f272d86 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -5672,7 +5672,10 @@ do_set_simple_ram_image(CData *cdata, CPTA_uchar image, int x_size, int y_size) //////////////////////////////////////////////////////////////////// int Texture:: 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; while (size > 1) { size >>= 1;