Skip to content

Commit

Permalink
Remove some unneccesery functions to reduce code clutter
Browse files Browse the repository at this point in the history
  • Loading branch information
kirides committed May 6, 2021
1 parent 07e001f commit 1592a5d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 127 deletions.
12 changes: 0 additions & 12 deletions D3D11Engine/D3D11GraphicsEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@ class D3D11GraphicsEngine : public D3D11GraphicsEngineBase {
/** Called when the game wants to clear the bound rendertarget */
virtual XRESULT Clear( const float4& color );

/** Creates a vertexbuffer object (Not registered inside) */
virtual XRESULT CreateVertexBuffer( D3D11VertexBuffer** outBuffer );

/** Creates a texture object (Not registered inside) */
virtual XRESULT CreateTexture( D3D11Texture** outTexture );

/** Creates a constantbuffer object (Not registered inside) */
virtual XRESULT CreateConstantBuffer( D3D11ConstantBuffer** outCB, void* data, int size );

/** Returns a list of available display modes */
virtual XRESULT GetDisplayModeList( std::vector<DisplayModeInfo>* modeList, bool includeSuperSampling = false );

Expand Down Expand Up @@ -176,9 +167,6 @@ class D3D11GraphicsEngine : public D3D11GraphicsEngineBase {
/** Returns the data of the backbuffer */
void GetBackbufferData( byte** data, int& pixelsize );

/** Returns the line renderer object */
BaseLineRenderer* GetLineRenderer();

/** ---------------- Gothic rendering functions -------------------- */

/** Draws the world mesh */
Expand Down
109 changes: 0 additions & 109 deletions D3D11Engine/D3D11GraphicsEngineBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,115 +94,6 @@ XRESULT D3D11GraphicsEngineBase::CreateConstantBuffer( D3D11ConstantBuffer** out
return XR_SUCCESS;
}

/** Presents the current frame to the screen */
XRESULT D3D11GraphicsEngineBase::Present() {
// Set default viewport
SetViewport( ViewportInfo( 0, 0, Resolution.x, Resolution.y ) );

// Reset State
SetDefaultStates();

// Draw debug-lines
LineRenderer->Flush();

// Draw ant tweak bar
Engine::AntTweakBar->Draw();

bool vsync = Engine::GAPI->GetRendererState().RendererSettings.EnableVSync;
if ( dxgi_1_3 ) {
if ( SwapChain2->Present( vsync ? 1 : 0, 0 ) == DXGI_ERROR_DEVICE_REMOVED ) {
switch ( GetDevice()->GetDeviceRemovedReason() ) {
case DXGI_ERROR_DEVICE_HUNG:
LogErrorBox() << "Device Removed! (DXGI_ERROR_DEVICE_HUNG)";
exit( 0 );
break;

case DXGI_ERROR_DEVICE_REMOVED:
LogErrorBox() << "Device Removed! (DXGI_ERROR_DEVICE_REMOVED)";
exit( 0 );
break;

case DXGI_ERROR_DEVICE_RESET:
LogErrorBox() << "Device Removed! (DXGI_ERROR_DEVICE_RESET)";
exit( 0 );
break;

case DXGI_ERROR_DRIVER_INTERNAL_ERROR:
LogErrorBox() << "Device Removed! (DXGI_ERROR_DRIVER_INTERNAL_ERROR)";
exit( 0 );
break;

case DXGI_ERROR_INVALID_CALL:
LogErrorBox() << "Device Removed! (DXGI_ERROR_INVALID_CALL)";
exit( 0 );
break;

case S_OK:
LogInfo() << "Device removed, but we're fine!";
break;

default:
LogWarnBox() << "Device Removed! (Unknown reason)";
}
} else if ( SwapChain->Present( vsync ? 1 : 0, 0 ) == DXGI_ERROR_DEVICE_REMOVED ) {
switch ( GetDevice()->GetDeviceRemovedReason() ) {
case DXGI_ERROR_DEVICE_HUNG:
LogErrorBox() << "Device Removed! (DXGI_ERROR_DEVICE_HUNG)";
exit( 0 );
break;

case DXGI_ERROR_DEVICE_REMOVED:
LogErrorBox() << "Device Removed! (DXGI_ERROR_DEVICE_REMOVED)";
exit( 0 );
break;

case DXGI_ERROR_DEVICE_RESET:
LogErrorBox() << "Device Removed! (DXGI_ERROR_DEVICE_RESET)";
exit( 0 );
break;

case DXGI_ERROR_DRIVER_INTERNAL_ERROR:
LogErrorBox() << "Device Removed! (DXGI_ERROR_DRIVER_INTERNAL_ERROR)";
exit( 0 );
break;

case DXGI_ERROR_INVALID_CALL:
LogErrorBox() << "Device Removed! (DXGI_ERROR_INVALID_CALL)";
exit( 0 );
break;

case S_OK:
LogInfo() << "Device removed, but we're fine!";
break;

default:
LogWarnBox() << "Device Removed! (Unknown reason)";
}
}
}

// We did our present, set the next frame ready
PresentPending = false;

return XR_SUCCESS;
}

/** Called when we started to render the world */
XRESULT D3D11GraphicsEngineBase::OnStartWorldRendering() {
if ( PresentPending )
return XR_FAILED;

PresentPending = true;

// Update transforms
UpdateTransformsCB();

// Force farplane
Engine::GAPI->SetFarPlane( Engine::GAPI->GetRendererState().RendererSettings.SectionDrawRadius * WORLD_SECTION_SIZE );

return XR_SUCCESS;
}

/** Returns the line renderer object */
BaseLineRenderer* D3D11GraphicsEngineBase::GetLineRenderer() {
return LineRenderer.get();
Expand Down
6 changes: 0 additions & 6 deletions D3D11Engine/D3D11GraphicsEngineBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ class D3D11GraphicsEngineBase : public BaseGraphicsEngine {
/** Returns a list of available display modes */
virtual XRESULT GetDisplayModeList( std::vector<DisplayModeInfo>* modeList, bool includeSuperSampling = false ) PURE;

/** Presents the current frame to the screen */
virtual XRESULT Present();

/** Called when we started to render the world */
virtual XRESULT OnStartWorldRendering();

/** Returns the line renderer object */
virtual BaseLineRenderer* GetLineRenderer();

Expand Down

0 comments on commit 1592a5d

Please sign in to comment.