mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Just some renaming. Start moving away from the "thin3d" name
This commit is contained in:
parent
1044796de2
commit
20d9e60a67
34 changed files with 128 additions and 133 deletions
|
@ -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; }
|
||||
};
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ private:
|
|||
|
||||
GraphicsContext *gfxCtx_;
|
||||
Draw::Texture *fbTex;
|
||||
Draw::DrawContext *thin3d;
|
||||
Draw::DrawContext *draw_;
|
||||
Draw::Pipeline *texColor;
|
||||
std::vector<u32> fbTexBuffer;
|
||||
};
|
||||
|
|
|
@ -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<std::string> features = thin3d->GetFeatureList();
|
||||
std::vector<std::string> features = draw->GetFeatureList();
|
||||
for (auto &feature : features) {
|
||||
oglExtensions->Add(new TextView(feature))->SetFocusable(true);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<std::string, GameInfo *> info_;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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_;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -140,7 +140,7 @@ struct PendingMessage {
|
|||
|
||||
static recursive_mutex pendingMutex;
|
||||
static std::vector<PendingMessage> 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<std::string> 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -15,7 +15,7 @@ void D3D11Context::SwapBuffers() {
|
|||
swapChain_->Present(0, 0);
|
||||
}
|
||||
|
||||
Draw::DrawContext *D3D11Context::CreateThin3DContext() {
|
||||
Draw::DrawContext *D3D11Context::CreateDrawContext() {
|
||||
return Draw::T3DCreateD3D11Context(device_, context_);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
void Resize() override;
|
||||
|
||||
Draw::DrawContext *CreateThin3DContext() override;
|
||||
Draw::DrawContext *CreateDrawContext() override;
|
||||
|
||||
private:
|
||||
ID3D11Device *device_;
|
||||
|
|
|
@ -27,7 +27,7 @@ void D3D9Context::SwapBuffers() {
|
|||
}
|
||||
}
|
||||
|
||||
Draw::DrawContext *D3D9Context::CreateThin3DContext() {
|
||||
Draw::DrawContext *D3D9Context::CreateDrawContext() {
|
||||
return Draw::T3DCreateDX9Context(d3d, d3dEx, adapterId, device, deviceEx);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
void Resize() override;
|
||||
|
||||
Draw::DrawContext *CreateThin3DContext() override;
|
||||
Draw::DrawContext *CreateDrawContext() override;
|
||||
|
||||
private:
|
||||
bool has9Ex;
|
||||
|
|
|
@ -400,7 +400,7 @@ void WindowsGLContext::Shutdown() {
|
|||
void WindowsGLContext::Resize() {
|
||||
}
|
||||
|
||||
Draw::DrawContext *WindowsGLContext::CreateThin3DContext() {
|
||||
Draw::DrawContext *WindowsGLContext::CreateDrawContext() {
|
||||
CheckGLExtensions();
|
||||
return Draw::T3DCreateGLContext();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
void Resize() override;
|
||||
|
||||
Draw::DrawContext *CreateThin3DContext() override;
|
||||
Draw::DrawContext *CreateDrawContext() override;
|
||||
|
||||
private:
|
||||
HDC hDC; // Private GDI Device Context
|
||||
|
|
|
@ -207,7 +207,7 @@ void WindowsVulkanContext::Shutdown() {
|
|||
finalize_glslang();
|
||||
}
|
||||
|
||||
Draw::DrawContext *WindowsVulkanContext::CreateThin3DContext() {
|
||||
Draw::DrawContext *WindowsVulkanContext::CreateDrawContext() {
|
||||
return Draw::T3DCreateVulkanContext(g_Vulkan);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,6 @@ public:
|
|||
|
||||
void *GetAPIContext();
|
||||
|
||||
Draw::DrawContext *CreateThin3DContext() override;
|
||||
Draw::DrawContext *CreateDrawContext() override;
|
||||
};
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ SDLJoystick *joystick = NULL;
|
|||
|
||||
class GLDummyGraphicsContext : public DummyGraphicsContext {
|
||||
public:
|
||||
Draw::DrawContext *CreateThin3DContext() override {
|
||||
Draw::DrawContext *CreateDrawContext() override {
|
||||
CheckGLExtensions();
|
||||
return Draw::T3DCreateGLContext();
|
||||
}
|
||||
|
|
|
@ -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<TextStringEntry>(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++) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
void OncePerFrame();
|
||||
|
||||
private:
|
||||
Draw::DrawContext *thin3d_;
|
||||
Draw::DrawContext *draw_;
|
||||
|
||||
void ClearCache();
|
||||
void RecreateFonts(); // On DPI change
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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_;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
class IOSDummyGraphicsContext : public DummyGraphicsContext {
|
||||
public:
|
||||
Draw::DrawContext *CreateThin3DContext() override {
|
||||
Draw::DrawContext *CreateDrawContext() override {
|
||||
CheckGLExtensions();
|
||||
return Draw::T3DCreateGLContext();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue