diff --git a/CyberXeSS/CyberXess.h b/CyberXeSS/CyberXess.h index 6a7e082c..e55f59e5 100644 --- a/CyberXeSS/CyberXess.h +++ b/CyberXeSS/CyberXess.h @@ -735,7 +735,7 @@ public: return false; } - + CasInit(); @@ -771,7 +771,7 @@ public: return xessInit; } - bool XeSSExecuteDx12(ID3D12GraphicsCommandList* commandList, const NVSDK_NGX_Parameter* initParams) + bool XeSSExecuteDx12(ID3D12GraphicsCommandList* commandList, const NVSDK_NGX_Parameter* initParams, const FeatureContext* context) { if (!xessInit) return false; @@ -794,20 +794,41 @@ public: { unsigned int width, height, outWidth, outHeight; - initParams->Get(NVSDK_NGX_Parameter_Width, &width); - initParams->Get(NVSDK_NGX_Parameter_Height, &height); - initParams->Get(NVSDK_NGX_Parameter_OutWidth, &outWidth); - initParams->Get(NVSDK_NGX_Parameter_OutHeight, &outHeight); - - if (width < outWidth) + if (initParams->Get(NVSDK_NGX_Parameter_Width, &width) == NVSDK_NGX_Result_Success && + initParams->Get(NVSDK_NGX_Parameter_Height, &height) == NVSDK_NGX_Result_Success) { - params.inputWidth = width; - params.inputHeight = height; + if (initParams->Get(NVSDK_NGX_Parameter_OutWidth, &outWidth) == NVSDK_NGX_Result_Success && + initParams->Get(NVSDK_NGX_Parameter_OutHeight, &outHeight) == NVSDK_NGX_Result_Success) + { + if (width < outWidth) + { + params.inputWidth = width; + params.inputHeight = height; + } + else + { + params.inputWidth = outWidth; + params.inputHeight = outHeight; + } + } + else + { + if (width < context->RenderWidth) + { + params.inputWidth = width; + params.inputHeight = height; + } + else + { + params.inputWidth = context->RenderWidth; + params.inputHeight = context->RenderHeight; + } + } } else { - params.inputWidth = outWidth; - params.inputHeight = outHeight; + params.inputWidth = context->RenderWidth; + params.inputHeight = context->RenderHeight; } } @@ -1075,7 +1096,7 @@ public: bool XeSSExecuteDx11(ID3D12GraphicsCommandList* commandList, ID3D12CommandQueue* commandQueue, ID3D11Device* dx11device, ID3D11DeviceContext* deviceContext, - const NVSDK_NGX_Parameter* initParams) + const NVSDK_NGX_Parameter* initParams, const FeatureContext* context) { if (!xessInit) return false; @@ -1109,20 +1130,41 @@ public: { unsigned int width, height, outWidth, outHeight; - initParams->Get(NVSDK_NGX_Parameter_Width, &width); - initParams->Get(NVSDK_NGX_Parameter_Height, &height); - initParams->Get(NVSDK_NGX_Parameter_OutWidth, &outWidth); - initParams->Get(NVSDK_NGX_Parameter_OutHeight, &outHeight); - - if (width < outWidth) + if (initParams->Get(NVSDK_NGX_Parameter_Width, &width) == NVSDK_NGX_Result_Success && + initParams->Get(NVSDK_NGX_Parameter_Height, &height) == NVSDK_NGX_Result_Success) { - params.inputWidth = width; - params.inputHeight = height; + if (initParams->Get(NVSDK_NGX_Parameter_OutWidth, &outWidth) == NVSDK_NGX_Result_Success && + initParams->Get(NVSDK_NGX_Parameter_OutHeight, &outHeight) == NVSDK_NGX_Result_Success) + { + if (width < outWidth) + { + params.inputWidth = width; + params.inputHeight = height; + } + else + { + params.inputWidth = outWidth; + params.inputHeight = outHeight; + } + } + else + { + if (width < context->RenderWidth) + { + params.inputWidth = width; + params.inputHeight = height; + } + else + { + params.inputWidth = context->RenderWidth; + params.inputHeight = context->RenderHeight; + } + } } else { - params.inputWidth = outWidth; - params.inputHeight = outHeight; + params.inputWidth = context->RenderWidth; + params.inputHeight = context->RenderHeight; } } diff --git a/CyberXeSS/CyberXessDx11.cpp b/CyberXeSS/CyberXessDx11.cpp index d9f99c11..7c43eacc 100644 --- a/CyberXeSS/CyberXessDx11.cpp +++ b/CyberXeSS/CyberXessDx11.cpp @@ -13,7 +13,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D11_Init_Ext(unsigned long long InApp spdlog::info("NVSDK_NGX_D3D11_Init_Ext SDK: {0}", (int)InSDKVersion); spdlog::info("NVSDK_NGX_D3D11_Init_Ext BuildPipelines: {0}", CyberXessContext::instance()->MyConfig->BuildPipelines.value_or(true)); spdlog::info("NVSDK_NGX_D3D11_Init_Ext NetworkModel: {0}", CyberXessContext::instance()->MyConfig->NetworkModel.value_or(0)); - spdlog::info("NVSDK_NGX_D3D11_Init_Ext LogLevel: {0}", CyberXessContext::instance()->MyConfig->LogLevel.value_or(1)); + spdlog::info("NVSDK_NGX_D3D11_Init_Ext LogLevel: {0}", CyberXessContext::instance()->MyConfig->LogLevel.value_or(2)); CyberXessContext::instance()->Shutdown(true, true); @@ -115,7 +115,7 @@ NVSDK_NGX_Result NVSDK_NGX_D3D11_GetParameters(NVSDK_NGX_Parameter** OutParamete } catch (const std::exception& ex) { - spdlog::error("NVSDK_NGX_D3D11_GetParameters exception: {}", ex.what()); + spdlog::error("NVSDK_NGX_D3D11_GetParameters exception: {0}", ex.what()); return NVSDK_NGX_Result_Fail; } } @@ -131,7 +131,7 @@ NVSDK_NGX_Result NVSDK_NGX_D3D11_GetCapabilityParameters(NVSDK_NGX_Parameter** O } catch (const std::exception& ex) { - spdlog::error("NVSDK_NGX_D3D11_GetCapabilityParameters exception: {}", ex.what()); + spdlog::error("NVSDK_NGX_D3D11_GetCapabilityParameters exception: {0}", ex.what()); return NVSDK_NGX_Result_Fail; } } @@ -147,7 +147,7 @@ NVSDK_NGX_Result NVSDK_NGX_D3D11_AllocateParameters(NVSDK_NGX_Parameter** OutPar } catch (const std::exception& ex) { - spdlog::error("NVSDK_NGX_D3D11_AllocateParameters exception: {}", ex.what()); + spdlog::error("NVSDK_NGX_D3D11_AllocateParameters exception: {0}", ex.what()); return NVSDK_NGX_Result_Fail; } @@ -326,15 +326,17 @@ NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceContext* InDevCtx, } unsigned int width, outWidth, height, outHeight; - InParameters->Get(NVSDK_NGX_Parameter_Width, &width); - InParameters->Get(NVSDK_NGX_Parameter_Height, &height); - InParameters->Get(NVSDK_NGX_Parameter_OutWidth, &outWidth); - InParameters->Get(NVSDK_NGX_Parameter_OutHeight, &outHeight); - width = width > outWidth ? width : outWidth; - height = height > outHeight ? height : outHeight; + if (InParameters->Get(NVSDK_NGX_Parameter_Width, &width) == NVSDK_NGX_Result_Success && + InParameters->Get(NVSDK_NGX_Parameter_Height, &height) == NVSDK_NGX_Result_Success && + InParameters->Get(NVSDK_NGX_Parameter_OutWidth, &outWidth) == NVSDK_NGX_Result_Success && + InParameters->Get(NVSDK_NGX_Parameter_OutHeight, &outHeight) == NVSDK_NGX_Result_Success) + { + width = width > outWidth ? width : outWidth; + height = height > outHeight ? height : outHeight; - if (deviceContext->XeSSIsInited() && (deviceContext->DisplayHeight != height || deviceContext->DisplayWidth != width)) - deviceContext->XeSSDestroy(); + if (deviceContext->XeSSIsInited() && (deviceContext->DisplayHeight != height || deviceContext->DisplayWidth != width)) + deviceContext->XeSSDestroy(); + } if (!CyberXessContext::instance()->MyConfig->DisableReactiveMaskSetFromIni) { @@ -368,7 +370,7 @@ NVSDK_NGX_Result NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceContext* InDevCtx, } NVSDK_NGX_Result evResult = NVSDK_NGX_Result_Success; - if (!deviceContext->XeSSExecuteDx11(instance->Dx12CommandList, instance->Dx12CommandQueue, instance->Dx11Device, InDevCtx, InParameters)) + if (!deviceContext->XeSSExecuteDx11(instance->Dx12CommandList, instance->Dx12CommandQueue, instance->Dx11Device, InDevCtx, InParameters, deviceContext)) evResult = NVSDK_NGX_Result_Fail; instance->Dx12CommandAllocator->Reset(); diff --git a/CyberXeSS/CyberXessDx12.cpp b/CyberXeSS/CyberXessDx12.cpp index f0fde919..ec3a336e 100644 --- a/CyberXeSS/CyberXessDx12.cpp +++ b/CyberXeSS/CyberXessDx12.cpp @@ -13,7 +13,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_Init_Ext(unsigned long long InApp spdlog::info("NVSDK_NGX_D3D12_Init_Ext BuildPipelines: {0}", CyberXessContext::instance()->MyConfig->BuildPipelines.value_or(true)); spdlog::info("NVSDK_NGX_D3D12_Init_Ext NetworkModel: {0}", CyberXessContext::instance()->MyConfig->NetworkModel.value_or(0)); - spdlog::info("NVSDK_NGX_D3D12_Init_Ext LogLevel: {0}", CyberXessContext::instance()->MyConfig->LogLevel.value_or(6)); + spdlog::info("NVSDK_NGX_D3D12_Init_Ext LogLevel: {0}", CyberXessContext::instance()->MyConfig->LogLevel.value_or(2)); CyberXessContext::instance()->Shutdown(true, true); @@ -99,7 +99,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_GetParameters(NVSDK_NGX_Parameter } catch (const std::exception& ex) { - spdlog::error("NVSDK_NGX_D3D12_GetParameters exception: {}", ex.what()); + spdlog::error("NVSDK_NGX_D3D12_GetParameters exception: {0}", ex.what()); return NVSDK_NGX_Result_Fail; } } @@ -115,7 +115,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_GetCapabilityParameters(NVSDK_NGX } catch (const std::exception& ex) { - spdlog::error("NVSDK_NGX_D3D12_GetCapabilityParameters exception: {}", ex.what()); + spdlog::error("NVSDK_NGX_D3D12_GetCapabilityParameters exception: {0}", ex.what()); return NVSDK_NGX_Result_Fail; } } @@ -131,7 +131,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_AllocateParameters(NVSDK_NGX_Para } catch (const std::exception& ex) { - spdlog::error("NVSDK_NGX_D3D12_AllocateParameters exception: {}", ex.what()); + spdlog::error("NVSDK_NGX_D3D12_AllocateParameters exception: {0}", ex.what()); return NVSDK_NGX_Result_Fail; } } @@ -247,15 +247,18 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom const auto deviceContext = CyberXessContext::instance()->Contexts[InFeatureHandle->Id].get(); unsigned int width, outWidth, height, outHeight; - InParameters->Get(NVSDK_NGX_Parameter_Width, &width); - InParameters->Get(NVSDK_NGX_Parameter_Height, &height); - InParameters->Get(NVSDK_NGX_Parameter_OutWidth, &outWidth); - InParameters->Get(NVSDK_NGX_Parameter_OutHeight, &outHeight); - width = width > outWidth ? width : outWidth; - height = height > outHeight ? height : outHeight; - if (deviceContext->XeSSIsInited() && (deviceContext->DisplayHeight != height || deviceContext->DisplayWidth != width)) - deviceContext->XeSSDestroy(); + if (InParameters->Get(NVSDK_NGX_Parameter_Width, &width) == NVSDK_NGX_Result_Success && + InParameters->Get(NVSDK_NGX_Parameter_Height, &height) == NVSDK_NGX_Result_Success && + InParameters->Get(NVSDK_NGX_Parameter_OutWidth, &outWidth) == NVSDK_NGX_Result_Success && + InParameters->Get(NVSDK_NGX_Parameter_OutHeight, &outHeight) == NVSDK_NGX_Result_Success) + { + width = width > outWidth ? width : outWidth; + height = height > outHeight ? height : outHeight; + + if (deviceContext->XeSSIsInited() && (deviceContext->DisplayHeight != height || deviceContext->DisplayWidth != width)) + deviceContext->XeSSDestroy(); + } if (!CyberXessContext::instance()->MyConfig->DisableReactiveMaskSetFromIni) { @@ -293,7 +296,7 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCom //dumpParams.path = "D:\\dmp\\"; //xessStartDump(deviceContext->XessContext, &dumpParams); - if (deviceContext->XeSSExecuteDx12(InCmdList, InParameters)) + if (deviceContext->XeSSExecuteDx12(InCmdList, InParameters, deviceContext)) return NVSDK_NGX_Result_Success; else return NVSDK_NGX_Result_Fail;