Guess what? More renaming

This commit is contained in:
Henrik Rydgård 2016-12-25 21:01:57 +01:00
parent 9b439e4c43
commit f86b9f7900
37 changed files with 113 additions and 116 deletions

View File

@ -25,7 +25,7 @@ public:
// Needs casting to the appropriate type, unfortunately. Should find a better solution..
virtual void *GetAPIContext() { return nullptr; }
virtual Draw::Thin3DContext *CreateThin3DContext() = 0;
virtual Draw::DrawContext *CreateThin3DContext() = 0;
};
class DummyGraphicsContext : public GraphicsContext {
@ -35,5 +35,5 @@ public:
void SwapBuffers() override {}
void Resize() override {}
Draw::Thin3DContext *CreateThin3DContext() override { return nullptr; }
Draw::DrawContext *CreateThin3DContext() override { return nullptr; }
};

View File

@ -35,7 +35,7 @@ class FileLoader;
class GraphicsContext;
namespace Draw {
class Thin3DContext;
class DrawContext;
}
// PSP_CoreParameter()
@ -46,7 +46,7 @@ struct CoreParameter {
GPUCore gpuCore;
GraphicsContext *graphicsContext; // TODO: Find a better place.
Draw::Thin3DContext *thin3d;
Draw::DrawContext *thin3d;
bool enableSound; // there aren't multiple sound cores.
std::string fileToStart;

View File

@ -513,7 +513,7 @@ GPU_DX9::~GPU_DX9() {
// Needs to be called on GPU thread, not reporting thread.
void GPU_DX9::BuildReportingInfo() {
using namespace Draw;
Thin3DContext *thin3d = gfxCtx_->CreateThin3DContext();
DrawContext *thin3d = gfxCtx_->CreateThin3DContext();
reportingPrimaryInfo_ = thin3d->GetInfoString(InfoField::VENDORSTRING);
reportingFullInfo_ = reportingPrimaryInfo_ + " - " + System_GetProperty(SYSPROP_GPUDRIVER_VERSION) + " - " + thin3d->GetInfoString(InfoField::SHADELANGVERSION);

View File

@ -46,7 +46,7 @@ static void SetGPU(T *obj) {
#undef new
#endif
bool GPU_Init(GraphicsContext *ctx, Draw::Thin3DContext *thin3d) {
bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *thin3d) {
switch (PSP_CoreParameter().gpuCore) {
case GPUCORE_NULL:
SetGPU(new NullGPU());

View File

@ -99,8 +99,8 @@ extern GPUInterface *gpu;
extern GPUDebugInterface *gpuDebug;
namespace Draw {
class Thin3DContext;
class DrawContext;
}
bool GPU_Init(GraphicsContext *ctx, Draw::Thin3DContext *thin3d);
bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *thin3d);
void GPU_Shutdown();

View File

@ -51,7 +51,7 @@ static Draw::SamplerState *samplerLinear = nullptr;
static Draw::Buffer *vdata = nullptr;
static Draw::Buffer *idata = nullptr;
SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::Thin3DContext *_thin3D)
SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *_thin3D)
: gfxCtx_(gfxCtx), thin3d(_thin3D)
{
using namespace Draw;

View File

@ -46,13 +46,13 @@ typedef struct {
class ShaderManager;
namespace Draw {
class Thin3DContext;
class DrawContext;
class Texture;
}
class SoftGPU : public GPUCommon {
public:
SoftGPU(GraphicsContext *gfxCtx, Draw::Thin3DContext *_thin3D);
SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *_thin3D);
~SoftGPU();
void InitClear() override {}
void ExecuteOp(u32 op, u32 diff) override;
@ -108,6 +108,6 @@ private:
GraphicsContext *gfxCtx_;
Draw::Texture *fbTex;
Draw::Thin3DContext *thin3d;
Draw::DrawContext *thin3d;
std::vector<u32> fbTexBuffer;
};

View File

@ -353,7 +353,7 @@ void SystemInfoScreen::CreateViews() {
#endif
deviceSpecs->Add(new ItemHeader("GPU Information"));
Thin3DContext *thin3d = screenManager()->getThin3DContext();
DrawContext *thin3d = screenManager()->getThin3DContext();
deviceSpecs->Add(new InfoItem("3D API", thin3d->GetInfoString(InfoField::APINAME)));
deviceSpecs->Add(new InfoItem("Vendor", std::string(thin3d->GetInfoString(InfoField::VENDORSTRING)) + " (" + thin3d->GetInfoString(InfoField::VENDOR) + ")"));

View File

@ -991,7 +991,7 @@ void EmuScreen::render() {
bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
if (!useBufferedRendering) {
Thin3DContext *thin3d = screenManager()->getThin3DContext();
DrawContext *thin3d = screenManager()->getThin3DContext();
thin3d->Clear(ClearFlag::COLOR | ClearFlag::DEPTH | ClearFlag::STENCIL, 0xFF000000, 0.0f, 0);
Viewport viewport;
@ -1032,7 +1032,7 @@ void EmuScreen::render() {
fbo_unbind();
if (!osm.IsEmpty() || g_Config.bShowDebugStats || g_Config.iShowFPSCounter || g_Config.bShowTouchControls || g_Config.bShowDeveloperMenu || g_Config.bShowAudioDebug || saveStatePreview_->GetVisibility() != UI::V_GONE || g_Config.bShowFrameProfiler) {
Thin3DContext *thin3d = screenManager()->getThin3DContext();
DrawContext *thin3d = screenManager()->getThin3DContext();
// This sets up some important states but not the viewport.
screenManager()->getUIContext()->Begin();

View File

@ -730,7 +730,7 @@ void GameInfoCache::WaitUntilDone(GameInfo *info) {
// Runs on the main thread.
GameInfo *GameInfoCache::GetInfo(Draw::Thin3DContext *thin3d, const std::string &gamePath, int wantFlags) {
GameInfo *GameInfoCache::GetInfo(Draw::DrawContext *thin3d, const std::string &gamePath, int wantFlags) {
GameInfo *info = 0;
auto iter = info_.find(gamePath);
@ -781,7 +781,7 @@ again:
return info;
}
void GameInfoCache::SetupTexture(GameInfo *info, std::string &textureData, Draw::Thin3DContext *thin3d, Draw::Texture *&tex, double &loadTime) {
void GameInfoCache::SetupTexture(GameInfo *info, std::string &textureData, Draw::DrawContext *thin3d, Draw::Texture *&tex, double &loadTime) {
using namespace Draw;
if (textureData.size()) {
if (!tex) {

View File

@ -26,7 +26,7 @@
#include "Core/Loaders.h"
namespace Draw {
class Thin3DContext;
class DrawContext;
class Texture;
}
class PrioritizedWorkQueue;
@ -192,7 +192,7 @@ public:
// but filled in later asynchronously in the background. So keep calling this,
// redrawing the UI often. Only set flags to GAMEINFO_WANTBG or WANTSND if you really want them
// because they're big. bgTextures and sound may be discarded over time as well.
GameInfo *GetInfo(Draw::Thin3DContext *thin3d, const std::string &gamePath, int wantFlags);
GameInfo *GetInfo(Draw::DrawContext *thin3d, const std::string &gamePath, int wantFlags);
void FlushBGs(); // Gets rid of all BG textures. Also gets rid of bg sounds.
PrioritizedWorkQueue *WorkQueue() { return gameInfoWQ_; }
@ -202,7 +202,7 @@ public:
private:
void Init();
void Shutdown();
void SetupTexture(GameInfo *info, std::string &textureData, Draw::Thin3DContext *thin3d, Draw::Texture *&tex, double &loadTime);
void SetupTexture(GameInfo *info, std::string &textureData, Draw::DrawContext *thin3d, Draw::Texture *&tex, double &loadTime);
// Maps ISO path to info.
std::map<std::string, GameInfo *> info_;

View File

@ -185,7 +185,7 @@ void GameScreen::update(InputState &input) {
I18NCategory *ga = GetI18NCategory("Game");
Draw::Thin3DContext *thin3d = screenManager()->getThin3DContext();
Draw::DrawContext *thin3d = screenManager()->getThin3DContext();
GameInfo *info = g_gameInfoCache->GetInfo(thin3d, gamePath_, GAMEINFO_WANTBG | GAMEINFO_WANTSIZE);

View File

@ -139,7 +139,7 @@ struct PendingMessage {
static recursive_mutex pendingMutex;
static std::vector<PendingMessage> pendingMessages;
static Draw::Thin3DContext *thin3d;
static Draw::DrawContext *thin3d;
static UIContext *uiContext;
static std::vector<std::string> inputboxValue;
@ -147,7 +147,7 @@ static std::vector<std::string> inputboxValue;
WindowsAudioBackend *winAudioBackend;
#endif
Draw::Thin3DContext *GetThin3D() {
Draw::DrawContext *GetThin3D() {
return thin3d;
}

View File

@ -15,7 +15,7 @@ void D3D11Context::SwapBuffers() {
swapChain_->Present(0, 0);
}
Draw::Thin3DContext *D3D11Context::CreateThin3DContext() {
Draw::DrawContext *D3D11Context::CreateThin3DContext() {
return Draw::T3DCreateD3D11Context(); // device_, context_);
}

View File

@ -23,7 +23,7 @@
#include "Windows/GPU/WindowsGraphicsContext.h"
#include <d3d11.h>
class Thin3DContext;
class DrawContext;
class D3D11Context : public WindowsGraphicsContext {
public:
@ -37,7 +37,7 @@ public:
void Resize() override;
Draw::Thin3DContext *CreateThin3DContext() override;
Draw::DrawContext *CreateThin3DContext() override;
private:
ID3D11Device *device_;

View File

@ -27,7 +27,7 @@ void D3D9Context::SwapBuffers() {
}
}
Draw::Thin3DContext *D3D9Context::CreateThin3DContext() {
Draw::DrawContext *D3D9Context::CreateThin3DContext() {
return Draw::T3DCreateDX9Context(d3d, d3dEx, adapterId, device, deviceEx);
}

View File

@ -24,7 +24,7 @@
#include <d3d9.h>
namespace Draw {
class Thin3DContext;
class DrawContext;
}
class D3D9Context : public WindowsGraphicsContext {
@ -39,7 +39,7 @@ public:
void Resize() override;
Draw::Thin3DContext *CreateThin3DContext() override;
Draw::DrawContext *CreateThin3DContext() override;
private:
bool has9Ex;

View File

@ -400,7 +400,7 @@ void WindowsGLContext::Shutdown() {
void WindowsGLContext::Resize() {
}
Draw::Thin3DContext *WindowsGLContext::CreateThin3DContext() {
Draw::DrawContext *WindowsGLContext::CreateThin3DContext() {
CheckGLExtensions();
return Draw::T3DCreateGLContext();
}

View File

@ -4,7 +4,7 @@
#include "Windows/GPU/WindowsGraphicsContext.h"
namespace Draw {
class Thin3DContext;
class DrawContext;
}
class WindowsGLContext : public WindowsGraphicsContext {
@ -21,7 +21,7 @@ public:
void Resize() override;
Draw::Thin3DContext *CreateThin3DContext() override;
Draw::DrawContext *CreateThin3DContext() override;
private:
HDC hDC; // Private GDI Device Context

View File

@ -206,7 +206,7 @@ void WindowsVulkanContext::Shutdown() {
finalize_glslang();
}
Draw::Thin3DContext *WindowsVulkanContext::CreateThin3DContext() {
Draw::DrawContext *WindowsVulkanContext::CreateThin3DContext() {
return Draw::T3DCreateVulkanContext(g_Vulkan);
}

View File

@ -31,6 +31,6 @@ public:
void *GetAPIContext();
Draw::Thin3DContext *CreateThin3DContext() override;
Draw::DrawContext *CreateThin3DContext() override;
};

View File

@ -48,7 +48,7 @@ SDLJoystick *joystick = NULL;
class GLDummyGraphicsContext : public DummyGraphicsContext {
public:
Thin3DContext *CreateThin3DContext() override {
DrawContext *CreateThin3DContext() override {
CheckGLExtensions();
return T3DCreateGLContext();
}

View File

@ -32,7 +32,7 @@ DrawBuffer::~DrawBuffer() {
delete [] verts_;
}
void DrawBuffer::Init(Draw::Thin3DContext *t3d) {
void DrawBuffer::Init(Draw::DrawContext *t3d) {
using namespace Draw;
if (inited_)

View File

@ -67,7 +67,7 @@ public:
void End();
// TODO: Enforce these. Now Init is autocalled and shutdown not called.
void Init(Draw::Thin3DContext *t3d);
void Init(Draw::DrawContext *t3d);
void Shutdown();
int Count() const { return count_; }
@ -157,7 +157,7 @@ private:
Matrix4x4 drawMatrix_;
Draw::Thin3DContext *t3d_;
Draw::DrawContext *t3d_;
Draw::Buffer *vbuf_;
Draw::Thin3DVertexFormat *vformat_;
Draw::ShaderSet *shaderSet_;

View File

@ -50,7 +50,7 @@ struct TextDrawerContext {
int *pBitmapBits;
};
TextDrawer::TextDrawer(Draw::Thin3DContext *thin3d) : thin3d_(thin3d), ctx_(nullptr) {
TextDrawer::TextDrawer(Draw::DrawContext *thin3d) : thin3d_(thin3d), ctx_(nullptr) {
fontScaleX_ = 1.0f;
fontScaleY_ = 1.0f;
@ -300,7 +300,7 @@ void TextDrawer::DrawString(DrawBuffer &target, const char *str, float x, float
#else
TextDrawer::TextDrawer(Thin3DContext *thin3d) : thin3d_(thin3d), ctx_(NULL) {
TextDrawer::TextDrawer(DrawContext *thin3d) : thin3d_(thin3d), ctx_(NULL) {
fontScaleX_ = 1.0f;
fontScaleY_ = 1.0f;
}

View File

@ -14,7 +14,7 @@
#include "gfx_es2/draw_buffer.h"
namespace Draw {
class Thin3DContext;
class DrawContext;
class Texture;
}
@ -49,7 +49,7 @@ struct TextDrawerFontContext;
class TextDrawer {
public:
TextDrawer(Draw::Thin3DContext *thin3d);
TextDrawer(Draw::DrawContext *thin3d);
~TextDrawer();
uint32_t SetFont(const char *fontName, int size, int flags);
@ -65,7 +65,7 @@ public:
void OncePerFrame();
private:
Draw::Thin3DContext *thin3d_;
Draw::DrawContext *thin3d_;
void WrapString(std::string &out, const char *str, float maxWidth);

View File

@ -147,7 +147,7 @@ static const char * const vulkan_vsTexCol =
"}\n";
void Thin3DContext::CreatePresets() {
void DrawContext::CreatePresets() {
vsPresets_[VS_TEXTURE_COLOR_2D] = CreateShader(ShaderStage::VERTEX, glsl_vsTexCol, hlslVsTexCol, vulkan_vsTexCol);
vsPresets_[VS_COLOR_2D] = CreateShader(ShaderStage::VERTEX, glsl_vsCol, hlslVsCol, vulkan_vsCol);
@ -158,7 +158,7 @@ void Thin3DContext::CreatePresets() {
ssPresets_[SS_COLOR_2D] = CreateShaderSet(vsPresets_[VS_COLOR_2D], fsPresets_[FS_COLOR_2D]);
}
Thin3DContext::~Thin3DContext() {
DrawContext::~DrawContext() {
for (int i = 0; i < VS_MAX_PRESET; i++) {
if (vsPresets_[i]) {
vsPresets_[i]->Release();
@ -292,7 +292,7 @@ bool Texture::LoadFromFile(const std::string &filename, ImageFileType type) {
return retval;
}
Texture *Thin3DContext::CreateTextureFromFile(const char *filename, ImageFileType type) {
Texture *DrawContext::CreateTextureFromFile(const char *filename, ImageFileType type) {
Texture *tex = CreateTexture();
if (!tex->LoadFromFile(filename, type)) {
tex->Release();
@ -302,7 +302,7 @@ Texture *Thin3DContext::CreateTextureFromFile(const char *filename, ImageFileTyp
}
// TODO: Remove the code duplication between this and LoadFromFileData
Texture *Thin3DContext::CreateTextureFromFileData(const uint8_t *data, int size, ImageFileType type) {
Texture *DrawContext::CreateTextureFromFileData(const uint8_t *data, int size, ImageFileType type) {
int width[16], height[16];
int num_levels = 0;
int zim_flags = 0;

View File

@ -120,6 +120,7 @@ enum class Primitive {
TRIANGLE_LIST,
TRIANGLE_STRIP,
TRIANGLE_FAN,
// Tesselation shader only
PATCH_LIST,
// These are for geometry shaders only.
LINE_LIST_ADJ,
@ -207,10 +208,10 @@ struct Viewport {
float MaxDepth;
};
class Thin3DObject {
class RefCountedObject {
public:
Thin3DObject() : refcount_(1) {}
virtual ~Thin3DObject() {}
RefCountedObject() : refcount_(1) {}
virtual ~RefCountedObject() {}
// TODO: Reconsider this annoying ref counting stuff.
virtual void AddRef() { refcount_++; }
@ -231,25 +232,25 @@ private:
int refcount_;
};
class BlendState : public Thin3DObject {
class BlendState : public RefCountedObject {
public:
};
class SamplerState : public Thin3DObject {
class SamplerState : public RefCountedObject {
public:
};
class DepthStencilState : public Thin3DObject {
class DepthStencilState : public RefCountedObject {
public:
};
class Buffer : public Thin3DObject {
class Buffer : public RefCountedObject {
public:
virtual void SetData(const uint8_t *data, size_t size) = 0;
virtual void SubData(const uint8_t *data, size_t offset, size_t size) = 0;
};
class Texture : public Thin3DObject {
class Texture : public RefCountedObject {
public:
bool LoadFromFile(const std::string &filename, ImageFileType type = ImageFileType::DETECT);
bool LoadFromFileData(const uint8_t *data, size_t dataSize, ImageFileType type = ImageFileType::DETECT);
@ -281,23 +282,23 @@ struct VertexComponent {
uint8_t offset;
};
class Thin3DVertexFormat : public Thin3DObject {
class Thin3DVertexFormat : public RefCountedObject {
public:
virtual bool RequiresBuffer() = 0;
};
class Shader : public Thin3DObject {
class Shader : public RefCountedObject {
public:
};
class ShaderSet : public Thin3DObject {
class ShaderSet : public RefCountedObject {
public:
// TODO: Make some faster way of doing these. Support uniform buffers (and fake them on GL 2.0?)
virtual void SetVector(const char *name, float *value, int n) = 0;
virtual void SetMatrix4x4(const char *name, const float value[16]) = 0;
};
class RasterState : public Thin3DObject {
class RasterState : public RefCountedObject {
public:
};
@ -357,9 +358,9 @@ struct T3DRasterStateDesc {
Facing facing;
};
class Thin3DContext : public Thin3DObject {
class DrawContext : public RefCountedObject {
public:
virtual ~Thin3DContext();
virtual ~DrawContext();
virtual std::vector<std::string> GetFeatureList() { return std::vector<std::string>(); }
@ -436,13 +437,13 @@ protected:
private:
};
Thin3DContext *T3DCreateGLContext();
DrawContext *T3DCreateGLContext();
#ifdef _WIN32
Thin3DContext *T3DCreateDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx);
DrawContext *T3DCreateDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx);
#endif
Thin3DContext *T3DCreateVulkanContext(VulkanContext *context);
Thin3DContext *T3DCreateD3D11Context();
DrawContext *T3DCreateVulkanContext(VulkanContext *context);
DrawContext *T3DCreateD3D11Context();
} // namespace Draw

View File

@ -2,7 +2,7 @@
namespace Draw {
Thin3DContext *T3DCreateD3D11Context() {
DrawContext *T3DCreateD3D11Context() {
return nullptr;
}

View File

@ -68,16 +68,20 @@ static const D3DTEXTUREFILTERTYPE texFilterToD3D9[] = {
D3DTEXF_LINEAR,
};
inline D3DPRIMITIVETYPE PrimToD3D9(Primitive prim) {
switch (prim) {
case Primitive::POINT_LIST: return D3DPT_POINTLIST;
case Primitive::LINE_LIST: return D3DPT_LINELIST;
case Primitive::LINE_STRIP: return D3DPT_LINESTRIP;
case Primitive::TRIANGLE_LIST: return D3DPT_TRIANGLELIST;
case Primitive::TRIANGLE_STRIP: return D3DPT_TRIANGLESTRIP;
case Primitive::TRIANGLE_FAN: return D3DPT_TRIANGLEFAN;
}
}
static const D3DPRIMITIVETYPE primToD3D9[] = {
D3DPT_POINTLIST,
D3DPT_LINELIST,
D3DPT_LINESTRIP,
D3DPT_TRIANGLELIST,
D3DPT_TRIANGLESTRIP,
D3DPT_TRIANGLEFAN,
// These aren't available.
D3DPT_POINTLIST, // tess
D3DPT_POINTLIST, // geom ...
D3DPT_POINTLIST,
D3DPT_POINTLIST,
D3DPT_POINTLIST,
};
inline int PrimCountDivisor(Primitive prim) {
switch (prim) {
@ -443,7 +447,7 @@ void Thin3DDX9Texture::SetToSampler(LPDIRECT3DDEVICE9 device, int sampler) {
}
}
class Thin3DDX9Context : public Thin3DContext {
class Thin3DDX9Context : public DrawContext {
public:
Thin3DDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx);
~Thin3DDX9Context();
@ -700,7 +704,7 @@ void Thin3DDX9Context::Draw(Primitive prim, ShaderSet *shaderSet, Thin3DVertexFo
vbuf->BindAsVertexBuf(device_, fmt->GetStride(), offset);
ss->Apply(device_);
fmt->Apply(device_);
device_->DrawPrimitive(PrimToD3D9(prim), offset, vertexCount / 3);
device_->DrawPrimitive(primToD3D9[(int)prim], offset, vertexCount / 3);
}
void Thin3DDX9Context::DrawIndexed(Primitive prim, ShaderSet *shaderSet, Thin3DVertexFormat *format, Buffer *vdata, Buffer *idata, int vertexCount, int offset) {
@ -713,7 +717,7 @@ void Thin3DDX9Context::DrawIndexed(Primitive prim, ShaderSet *shaderSet, Thin3DV
fmt->Apply(device_);
vbuf->BindAsVertexBuf(device_, fmt->GetStride(), offset);
ibuf->BindAsIndexBuf(device_);
device_->DrawIndexedPrimitive(PrimToD3D9(prim), 0, 0, vertexCount, 0, vertexCount / PrimCountDivisor(prim));
device_->DrawIndexedPrimitive(primToD3D9[(int)prim], 0, 0, vertexCount, 0, vertexCount / PrimCountDivisor(prim));
}
void Thin3DDX9Context::DrawUP(Primitive prim, ShaderSet *shaderSet, Thin3DVertexFormat *format, const void *vdata, int vertexCount) {
@ -722,7 +726,7 @@ void Thin3DDX9Context::DrawUP(Primitive prim, ShaderSet *shaderSet, Thin3DVertex
ss->Apply(device_);
fmt->Apply(device_);
device_->DrawPrimitiveUP(PrimToD3D9(prim), vertexCount / 3, vdata, fmt->GetStride());
device_->DrawPrimitiveUP(primToD3D9[(int)prim], vertexCount / 3, vdata, fmt->GetStride());
}
static uint32_t SwapRB(uint32_t c) {
@ -825,7 +829,7 @@ void Thin3DDX9Shader::SetMatrix4x4(LPDIRECT3DDEVICE9 device, const char *name, c
}
}
Thin3DContext *T3DCreateDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx) {
DrawContext *T3DCreateDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx) {
int d3dx_ver = LoadD3DX9Dynamic();
if (!d3dx_ver) {
ELOG("Failed to load D3DX9!");

View File

@ -83,26 +83,18 @@ static const unsigned short logicOpToGL[] = {
};
#endif
inline GLuint PrimToGL(Primitive prim) {
switch (prim) {
case Primitive::POINT_LIST: return GL_POINTS;
case Primitive::LINE_LIST: return GL_LINES;
case Primitive::LINE_LIST_ADJ: return GL_LINES_ADJACENCY;
case Primitive::LINE_STRIP: return GL_LINE_STRIP;
case Primitive::LINE_STRIP_ADJ: return GL_LINE_STRIP_ADJACENCY;
case Primitive::TRIANGLE_LIST: return GL_TRIANGLES;
case Primitive::TRIANGLE_LIST_ADJ: return GL_TRIANGLES_ADJACENCY;
case Primitive::TRIANGLE_STRIP: return GL_TRIANGLE_STRIP;
case Primitive::TRIANGLE_STRIP_ADJ: return GL_TRIANGLES_ADJACENCY;
case Primitive::TRIANGLE_FAN: return GL_TRIANGLE_FAN;
case Primitive::PATCH_LIST: return GL_PATCHES;
default: return GL_POINTS;
}
}
static const unsigned short primToGL[] = {
GL_POINTS,
GL_LINES,
GL_LINE_STRIP,
GL_TRIANGLES,
GL_TRIANGLE_STRIP,
GL_TRIANGLE_FAN,
GL_PATCHES,
GL_LINES_ADJACENCY,
GL_LINE_STRIP_ADJACENCY,
GL_TRIANGLES_ADJACENCY,
GL_TRIANGLE_STRIP_ADJACENCY,
};
static const char *glsl_fragment_prelude =
@ -387,7 +379,7 @@ private:
std::map<std::string, UniformInfo> uniforms_;
};
class Thin3DGLContext : public Thin3DContext {
class Thin3DGLContext : public DrawContext {
public:
Thin3DGLContext();
virtual ~Thin3DGLContext();
@ -936,7 +928,7 @@ void Thin3DGLContext::Draw(Primitive prim, ShaderSet *shaderSet, Thin3DVertexFor
fmt->Apply();
ss->Apply();
glDrawArrays(PrimToGL(prim), offset, vertexCount);
glDrawArrays(primToGL[(int)prim], offset, vertexCount);
ss->Unapply();
fmt->Unapply();
@ -954,7 +946,7 @@ void Thin3DGLContext::DrawIndexed(Primitive prim, ShaderSet *shaderSet, Thin3DVe
// Note: ibuf binding is stored in the VAO, so call this after binding the fmt.
ibuf->Bind();
glDrawElements(PrimToGL(prim), vertexCount, GL_UNSIGNED_INT, (const void *)(size_t)offset);
glDrawElements(primToGL[(int)prim], vertexCount, GL_UNSIGNED_INT, (const void *)(size_t)offset);
ss->Unapply();
fmt->Unapply();
@ -969,7 +961,7 @@ void Thin3DGLContext::DrawUP(Primitive prim, ShaderSet *shaderSet, Thin3DVertexF
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDrawArrays(PrimToGL(prim), 0, vertexCount);
glDrawArrays(primToGL[(int)prim], 0, vertexCount);
ss->Unapply();
fmt->Unapply();
@ -998,7 +990,7 @@ void Thin3DGLContext::Clear(int mask, uint32_t colorval, float depthVal, int ste
glClear(glMask);
}
Thin3DContext *T3DCreateGLContext() {
DrawContext *T3DCreateGLContext() {
return new Thin3DGLContext();
}

View File

@ -385,7 +385,7 @@ struct DescriptorSetKey {
}
};
class Thin3DVKContext : public Thin3DContext {
class Thin3DVKContext : public DrawContext {
public:
Thin3DVKContext(VulkanContext *vulkan);
virtual ~Thin3DVKContext();
@ -1182,7 +1182,7 @@ void Thin3DVKContext::Clear(int mask, uint32_t colorval, float depthVal, int ste
}
}
Thin3DContext *T3DCreateVulkanContext(VulkanContext *vulkan) {
DrawContext *T3DCreateVulkanContext(VulkanContext *vulkan) {
return new Thin3DVKContext(vulkan);
}

View File

@ -38,7 +38,7 @@ class ScreenManager;
class UIContext;
namespace Draw {
class Thin3DContext;
class DrawContext;
}
class Screen {
@ -102,8 +102,8 @@ public:
void setUIContext(UIContext *context) { uiContext_ = context; }
UIContext *getUIContext() { return uiContext_; }
void setThin3DContext(Draw::Thin3DContext *context) { thin3DContext_ = context; }
Draw::Thin3DContext *getThin3DContext() { return thin3DContext_; }
void setThin3DContext(Draw::DrawContext *context) { thin3DContext_ = context; }
Draw::DrawContext *getThin3DContext() { return thin3DContext_; }
void render();
void resized();
@ -139,7 +139,7 @@ private:
Screen *nextScreen_;
UIContext *uiContext_;
Draw::Thin3DContext *thin3DContext_;
Draw::DrawContext *thin3DContext_;
const Screen *dialogFinished_;
DialogResult dialogResult_;

View File

@ -23,7 +23,7 @@ UIContext::~UIContext() {
blendNormal_->Release();
}
void UIContext::Init(Draw::Thin3DContext *thin3d, Draw::ShaderSet *uishader, Draw::ShaderSet *uishadernotex, Draw::Texture *uitexture, DrawBuffer *uidrawbuffer, DrawBuffer *uidrawbufferTop) {
void UIContext::Init(Draw::DrawContext *thin3d, Draw::ShaderSet *uishader, Draw::ShaderSet *uishadernotex, Draw::Texture *uitexture, DrawBuffer *uidrawbuffer, DrawBuffer *uidrawbufferTop) {
using namespace Draw;
thin3d_ = thin3d;
blendNormal_ = thin3d_->CreateBlendState({ true, BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA });

View File

@ -10,7 +10,7 @@
// Everything forward declared so this header is safe everywhere.
namespace Draw {
class Thin3DContext;
class DrawContext;
class ShaderSet;
class DepthStencilState;
class Texture;
@ -36,7 +36,7 @@ public:
UIContext();
~UIContext();
void Init(Draw::Thin3DContext *thin3d, Draw::ShaderSet *uiShaderTex, Draw::ShaderSet *uiShaderNoTex, Draw::Texture *uitexture, DrawBuffer *uidrawbuffer, DrawBuffer *uidrawbufferTop);
void Init(Draw::DrawContext *thin3d, Draw::ShaderSet *uiShaderTex, Draw::ShaderSet *uiShaderNoTex, Draw::Texture *uitexture, DrawBuffer *uidrawbuffer, DrawBuffer *uidrawbufferTop);
void Begin();
void BeginNoTex();
@ -74,10 +74,10 @@ public:
// in dps, like dp_xres and dp_yres
void SetBounds(const Bounds &b) { bounds_ = b; }
const Bounds &GetBounds() const { return bounds_; }
Draw::Thin3DContext *GetThin3DContext() { return thin3d_; }
Draw::DrawContext *GetThin3DContext() { return thin3d_; }
private:
Draw::Thin3DContext *thin3d_;
Draw::DrawContext *thin3d_;
Bounds bounds_;
float fontScaleX_;
@ -85,7 +85,7 @@ private:
UI::FontStyle *fontStyle_;
TextDrawer *textDrawer_;
Draw::Thin3DContext *thin3D_;
Draw::DrawContext *thin3D_;
Draw::DepthStencilState *depth_;
Draw::SamplerState *sampler_;
Draw::RasterState *rasterNoCull_;

View File

@ -59,7 +59,7 @@ void UIScreen::update(InputState &input) {
}
void UIScreen::preRender() {
Draw::Thin3DContext *thin3d = screenManager()->getThin3DContext();
Draw::DrawContext *thin3d = screenManager()->getThin3DContext();
if (!thin3d) {
return;
}

View File

@ -7,7 +7,7 @@
class I18NCategory;
namespace Draw {
class Thin3DContext;
class DrawContext;
}
class UIScreen : public Screen {