Skeleton GPU files.

This commit is contained in:
Ben Vanik 2013-05-27 21:45:55 -07:00
parent 16baef3591
commit 2cecc02787
19 changed files with 501 additions and 8 deletions

View File

@ -0,0 +1,31 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_D3D11_D3D11_PRIVATE_H_
#define XENIA_GPU_D3D11_D3D11_PRIVATE_H_
#include <xenia/core.h>
#include <xenia/gpu/d3d11/d3d11.h>
namespace xe {
namespace gpu {
namespace d3d11 {
} // namespace d3d11
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_D3D11_D3D11_PRIVATE_H_

View File

@ -0,0 +1,44 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/gpu/d3d11/d3d11.h>
#include <xenia/gpu/d3d11/d3d11_graphics_system.h>
using namespace xe;
using namespace xe::gpu;
using namespace xe::gpu::d3d11;
namespace {
void InitializeIfNeeded();
void CleanupOnShutdown();
void InitializeIfNeeded() {
static bool has_initialized = false;
if (has_initialized) {
return;
}
has_initialized = true;
//
atexit(CleanupOnShutdown);
}
void CleanupOnShutdown() {
}
}
GraphicsSystem* xe::gpu::d3d11::Create(const CreationParams* params) {
InitializeIfNeeded();
return new D3D11GraphicsSystem(params);
}

View File

@ -0,0 +1,33 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_D3D11_D3D11_H_
#define XENIA_GPU_D3D11_D3D11_H_
#include <xenia/core.h>
namespace xe {
namespace gpu {
class CreationParams;
class GraphicsSystem;
namespace d3d11 {
GraphicsSystem* Create(const CreationParams* params);
} // namespace d3d11
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_D3D11_D3D11_H_

View File

@ -0,0 +1,25 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/gpu/d3d11/d3d11_graphics_system.h>
#include <xenia/gpu/gpu-private.h>
using namespace xe;
using namespace xe::gpu;
using namespace xe::gpu::d3d11;
D3D11GraphicsSystem::D3D11GraphicsSystem(const CreationParams* params) :
GraphicsSystem(params) {
}
D3D11GraphicsSystem::~D3D11GraphicsSystem() {
}

View File

@ -0,0 +1,39 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_D3D11_D3D11_GRAPHICS_SYSTEM_H_
#define XENIA_GPU_D3D11_D3D11_GRAPHICS_SYSTEM_H_
#include <xenia/core.h>
#include <xenia/gpu/graphics_system.h>
#include <xenia/gpu/d3d11/d3d11-private.h>
namespace xe {
namespace gpu {
namespace d3d11 {
GraphicsSystem* Create(const CreationParams* params);
class D3D11GraphicsSystem : public GraphicsSystem {
public:
D3D11GraphicsSystem(const CreationParams* params);
virtual ~D3D11GraphicsSystem();
};
} // namespace d3d11
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_D3D11_D3D11_GRAPHICS_SYSTEM_H_

View File

@ -0,0 +1,10 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'd3d11-private.h',
'd3d11.cc',
'd3d11.h',
'd3d11_graphics_system.cc',
'd3d11_graphics_system.h',
],
}

View File

@ -0,0 +1,19 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_PRIVATE_H_
#define XENIA_GPU_PRIVATE_H_
#include <gflags/gflags.h>
// DECLARE_ flags here
#endif // XENIA_GPU_PRIVATE_H_

View File

@ -8,8 +8,29 @@
*/
#include <xenia/gpu/gpu.h>
#include <xenia/gpu/gpu-private.h>
#if XE_PLATFORM(WIN32)
#include <xenia/gpu/d3d11/d3d11.h>
#endif // WIN32
#include <xenia/gpu/nop/nop.h>
void do_gpu_stuff() {
XELOGGPU("gpu");
using namespace xe;
using namespace xe::gpu;
// DEFINE_ flags here.
GraphicsSystem* xe::gpu::Create(const CreationParams* params) {
// TODO(benvanik): use flags to determine system, check support, etc.
return xe::gpu::nop::Create(params);
// #if XE_PLATFORM(WIN32)
// return xe::gpu::d3d11::Create(params);
// #endif // WIN32
}
GraphicsSystem* xe::gpu::CreateNop(const CreationParams* params) {
return xe::gpu::nop::Create(params);
}

View File

@ -10,9 +10,19 @@
#ifndef XENIA_GPU_GPU_H_
#define XENIA_GPU_GPU_H_
#include <xenia/common.h>
#include <xenia/core.h>
#include <xenia/gpu/graphics_system.h>
namespace xe {
namespace gpu {
GraphicsSystem* Create(const CreationParams* params);
GraphicsSystem* CreateNop(const CreationParams* params);
} // namespace gpu
} // namespace xe
void do_gpu_stuff();
#endif // XENIA_GPU_GPU_H_

View File

@ -0,0 +1,27 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/gpu/graphics_system.h>
using namespace xe;
using namespace xe::gpu;
GraphicsSystem::GraphicsSystem(const CreationParams* params) {
memory_ = xe_memory_retain(params->memory);
}
GraphicsSystem::~GraphicsSystem() {
xe_memory_release(memory_);
}
xe_memory_ref GraphicsSystem::memory() {
return xe_memory_retain(memory_);
}

View File

@ -0,0 +1,43 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_GRAPHICS_SYSTEM_H_
#define XENIA_GPU_GRAPHICS_SYSTEM_H_
#include <xenia/core.h>
namespace xe {
namespace gpu {
class CreationParams {
public:
xe_memory_ref memory;
};
class GraphicsSystem {
public:
virtual ~GraphicsSystem();
xe_memory_ref memory();
protected:
GraphicsSystem(const CreationParams* params);
xe_memory_ref memory_;
};
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_GRAPHICS_SYSTEM_H_

View File

@ -0,0 +1,31 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_NOP_NOP_PRIVATE_H_
#define XENIA_GPU_NOP_NOP_PRIVATE_H_
#include <xenia/core.h>
#include <xenia/gpu/nop/nop.h>
namespace xe {
namespace gpu {
namespace nop {
} // namespace nop
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_NOP_NOP_PRIVATE_H_

44
src/xenia/gpu/nop/nop.cc Normal file
View File

@ -0,0 +1,44 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/gpu/nop/nop.h>
#include <xenia/gpu/nop/nop_graphics_system.h>
using namespace xe;
using namespace xe::gpu;
using namespace xe::gpu::nop;
namespace {
void InitializeIfNeeded();
void CleanupOnShutdown();
void InitializeIfNeeded() {
static bool has_initialized = false;
if (has_initialized) {
return;
}
has_initialized = true;
//
atexit(CleanupOnShutdown);
}
void CleanupOnShutdown() {
}
}
GraphicsSystem* xe::gpu::nop::Create(const CreationParams* params) {
InitializeIfNeeded();
return new NopGraphicsSystem(params);
}

33
src/xenia/gpu/nop/nop.h Normal file
View File

@ -0,0 +1,33 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_NOP_NOP_H_
#define XENIA_GPU_NOP_NOP_H_
#include <xenia/core.h>
namespace xe {
namespace gpu {
class CreationParams;
class GraphicsSystem;
namespace nop {
GraphicsSystem* Create(const CreationParams* params);
} // namespace nop
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_NOP_NOP_H_

View File

@ -0,0 +1,25 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xenia/gpu/nop/nop_graphics_system.h>
#include <xenia/gpu/gpu-private.h>
using namespace xe;
using namespace xe::gpu;
using namespace xe::gpu::nop;
NopGraphicsSystem::NopGraphicsSystem(const CreationParams* params) :
GraphicsSystem(params) {
}
NopGraphicsSystem::~NopGraphicsSystem() {
}

View File

@ -0,0 +1,36 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_GPU_NOP_NOP_GRAPHICS_SYSTEM_H_
#define XENIA_GPU_NOP_NOP_GRAPHICS_SYSTEM_H_
#include <xenia/core.h>
#include <xenia/gpu/graphics_system.h>
#include <xenia/gpu/nop/nop-private.h>
namespace xe {
namespace gpu {
namespace nop {
class NopGraphicsSystem : public GraphicsSystem {
public:
NopGraphicsSystem(const CreationParams* params);
virtual ~NopGraphicsSystem();
};
} // namespace nop
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_NOP_NOP_GRAPHICS_SYSTEM_H_

View File

@ -0,0 +1,10 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'nop-private.h',
'nop.cc',
'nop.h',
'nop_graphics_system.cc',
'nop_graphics_system.h',
],
}

View File

@ -1,7 +1,22 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'gpu-private.h',
'gpu.cc',
'gpu.h',
'graphics_system.cc',
'graphics_system.h',
],
'includes': [
'nop/sources.gypi',
],
'conditions': [
['OS == "win"', {
'includes': [
'd3d11/sources.gypi',
],
}],
],
}

View File

@ -99,9 +99,6 @@ int Run::Launch(const xechar_t* path) {
}
int xenia_run(int argc, xechar_t **argv) {
// Dummy call to keep the GPU code linking in to ensure it's working.
do_gpu_stuff();
int result_code = 1;
// Grab path.