Skip to content

Commit

Permalink
Fix Capturer regressions
Browse files Browse the repository at this point in the history
- Capturer now waits on texture export completing prior to USD export.
- LegacyMaterialData given default hash initialization.
- Fix terrain baking disabling logic and setting LegacyMaterialData hash.
- Update goldens
  • Loading branch information
nv-nfreybler committed Nov 2, 2023
2 parents 91187a0 + bc90ead commit 1f601dc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/dxvk/rtx_render/rtx_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1762,8 +1762,10 @@ namespace dxvk {
}

void RtxContext::bakeTerrain(const DrawParameters& params, DrawCallState& drawCallState, const MaterialData** outOverrideMaterialData) {
if (!drawCallState.testCategoryFlags(InstanceCategories::Terrain))
if (!getSceneManager().getTerrainBaker().enableBaking() ||
!drawCallState.testCategoryFlags(InstanceCategories::Terrain)) {
return;
}

DrawCallTransforms& transformData = drawCallState.transformData;

Expand Down Expand Up @@ -1818,6 +1820,7 @@ namespace dxvk {
LegacyMaterialData overrideMaterial;
overrideMaterial.colorTextures[0] = (*outOverrideMaterialData)->getOpaqueMaterialData().getAlbedoOpacityTexture();
overrideMaterial.samplers[0] = terrainBaker.getTerrainSampler();
overrideMaterial.updateCachedHash();
drawCallState.materialData = overrideMaterial;
}

Expand Down
17 changes: 9 additions & 8 deletions src/dxvk/rtx_render/rtx_game_capturer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ namespace dxvk {
//Export Textures
const std::string albedoTexFilename(matName + lss::ext::dds);
m_exporter.dumpImageToFile(ctx, BASE_DIR + lss::commonDirName::texDir,
albedoTexFilename,
materialData.getColorTexture().getImageView()->image());
albedoTexFilename,
materialData.getColorTexture().getImageView()->image());

const std::string albedoTexPath = str::format(BASE_DIR + lss::commonDirName::texDir, albedoTexFilename);

Expand Down Expand Up @@ -865,12 +865,13 @@ namespace dxvk {
assert(m_state.has<State::BeginExport>());
assert(!m_state.has<State::PreppingExport>());
assert(!m_state.has<State::Exporting>());
static auto exportThreadTask = [](const Rc<DxvkContext> ctx,
Capture cap,
State* pState,
CompletedCapture* complete,
const float framesPerSecond,
const bool bUseLssUsdPlugins) {
static auto exportThreadTask = [this](const Rc<DxvkContext> ctx,
Capture cap,
State* pState,
CompletedCapture* complete,
const float framesPerSecond,
const bool bUseLssUsdPlugins) {
m_exporter.waitForAllExportsToComplete();
assert(pState->has<State::PreppingExport>());
const auto exportPrep = prepExport(cap, framesPerSecond, bUseLssUsdPlugins);
pState->set<State::PreppingExport, false>();
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/rtx_render/rtx_materials.h
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ struct LegacyMaterialData {
static_assert(kInvalidResourceSlot == 0 && "Below initialization of all array members is only valid for a value of 0.");
uint32_t colorTextureSlot[kMaxSupportedTextures] = { kInvalidResourceSlot };

XXH64_hash_t m_cachedHash;
XXH64_hash_t m_cachedHash = kEmptyHash;
};

struct MaterialData {
Expand Down

0 comments on commit 1f601dc

Please sign in to comment.