MAINT-2150 Fix for super-large ( > 4096 ) snapshots having black borders

meow-7.2.2
Dave Parks 2012-12-18 16:39:48 -06:00
parent d2b7857721
commit 615af0c556
4 changed files with 13 additions and 10 deletions

View File

@ -1132,7 +1132,8 @@ void LLGLManager::initExtensions()
// Misc // Misc
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange);
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &mGLMaxTextureSize);
#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS #if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS
LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL; LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;
if (mHasVertexBufferObject) if (mHasVertexBufferObject)

View File

@ -147,6 +147,7 @@ public:
S32 mVRAM; // VRAM in MB S32 mVRAM; // VRAM in MB
S32 mGLMaxVertexRange; S32 mGLMaxVertexRange;
S32 mGLMaxIndexRange; S32 mGLMaxIndexRange;
S32 mGLMaxTextureSize;
void getPixelFormat(); // Get the best pixel format void getPixelFormat(); // Get the best pixel format

View File

@ -109,8 +109,8 @@ void LLRenderTarget::resize(U32 resx, U32 resy, U32 color_fmt)
bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, S32 samples) bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, S32 samples)
{ {
resx = llmin(resx, (U32) 4096); resx = llmin(resx, (U32) gGLManager.mGLMaxTextureSize);
resy = llmin(resy, (U32) 4096); resy = llmin(resy, (U32) gGLManager.mGLMaxTextureSize);
stop_glerror(); stop_glerror();
release(); release();

View File

@ -4247,7 +4247,8 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
F32 scale_factor = 1.0f ; F32 scale_factor = 1.0f ;
if (!keep_window_aspect || (image_width > window_width) || (image_height > window_height)) if (!keep_window_aspect || (image_width > window_width) || (image_height > window_height))
{ {
if ((image_width > window_width || image_height > window_height) && LLPipeline::sRenderDeferred && !show_ui) if ((image_width <= gGLManager.mGLMaxTextureSize && image_height <= gGLManager.mGLMaxTextureSize) &&
(image_width > window_width || image_height > window_height) && LLPipeline::sRenderDeferred && !show_ui)
{ {
if (scratch_space.allocate(image_width, image_height, GL_RGBA, true, true)) if (scratch_space.allocate(image_width, image_height, GL_RGBA, true, true))
{ {
@ -4274,12 +4275,12 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
if (!reset_deferred) if (!reset_deferred)
{ {
// if image cropping or need to enlarge the scene, compute a scale_factor // if image cropping or need to enlarge the scene, compute a scale_factor
F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ; F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ;
snapshot_width = (S32)(ratio * image_width) ; snapshot_width = (S32)(ratio * image_width) ;
snapshot_height = (S32)(ratio * image_height) ; snapshot_height = (S32)(ratio * image_height) ;
scale_factor = llmax(1.0f, 1.0f / ratio) ; scale_factor = llmax(1.0f, 1.0f / ratio) ;
} }
} }
if (show_ui && scale_factor > 1.f) if (show_ui && scale_factor > 1.f)