Skip to content

Commit

Permalink
Fix texture sampler
Browse files Browse the repository at this point in the history
- Change texture sampler to linear clamp when rendering UI to avoid some artifacts
  • Loading branch information
SaiyansKing committed Nov 9, 2022
1 parent 7bbe8ee commit 4a99dfb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions D3D11Engine/D3D11GraphicsEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@ XRESULT D3D11GraphicsEngine::OnBeginFrame() {
Engine::GAPI->GetRendererState().RasterizerState.CullMode = GothicRasterizerStateInfo::CM_CULL_NONE;
Engine::GAPI->GetRendererState().RasterizerState.SetDirty();
UpdateRenderStates();
GetContext()->PSSetSamplers( 0, 1, ClampSamplerState.GetAddressOf() );

// Bind HDR Back Buffer
GetContext()->OMSetRenderTargets( 1, HDRBackBuffer->GetRenderTargetView().GetAddressOf(), nullptr );
Expand Down Expand Up @@ -2361,6 +2362,7 @@ XRESULT D3D11GraphicsEngine::OnStartWorldRendering() {
Engine::GAPI->GetRendererState().RasterizerState.CullMode = GothicRasterizerStateInfo::CM_CULL_NONE;
Engine::GAPI->GetRendererState().RasterizerState.SetDirty();
UpdateRenderStates();
GetContext()->PSSetSamplers( 0, 1, ClampSamplerState.GetAddressOf() );

// Save screenshot if wanted
if ( SaveScreenshotNextFrame ) {
Expand Down Expand Up @@ -5203,6 +5205,7 @@ void D3D11GraphicsEngine::DrawVobSingle( VobInfo* vob, zCCamera& camera ) {
// Set backface culling
Engine::GAPI->GetRendererState().RasterizerState.CullMode = GothicRasterizerStateInfo::CM_CULL_BACK;
Engine::GAPI->GetRendererState().RasterizerState.SetDirty();
GetContext()->PSSetSamplers( 0, 1, DefaultSamplerState.GetAddressOf() );

SetActivePixelShader( "PS_Preview_Textured" );
SetActiveVertexShader( "VS_Ex" );
Expand Down Expand Up @@ -5238,6 +5241,7 @@ void D3D11GraphicsEngine::DrawVobSingle( VobInfo* vob, zCCamera& camera ) {
// Disable culling again
Engine::GAPI->GetRendererState().RasterizerState.CullMode = GothicRasterizerStateInfo::CM_CULL_NONE;
Engine::GAPI->GetRendererState().RasterizerState.SetDirty();
GetContext()->PSSetSamplers( 0, 1, ClampSamplerState.GetAddressOf() );
}

/** Update clipping cursor onto window */
Expand Down

0 comments on commit 4a99dfb

Please sign in to comment.