Skip to content

Commit

Permalink
Merge branch 'sultimt/object-picking-lifetime' into 'main'
Browse files Browse the repository at this point in the history
Fix object picking image lifetime, if requested from API

See merge request lightspeedrtx/dxvk-remix-nv!672
  • Loading branch information
sultim-t-nv committed Jan 19, 2024
2 parents 4eb9fe8 + d23bed0 commit 81cd3fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dxvk/rtx_render/rtx_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ namespace dxvk {
Metrics Metrics::s_instance;

bool g_allowSrgbConversionForOutput = true;
bool g_forceKeepObjectPickingImage = false;

void RtxContext::takeScreenshot(std::string imageName, Rc<DxvkImage> image) {
// NOTE: Improve this, I'd like all textures from the same frame to have the same time code... Currently sampling the time on each "dump op" results in different timecodes.
Expand Down Expand Up @@ -1529,6 +1530,9 @@ namespace dxvk {


auto enoughTimeHasPassedToDestroy = [&]() {
if (g_forceKeepObjectPickingImage) {
return false;
}
// there are object picking / highlighting requests, so don't destroy
if (debugView.ObjectPicking.containsRequests() ||
debugView.Highlighting.active(frameIdx) ||
Expand Down
9 changes: 9 additions & 0 deletions src/dxvk/rtx_render/rtx_remix_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace dxvk {
bool WithDrawCallConversion);

extern bool g_allowSrgbConversionForOutput;
extern bool g_forceKeepObjectPickingImage;

extern std::array<uint8_t, 3> g_customHighlightColor;
}
Expand Down Expand Up @@ -1126,6 +1127,14 @@ namespace {
return REMIXAPI_ERROR_CODE_GENERAL_FAILURE;
}

if (type == REMIXAPI_DXVK_COPY_RENDERING_OUTPUT_TYPE_OBJECT_PICKING) {
// suppress resource clean up
if (!dxvk::g_forceKeepObjectPickingImage) {
dxvk::g_forceKeepObjectPickingImage = true;
return REMIXAPI_ERROR_CODE_SUCCESS;
}
}

dxvk::Resources& resourceManager = remixDevice->GetDXVKDevice()->getCommon()->getResources();
const dxvk::Resources::RaytracingOutput& rtOutput = resourceManager.getRaytracingOutput();

Expand Down

0 comments on commit 81cd3fb

Please sign in to comment.