diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index fc4ac4e7ad..8cea76df6c 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -742,7 +742,7 @@ cp_add_mat_spec(ShaderMatSpec &spec) { spec._cache_offset[p] = offset + begin[p] * size; } if (spec._func == SMF_shader_input_ptr) { - _mat_scratch_size = std::max(_mat_scratch_size, spec._array_count); + _mat_scratch_size = std::max(_mat_scratch_size, spec._array_count * ((spec._num_components + 3) / 4)); // We specify SSD_frame because a PTA may be modified by the app from // frame to frame, and we have no way to know. So, we must respecify a