Skip to content

Commit

Permalink
Revert "fixing errors related to changing settings"
Browse files Browse the repository at this point in the history
This reverts commit d746130.
  • Loading branch information
nouverbe authored and nouverbe committed Feb 7, 2024
1 parent d746130 commit e64ecff
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 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 = true;
const bool CV_r_EnableDebugLayer = false;
}; // namespace RendererDX12

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

IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED);

ResetCachedState();

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

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

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

SubmitAllCommands(true);
WaitForIdle();
}

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

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

Expand Down
14 changes: 9 additions & 5 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
ID3DBaseTexture* t_noise_surf_mipped = NULL;
DirectX::ScratchImage mippedNoise = {};
DirectX::Image img = {
ID3DTexture2D* t_noise_surf_mipped = NULL;
DirectX::ScratchImage mippedNoise;
DirectX::Image img{
/*.width =*/TEX_jitter,
/*.height =*/TEX_jitter,
/*.format =*/desc.Format,
Expand All @@ -273,8 +273,12 @@ 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(), &t_noise_surf_mipped));
//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));

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

0 comments on commit e64ecff

Please sign in to comment.