[Mesa-dev] [PATCH 04/12] glsl/gsraytrace: Don't create new Buffer objects everytime the window is resized.

Fabian Bieler fabianbieler at fastmail.fm
Wed Feb 19 15:17:05 PST 2014


Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/gsraytrace.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/gsraytrace.cpp b/src/glsl/gsraytrace.cpp
index c21c667..f156fdc 100644
--- a/src/glsl/gsraytrace.cpp
+++ b/src/glsl/gsraytrace.cpp
@@ -776,7 +776,6 @@ Reshape(int width, int height)
 
    {
       size_t nElem = WinWidth*WinHeight*nRayGens;
-      glGenBuffers(1, &dst);
       glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_NV, dst);
       glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER_NV, nElem*sizeof(GSRay), 0, GL_STREAM_DRAW);
       GSRay* d = (GSRay*)glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_NV, GL_READ_WRITE);
@@ -790,7 +789,6 @@ Reshape(int width, int height)
    }
 
    {
-      glGenBuffers(1, &eyeRaysAsPoints);
       glBindBuffer(GL_ARRAY_BUFFER, eyeRaysAsPoints);
       glBufferData(GL_ARRAY_BUFFER, WinWidth*WinHeight*sizeof(GSRay), 0, GL_STATIC_DRAW);
       GSRay* d = (GSRay*)glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
@@ -919,6 +917,8 @@ Init(void)
    }
 
    glGenQueries(1, &pgQuery);
+   glGenBuffers(1, &dst);
+   glGenBuffers(1, &eyeRaysAsPoints);
 
    printf("\nESC                 = exit demo\nleft mouse + drag   = rotate camera\n\n");
 }
-- 
1.8.3.2



More information about the mesa-dev mailing list