refactor(srp): remove managed backend key binding detour
This commit is contained in:
@@ -1534,10 +1534,6 @@ private:
|
||||
MonoObject* assetObject) const;
|
||||
MonoMethod* ResolveGetRuntimeResourceVersionMethod(
|
||||
MonoObject* assetObject) const;
|
||||
MonoMethod* ResolveGetPipelineRendererAssetKeyMethod(
|
||||
MonoObject* assetObject) const;
|
||||
MonoMethod* ResolveGetPipelineRendererAssetKeyContextualMethod(
|
||||
MonoObject* assetObject) const;
|
||||
MonoMethod* ResolveUsesNativeCameraFramePlanBaselineMethod(
|
||||
MonoObject* assetObject) const;
|
||||
MonoMethod* ResolveUsesNativeCameraFramePlanBaselineContextualMethod(
|
||||
@@ -1559,9 +1555,6 @@ private:
|
||||
mutable MonoMethod* m_configureCameraFramePlanMethod = nullptr;
|
||||
mutable MonoMethod* m_getDefaultFinalColorSettingsMethod = nullptr;
|
||||
mutable MonoMethod* m_getRuntimeResourceVersionMethod = nullptr;
|
||||
mutable MonoMethod* m_getPipelineRendererAssetKeyMethod = nullptr;
|
||||
mutable MonoMethod* m_getPipelineRendererAssetKeyContextualMethod =
|
||||
nullptr;
|
||||
mutable MonoMethod* m_usesNativeCameraFramePlanBaselineMethod =
|
||||
nullptr;
|
||||
mutable MonoMethod*
|
||||
@@ -1581,10 +1574,6 @@ private:
|
||||
mutable bool m_pipelineRendererAssetResolved = false;
|
||||
mutable std::shared_ptr<const Rendering::RenderPipelineAsset>
|
||||
m_pipelineRendererAsset = nullptr;
|
||||
mutable std::unordered_map<
|
||||
int32_t,
|
||||
std::shared_ptr<const Rendering::RenderPipelineAsset>>
|
||||
m_contextualPipelineRendererAssets = {};
|
||||
};
|
||||
|
||||
class MonoManagedRenderPipelineStageRecorder final
|
||||
@@ -2217,92 +2206,17 @@ MonoManagedRenderPipelineAssetRuntime::GetPipelineRendererAsset(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (rendererIndex >= 0) {
|
||||
const auto contextualIt =
|
||||
m_contextualPipelineRendererAssets.find(rendererIndex);
|
||||
if (contextualIt != m_contextualPipelineRendererAssets.end()) {
|
||||
return contextualIt->second;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pipelineRendererAssetResolved) {
|
||||
if (rendererIndex < 0) {
|
||||
return m_pipelineRendererAsset;
|
||||
}
|
||||
return m_pipelineRendererAsset;
|
||||
}
|
||||
|
||||
MonoObject* const assetObject = GetManagedAssetObject();
|
||||
if (assetObject == nullptr) {
|
||||
if (GetManagedAssetObject() == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string pipelineRendererAssetKey = {};
|
||||
MonoMethod* const contextualMethod =
|
||||
ResolveGetPipelineRendererAssetKeyContextualMethod(assetObject);
|
||||
if (contextualMethod != nullptr) {
|
||||
void* args[1] = { &rendererIndex };
|
||||
MonoObject* managedKeyObject = nullptr;
|
||||
if (!m_runtime->InvokeManagedMethod(
|
||||
assetObject,
|
||||
contextualMethod,
|
||||
args,
|
||||
&managedKeyObject)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pipelineRendererAssetKey =
|
||||
MonoStringToUtf8(
|
||||
reinterpret_cast<MonoString*>(managedKeyObject));
|
||||
} else {
|
||||
if (rendererIndex >= 0) {
|
||||
if (m_pipelineRendererAssetResolved) {
|
||||
return m_pipelineRendererAsset;
|
||||
}
|
||||
}
|
||||
|
||||
MonoMethod* const method =
|
||||
ResolveGetPipelineRendererAssetKeyMethod(assetObject);
|
||||
if (method == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MonoObject* managedKeyObject = nullptr;
|
||||
if (!m_runtime->InvokeManagedMethod(
|
||||
assetObject,
|
||||
method,
|
||||
nullptr,
|
||||
&managedKeyObject)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pipelineRendererAssetKey =
|
||||
MonoStringToUtf8(
|
||||
reinterpret_cast<MonoString*>(managedKeyObject));
|
||||
}
|
||||
|
||||
std::shared_ptr<const Rendering::RenderPipelineAsset>
|
||||
pipelineRendererAsset = nullptr;
|
||||
if (pipelineRendererAssetKey.empty()) {
|
||||
if (rendererIndex >= 0) {
|
||||
m_contextualPipelineRendererAssets[rendererIndex] = nullptr;
|
||||
} else {
|
||||
m_pipelineRendererAssetResolved = true;
|
||||
m_pipelineRendererAsset.reset();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pipelineRendererAsset =
|
||||
Rendering::Internal::CreatePipelineRendererAssetByKey(
|
||||
pipelineRendererAssetKey);
|
||||
if (rendererIndex >= 0) {
|
||||
m_contextualPipelineRendererAssets[rendererIndex] =
|
||||
pipelineRendererAsset;
|
||||
return pipelineRendererAsset;
|
||||
}
|
||||
|
||||
m_pipelineRendererAssetResolved = true;
|
||||
m_pipelineRendererAsset = pipelineRendererAsset;
|
||||
m_pipelineRendererAsset =
|
||||
Rendering::Internal::CreateDefaultPipelineRendererAsset();
|
||||
return m_pipelineRendererAsset;
|
||||
}
|
||||
|
||||
@@ -2505,7 +2419,6 @@ bool MonoManagedRenderPipelineAssetRuntime::SyncManagedAssetRuntimeState() const
|
||||
ReleaseManagedPipeline();
|
||||
m_pipelineRendererAsset.reset();
|
||||
m_pipelineRendererAssetResolved = false;
|
||||
m_contextualPipelineRendererAssets.clear();
|
||||
m_runtimeResourceVersion = runtimeResourceVersion;
|
||||
return true;
|
||||
}
|
||||
@@ -2571,15 +2484,12 @@ void MonoManagedRenderPipelineAssetRuntime::ReleaseManagedAsset() const {
|
||||
m_configureCameraFramePlanMethod = nullptr;
|
||||
m_getDefaultFinalColorSettingsMethod = nullptr;
|
||||
m_getRuntimeResourceVersionMethod = nullptr;
|
||||
m_getPipelineRendererAssetKeyMethod = nullptr;
|
||||
m_getPipelineRendererAssetKeyContextualMethod = nullptr;
|
||||
m_usesNativeCameraFramePlanBaselineMethod = nullptr;
|
||||
m_usesNativeCameraFramePlanBaselineContextualMethod = nullptr;
|
||||
m_configureRenderSceneSetupMethod = nullptr;
|
||||
m_configureDirectionalShadowExecutionStateMethod = nullptr;
|
||||
m_pipelineRendererAsset.reset();
|
||||
m_pipelineRendererAssetResolved = false;
|
||||
m_contextualPipelineRendererAssets.clear();
|
||||
m_runtimeResourceVersionResolved = false;
|
||||
m_runtimeResourceVersion = 0;
|
||||
const bool ownsManagedAssetHandle = m_ownsManagedAssetHandle;
|
||||
@@ -2697,34 +2607,6 @@ MonoManagedRenderPipelineAssetRuntime::ResolveGetRuntimeResourceVersionMethod(
|
||||
return m_getRuntimeResourceVersionMethod;
|
||||
}
|
||||
|
||||
MonoMethod*
|
||||
MonoManagedRenderPipelineAssetRuntime::ResolveGetPipelineRendererAssetKeyMethod(
|
||||
MonoObject* assetObject) const {
|
||||
if (m_getPipelineRendererAssetKeyMethod == nullptr) {
|
||||
m_getPipelineRendererAssetKeyMethod =
|
||||
m_runtime->ResolveManagedMethod(
|
||||
assetObject,
|
||||
"GetPipelineRendererAssetKey",
|
||||
0);
|
||||
}
|
||||
|
||||
return m_getPipelineRendererAssetKeyMethod;
|
||||
}
|
||||
|
||||
MonoMethod*
|
||||
MonoManagedRenderPipelineAssetRuntime::ResolveGetPipelineRendererAssetKeyContextualMethod(
|
||||
MonoObject* assetObject) const {
|
||||
if (m_getPipelineRendererAssetKeyContextualMethod == nullptr) {
|
||||
m_getPipelineRendererAssetKeyContextualMethod =
|
||||
m_runtime->ResolveManagedMethod(
|
||||
assetObject,
|
||||
"GetPipelineRendererAssetKeyContextual",
|
||||
1);
|
||||
}
|
||||
|
||||
return m_getPipelineRendererAssetKeyContextualMethod;
|
||||
}
|
||||
|
||||
MonoMethod*
|
||||
MonoManagedRenderPipelineAssetRuntime::
|
||||
ResolveUsesNativeCameraFramePlanBaselineMethod(
|
||||
|
||||
Reference in New Issue
Block a user