mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Merge branch 'release/1.9.x'
This commit is contained in:
commit
18533a29bf
@ -32,7 +32,8 @@ CLP(GraphicsBuffer)(GraphicsEngine *engine, GraphicsPipe *pipe,
|
||||
_generate_mipmap_pcollector(_draw_window_pcollector, "Generate mipmaps"),
|
||||
_resolve_multisample_pcollector(_draw_window_pcollector, "Resolve multisamples"),
|
||||
_requested_multisamples(0),
|
||||
_requested_coverage_samples(0)
|
||||
_requested_coverage_samples(0),
|
||||
_rb_context(NULL)
|
||||
{
|
||||
// A FBO doesn't have a back buffer.
|
||||
_draw_buffer_type = RenderBuffer::T_front;
|
||||
@ -50,6 +51,7 @@ CLP(GraphicsBuffer)(GraphicsEngine *engine, GraphicsPipe *pipe,
|
||||
_rb[i] = 0;
|
||||
_rbm[i] = 0;
|
||||
}
|
||||
_rb_data_size_bytes = 0;
|
||||
|
||||
_shared_depth_buffer = 0;
|
||||
_bound_tex_page = -1;
|
||||
@ -246,6 +248,7 @@ rebuild_bitplanes() {
|
||||
} else {
|
||||
glgsg->bind_fbo(0);
|
||||
}
|
||||
_rb_context->set_active(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -273,6 +276,7 @@ rebuild_bitplanes() {
|
||||
rb_resize = true;
|
||||
}
|
||||
_rb_size_z = 1;
|
||||
_rb_data_size_bytes = 0;
|
||||
|
||||
int num_fbos = 1;
|
||||
|
||||
@ -526,6 +530,9 @@ rebuild_bitplanes() {
|
||||
_fb_properties.set_rgba_bits(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
_rb_context->set_active(true);
|
||||
_rb_context->update_data_size_bytes(_rb_data_size_bytes);
|
||||
|
||||
_initial_clear = false;
|
||||
report_my_gl_errors();
|
||||
|
||||
@ -828,6 +835,7 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot,
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_STENCIL_SIZE_EXT, &stencil_size);
|
||||
_fb_properties.set_depth_bits(depth_size);
|
||||
_fb_properties.set_stencil_bits(stencil_size);
|
||||
_rb_data_size_bytes += _rb_size_x * _rb_size_y * ((depth_size + stencil_size) / 8);
|
||||
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
|
||||
@ -851,6 +859,7 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot,
|
||||
glgsg->_glRenderbufferStorage(GL_RENDERBUFFER_EXT, gl_format, _rb_size_x, _rb_size_y);
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_DEPTH_SIZE_EXT, &depth_size);
|
||||
_fb_properties.set_depth_bits(depth_size);
|
||||
_rb_data_size_bytes += _rb_size_x * _rb_size_y * (depth_size / 8);
|
||||
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
|
||||
@ -868,14 +877,17 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot,
|
||||
GLCAT.debug() << "Creating color renderbuffer.\n";
|
||||
glgsg->_glRenderbufferStorage(GL_RENDERBUFFER_EXT, gl_format, _rb_size_x, _rb_size_y);
|
||||
|
||||
GLint red_size = 0, green_size = 0, blue_size = 0, alpha_size = 0;
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_RED_SIZE_EXT, &red_size);
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_GREEN_SIZE_EXT, &green_size);
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_BLUE_SIZE_EXT, &blue_size);
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_ALPHA_SIZE_EXT, &alpha_size);
|
||||
|
||||
if (attachpoint == GL_COLOR_ATTACHMENT0_EXT) {
|
||||
GLint red_size = 0, green_size = 0, blue_size = 0, alpha_size = 0;
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_RED_SIZE_EXT, &red_size);
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_GREEN_SIZE_EXT, &green_size);
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_BLUE_SIZE_EXT, &blue_size);
|
||||
glgsg->_glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_ALPHA_SIZE_EXT, &alpha_size);
|
||||
_fb_properties.set_rgba_bits(red_size, green_size, blue_size, alpha_size);
|
||||
}
|
||||
_rb_data_size_bytes += _rb_size_x * _rb_size_y * ((red_size + green_size + blue_size + alpha_size) / 8);
|
||||
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
glgsg->_glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, attachpoint,
|
||||
GL_RENDERBUFFER_EXT, _rb[slot]);
|
||||
@ -1236,6 +1248,10 @@ open_buffer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_rb_context == NULL) {
|
||||
_rb_context = new BufferContext(&(glgsg->_renderbuffer_residency));
|
||||
}
|
||||
|
||||
// Describe the framebuffer properties of the FBO.
|
||||
//
|
||||
// Unfortunately, we can't currently predict which formats
|
||||
@ -1407,6 +1423,13 @@ open_buffer() {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CLP(GraphicsBuffer)::
|
||||
close_buffer() {
|
||||
_rb_data_size_bytes = 0;
|
||||
if (_rb_context != NULL) {
|
||||
_rb_context->update_data_size_bytes(0);
|
||||
delete _rb_context;
|
||||
_rb_context = NULL;
|
||||
}
|
||||
|
||||
check_host_valid();
|
||||
|
||||
if (_gsg == 0) {
|
||||
@ -1425,13 +1448,14 @@ close_buffer() {
|
||||
_rb[i] = 0;
|
||||
}
|
||||
}
|
||||
// Delete the renderbuffers.
|
||||
// Delete the multisample renderbuffers.
|
||||
for (int i=0; i<RTP_COUNT; i++) {
|
||||
if (_rbm[i] != 0) {
|
||||
glgsg->_glDeleteRenderbuffers(1, &(_rbm[i]));
|
||||
_rb[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
_rb_size_x = 0;
|
||||
_rb_size_y = 0;
|
||||
report_my_gl_errors();
|
||||
|
@ -57,7 +57,6 @@
|
||||
// the buffer will render as if multisamples is 0.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
class EXPCL_GL CLP(GraphicsBuffer) : public GraphicsBuffer {
|
||||
public:
|
||||
CLP(GraphicsBuffer)(GraphicsEngine *engine, GraphicsPipe *pipe,
|
||||
@ -125,6 +124,10 @@ private:
|
||||
GLuint _rb[RTP_COUNT];
|
||||
GLuint _rbm[RTP_COUNT];
|
||||
|
||||
// For memory tracking of renderbuffers.
|
||||
BufferContext *_rb_context;
|
||||
size_t _rb_data_size_bytes;
|
||||
|
||||
// List of textures for which we might have to generate mipmaps
|
||||
// after rendering one frame.
|
||||
typedef pvector<CLP(TextureContext)*> TextureContexts;
|
||||
|
@ -304,7 +304,8 @@ int CLP(GraphicsStateGuardian)::get_driver_shader_version_minor() { return _gl_s
|
||||
////////////////////////////////////////////////////////////////////
|
||||
CLP(GraphicsStateGuardian)::
|
||||
CLP(GraphicsStateGuardian)(GraphicsEngine *engine, GraphicsPipe *pipe) :
|
||||
GraphicsStateGuardian(gl_coordinate_system, engine, pipe)
|
||||
GraphicsStateGuardian(gl_coordinate_system, engine, pipe),
|
||||
_renderbuffer_residency(get_prepared_objects()->get_name(), "renderbuffer")
|
||||
{
|
||||
_error_count = 0;
|
||||
|
||||
@ -2942,6 +2943,8 @@ begin_frame(Thread *current_thread) {
|
||||
if (!GraphicsStateGuardian::begin_frame(current_thread)) {
|
||||
return false;
|
||||
}
|
||||
_renderbuffer_residency.begin_frame(current_thread);
|
||||
|
||||
report_my_gl_errors();
|
||||
|
||||
#ifdef DO_PSTATS
|
||||
@ -3102,6 +3105,8 @@ end_frame(Thread *current_thread) {
|
||||
|
||||
GraphicsStateGuardian::end_frame(current_thread);
|
||||
|
||||
_renderbuffer_residency.end_frame(current_thread);
|
||||
|
||||
// Flush any PCollectors specific to this kind of GSG.
|
||||
_primitive_batches_display_list_pcollector.flush_level();
|
||||
_vertices_display_list_pcollector.flush_level();
|
||||
@ -10971,9 +10976,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
||||
gtc->_width = width;
|
||||
gtc->_height = height;
|
||||
gtc->_depth = depth;
|
||||
}
|
||||
|
||||
if (!image.is_null()) {
|
||||
gtc->update_data_size_bytes(get_texture_memory_size(tex));
|
||||
}
|
||||
|
||||
|
@ -923,6 +923,8 @@ public:
|
||||
UsageTextures _usage_textures;
|
||||
#endif // NDEBUG
|
||||
|
||||
BufferResidencyTracker _renderbuffer_residency;
|
||||
|
||||
static PStatCollector _load_display_list_pcollector;
|
||||
static PStatCollector _primitive_batches_display_list_pcollector;
|
||||
static PStatCollector _vertices_display_list_pcollector;
|
||||
|
@ -1222,6 +1222,11 @@ p_read_object() {
|
||||
}
|
||||
|
||||
return p_read_object();
|
||||
|
||||
default:
|
||||
bam_cat.error()
|
||||
<< "Encountered invalid BamObjectCode 0x" << hex << (int)boc << dec << ".\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
// An object definition in a Bam file consists of a TypeHandle
|
||||
|
Loading…
x
Reference in New Issue
Block a user