From 20d9e60a67c1b5b6d31264aeb68019f4df38ffbc Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Mon, 30 Jan 2017 14:33:38 +0100 Subject: [PATCH] Just some renaming. Start moving away from the "thin3d" name --- Common/GraphicsContext.h | 4 +-- GPU/Directx9/GPU_DX9.cpp | 2 +- GPU/Software/SoftGpu.cpp | 46 ++++++++++++++-------------- GPU/Software/SoftGpu.h | 2 +- UI/DevScreens.cpp | 14 ++++----- UI/EmuScreen.cpp | 12 ++++---- UI/GameInfoCache.cpp | 14 ++++----- UI/GameInfoCache.h | 4 +-- UI/GameScreen.cpp | 4 +-- UI/GameScreen.h | 2 +- UI/MainScreen.cpp | 10 +++--- UI/MiscScreens.cpp | 8 ++--- UI/NativeApp.cpp | 38 ++++++++++------------- UI/PauseScreen.cpp | 4 +-- UI/SavedataScreen.cpp | 10 +++--- UI/Store.cpp | 4 +-- Windows/GPU/D3D11Context.cpp | 2 +- Windows/GPU/D3D11Context.h | 2 +- Windows/GPU/D3D9Context.cpp | 2 +- Windows/GPU/D3D9Context.h | 2 +- Windows/GPU/WindowsGLContext.cpp | 2 +- Windows/GPU/WindowsGLContext.h | 2 +- Windows/GPU/WindowsVulkanContext.cpp | 2 +- Windows/GPU/WindowsVulkanContext.h | 2 +- ext/native/base/PCMain.cpp | 2 +- ext/native/gfx_es2/draw_text.cpp | 16 +++++----- ext/native/gfx_es2/draw_text.h | 2 +- ext/native/ui/screen.h | 4 +-- ext/native/ui/ui_context.cpp | 14 ++++----- ext/native/ui/ui_context.h | 5 ++- ext/native/ui/ui_screen.cpp | 12 ++++---- ext/native/ui/view.cpp | 6 ++-- ext/native/ui/view.h | 4 +-- ios/ViewController.mm | 2 +- 34 files changed, 128 insertions(+), 133 deletions(-) diff --git a/Common/GraphicsContext.h b/Common/GraphicsContext.h index cd2d85da0c..c51bcd8596 100644 --- a/Common/GraphicsContext.h +++ b/Common/GraphicsContext.h @@ -25,7 +25,7 @@ public: // Needs casting to the appropriate type, unfortunately. Should find a better solution.. virtual void *GetAPIContext() { return nullptr; } - virtual Draw::DrawContext *CreateThin3DContext() = 0; + virtual Draw::DrawContext *CreateDrawContext() = 0; }; class DummyGraphicsContext : public GraphicsContext { @@ -35,5 +35,5 @@ public: void SwapBuffers() override {} void Resize() override {} - Draw::DrawContext *CreateThin3DContext() override { return nullptr; } + Draw::DrawContext *CreateDrawContext() override { return nullptr; } }; \ No newline at end of file diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 031e3afe7e..51309d8384 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -519,7 +519,7 @@ GPU_DX9::~GPU_DX9() { // Needs to be called on GPU thread, not reporting thread. void GPU_DX9::BuildReportingInfo() { using namespace Draw; - DrawContext *thin3d = gfxCtx_->CreateThin3DContext(); + DrawContext *thin3d = gfxCtx_->CreateDrawContext(); reportingPrimaryInfo_ = thin3d->GetInfoString(InfoField::VENDORSTRING); reportingFullInfo_ = reportingPrimaryInfo_ + " - " + System_GetProperty(SYSPROP_GPUDRIVER_VERSION) + " - " + thin3d->GetInfoString(InfoField::SHADELANGVERSION); diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index 94ed7e1388..3cced07af0 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -48,7 +48,7 @@ static Draw::Buffer *vdata = nullptr; static Draw::Buffer *idata = nullptr; SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *_thin3D) - : gfxCtx_(gfxCtx), thin3d(_thin3D) + : gfxCtx_(gfxCtx), draw_(_thin3D) { using namespace Draw; TextureDesc desc{}; @@ -58,7 +58,7 @@ SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *_thin3D) desc.height = 272; desc.depth = 1; desc.mipLevels = 1; - fbTex = thin3d->CreateTexture(desc); + fbTex = draw_->CreateTexture(desc); InputLayoutDesc inputDesc = { { @@ -71,25 +71,25 @@ SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *_thin3D) }, }; - ShaderModule *vshader = thin3d->GetVshaderPreset(VS_TEXTURE_COLOR_2D); + ShaderModule *vshader = draw_->GetVshaderPreset(VS_TEXTURE_COLOR_2D); - vdata = thin3d->CreateBuffer(24 * 4, BufferUsageFlag::DYNAMIC | BufferUsageFlag::VERTEXDATA); - idata = thin3d->CreateBuffer(sizeof(int) * 6, BufferUsageFlag::DYNAMIC | BufferUsageFlag::INDEXDATA); + vdata = draw_->CreateBuffer(24 * 4, BufferUsageFlag::DYNAMIC | BufferUsageFlag::VERTEXDATA); + idata = draw_->CreateBuffer(sizeof(int) * 6, BufferUsageFlag::DYNAMIC | BufferUsageFlag::INDEXDATA); - InputLayout *inputLayout = thin3d->CreateInputLayout(inputDesc); - DepthStencilState *depth = thin3d->CreateDepthStencilState({ false, false, Comparison::LESS }); - BlendState *blendstateOff = thin3d->CreateBlendState({ false, 0xF }); - RasterState *rasterNoCull = thin3d->CreateRasterState({}); + InputLayout *inputLayout = draw_->CreateInputLayout(inputDesc); + DepthStencilState *depth = draw_->CreateDepthStencilState({ false, false, Comparison::LESS }); + BlendState *blendstateOff = draw_->CreateBlendState({ false, 0xF }); + RasterState *rasterNoCull = draw_->CreateRasterState({}); - samplerNearest = thin3d->CreateSamplerState({ TextureFilter::NEAREST, TextureFilter::NEAREST, TextureFilter::NEAREST }); - samplerLinear = thin3d->CreateSamplerState({ TextureFilter::LINEAR, TextureFilter::LINEAR, TextureFilter::LINEAR }); + samplerNearest = draw_->CreateSamplerState({ TextureFilter::NEAREST, TextureFilter::NEAREST, TextureFilter::NEAREST }); + samplerLinear = draw_->CreateSamplerState({ TextureFilter::LINEAR, TextureFilter::LINEAR, TextureFilter::LINEAR }); PipelineDesc pipelineDesc{ Primitive::TRIANGLE_LIST, - { thin3d->GetVshaderPreset(VS_TEXTURE_COLOR_2D), thin3d->GetFshaderPreset(FS_TEXTURE_COLOR_2D) }, + { draw_->GetVshaderPreset(VS_TEXTURE_COLOR_2D), draw_->GetFshaderPreset(FS_TEXTURE_COLOR_2D) }, inputLayout, depth, blendstateOff, rasterNoCull }; - texColor = thin3d->CreateGraphicsPipeline(pipelineDesc); + texColor = draw_->CreateGraphicsPipeline(pipelineDesc); fb.data = Memory::GetPointer(0x44000000); // TODO: correct default address? depthbuf.data = Memory::GetPointer(0x44000000); // TODO: correct default address? @@ -138,20 +138,20 @@ void SoftGPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat for void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) { using namespace Draw; - if (!thin3d) + if (!draw_) return; float dstwidth = (float)PSP_CoreParameter().pixelWidth; float dstheight = (float)PSP_CoreParameter().pixelHeight; Viewport viewport = {0.0f, 0.0f, dstwidth, dstheight, 0.0f, 1.0f}; - thin3d->SetViewports(1, &viewport); + draw_->SetViewports(1, &viewport); SamplerState *sampler; if (g_Config.iBufFilter == SCALE_NEAREST) { sampler = samplerNearest; } else { sampler = samplerLinear; } - thin3d->SetScissorRect(0, 0, dstwidth, dstheight); + draw_->SetScissorRect(0, 0, dstwidth, dstheight); float u0 = 0.0f; float u1; @@ -227,7 +227,7 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) { std::swap(v0, v1); } - thin3d->BindSamplerStates(0, 1, &sampler); + draw_->BindSamplerStates(0, 1, &sampler); const Vertex verts[4] = { { x, y, 0, u0, v0, 0xFFFFFFFF }, // TL @@ -240,7 +240,7 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) { int indexes[] = { 0, 1, 2, 0, 2, 3 }; idata->SetData((const uint8_t *)indexes, sizeof(indexes)); - thin3d->BindTexture(0, fbTex); + draw_->BindTexture(0, fbTex); static const float identity4x4[16] = { 1.0f, 0.0f, 0.0f, 0.0f, @@ -250,12 +250,12 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) { }; texColor->SetMatrix4x4("WorldViewProj", identity4x4); - thin3d->BindPipeline(texColor); - thin3d->BindVertexBuffers(0, 1, &vdata, nullptr); - thin3d->BindIndexBuffer(idata, 0); - thin3d->DrawIndexed(6, 0); + draw_->BindPipeline(texColor); + draw_->BindVertexBuffers(0, 1, &vdata, nullptr); + draw_->BindIndexBuffer(idata, 0); + draw_->DrawIndexed(6, 0); } else { - thin3d->Clear(Draw::COLOR, 0, 0, 0); + draw_->Clear(Draw::COLOR, 0, 0, 0); } } diff --git a/GPU/Software/SoftGpu.h b/GPU/Software/SoftGpu.h index b51d17479d..d0dc9da949 100644 --- a/GPU/Software/SoftGpu.h +++ b/GPU/Software/SoftGpu.h @@ -105,7 +105,7 @@ private: GraphicsContext *gfxCtx_; Draw::Texture *fbTex; - Draw::DrawContext *thin3d; + Draw::DrawContext *draw_; Draw::Pipeline *texColor; std::vector fbTexBuffer; }; diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 97af7a724b..3e25f3579d 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -352,11 +352,11 @@ void SystemInfoScreen::CreateViews() { #endif deviceSpecs->Add(new ItemHeader("GPU Information")); - DrawContext *thin3d = screenManager()->getThin3DContext(); + DrawContext *draw = screenManager()->getDrawContext(); - 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) + ")")); - deviceSpecs->Add(new InfoItem("Model", thin3d->GetInfoString(InfoField::RENDERER))); + deviceSpecs->Add(new InfoItem("3D API", draw->GetInfoString(InfoField::APINAME))); + deviceSpecs->Add(new InfoItem("Vendor", std::string(draw->GetInfoString(InfoField::VENDORSTRING)) + " (" + draw->GetInfoString(InfoField::VENDOR) + ")")); + deviceSpecs->Add(new InfoItem("Model", draw->GetInfoString(InfoField::RENDERER))); #ifdef _WIN32 deviceSpecs->Add(new InfoItem("Driver Version", System_GetProperty(SYSPROP_GPUDRIVER_VERSION))); if (GetGPUBackend() == GPUBackend::DIRECT3D9) { @@ -391,12 +391,12 @@ void SystemInfoScreen::CreateViews() { apiVersion = StringFromFormat("v%d.%d.%d", gl_extensions.ver[0], gl_extensions.ver[1], gl_extensions.ver[2]); } } else { - apiVersion = thin3d->GetInfoString(InfoField::APIVERSION); + apiVersion = draw->GetInfoString(InfoField::APIVERSION); if (apiVersion.size() > 30) apiVersion.resize(30); } deviceSpecs->Add(new InfoItem("API Version", apiVersion)); - deviceSpecs->Add(new InfoItem("Shading Language", thin3d->GetInfoString(InfoField::SHADELANGVERSION))); + deviceSpecs->Add(new InfoItem("Shading Language", draw->GetInfoString(InfoField::SHADELANGVERSION))); #ifdef __ANDROID__ std::string moga = System_GetProperty(SYSPROP_MOGA_VERSION); @@ -474,7 +474,7 @@ void SystemInfoScreen::CreateViews() { tabHolder->AddTab("Vulkan Features", oglExtensionsScroll); oglExtensions->Add(new ItemHeader("Vulkan Features")); - std::vector features = thin3d->GetFeatureList(); + std::vector features = draw->GetFeatureList(); for (auto &feature : features) { oglExtensions->Add(new TextView(feature))->SetFocusable(true); } diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 3927d81769..882d9bbc48 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -179,7 +179,7 @@ void EmuScreen::bootGame(const std::string &filename) { } // Preserve the existing graphics context. coreParam.graphicsContext = PSP_CoreParameter().graphicsContext; - coreParam.thin3d = screenManager()->getThin3DContext(); + coreParam.thin3d = screenManager()->getDrawContext(); coreParam.enableSound = g_Config.bEnableSound; coreParam.fileToStart = filename; coreParam.mountIso = ""; @@ -991,8 +991,8 @@ void EmuScreen::render() { bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE; if (!useBufferedRendering) { - DrawContext *thin3d = screenManager()->getThin3DContext(); - thin3d->Clear(ClearFlag::COLOR | ClearFlag::DEPTH | ClearFlag::STENCIL, 0xFF000000, 0.0f, 0); + DrawContext *draw = screenManager()->getDrawContext(); + draw->Clear(ClearFlag::COLOR | ClearFlag::DEPTH | ClearFlag::STENCIL, 0xFF000000, 0.0f, 0); Viewport viewport; viewport.TopLeftX = 0; @@ -1001,8 +1001,8 @@ void EmuScreen::render() { viewport.Height = pixel_yres; viewport.MaxDepth = 1.0; viewport.MinDepth = 0.0; - thin3d->SetViewports(1, &viewport); - thin3d->SetTargetSize(pixel_xres, pixel_yres); + draw->SetViewports(1, &viewport); + draw->SetTargetSize(pixel_xres, pixel_yres); } PSP_BeginHostFrame(); @@ -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) { - DrawContext *thin3d = screenManager()->getThin3DContext(); + DrawContext *thin3d = screenManager()->getDrawContext(); // This sets up some important states but not the viewport. screenManager()->getUIContext()->Begin(); diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index b041211099..259b3e9b9c 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -731,7 +731,7 @@ void GameInfoCache::WaitUntilDone(GameInfo *info) { // Runs on the main thread. -GameInfo *GameInfoCache::GetInfo(Draw::DrawContext *thin3d, const std::string &gamePath, int wantFlags) { +GameInfo *GameInfoCache::GetInfo(Draw::DrawContext *draw, const std::string &gamePath, int wantFlags) { GameInfo *info = 0; auto iter = info_.find(gamePath); @@ -741,16 +741,16 @@ GameInfo *GameInfoCache::GetInfo(Draw::DrawContext *thin3d, const std::string &g // Need to start over. We'll just add a new work item. goto again; } - if (thin3d && info->iconDataLoaded) { - SetupTexture(info, info->iconTextureData, thin3d, info->iconTexture, info->timeIconWasLoaded); + if (draw && info->iconDataLoaded) { + SetupTexture(info, info->iconTextureData, draw, info->iconTexture, info->timeIconWasLoaded); info->iconDataLoaded = false; } - if (thin3d && info->pic0DataLoaded) { - SetupTexture(info, info->pic0TextureData, thin3d, info->pic0Texture, info->timePic0WasLoaded); + if (draw && info->pic0DataLoaded) { + SetupTexture(info, info->pic0TextureData, draw, info->pic0Texture, info->timePic0WasLoaded); info->pic0DataLoaded = false; } - if (thin3d && info->pic1DataLoaded) { - SetupTexture(info, info->pic1TextureData, thin3d, info->pic1Texture, info->timePic1WasLoaded); + if (draw && info->pic1DataLoaded) { + SetupTexture(info, info->pic1TextureData, draw, info->pic1Texture, info->timePic1WasLoaded); info->pic1DataLoaded = false; } iter->second->lastAccessedTime = time_now_d(); diff --git a/UI/GameInfoCache.h b/UI/GameInfoCache.h index f0d1d073e2..6096693d27 100644 --- a/UI/GameInfoCache.h +++ b/UI/GameInfoCache.h @@ -193,7 +193,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::DrawContext *thin3d, const std::string &gamePath, int wantFlags); + GameInfo *GetInfo(Draw::DrawContext *draw, const std::string &gamePath, int wantFlags); void FlushBGs(); // Gets rid of all BG textures. Also gets rid of bg sounds. PrioritizedWorkQueue *WorkQueue() { return gameInfoWQ_; } @@ -203,7 +203,7 @@ public: private: void Init(); void Shutdown(); - void SetupTexture(GameInfo *info, std::string &textureData, Draw::DrawContext *thin3d, ManagedTexture *&tex, double &loadTime); + void SetupTexture(GameInfo *info, std::string &textureData, Draw::DrawContext *draw, ManagedTexture *&tex, double &loadTime); // Maps ISO path to info. std::map info_; diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index 9eb72ce0fd..9709e912ae 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -65,7 +65,7 @@ void GameScreen::CreateViews() { leftColumn->Add(new Choice(di->T("Back"), "", false, new AnchorLayoutParams(150, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle(this, &GameScreen::OnSwitchBack); if (info) { - texvGameIcon_ = leftColumn->Add(new Thin3DTextureView(0, IS_DEFAULT, new AnchorLayoutParams(144 * 2, 80 * 2, 10, 10, NONE, NONE))); + texvGameIcon_ = leftColumn->Add(new TextureView(0, IS_DEFAULT, new AnchorLayoutParams(144 * 2, 80 * 2, 10, 10, NONE, NONE))); LinearLayout *infoLayout = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(10, 200, NONE, NONE)); leftColumn->Add(infoLayout); @@ -185,7 +185,7 @@ void GameScreen::update(InputState &input) { I18NCategory *ga = GetI18NCategory("Game"); - Draw::DrawContext *thin3d = screenManager()->getThin3DContext(); + Draw::DrawContext *thin3d = screenManager()->getDrawContext(); GameInfo *info = g_gameInfoCache->GetInfo(thin3d, gamePath_, GAMEINFO_WANTBG | GAMEINFO_WANTSIZE); diff --git a/UI/GameScreen.h b/UI/GameScreen.h index 8b0a821ed8..57b580155c 100644 --- a/UI/GameScreen.h +++ b/UI/GameScreen.h @@ -61,7 +61,7 @@ private: UI::EventReturn OnCwCheat(UI::EventParams &e); // As we load metadata in the background, we need to be able to update these after the fact. - UI::Thin3DTextureView *texvGameIcon_; + UI::TextureView *texvGameIcon_; UI::TextView *tvTitle_; UI::TextView *tvGameSize_; UI::TextView *tvSaveDataSize_; diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 2bbd840464..78fe1cd5c0 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -173,7 +173,7 @@ private: }; void GameButton::Draw(UIContext &dc) { - GameInfo *ginfo = g_gameInfoCache->GetInfo(dc.GetThin3DContext(), gamePath_, 0); + GameInfo *ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath_, 0); Draw::Texture *texture = 0; u32 color = 0, shadowColor = 0; using namespace UI; @@ -251,7 +251,7 @@ void GameButton::Draw(UIContext &dc) { if (texture) { dc.Draw()->Flush(); - dc.GetThin3DContext()->BindTexture(0, texture); + dc.GetDrawContext()->BindTexture(0, texture); if (holdStart_ != 0.0) { double time_held = time_now_d() - holdStart_; int holdFrameCount = (int)(time_held * 60.0f); @@ -1000,7 +1000,7 @@ bool MainScreen::DrawBackgroundFor(UIContext &dc, const std::string &gamePath, f GameInfo *ginfo = 0; if (!gamePath.empty()) { - ginfo = g_gameInfoCache->GetInfo(dc.GetThin3DContext(), gamePath, GAMEINFO_WANTBG); + ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath, GAMEINFO_WANTBG); // Loading texture data may bind a texture. dc.RebindTexture(); @@ -1013,9 +1013,9 @@ bool MainScreen::DrawBackgroundFor(UIContext &dc, const std::string &gamePath, f } if (ginfo->pic1Texture) { - dc.GetThin3DContext()->BindTexture(0, ginfo->pic1Texture->GetTexture()); + dc.GetDrawContext()->BindTexture(0, ginfo->pic1Texture->GetTexture()); } else if (ginfo->pic0Texture) { - dc.GetThin3DContext()->BindTexture(0, ginfo->pic0Texture->GetTexture()); + dc.GetDrawContext()->BindTexture(0, ginfo->pic0Texture->GetTexture()); } uint32_t color = whiteAlpha(ease(progress)) & 0xFFc0c0c0; diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 4242c69b25..ae32f2b06f 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -103,18 +103,18 @@ void DrawBackground(UIContext &dc, float alpha = 1.0f) { } void DrawGameBackground(UIContext &dc, const std::string &gamePath) { - GameInfo *ginfo = g_gameInfoCache->GetInfo(dc.GetThin3DContext(), gamePath, GAMEINFO_WANTBG); + GameInfo *ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath, GAMEINFO_WANTBG); dc.Flush(); if (ginfo) { bool hasPic = false; double loadTime; if (ginfo->pic1Texture) { - dc.GetThin3DContext()->BindTexture(0, ginfo->pic1Texture->GetTexture()); + dc.GetDrawContext()->BindTexture(0, ginfo->pic1Texture->GetTexture()); loadTime = ginfo->timePic1WasLoaded; hasPic = true; } else if (ginfo->pic0Texture) { - dc.GetThin3DContext()->BindTexture(0, ginfo->pic0Texture->GetTexture()); + dc.GetDrawContext()->BindTexture(0, ginfo->pic0Texture->GetTexture()); loadTime = ginfo->timePic0WasLoaded; hasPic = true; } @@ -475,7 +475,7 @@ void LogoScreen::render() { } #ifdef _WIN32 - dc.DrawText(screenManager()->getThin3DContext()->GetInfoString(InfoField::APINAME).c_str(), bounds.centerX(), bounds.y2() - 100, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); + dc.DrawText(screenManager()->getDrawContext()->GetInfoString(InfoField::APINAME).c_str(), bounds.centerX(), bounds.y2() - 100, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); #endif dc.End(); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index eac524efae..a94c5ea990 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -140,7 +140,7 @@ struct PendingMessage { static recursive_mutex pendingMutex; static std::vector pendingMessages; -static Draw::DrawContext *thin3d; +static Draw::DrawContext *g_draw; static Draw::Pipeline *colorPipeline; static Draw::Pipeline *texColorPipeline; static UIContext *uiContext; @@ -150,10 +150,6 @@ static std::vector inputboxValue; WindowsAudioBackend *winAudioBackend; #endif -Draw::DrawContext *GetThin3D() { - return thin3d; -} - std::thread *graphicsLoadThread; class AndroidLogger : public LogListener { @@ -529,7 +525,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch void NativeInitGraphics(GraphicsContext *graphicsContext) { using namespace Draw; Core_SetGraphicsContext(graphicsContext); - thin3d = graphicsContext->CreateThin3DContext(); + g_draw = graphicsContext->CreateDrawContext(); ui_draw2d.SetAtlas(&ui_atlas); ui_draw2d_front.SetAtlas(&ui_atlas); @@ -579,7 +575,7 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) { ui_theme.popupTitle.fgColor = 0xFF59BEE3; #endif - uiTexture = CreateTextureFromFile(thin3d, "ui_atlas.zim", ImageFileType::ZIM); + uiTexture = CreateTextureFromFile(g_draw, "ui_atlas.zim", ImageFileType::ZIM); if (!uiTexture) { PanicAlert("Failed to load ui_atlas.zim.\n\nPlace it in the directory \"assets\" under your PPSSPP directory."); ELOG("Failed to load ui_atlas.zim"); @@ -592,34 +588,34 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) { uiContext = new UIContext(); uiContext->theme = &ui_theme; - Draw::InputLayout *inputLayout = ui_draw2d.CreateInputLayout(thin3d); - Draw::BlendState *blendNormal = thin3d->CreateBlendState({ true, 0xF, BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA }); - Draw::DepthStencilState *depth = thin3d->CreateDepthStencilState({ false, false, Comparison::LESS }); - Draw::RasterState *rasterNoCull = thin3d->CreateRasterState({}); + Draw::InputLayout *inputLayout = ui_draw2d.CreateInputLayout(g_draw); + Draw::BlendState *blendNormal = g_draw->CreateBlendState({ true, 0xF, BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA }); + Draw::DepthStencilState *depth = g_draw->CreateDepthStencilState({ false, false, Comparison::LESS }); + Draw::RasterState *rasterNoCull = g_draw->CreateRasterState({}); PipelineDesc colorDesc{ Primitive::TRIANGLE_LIST, - { thin3d->GetVshaderPreset(VS_COLOR_2D), thin3d->GetFshaderPreset(FS_COLOR_2D) }, + { g_draw->GetVshaderPreset(VS_COLOR_2D), g_draw->GetFshaderPreset(FS_COLOR_2D) }, inputLayout, depth, blendNormal, rasterNoCull }; PipelineDesc texColorDesc{ Primitive::TRIANGLE_LIST, - { thin3d->GetVshaderPreset(VS_TEXTURE_COLOR_2D), thin3d->GetFshaderPreset(FS_TEXTURE_COLOR_2D) }, + { g_draw->GetVshaderPreset(VS_TEXTURE_COLOR_2D), g_draw->GetFshaderPreset(FS_TEXTURE_COLOR_2D) }, inputLayout, depth, blendNormal, rasterNoCull }; - colorPipeline = thin3d->CreateGraphicsPipeline(colorDesc); - texColorPipeline = thin3d->CreateGraphicsPipeline(texColorDesc); + colorPipeline = g_draw->CreateGraphicsPipeline(colorDesc); + texColorPipeline = g_draw->CreateGraphicsPipeline(texColorDesc); inputLayout->Release(); rasterNoCull->Release(); blendNormal->Release(); depth->Release(); - ui_draw2d.Init(thin3d, texColorPipeline); - ui_draw2d_front.Init(thin3d, texColorPipeline); + ui_draw2d.Init(g_draw, texColorPipeline); + ui_draw2d_front.Init(g_draw, texColorPipeline); - uiContext->Init(thin3d, texColorPipeline, colorPipeline, &ui_draw2d, &ui_draw2d_front); + uiContext->Init(g_draw, texColorPipeline, colorPipeline, &ui_draw2d, &ui_draw2d_front); RasterStateDesc desc; desc.cull = CullMode::NONE; desc.frontFace = Facing::CCW; @@ -628,7 +624,7 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) { uiContext->Text()->SetFont("Tahoma", 20, 0); screenManager->setUIContext(uiContext); - screenManager->setThin3DContext(thin3d); + screenManager->setDrawContext(g_draw); #ifdef _WIN32 winAudioBackend = CreateAudioBackend((AudioBackendType)g_Config.iAudioBackend); @@ -662,8 +658,8 @@ void NativeShutdownGraphics() { texColorPipeline->Release(); // TODO: Reconsider this annoying ref counting stuff. - if (thin3d->Release()) { - thin3d = nullptr; + if (g_draw->Release()) { + g_draw = nullptr; } } diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index 01d8f5a154..6298d8288e 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -78,7 +78,7 @@ void AsyncImageFileView::SetFilename(std::string filename) { void AsyncImageFileView::Draw(UIContext &dc) { using namespace Draw; if (!texture_ && !textureFailed_ && !filename_.empty()) { - texture_ = CreateTextureFromFile(dc.GetThin3DContext(), filename_.c_str(), DETECT); + texture_ = CreateTextureFromFile(dc.GetDrawContext(), filename_.c_str(), DETECT); if (!texture_) textureFailed_ = true; } @@ -90,7 +90,7 @@ void AsyncImageFileView::Draw(UIContext &dc) { // TODO: involve sizemode if (texture_) { dc.Flush(); - dc.GetThin3DContext()->BindTexture(0, texture_->GetTexture()); + dc.GetDrawContext()->BindTexture(0, texture_->GetTexture()); dc.Draw()->Rect(bounds_.x, bounds_.y, bounds_.w, bounds_.h, color_); dc.Flush(); dc.RebindTexture(); diff --git a/UI/SavedataScreen.cpp b/UI/SavedataScreen.cpp index b67ced8a69..0a3ca6db13 100644 --- a/UI/SavedataScreen.cpp +++ b/UI/SavedataScreen.cpp @@ -66,7 +66,7 @@ public: void CreatePopupContents(UI::ViewGroup *parent) override { using namespace UI; - GameInfo *ginfo = g_gameInfoCache->GetInfo(screenManager()->getThin3DContext(), savePath_, GAMEINFO_WANTBG | GAMEINFO_WANTSIZE); + GameInfo *ginfo = g_gameInfoCache->GetInfo(screenManager()->getDrawContext(), savePath_, GAMEINFO_WANTBG | GAMEINFO_WANTSIZE); LinearLayout *content = new LinearLayout(ORIENT_VERTICAL); parent->Add(content); if (!ginfo) @@ -80,7 +80,7 @@ public: std::string savedata_title = ginfo->paramSFO.GetValueString("SAVEDATA_TITLE"); if (ginfo->iconTexture) { - toprow->Add(new Thin3DTextureView(ginfo->iconTexture->GetTexture(), IS_FIXED, new LinearLayoutParams(Margins(10, 5)))); + toprow->Add(new TextureView(ginfo->iconTexture->GetTexture(), IS_FIXED, new LinearLayoutParams(Margins(10, 5)))); } LinearLayout *topright = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1.0f)); topright->SetSpacing(1.0f); @@ -153,7 +153,7 @@ static std::string CleanSaveString(std::string str) { } void SavedataButton::Draw(UIContext &dc) { - GameInfo *ginfo = g_gameInfoCache->GetInfo(dc.GetThin3DContext(), savePath_, GAMEINFO_WANTSIZE); + GameInfo *ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), savePath_, GAMEINFO_WANTSIZE); Draw::Texture *texture = 0; u32 color = 0, shadowColor = 0; using namespace UI; @@ -224,7 +224,7 @@ void SavedataButton::Draw(UIContext &dc) { if (texture) { dc.Draw()->Flush(); - dc.GetThin3DContext()->BindTexture(0, texture); + dc.GetDrawContext()->BindTexture(0, texture); dc.Draw()->DrawTexRect(x, y, x + w, y + h, 0, 0, 1, 1, color); dc.Draw()->Flush(); } @@ -376,7 +376,7 @@ void SavedataScreen::CreateViews() { } UI::EventReturn SavedataScreen::OnSavedataButtonClick(UI::EventParams &e) { - GameInfo *ginfo = g_gameInfoCache->GetInfo(screenManager()->getThin3DContext(), e.s, 0); + GameInfo *ginfo = g_gameInfoCache->GetInfo(screenManager()->getDrawContext(), e.s, 0); screenManager()->push(new SavedataPopupScreen(e.s, ginfo->GetTitle())); // the game path: e.s; return UI::EVENT_DONE; diff --git a/UI/Store.cpp b/UI/Store.cpp index f8b467aff1..e4ed259204 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -143,7 +143,7 @@ void HttpImageFileView::Draw(UIContext &dc) { } if (!textureData_.empty()) { - texture_ = CreateTextureFromFileData(dc.GetThin3DContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), DETECT); + texture_ = CreateTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), DETECT); if (!texture_) textureFailed_ = true; textureData_.clear(); @@ -157,7 +157,7 @@ void HttpImageFileView::Draw(UIContext &dc) { // TODO: involve sizemode if (texture_) { dc.Flush(); - dc.GetThin3DContext()->BindTexture(0, texture_->GetTexture()); + dc.GetDrawContext()->BindTexture(0, texture_->GetTexture()); dc.Draw()->Rect(bounds_.x, bounds_.y, bounds_.w, bounds_.h, color_); dc.Flush(); dc.RebindTexture(); diff --git a/Windows/GPU/D3D11Context.cpp b/Windows/GPU/D3D11Context.cpp index e034bddb38..0c43b3c838 100644 --- a/Windows/GPU/D3D11Context.cpp +++ b/Windows/GPU/D3D11Context.cpp @@ -15,7 +15,7 @@ void D3D11Context::SwapBuffers() { swapChain_->Present(0, 0); } -Draw::DrawContext *D3D11Context::CreateThin3DContext() { +Draw::DrawContext *D3D11Context::CreateDrawContext() { return Draw::T3DCreateD3D11Context(device_, context_); } diff --git a/Windows/GPU/D3D11Context.h b/Windows/GPU/D3D11Context.h index e5c00e9f64..f0c2eebee3 100644 --- a/Windows/GPU/D3D11Context.h +++ b/Windows/GPU/D3D11Context.h @@ -37,7 +37,7 @@ public: void Resize() override; - Draw::DrawContext *CreateThin3DContext() override; + Draw::DrawContext *CreateDrawContext() override; private: ID3D11Device *device_; diff --git a/Windows/GPU/D3D9Context.cpp b/Windows/GPU/D3D9Context.cpp index 5859c3af51..4c4d40a26b 100644 --- a/Windows/GPU/D3D9Context.cpp +++ b/Windows/GPU/D3D9Context.cpp @@ -27,7 +27,7 @@ void D3D9Context::SwapBuffers() { } } -Draw::DrawContext *D3D9Context::CreateThin3DContext() { +Draw::DrawContext *D3D9Context::CreateDrawContext() { return Draw::T3DCreateDX9Context(d3d, d3dEx, adapterId, device, deviceEx); } diff --git a/Windows/GPU/D3D9Context.h b/Windows/GPU/D3D9Context.h index 55c706c325..0eba05f43b 100644 --- a/Windows/GPU/D3D9Context.h +++ b/Windows/GPU/D3D9Context.h @@ -39,7 +39,7 @@ public: void Resize() override; - Draw::DrawContext *CreateThin3DContext() override; + Draw::DrawContext *CreateDrawContext() override; private: bool has9Ex; diff --git a/Windows/GPU/WindowsGLContext.cpp b/Windows/GPU/WindowsGLContext.cpp index 857a512553..a3a91c98dd 100644 --- a/Windows/GPU/WindowsGLContext.cpp +++ b/Windows/GPU/WindowsGLContext.cpp @@ -400,7 +400,7 @@ void WindowsGLContext::Shutdown() { void WindowsGLContext::Resize() { } -Draw::DrawContext *WindowsGLContext::CreateThin3DContext() { +Draw::DrawContext *WindowsGLContext::CreateDrawContext() { CheckGLExtensions(); return Draw::T3DCreateGLContext(); } diff --git a/Windows/GPU/WindowsGLContext.h b/Windows/GPU/WindowsGLContext.h index 10ae527552..6b2d2dbbeb 100644 --- a/Windows/GPU/WindowsGLContext.h +++ b/Windows/GPU/WindowsGLContext.h @@ -21,7 +21,7 @@ public: void Resize() override; - Draw::DrawContext *CreateThin3DContext() override; + Draw::DrawContext *CreateDrawContext() override; private: HDC hDC; // Private GDI Device Context diff --git a/Windows/GPU/WindowsVulkanContext.cpp b/Windows/GPU/WindowsVulkanContext.cpp index f9562c4dcf..c97c9c8e59 100644 --- a/Windows/GPU/WindowsVulkanContext.cpp +++ b/Windows/GPU/WindowsVulkanContext.cpp @@ -207,7 +207,7 @@ void WindowsVulkanContext::Shutdown() { finalize_glslang(); } -Draw::DrawContext *WindowsVulkanContext::CreateThin3DContext() { +Draw::DrawContext *WindowsVulkanContext::CreateDrawContext() { return Draw::T3DCreateVulkanContext(g_Vulkan); } diff --git a/Windows/GPU/WindowsVulkanContext.h b/Windows/GPU/WindowsVulkanContext.h index f79aa59757..859d017545 100644 --- a/Windows/GPU/WindowsVulkanContext.h +++ b/Windows/GPU/WindowsVulkanContext.h @@ -31,6 +31,6 @@ public: void *GetAPIContext(); - Draw::DrawContext *CreateThin3DContext() override; + Draw::DrawContext *CreateDrawContext() override; }; diff --git a/ext/native/base/PCMain.cpp b/ext/native/base/PCMain.cpp index 6e71d97d31..fde9fc2e40 100644 --- a/ext/native/base/PCMain.cpp +++ b/ext/native/base/PCMain.cpp @@ -48,7 +48,7 @@ SDLJoystick *joystick = NULL; class GLDummyGraphicsContext : public DummyGraphicsContext { public: - Draw::DrawContext *CreateThin3DContext() override { + Draw::DrawContext *CreateDrawContext() override { CheckGLExtensions(); return Draw::T3DCreateGLContext(); } diff --git a/ext/native/gfx_es2/draw_text.cpp b/ext/native/gfx_es2/draw_text.cpp index 3527c84098..edddf6df92 100644 --- a/ext/native/gfx_es2/draw_text.cpp +++ b/ext/native/gfx_es2/draw_text.cpp @@ -75,7 +75,7 @@ struct TextDrawerContext { int *pBitmapBits; }; -TextDrawer::TextDrawer(Draw::DrawContext *thin3d) : thin3d_(thin3d), ctx_(nullptr) { +TextDrawer::TextDrawer(Draw::DrawContext *thin3d) : draw_(thin3d), ctx_(nullptr) { // These probably shouldn't be state. fontScaleX_ = 1.0f; fontScaleY_ = 1.0f; @@ -282,9 +282,9 @@ void TextDrawer::DrawString(DrawBuffer &target, const char *str, float x, float DataFormat texFormat; // For our purposes these are equivalent, so just choose the supported one. D3D can emulate them. - if (thin3d_->GetDataFormatSupport(Draw::DataFormat::B4G4R4A4_UNORM_PACK16) & FMT_TEXTURE) + if (draw_->GetDataFormatSupport(Draw::DataFormat::B4G4R4A4_UNORM_PACK16) & FMT_TEXTURE) texFormat = Draw::DataFormat::B4G4R4A4_UNORM_PACK16; - else if (thin3d_->GetDataFormatSupport(Draw::DataFormat::R4G4B4A4_UNORM_PACK16) & FMT_TEXTURE) + else if (draw_->GetDataFormatSupport(Draw::DataFormat::R4G4B4A4_UNORM_PACK16) & FMT_TEXTURE) texFormat = Draw::DataFormat::R4G4B4A4_UNORM_PACK16; else texFormat = Draw::DataFormat::R8G8B8A8_UNORM; @@ -322,7 +322,7 @@ void TextDrawer::DrawString(DrawBuffer &target, const char *str, float x, float desc.height = entry->bmHeight; desc.depth = 1; desc.mipLevels = 1; - entry->texture = thin3d_->CreateTexture(desc); + entry->texture = draw_->CreateTexture(desc); if (bitmapData16) delete[] bitmapData16; if (bitmapData32) @@ -330,7 +330,7 @@ void TextDrawer::DrawString(DrawBuffer &target, const char *str, float x, float cache_[entryHash] = std::unique_ptr(entry); } - thin3d_->BindTexture(0, entry->texture); + draw_->BindTexture(0, entry->texture); // Okay, the texture is bound, let's draw. float w = entry->bmWidth * fontScaleX_ * g_dpi_scale; @@ -348,7 +348,7 @@ void TextDrawer::RecreateFonts() { #else -TextDrawer::TextDrawer(Draw::DrawContext *thin3d) : thin3d_(thin3d), ctx_(NULL) { +TextDrawer::TextDrawer(Draw::DrawContext *thin3d) : draw_(thin3d), ctx_(NULL) { fontScaleX_ = 1.0f; fontScaleY_ = 1.0f; } @@ -442,7 +442,7 @@ void TextDrawer::DrawString(DrawBuffer &target, const char *str, float x, float if (iter != cache_.end()) { entry = iter->second.get(); entry->lastUsedFrame = frameCount_; - thin3d_->BindTexture(0, entry->texture); + draw_->BindTexture(0, entry->texture); } else { QFont *font = fontMap_.find(fontHash_)->second; QFontMetrics fm(*font); @@ -473,7 +473,7 @@ void TextDrawer::DrawString(DrawBuffer &target, const char *str, float x, float desc.height = entry->bmHeight; desc.depth = 1; desc.mipLevels = 1; - entry->texture = thin3d_->CreateTexture(desc); + entry->texture = draw_->CreateTexture(desc); uint16_t *bitmapData = new uint16_t[entry->bmWidth * entry->bmHeight]; for (int x = 0; x < entry->bmWidth; x++) { diff --git a/ext/native/gfx_es2/draw_text.h b/ext/native/gfx_es2/draw_text.h index 9ea3e393bf..1d47d76291 100644 --- a/ext/native/gfx_es2/draw_text.h +++ b/ext/native/gfx_es2/draw_text.h @@ -66,7 +66,7 @@ public: void OncePerFrame(); private: - Draw::DrawContext *thin3d_; + Draw::DrawContext *draw_; void ClearCache(); void RecreateFonts(); // On DPI change diff --git a/ext/native/ui/screen.h b/ext/native/ui/screen.h index c9324f6941..be844e2283 100644 --- a/ext/native/ui/screen.h +++ b/ext/native/ui/screen.h @@ -102,8 +102,8 @@ public: void setUIContext(UIContext *context) { uiContext_ = context; } UIContext *getUIContext() { return uiContext_; } - void setThin3DContext(Draw::DrawContext *context) { thin3DContext_ = context; } - Draw::DrawContext *getThin3DContext() { return thin3DContext_; } + void setDrawContext(Draw::DrawContext *context) { thin3DContext_ = context; } + Draw::DrawContext *getDrawContext() { return thin3DContext_; } void render(); void resized(); diff --git a/ext/native/ui/ui_context.cpp b/ext/native/ui/ui_context.cpp index 6073bbbe58..bf7ba9f194 100644 --- a/ext/native/ui/ui_context.cpp +++ b/ext/native/ui/ui_context.cpp @@ -20,8 +20,8 @@ UIContext::~UIContext() { void UIContext::Init(Draw::DrawContext *thin3d, Draw::Pipeline *uipipe, Draw::Pipeline *uipipenotex, DrawBuffer *uidrawbuffer, DrawBuffer *uidrawbufferTop) { using namespace Draw; - thin3d_ = thin3d; - sampler_ = thin3d_->CreateSamplerState({ TextureFilter::LINEAR, TextureFilter::LINEAR, TextureFilter::LINEAR }); + draw_ = thin3d; + sampler_ = draw_->CreateSamplerState({ TextureFilter::LINEAR, TextureFilter::LINEAR, TextureFilter::LINEAR }); ui_pipeline_ = uipipe; ui_pipeline_notex_ = uipipenotex; uidrawbuffer_ = uidrawbuffer; @@ -38,19 +38,19 @@ void UIContext::FrameSetup(Draw::Texture *uiTexture) { } void UIContext::Begin() { - thin3d_->BindSamplerStates(0, 1, &sampler_); - thin3d_->BindTexture(0, uitexture_); + draw_->BindSamplerStates(0, 1, &sampler_); + draw_->BindTexture(0, uitexture_); ActivateTopScissor(); UIBegin(ui_pipeline_); } void UIContext::BeginNoTex() { - thin3d_->BindSamplerStates(0, 1, &sampler_); + draw_->BindSamplerStates(0, 1, &sampler_); UIBegin(ui_pipeline_notex_); } void UIContext::RebindTexture() const { - thin3d_->BindTexture(0, uitexture_); + draw_->BindTexture(0, uitexture_); } void UIContext::Flush() { @@ -105,7 +105,7 @@ void UIContext::ActivateTopScissor() { int y = scale * bounds.y; int w = scale * bounds.w; int h = scale * bounds.h; - thin3d_->SetScissorRect(x, y, w, h); + draw_->SetScissorRect(x, y, w, h); } void UIContext::SetFontScale(float scaleX, float scaleY) { diff --git a/ext/native/ui/ui_context.h b/ext/native/ui/ui_context.h index 558c74bb9e..25a57ef63f 100644 --- a/ext/native/ui/ui_context.h +++ b/ext/native/ui/ui_context.h @@ -76,10 +76,10 @@ public: // in dps, like dp_xres and dp_yres void SetBounds(const Bounds &b) { bounds_ = b; } const Bounds &GetBounds() const { return bounds_; } - Draw::DrawContext *GetThin3DContext() { return thin3d_; } + Draw::DrawContext *GetDrawContext() { return draw_; } private: - Draw::DrawContext *thin3d_; + Draw::DrawContext *draw_; Bounds bounds_; float fontScaleX_; @@ -87,7 +87,6 @@ private: UI::FontStyle *fontStyle_; TextDrawer *textDrawer_; - Draw::DrawContext *thin3D_; Draw::SamplerState *sampler_; Draw::Pipeline *ui_pipeline_; Draw::Pipeline *ui_pipeline_notex_; diff --git a/ext/native/ui/ui_screen.cpp b/ext/native/ui/ui_screen.cpp index caff8dde45..aaffa3a2ff 100644 --- a/ext/native/ui/ui_screen.cpp +++ b/ext/native/ui/ui_screen.cpp @@ -59,11 +59,11 @@ void UIScreen::update(InputState &input) { } void UIScreen::preRender() { - Draw::DrawContext *thin3d = screenManager()->getThin3DContext(); - if (!thin3d) { + Draw::DrawContext *draw = screenManager()->getDrawContext(); + if (!draw) { return; } - thin3d->Begin(true, 0xFF000000, 0.0f, 0); + draw->Begin(true, 0xFF000000, 0.0f, 0); Draw::Viewport viewport; viewport.TopLeftX = 0; @@ -72,12 +72,12 @@ void UIScreen::preRender() { viewport.Height = pixel_yres; viewport.MaxDepth = 1.0; viewport.MinDepth = 0.0; - thin3d->SetViewports(1, &viewport); - thin3d->SetTargetSize(pixel_xres, pixel_yres); + draw->SetViewports(1, &viewport); + draw->SetTargetSize(pixel_xres, pixel_yres); } void UIScreen::postRender() { - auto thin3d = screenManager()->getThin3DContext(); + auto thin3d = screenManager()->getDrawContext(); if (!thin3d) { return; } diff --git a/ext/native/ui/view.cpp b/ext/native/ui/view.cpp index f0a8230935..ceff4b95d0 100644 --- a/ext/native/ui/view.cpp +++ b/ext/native/ui/view.cpp @@ -698,7 +698,7 @@ void ImageView::Draw(UIContext &dc) { dc.Draw()->DrawImage(atlasImage_, bounds_.x, bounds_.y, scale, 0xFFFFFFFF, ALIGN_TOPLEFT); } -void Thin3DTextureView::GetContentDimensions(const UIContext &dc, float &w, float &h) const { +void TextureView::GetContentDimensions(const UIContext &dc, float &w, float &h) const { // TODO: involve sizemode if (texture_) { w = (float)texture_->Width(); @@ -709,11 +709,11 @@ void Thin3DTextureView::GetContentDimensions(const UIContext &dc, float &w, floa } } -void Thin3DTextureView::Draw(UIContext &dc) { +void TextureView::Draw(UIContext &dc) { // TODO: involve sizemode if (texture_) { dc.Flush(); - dc.GetThin3DContext()->BindTexture(0, texture_); + dc.GetDrawContext()->BindTexture(0, texture_); dc.Draw()->Rect(bounds_.x, bounds_.y, bounds_.w, bounds_.h, color_); dc.Flush(); dc.RebindTexture(); diff --git a/ext/native/ui/view.h b/ext/native/ui/view.h index d59e3b3c8c..3d77689b52 100644 --- a/ext/native/ui/view.h +++ b/ext/native/ui/view.h @@ -825,9 +825,9 @@ private: // TextureView takes a texture that is assumed to be alive during the lifetime // of the view. -class Thin3DTextureView : public InertView { +class TextureView : public InertView { public: - Thin3DTextureView(Draw::Texture *texture, ImageSizeMode sizeMode, LayoutParams *layoutParams = 0) + TextureView(Draw::Texture *texture, ImageSizeMode sizeMode, LayoutParams *layoutParams = 0) : InertView(layoutParams), texture_(texture), color_(0xFFFFFFFF), sizeMode_(sizeMode) {} void GetContentDimensions(const UIContext &dc, float &w, float &h) const override; diff --git a/ios/ViewController.mm b/ios/ViewController.mm index 2d9f46bb5d..3fd59496df 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -36,7 +36,7 @@ class IOSDummyGraphicsContext : public DummyGraphicsContext { public: - Draw::DrawContext *CreateThin3DContext() override { + Draw::DrawContext *CreateDrawContext() override { CheckGLExtensions(); return Draw::T3DCreateGLContext(); }