diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llviewerwindow.cpp | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index 9f091dc..d61fa59 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp | |||
@@ -192,12 +192,12 @@ | |||
192 | // | 192 | // |
193 | // Globals | 193 | // Globals |
194 | // | 194 | // |
195 | void render_ui_and_swap_if_needed(); | ||
196 | void render_ui_and_swap(); | 195 | void render_ui_and_swap(); |
197 | LLBottomPanel* gBottomPanel = NULL; | 196 | LLBottomPanel* gBottomPanel = NULL; |
198 | 197 | ||
199 | extern BOOL gDebugClicks; | 198 | extern BOOL gDebugClicks; |
200 | extern BOOL gDisplaySwapBuffers; | 199 | extern BOOL gDisplaySwapBuffers; |
200 | extern BOOL gDepthDirty; | ||
201 | extern BOOL gResizeScreenTexture; | 201 | extern BOOL gResizeScreenTexture; |
202 | extern S32 gJamesInt; | 202 | extern S32 gJamesInt; |
203 | 203 | ||
@@ -3387,9 +3387,8 @@ void LLViewerWindow::hitObjectOrLandGlobalAsync(S32 x, S32 y_from_bot, MASK mask | |||
3387 | return; | 3387 | return; |
3388 | } | 3388 | } |
3389 | 3389 | ||
3390 | render_ui_and_swap_if_needed(); | ||
3391 | glClear(GL_DEPTH_BUFFER_BIT); | 3390 | glClear(GL_DEPTH_BUFFER_BIT); |
3392 | gDisplaySwapBuffers = FALSE; | 3391 | gDepthDirty = TRUE; |
3393 | 3392 | ||
3394 | S32 scaled_x = llround((F32)x * mDisplayScale.mV[VX]); | 3393 | S32 scaled_x = llround((F32)x * mDisplayScale.mV[VX]); |
3395 | S32 scaled_y = llround((F32)y_from_bot * mDisplayScale.mV[VY]); | 3394 | S32 scaled_y = llround((F32)y_from_bot * mDisplayScale.mV[VY]); |
@@ -4282,7 +4281,8 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p | |||
4282 | LLRect window_rect = mWindowRect; | 4281 | LLRect window_rect = mWindowRect; |
4283 | mWindowRect.set(0, h, w, 0); | 4282 | mWindowRect.set(0, h, w, 0); |
4284 | 4283 | ||
4285 | gDisplaySwapBuffers = FALSE; | 4284 | gDisplaySwapBuffers = FALSE; |
4285 | gDepthDirty = TRUE; | ||
4286 | glClearColor(0.f, 0.f, 0.f, 0.f); | 4286 | glClearColor(0.f, 0.f, 0.f, 0.f); |
4287 | glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 4287 | glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
4288 | setup3DRender(); | 4288 | setup3DRender(); |
@@ -4350,6 +4350,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p | |||
4350 | setup3DRender(); | 4350 | setup3DRender(); |
4351 | setupViewport(); | 4351 | setupViewport(); |
4352 | gDisplaySwapBuffers = FALSE; | 4352 | gDisplaySwapBuffers = FALSE; |
4353 | gDepthDirty = TRUE; | ||
4353 | 4354 | ||
4354 | // POST SNAPSHOT | 4355 | // POST SNAPSHOT |
4355 | if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) | 4356 | if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) |
@@ -4389,7 +4390,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4389 | } | 4390 | } |
4390 | 4391 | ||
4391 | // PRE SNAPSHOT | 4392 | // PRE SNAPSHOT |
4392 | render_ui_and_swap_if_needed(); | ||
4393 | gDisplaySwapBuffers = FALSE; | 4393 | gDisplaySwapBuffers = FALSE; |
4394 | 4394 | ||
4395 | glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 4395 | glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
@@ -4420,6 +4420,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4420 | LLRect window_rect = mWindowRect; | 4420 | LLRect window_rect = mWindowRect; |
4421 | BOOL use_fbo = FALSE; | 4421 | BOOL use_fbo = FALSE; |
4422 | 4422 | ||
4423 | LLRenderTarget target; | ||
4423 | F32 scale_factor = 1.0f ; | 4424 | F32 scale_factor = 1.0f ; |
4424 | if(!keep_window_aspect) //image cropping | 4425 | if(!keep_window_aspect) //image cropping |
4425 | { | 4426 | { |
@@ -4428,37 +4429,39 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4428 | snapshot_height = (S32)(ratio * image_height) ; | 4429 | snapshot_height = (S32)(ratio * image_height) ; |
4429 | scale_factor = llmax(1.0f, 1.0f / ratio) ; | 4430 | scale_factor = llmax(1.0f, 1.0f / ratio) ; |
4430 | } | 4431 | } |
4431 | 4432 | else //the scene(window) proportion needs to be maintained. | |
4432 | LLRenderTarget target; | 4433 | { |
4433 | if (gGLManager.mHasFramebufferObject && | 4434 | if(image_width > window_width || image_height > window_height) //need to enlarge the scene |
4434 | (image_width > window_width || | ||
4435 | image_height > window_height) && | ||
4436 | !show_ui && | ||
4437 | keep_window_aspect) | ||
4438 | { | ||
4439 | GLint max_size = 0; | ||
4440 | glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &max_size); | ||
4441 | |||
4442 | if (image_width <= max_size && image_height <= max_size) | ||
4443 | { | ||
4444 | use_fbo = TRUE; | ||
4445 | |||
4446 | snapshot_width = image_width; | ||
4447 | snapshot_height = image_height; | ||
4448 | target.allocate(snapshot_width, snapshot_height, GL_RGBA, TRUE, GL_TEXTURE_RECTANGLE_ARB, TRUE); | ||
4449 | window_width = snapshot_width; | ||
4450 | window_height = snapshot_height; | ||
4451 | scale_factor = 1.f; | ||
4452 | mWindowRect.set(0, 0, snapshot_width, snapshot_height); | ||
4453 | target.bindTarget(); | ||
4454 | } | ||
4455 | else //tiling | ||
4456 | { | 4435 | { |
4457 | F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ; | 4436 | if (gGLManager.mHasFramebufferObject && !show_ui) |
4458 | snapshot_width = (S32)(ratio * image_width) ; | 4437 | { |
4459 | snapshot_height = (S32)(ratio * image_height) ; | 4438 | GLint max_size = 0; |
4460 | scale_factor = llmax(1.0f, 1.0f / ratio) ; | 4439 | glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &max_size); |
4440 | |||
4441 | if (image_width <= max_size && image_height <= max_size) //re-project the scene | ||
4442 | { | ||
4443 | use_fbo = TRUE; | ||
4444 | |||
4445 | snapshot_width = image_width; | ||
4446 | snapshot_height = image_height; | ||
4447 | target.allocate(snapshot_width, snapshot_height, GL_RGBA, TRUE, GL_TEXTURE_RECTANGLE_ARB, TRUE); | ||
4448 | window_width = snapshot_width; | ||
4449 | window_height = snapshot_height; | ||
4450 | scale_factor = 1.f; | ||
4451 | mWindowRect.set(0, 0, snapshot_width, snapshot_height); | ||
4452 | target.bindTarget(); | ||
4453 | } | ||
4454 | } | ||
4455 | |||
4456 | if(!use_fbo) //no re-projection, so tiling the scene | ||
4457 | { | ||
4458 | F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ; | ||
4459 | snapshot_width = (S32)(ratio * image_width) ; | ||
4460 | snapshot_height = (S32)(ratio * image_height) ; | ||
4461 | scale_factor = llmax(1.0f, 1.0f / ratio) ; | ||
4462 | } | ||
4461 | } | 4463 | } |
4464 | //else: keep the current scene scale, re-scale it if necessary after reading out. | ||
4462 | } | 4465 | } |
4463 | 4466 | ||
4464 | S32 buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f); | 4467 | S32 buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f); |
@@ -4503,6 +4506,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4503 | for (int subimage_x = 0; subimage_x < scale_factor; ++subimage_x) | 4506 | for (int subimage_x = 0; subimage_x < scale_factor; ++subimage_x) |
4504 | { | 4507 | { |
4505 | gDisplaySwapBuffers = FALSE; | 4508 | gDisplaySwapBuffers = FALSE; |
4509 | gDepthDirty = TRUE; | ||
4506 | if (type == SNAPSHOT_TYPE_OBJECT_ID) | 4510 | if (type == SNAPSHOT_TYPE_OBJECT_ID) |
4507 | { | 4511 | { |
4508 | glClearColor(0.f, 0.f, 0.f, 0.f); | 4512 | glClearColor(0.f, 0.f, 0.f, 0.f); |
@@ -4586,6 +4590,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4586 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | 4590 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |
4587 | } | 4591 | } |
4588 | gDisplaySwapBuffers = FALSE; | 4592 | gDisplaySwapBuffers = FALSE; |
4593 | gDepthDirty = TRUE; | ||
4589 | 4594 | ||
4590 | // POST SNAPSHOT | 4595 | // POST SNAPSHOT |
4591 | if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) | 4596 | if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) |