From 3a41db130be1fcf68707cc300c9616c47026eba8 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 12 Jan 2021 23:13:02 +0100 Subject: [PATCH] gobj: Fix Texture.set_ram_image_as for 3D and multiview textures Fixes #1095 --- panda/src/gobj/texture.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index d0d69cfda3..d1d76d471c 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -1023,7 +1023,8 @@ set_ram_image_as(CPTA_uchar image, const string &supplied_format) { string format = upcase(supplied_format); // Make sure we can grab something that's uncompressed. - int imgsize = cdata->_x_size * cdata->_y_size; + size_t imgsize = (size_t)cdata->_x_size * (size_t)cdata->_y_size * + (size_t)cdata->_z_size * (size_t)cdata->_num_views; nassertv(image.size() == (size_t)(cdata->_component_width * format.size() * imgsize)); // Check if the format is already what we have internally.