[Piglit] [PATCH 13/20] msaa: Make a separate Fbo setup() function.

Paul Berry stereotype441 at gmail.com
Tue Jun 5 17:03:23 PDT 2012


This patch splits the function Fbo::set_samples() into two functions,
Fbo::set_samples() (which sets the number of samples and then updates
the framebuffer object to reflect the contents of Fbo::config), and
Fbo::setup() (which simply updates the framebuffer object to reflect
the contents of Fbo::config).  This lets us avoid a clumsy call to
Fbo::set_samples() from Fbo::init().
---
 tests/spec/ext_framebuffer_multisample/common.cpp |   12 +++++++++++-
 tests/spec/ext_framebuffer_multisample/common.h   |    1 +
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp
index 0d96ef2..eae906d 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -129,7 +129,7 @@ Fbo::init(const FboConfig &initial_config)
 {
 	generate();
 	this->config = initial_config;
-	set_samples(initial_config.num_samples);
+	setup();
 }
 
 void
@@ -142,6 +142,16 @@ void
 Fbo::set_samples(int num_samples)
 {
 	this->config.num_samples = num_samples;
+	setup();
+}
+
+/**
+ * Modify the state of the framebuffer object to reflect the state in
+ * this->config.
+ */
+void
+Fbo::setup()
+{
 	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, handle);
 	this->color_tex = 0;
 
diff --git a/tests/spec/ext_framebuffer_multisample/common.h b/tests/spec/ext_framebuffer_multisample/common.h
index 1e8cd85..71adccd 100644
--- a/tests/spec/ext_framebuffer_multisample/common.h
+++ b/tests/spec/ext_framebuffer_multisample/common.h
@@ -81,6 +81,7 @@ public:
 	void init(const FboConfig &initial_config);
 	void generate();
 	void set_samples(int num_samples);
+	void setup();
 
 	void set_viewport();
 
-- 
1.7.7.6



More information about the Piglit mailing list