Skip to content

Commit

Permalink
fixing errors related to changing settings
Browse files Browse the repository at this point in the history
  • Loading branch information
nouverbe authored and nouverbe committed Feb 7, 2024
1 parent 3b03804 commit d746130
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/Layers/xrRenderDX11/dx11HW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ void CHW::Present()
psDeviceFlags.test(rsVSync); // xxx: weird tearing glitches when VSync turned on for windowed mode in DX11

#if defined(USE_DX12)
WaitForSingleObjectEx(Device.PresentationFinished.GetHandle(),
1000, // 1 second timeout (shouldn't ever occur)
true);
//WaitForSingleObjectEx(Device.PresentationFinished.GetHandle(),
// 1000, // 1 second timeout (shouldn't ever occur)
// true);
#endif

m_pSwapChain->Present(bUseVSync ? 1 : 0, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_R5/DX12/API/DX12.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern int g_nPrintDX12;
namespace RendererDX12
{
const int CV_r_D3D12SubmissionThread = 0;
const bool CV_r_EnableDebugLayer = false;
const bool CV_r_EnableDebugLayer = true;
}; // namespace RendererDX12

#define DX12_NOT_IMPLEMENTED R_ASSERT2(0, "Not implemented!");
Expand Down
13 changes: 6 additions & 7 deletions src/Layers/xrRenderPC_R5/DX12/Device/CCryDX12DeviceContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2516,8 +2516,6 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ClearState()

IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED);

ResetCachedState();

CSSetShader(NULL, NULL, 0);
DSSetShader(NULL, NULL, 0);
GSSetShader(NULL, NULL, 0);
Expand All @@ -2532,9 +2530,8 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ClearState()

OMSetBlendState(NULL, NULL, 0);
OMSetDepthStencilState(NULL, 0);

SubmitAllCommands(true);
WaitForIdle();

SubmitAllCommands(DX12_SUBMISSION_MODE == DX12_SUBMISSION_SYNC, m_CmdFenceSet.GetCurrentValues());
}

void STDMETHODCALLTYPE CCryDX12DeviceContext::Flush()
Expand All @@ -2561,15 +2558,17 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ExecuteCommandList(
_In_ BOOL RestoreContextState)
{
DX12_FUNC_LOG
DX12_NOT_IMPLEMENTED
//R_ASSERT(!IsDeferred(), "Only immediate context can execute command list");
DX12_NOT_IMPLEMENTED
}

HRESULT STDMETHODCALLTYPE CCryDX12DeviceContext::FinishCommandList(
BOOL RestoreDeferredContextState,
_Out_opt_ ID3D11CommandList** ppCommandList)
{
DX12_FUNC_LOG
DX12_NOT_IMPLEMENTED
DX12_NOT_IMPLEMENTED
//R_ASSERT(IsDeferred(), "Only deferred context can record command list");
return E_FAIL;
}

Expand Down
14 changes: 5 additions & 9 deletions src/Layers/xrRenderPC_R5/r5_rendertarget_build_textures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ void CRenderTarget::build_textures()
// Create noise mipped
{
// Autogen mipmaps
ID3DTexture2D* t_noise_surf_mipped = NULL;
DirectX::ScratchImage mippedNoise;
DirectX::Image img{
ID3DBaseTexture* t_noise_surf_mipped = NULL;
DirectX::ScratchImage mippedNoise = {};
DirectX::Image img = {
/*.width =*/TEX_jitter,
/*.height =*/TEX_jitter,
/*.format =*/desc.Format,
Expand All @@ -273,12 +273,8 @@ void CRenderTarget::build_textures()
// WIC produces bad texture, non-WIC gives 100% identical texture as from D3DX11FilterTexture
GenerateMipMaps(img, DirectX::TEX_FILTER_POINT | DirectX::TEX_FILTER_FORCE_NON_WIC, 0, mippedNoise);

//R_CHK(CreateTexture(HW.pDevice, mippedNoise.GetImages(), mippedNoise.GetImageCount(),
// mippedNoise.GetMetadata(), (ID3D11Resource**)&t_noise_surf_mipped));

R_CHK(CreateTextureEx(HW.pDevice, mippedNoise.GetImages(), mippedNoise.GetImageCount(),
mippedNoise.GetMetadata(), D3D_USAGE_IMMUTABLE, D3D_BIND_SHADER_RESOURCE, 0, 0,
DirectX::CREATETEX_DEFAULT, (ID3D11Resource**)&t_noise_surf_mipped));
R_CHK(CreateTexture(HW.pDevice, mippedNoise.GetImages(), mippedNoise.GetImageCount(),
mippedNoise.GetMetadata(), &t_noise_surf_mipped));

t_noise_mipped = RImplementation.Resources->_CreateTexture(r2_jitter_mipped);
t_noise_mipped->surface_set(t_noise_surf_mipped);
Expand Down

0 comments on commit d746130

Please sign in to comment.