Skip to content
Snippets Groups Projects
Commit 17635374 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Merge branch 'xenhat/pr-snapshot-improvements' into 'master'

Enable snapshots for 4K, 8K and then some.

See merge request alchemy/alchemy-next!41
parents 4235e4fa 62c4101d
No related branches found
No related tags found
No related merge requests found
...@@ -276,7 +276,8 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y) ...@@ -276,7 +276,8 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y)
//called when the frame is frozen. //called when the frame is frozen.
void LLSnapshotLivePreview::draw() void LLSnapshotLivePreview::draw()
{ {
if (getCurrentImage() && LLViewerTexture* currentImage = getCurrentImage();
if (currentImage &&
mPreviewImageEncoded.notNull() && mPreviewImageEncoded.notNull() &&
getSnapshotUpToDate()) getSnapshotUpToDate())
{ {
...@@ -289,10 +290,10 @@ void LLSnapshotLivePreview::draw() ...@@ -289,10 +290,10 @@ void LLSnapshotLivePreview::draw()
LLColor4 image_color(1.f, 1.f, 1.f, 1.f); LLColor4 image_color(1.f, 1.f, 1.f, 1.f);
gGL.color4fv(image_color.mV); gGL.color4fv(image_color.mV);
gGL.getTexUnit(0)->bind(getCurrentImage()); gGL.getTexUnit(0)->bind(currentImage);
// calculate UV scale // calculate UV scale
F32 uv_width = isImageScaled() ? 1.f : llmin((F32)getWidth() / (F32)getCurrentImage()->getWidth(), 1.f); F32 uv_width = isImageScaled() ? 1.f : llmin((F32)getWidth() / (F32)currentImage->getWidth(), 1.f);
F32 uv_height = isImageScaled() ? 1.f : llmin((F32)getHeight() / (F32)getCurrentImage()->getHeight(), 1.f); F32 uv_height = isImageScaled() ? 1.f : llmin((F32)getHeight() / (F32)currentImage->getHeight(), 1.f);
gGL.pushMatrix(); gGL.pushMatrix();
{ {
gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom + TOP_PANEL_HEIGHT, 0.f); gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom + TOP_PANEL_HEIGHT, 0.f);
...@@ -645,18 +646,19 @@ LLViewerTexture* LLSnapshotLivePreview::getBigThumbnailImage() ...@@ -645,18 +646,19 @@ LLViewerTexture* LLSnapshotLivePreview::getBigThumbnailImage()
//static //static
BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
{ {
BOOL success = FALSE;
LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview;
if (previewp->getWidth() == 0 || previewp->getHeight() == 0) if (previewp->getWidth() == 0 || previewp->getHeight() == 0)
{ {
LL_WARNS("Snapshot") << "Incorrect dimensions: " << previewp->getWidth() << "x" << previewp->getHeight() << LL_ENDL; LL_WARNS("Snapshot") << "Incorrect dimensions: " << previewp->getWidth() << "x" << previewp->getHeight() << LL_ENDL;
return FALSE; return success;
} }
if (previewp->mSnapshotDelayTimer.getStarted()) // Wait for a snapshot delay timer if (previewp->mSnapshotDelayTimer.getStarted()) // Wait for a snapshot delay timer
{ {
if (!previewp->mSnapshotDelayTimer.hasExpired()) if (!previewp->mSnapshotDelayTimer.hasExpired())
{ {
return FALSE; return success;
} }
previewp->mSnapshotDelayTimer.stop(); previewp->mSnapshotDelayTimer.stop();
} }
...@@ -664,7 +666,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) ...@@ -664,7 +666,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
if (LLToolCamera::getInstance()->hasMouseCapture()) // Hide full-screen preview while camming, either don't take snapshots while ALT-zoom active if (LLToolCamera::getInstance()->hasMouseCapture()) // Hide full-screen preview while camming, either don't take snapshots while ALT-zoom active
{ {
previewp->setVisible(FALSE); previewp->setVisible(FALSE);
return FALSE; return success;
} }
// If we're in freeze-frame and/or auto update mode and camera has moved, update snapshot. // If we're in freeze-frame and/or auto update mode and camera has moved, update snapshot.
...@@ -689,9 +691,12 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) ...@@ -689,9 +691,12 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
if (previewp->getSnapshotUpToDate() && previewp->getThumbnailUpToDate()) if (previewp->getSnapshotUpToDate() && previewp->getThumbnailUpToDate())
{ {
return FALSE; return success;
} }
auto last_image = previewp->mFormattedImage;
auto last_preview = previewp->mPreviewImage;
auto last_preview_encoded = previewp->mPreviewImageEncoded;
// time to produce a snapshot // time to produce a snapshot
if(!previewp->getSnapshotUpToDate()) if(!previewp->getSnapshotUpToDate())
{ {
...@@ -710,7 +715,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) ...@@ -710,7 +715,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->setImageScaled(FALSE); previewp->setImageScaled(FALSE);
// grab the raw image // grab the raw image
if (gViewerWindow->rawSnapshot( success = gViewerWindow->rawSnapshot(
previewp->mPreviewImage, previewp->mPreviewImage,
previewp->getWidth(), previewp->getWidth(),
previewp->getHeight(), previewp->getHeight(),
...@@ -720,7 +725,8 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) ...@@ -720,7 +725,8 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
gSavedSettings.getBOOL("RenderHUDInSnapshot"), gSavedSettings.getBOOL("RenderHUDInSnapshot"),
FALSE, FALSE,
previewp->mSnapshotBufferType, previewp->mSnapshotBufferType,
previewp->getMaxImageSize())) previewp->getMaxImageSize());
if (success)
{ {
// Invalidate/delete any existing encoded image // Invalidate/delete any existing encoded image
previewp->mPreviewImageEncoded = NULL; previewp->mPreviewImageEncoded = NULL;
...@@ -740,26 +746,39 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) ...@@ -740,26 +746,39 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
// We need to update the thumbnail though // We need to update the thumbnail though
previewp->setThumbnailImageSize(); previewp->setThumbnailImageSize();
previewp->generateThumbnailImage(TRUE) ;
previewp->generateThumbnailImage(TRUE) ;
previewp->getWindow()->decBusyCount();
previewp->setVisible(gSavedSettings.getBOOL("UseFreezeFrame") && previewp->mAllowFullScreenPreview); // only show fullscreen preview when in freeze frame mode
previewp->mSnapshotActive = FALSE;
LL_DEBUGS("Snapshot") << "done creating snapshot" << LL_ENDL;
} }
previewp->getWindow()->decBusyCount(); else
previewp->setVisible(gSavedSettings.getBOOL("UseFreezeFrame") && previewp->mAllowFullScreenPreview); // only show fullscreen preview when in freeze frame mode {
previewp->mSnapshotActive = FALSE; LL_WARNS() << "Failed creating snapshot" << LL_ENDL;
LL_DEBUGS("Snapshot") << "done creating snapshot" << LL_ENDL; previewp->mSnapshotDelayTimer.stop();
// previewp->setVisible(gSavedSettings.getBOOL("UseFreezeFrame") && previewp->mAllowFullScreenPreview); // only show fullscreen preview when in freeze frame mode
// Restore the old data
previewp->mSnapshotActive = FALSE;
previewp->mThumbnailUpdateLock = FALSE;
previewp->mSnapshotUpToDate = TRUE;
previewp->mThumbnailUpToDate = TRUE;
previewp->mFormattedImage = last_image;
previewp->mPreviewImageEncoded = last_preview;
previewp->mPreviewImageEncoded = last_preview_encoded;
previewp->generateThumbnailImage(FALSE);
previewp->getWindow()->decBusyCount();
gPipeline.doResetVertexBuffers(true);
}
} }
if (!previewp->getThumbnailUpToDate())
{
previewp->generateThumbnailImage() ;
}
// Tell the floater container that the snapshot is updated now // Tell the floater container that the snapshot is updated now
if (previewp->mViewContainer) if (previewp->mViewContainer)
{ {
previewp->mViewContainer->notify(LLSD().with("snapshot-updated", true)); previewp->mViewContainer->notify(LLSD().with("snapshot-updated", true));
} }
return TRUE; return success;
} }
void LLSnapshotLivePreview::prepareFreezeFrame() void LLSnapshotLivePreview::prepareFreezeFrame()
......
...@@ -136,7 +136,7 @@ class LLPickInfo ...@@ -136,7 +136,7 @@ class LLPickInfo
}; };
static const U32 MAX_SNAPSHOT_IMAGE_SIZE = 7680; // max snapshot image size 7680 * 7680 UHDTV2 static const U32 MAX_SNAPSHOT_IMAGE_SIZE = 10240; // max snapshot image size
class LLViewerWindow final : public LLWindowCallbacks class LLViewerWindow final : public LLWindowCallbacks
{ {
......
...@@ -62,18 +62,70 @@ ...@@ -62,18 +62,70 @@
label="800x600" label="800x600"
name="800x600" name="800x600"
value="[i800,i600]" /> value="[i800,i600]" />
<combo_box.item
label="720p"
name="1280x720"
value="[i1280,i720]" />
<combo_box.item <combo_box.item
label="1024x768" label="1024x768"
name="1024x768" name="1024x768"
value="[i1024,i768]" /> value="[i1024,i768]" />
<combo_box.item
label="SL Texture (1024x1024)"
name="1024x1024"
value="[i1024,i1024]" />
<combo_box.item <combo_box.item
label="1280x1024" label="1280x1024"
name="1280x1024" name="1280x1024"
value="[i1280,i1024]" /> value="[i1280,i1024]" />
<combo_box.item
label="1080p (16:9)"
name="1920x1080"
value="[i1920,i1080]" />
<combo_box.item <combo_box.item
label="1600x1200" label="1600x1200"
name="1600x1200" name="1600x1200"
value="[i1600,i1200]" /> value="[i1600,i1200]" />
<combo_box.item
label="1080p FHD (21:9)"
name="2560x1080"
value="[i2560,i1080]" />
<combo_box.item
label="1440p QHD (16:9)"
name="2560x1440"
value="[i2560,i1440]" />
<combo_box.item
label="1440p WQHD &quot;Ultra-Wide&quot; (21:9)"
name="3440x1440"
value="[i3440,i1440]" />
<combo_box.item
label="1440p DQHD (32:9)"
name="5120x1440"
value="[i5120,i1440]" />
<combo_box.item
label="4K (16:9)"
name="3840x2160"
value="[i3840,i2160]" />
<combo_box.item
label="4K (1.90:1)"
name="4096x2160"
value="[i4096,i2160]" />
<combo_box.item
label="4K UWD (21:9)"
name="5120x2160"
value="[i5120,i2160]" />
<combo_box.item
label="4K (4:3)"
name="4096x3072"
value="[i4096,i3072]" />
<combo_box.item
label="8K (16:9)"
name="7680x4320"
value="[i7680,i4320]" />
<combo_box.item
label="8K (21:9)"
name="10240x4320"
value="[i10240,i4320]" />
<combo_box.item <combo_box.item
label="Custom" label="Custom"
name="Custom" name="Custom"
...@@ -89,7 +141,6 @@ ...@@ -89,7 +141,6 @@
label_width="90" label_width="90"
layout="topleft" layout="topleft"
left="10" left="10"
max_val="6016"
min_val="32" min_val="32"
name="local_snapshot_width" name="local_snapshot_width"
top_pad="7" top_pad="7"
...@@ -104,7 +155,6 @@ ...@@ -104,7 +155,6 @@
label_width="0" label_width="0"
layout="topleft" layout="topleft"
left_pad="0" left_pad="0"
max_val="6016"
min_val="32" min_val="32"
name="local_snapshot_height" name="local_snapshot_height"
top_delta="0" top_delta="0"
...@@ -200,4 +250,4 @@ ...@@ -200,4 +250,4 @@
name="saveas_item" name="saveas_item"
value="save as" /> value="save as" />
</flyout_button> </flyout_button>
</panel> </panel>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment