Upload pools once per Gfx::Draw and FIX DX9
This commit is contained in:
@@ -28,6 +28,7 @@ class GfxCitro3D : public GfxDriverBase<GfxCitro3DConfig> {
|
|||||||
TextureFormat type = TextureFormat::RGBA32,
|
TextureFormat type = TextureFormat::RGBA32,
|
||||||
TextureFilter filter = TextureFilter::Linear) override;
|
TextureFilter filter = TextureFilter::Linear) override;
|
||||||
void DeleteTexture(const Li::Texture& tex) override;
|
void DeleteTexture(const Li::Texture& tex) override;
|
||||||
|
void UploadPools() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Impl;
|
struct Impl;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class GfxDirectX9 : public GfxDriverBase<GfxDirectX9Config> {
|
|||||||
TextureFormat type = TextureFormat::RGBA32,
|
TextureFormat type = TextureFormat::RGBA32,
|
||||||
TextureFilter filter = TextureFilter::Linear) override;
|
TextureFilter filter = TextureFilter::Linear) override;
|
||||||
void DeleteTexture(const Li::Texture& tex) override;
|
void DeleteTexture(const Li::Texture& tex) override;
|
||||||
|
void UploadPools() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Impl;
|
struct Impl;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class GfxOpenGL2 : public GfxDriverBase<GfxOpenGL2Config> {
|
|||||||
TextureFormat type = TextureFormat::RGBA32,
|
TextureFormat type = TextureFormat::RGBA32,
|
||||||
TextureFilter filter = TextureFilter::Linear) override;
|
TextureFilter filter = TextureFilter::Linear) override;
|
||||||
void DeleteTexture(const Li::Texture& tex) override;
|
void DeleteTexture(const Li::Texture& tex) override;
|
||||||
|
void UploadPools() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void pSetupShaderAttribs(u32 shader);
|
void pSetupShaderAttribs(u32 shader);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class GfxOpenGL3 : public GfxDriverBase<GfxOpenGL3Config> {
|
|||||||
TextureFormat type = TextureFormat::RGBA32,
|
TextureFormat type = TextureFormat::RGBA32,
|
||||||
TextureFilter filter = TextureFilter::Linear) override;
|
TextureFilter filter = TextureFilter::Linear) override;
|
||||||
void DeleteTexture(const Li::Texture& tex) override;
|
void DeleteTexture(const Li::Texture& tex) override;
|
||||||
|
void UploadPools() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 pShader = 0;
|
u32 pShader = 0;
|
||||||
|
|||||||
@@ -152,9 +152,6 @@ void GfxCitro3D::Submit(size_t count, size_t start) {
|
|||||||
C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, impl->uLocProjection, &proj);
|
C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, impl->uLocProjection, &proj);
|
||||||
// C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, impl->uLocProjection,
|
// C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, impl->uLocProjection,
|
||||||
// (C3D_Mtx*)&Projection);
|
// (C3D_Mtx*)&Projection);
|
||||||
auto buf = C3D_GetBufInfo();
|
|
||||||
BufInfo_Init(buf);
|
|
||||||
BufInfo_Add(buf, GetVertexBufPtr(0), sizeof(Li::Vertex), 3, 0x210);
|
|
||||||
C3D_DrawElements(GPU_TRIANGLES, count, C3D_UNSIGNED_SHORT,
|
C3D_DrawElements(GPU_TRIANGLES, count, C3D_UNSIGNED_SHORT,
|
||||||
GetIndexBufPtr(start));
|
GetIndexBufPtr(start));
|
||||||
impl->CurrentTex = nullptr;
|
impl->CurrentTex = nullptr;
|
||||||
@@ -240,6 +237,12 @@ void GfxCitro3D::DeleteTexture(const Li::Texture& tex) {
|
|||||||
C3D_TexDelete(t);
|
C3D_TexDelete(t);
|
||||||
delete t;
|
delete t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GfxCitro3D::UploadPools() {
|
||||||
|
auto buf = C3D_GetBufInfo();
|
||||||
|
BufInfo_Init(buf);
|
||||||
|
BufInfo_Add(buf, GetVertexBufPtr(0), sizeof(Li::Vertex), 3, 0x210);
|
||||||
|
}
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
#else
|
#else
|
||||||
namespace PD {
|
namespace PD {
|
||||||
@@ -258,5 +261,6 @@ Li::Texture GfxCitro3D::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
|||||||
return Li::Texture();
|
return Li::Texture();
|
||||||
}
|
}
|
||||||
void GfxCitro3D::DeleteTexture(const Li::Texture& tex) {}
|
void GfxCitro3D::DeleteTexture(const Li::Texture& tex) {}
|
||||||
|
void GfxCitro3D::UploadPools() {}
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
#endif
|
#endif
|
||||||
@@ -30,7 +30,7 @@ VS_OUT main(VS_IN input) {
|
|||||||
VS_OUT o;
|
VS_OUT o;
|
||||||
o.pos = mul(projection, float4(input.pos, 0.0, 1.0));
|
o.pos = mul(projection, float4(input.pos, 0.0, 1.0));
|
||||||
o.uv = input.uv;
|
o.uv = input.uv;
|
||||||
o.col = input.col;
|
o.col = input.col.bgra;
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
@@ -132,44 +132,8 @@ void GfxDirectX9::Submit(size_t count, size_t start) {
|
|||||||
if (!impl || !impl->Device || !impl->VBO || !impl->IBO) return;
|
if (!impl || !impl->Device || !impl->VBO || !impl->IBO) return;
|
||||||
|
|
||||||
BindTexture(CurrentTex);
|
BindTexture(CurrentTex);
|
||||||
impl->Device->SetVertexShaderConstantF(
|
|
||||||
0, reinterpret_cast<const float*>(&Projection), 4);
|
|
||||||
|
|
||||||
if (!impl->VBO || impl->VertexBufferSize != GetVertexPoolSize()) {
|
impl->Device->SetVertexShaderConstantF(0, Projection.Ptr(), 4);
|
||||||
if (impl->VBO) {
|
|
||||||
impl->VBO->Release();
|
|
||||||
impl->VBO = nullptr;
|
|
||||||
impl->VertexBufferSize = 0;
|
|
||||||
}
|
|
||||||
if (impl->Device->CreateVertexBuffer(
|
|
||||||
GetVertexPoolSize() * sizeof(Li::Vertex),
|
|
||||||
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT,
|
|
||||||
&impl->VBO, nullptr) < 0)
|
|
||||||
return;
|
|
||||||
impl->VertexBufferSize = GetVertexPoolSize();
|
|
||||||
}
|
|
||||||
if (!impl->IBO || impl->IndexBufferSize != GetIndexPoolSize()) {
|
|
||||||
if (impl->IBO) {
|
|
||||||
impl->IBO->Release();
|
|
||||||
impl->IBO = nullptr;
|
|
||||||
impl->IndexBufferSize = 0;
|
|
||||||
}
|
|
||||||
if (impl->Device->CreateIndexBuffer(GetVertexPoolSize() * sizeof(u16),
|
|
||||||
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY,
|
|
||||||
D3DFMT_INDEX16, D3DPOOL_DEFAULT,
|
|
||||||
&impl->IBO, nullptr) < 0)
|
|
||||||
return;
|
|
||||||
impl->IndexBufferSize = GetIndexPoolSize();
|
|
||||||
}
|
|
||||||
void* vptr;
|
|
||||||
impl->VBO->Lock(0, 0, &vptr, D3DLOCK_DISCARD);
|
|
||||||
memcpy(vptr, GetVertexBufPtr(0), CurrentVertex * sizeof(PD::Li::Vertex));
|
|
||||||
impl->VBO->Unlock();
|
|
||||||
|
|
||||||
void* iptr;
|
|
||||||
impl->IBO->Lock(0, 0, &iptr, D3DLOCK_DISCARD);
|
|
||||||
memcpy(iptr, GetIndexBufPtr(0), CurrentIndex * sizeof(u16));
|
|
||||||
impl->IBO->Unlock();
|
|
||||||
|
|
||||||
impl->Device->SetStreamSource(0, impl->VBO, 0, sizeof(PD::Li::Vertex));
|
impl->Device->SetStreamSource(0, impl->VBO, 0, sizeof(PD::Li::Vertex));
|
||||||
impl->Device->SetIndices(impl->IBO);
|
impl->Device->SetIndices(impl->IBO);
|
||||||
@@ -177,8 +141,8 @@ void GfxDirectX9::Submit(size_t count, size_t start) {
|
|||||||
impl->Device->SetVertexShader(impl->VS);
|
impl->Device->SetVertexShader(impl->VS);
|
||||||
impl->Device->SetPixelShader(impl->FS);
|
impl->Device->SetPixelShader(impl->FS);
|
||||||
|
|
||||||
impl->Device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, CurrentVertex,
|
impl->Device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0,
|
||||||
start, count / 3);
|
GetVertexPoolSize(), start, count / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxDirectX9::BindTexture(TextureID id) {
|
void GfxDirectX9::BindTexture(TextureID id) {
|
||||||
@@ -200,6 +164,7 @@ void GfxDirectX9::BindTexture(TextureID id) {
|
|||||||
void GfxDirectX9::SysReset() {
|
void GfxDirectX9::SysReset() {
|
||||||
if (!impl || !impl->Device) return;
|
if (!impl || !impl->Device) return;
|
||||||
|
|
||||||
|
impl->Device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||||
impl->Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
impl->Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||||||
impl->Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
impl->Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||||
impl->Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
impl->Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
||||||
@@ -279,6 +244,36 @@ void GfxDirectX9::DeleteTexture(const Li::Texture& tex) {
|
|||||||
IDirect3DTexture9* t = (IDirect3DTexture9*)tex.GetID();
|
IDirect3DTexture9* t = (IDirect3DTexture9*)tex.GetID();
|
||||||
t->Release();
|
t->Release();
|
||||||
}
|
}
|
||||||
|
void GfxDirectX9::UploadPools() {
|
||||||
|
if (!impl || !impl->Device) return;
|
||||||
|
|
||||||
|
if (!impl->VBO || impl->VertexBufferSize != GetVertexPoolSize()) {
|
||||||
|
if (impl->VBO) impl->VBO->Release();
|
||||||
|
impl->Device->CreateVertexBuffer(GetVertexPoolSize() * sizeof(Li::Vertex),
|
||||||
|
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0,
|
||||||
|
D3DPOOL_DEFAULT, &impl->VBO, nullptr);
|
||||||
|
impl->VertexBufferSize = GetVertexPoolSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!impl->IBO || impl->IndexBufferSize != GetIndexPoolSize()) {
|
||||||
|
if (impl->IBO) impl->IBO->Release();
|
||||||
|
impl->Device->CreateIndexBuffer(
|
||||||
|
GetIndexPoolSize() * sizeof(u16), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY,
|
||||||
|
D3DFMT_INDEX16, D3DPOOL_DEFAULT, &impl->IBO, nullptr);
|
||||||
|
impl->IndexBufferSize = GetIndexPoolSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void* vptr;
|
||||||
|
impl->VBO->Lock(0, 0, &vptr, D3DLOCK_DISCARD);
|
||||||
|
memcpy(vptr, GetVertexBufPtr(0),
|
||||||
|
GetVertexPoolSize() * sizeof(PD::Li::Vertex));
|
||||||
|
impl->VBO->Unlock();
|
||||||
|
|
||||||
|
void* iptr;
|
||||||
|
impl->IBO->Lock(0, 0, &iptr, D3DLOCK_DISCARD);
|
||||||
|
memcpy(iptr, GetIndexBufPtr(0), GetIndexPoolSize() * sizeof(u16));
|
||||||
|
impl->IBO->Unlock();
|
||||||
|
}
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
#else
|
#else
|
||||||
namespace PD {
|
namespace PD {
|
||||||
@@ -297,5 +292,6 @@ Li::Texture GfxDirectX9::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
|||||||
return Li::Texture();
|
return Li::Texture();
|
||||||
}
|
}
|
||||||
void GfxDirectX9::DeleteTexture(const Li::Texture& tex) {}
|
void GfxDirectX9::DeleteTexture(const Li::Texture& tex) {}
|
||||||
|
void GfxDirectX9::UploadPools() {}
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
#endif
|
#endif
|
||||||
@@ -94,19 +94,14 @@ void GfxOpenGL2::Submit(size_t count, size_t start) {
|
|||||||
BindTexture(CurrentTex);
|
BindTexture(CurrentTex);
|
||||||
glUseProgram(pShader);
|
glUseProgram(pShader);
|
||||||
glUniformMatrix4fv(pLocProjection, 1, GL_FALSE, Projection.m.data());
|
glUniformMatrix4fv(pLocProjection, 1, GL_FALSE, Projection.m.data());
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||||
glBufferData(GL_ARRAY_BUFFER, GetVertexPoolSize() * sizeof(PD::Li::Vertex),
|
|
||||||
GetVertexBufPtr(0), GL_DYNAMIC_DRAW);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, GetIndexPoolSize() * sizeof(u16),
|
|
||||||
GetIndexBufPtr(0), GL_DYNAMIC_DRAW);
|
|
||||||
|
|
||||||
pSetupShaderAttribs(pShader);
|
pSetupShaderAttribs(pShader);
|
||||||
GLint ibo = 0;
|
|
||||||
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &ibo);
|
|
||||||
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT,
|
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT,
|
||||||
reinterpret_cast<void*>(start * sizeof(u16)));
|
reinterpret_cast<void*>(start * sizeof(u16)));
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||||
BindTexture(0);
|
BindTexture(0);
|
||||||
@@ -171,6 +166,16 @@ void GfxOpenGL2::DeleteTexture(const Li::Texture& tex) {
|
|||||||
GLuint tex_ = tex.GetID();
|
GLuint tex_ = tex.GetID();
|
||||||
glDeleteTextures(1, &tex_);
|
glDeleteTextures(1, &tex_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GfxOpenGL2::UploadPools() {
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, GetVertexPoolSize() * sizeof(PD::Li::Vertex),
|
||||||
|
GetVertexBufPtr(0), GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);
|
||||||
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, GetIndexPoolSize() * sizeof(u16),
|
||||||
|
GetIndexBufPtr(0), GL_DYNAMIC_DRAW);
|
||||||
|
}
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
#else
|
#else
|
||||||
namespace PD {
|
namespace PD {
|
||||||
@@ -190,5 +195,6 @@ Li::Texture GfxOpenGL2::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
|||||||
}
|
}
|
||||||
void GfxOpenGL2::DeleteTexture(const Li::Texture& tex) {}
|
void GfxOpenGL2::DeleteTexture(const Li::Texture& tex) {}
|
||||||
void GfxOpenGL2::pSetupShaderAttribs(u32 shader) {}
|
void GfxOpenGL2::pSetupShaderAttribs(u32 shader) {}
|
||||||
|
void GfxOpenGL2::UploadPools() {}
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
#endif
|
#endif
|
||||||
@@ -65,20 +65,12 @@ void GfxOpenGL3::Submit(size_t count, size_t start) {
|
|||||||
BindTexture(CurrentTex);
|
BindTexture(CurrentTex);
|
||||||
glUseProgram(pShader);
|
glUseProgram(pShader);
|
||||||
glUniformMatrix4fv(pLocProjection, 1, GL_FALSE, Projection.m.data());
|
glUniformMatrix4fv(pLocProjection, 1, GL_FALSE, Projection.m.data());
|
||||||
|
|
||||||
glBindVertexArray(VAO);
|
glBindVertexArray(VAO);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, GetVertexPoolSize() * sizeof(PD::Li::Vertex),
|
|
||||||
GetVertexBufPtr(0), GL_DYNAMIC_DRAW);
|
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);
|
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, GetIndexPoolSize() * sizeof(u16),
|
|
||||||
GetIndexBufPtr(0), GL_DYNAMIC_DRAW);
|
|
||||||
|
|
||||||
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT,
|
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT,
|
||||||
reinterpret_cast<void*>(start * sizeof(u16)));
|
reinterpret_cast<void*>(start * sizeof(u16)));
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
|
||||||
BindTexture(0);
|
BindTexture(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +133,20 @@ void GfxOpenGL3::DeleteTexture(const Li::Texture& tex) {
|
|||||||
GLuint tex_ = tex.GetID();
|
GLuint tex_ = tex.GetID();
|
||||||
glDeleteTextures(1, &tex_);
|
glDeleteTextures(1, &tex_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GfxOpenGL3::UploadPools() {
|
||||||
|
glBindVertexArray(VAO);
|
||||||
|
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, GetVertexPoolSize() * sizeof(PD::Li::Vertex),
|
||||||
|
GetVertexBufPtr(0), GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO);
|
||||||
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, GetIndexPoolSize() * sizeof(u16),
|
||||||
|
GetIndexBufPtr(0), GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
glBindVertexArray(0);
|
||||||
|
}
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
#else
|
#else
|
||||||
namespace PD {
|
namespace PD {
|
||||||
@@ -159,5 +165,6 @@ Li::Texture GfxOpenGL3::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
|||||||
return Li::Texture();
|
return Li::Texture();
|
||||||
}
|
}
|
||||||
void GfxOpenGL3::DeleteTexture(const Li::Texture& tex) {}
|
void GfxOpenGL3::DeleteTexture(const Li::Texture& tex) {}
|
||||||
|
void GfxOpenGL3::UploadPools() {}
|
||||||
} // namespace PD
|
} // namespace PD
|
||||||
#endif
|
#endif
|
||||||
@@ -63,6 +63,7 @@ class PD_API GfxDriver : public DriverInterface {
|
|||||||
virtual void SysInit() {}
|
virtual void SysInit() {}
|
||||||
virtual void SysReset() {}
|
virtual void SysReset() {}
|
||||||
virtual void Submit(size_t count, size_t start) {}
|
virtual void Submit(size_t count, size_t start) {}
|
||||||
|
virtual void UploadPools() {} // not every driver requires it
|
||||||
void RegisterTexture(const Li::Texture& tex);
|
void RegisterTexture(const Li::Texture& tex);
|
||||||
void UnregisterTexture(const Li::Texture& tex);
|
void UnregisterTexture(const Li::Texture& tex);
|
||||||
|
|
||||||
@@ -110,6 +111,7 @@ class GfxDriverBase : public GfxDriver {
|
|||||||
void Draw(const Pool<Li::Command>& commands) override {
|
void Draw(const Pool<Li::Command>& commands) override {
|
||||||
pCountCommands += commands.size();
|
pCountCommands += commands.size();
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
|
UploadPools();
|
||||||
while (index < commands.size()) {
|
while (index < commands.size()) {
|
||||||
CurrentTex = commands[index].Tex;
|
CurrentTex = commands[index].Tex;
|
||||||
if (!CurrentTex) {
|
if (!CurrentTex) {
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class MainMenu : public PD::Ultra::Layout {
|
|||||||
Push(pBackground);
|
Push(pBackground);
|
||||||
pText.SetColor("#ffffff");
|
pText.SetColor("#ffffff");
|
||||||
pText.SetText("MousePos: ");
|
pText.SetText("MousePos: ");
|
||||||
pText.SetAlignment(UltraAlignment_TopLeft);
|
pText.SetAlignment(UltraAlignment_TopRight);
|
||||||
Push(pText);
|
Push(pText);
|
||||||
pBtn.SetText("Test");
|
pBtn.SetText("Test");
|
||||||
pBtn.SetAlignment(UltraAlignment_Center);
|
pBtn.SetAlignment(UltraAlignment_Center);
|
||||||
@@ -198,6 +198,7 @@ int main(int argc, char** argv) {
|
|||||||
Cursor RightStick;
|
Cursor RightStick;
|
||||||
RightStick.pColor = "#00ffff";
|
RightStick.pColor = "#00ffff";
|
||||||
while (pOs->Mainloop()) {
|
while (pOs->Mainloop()) {
|
||||||
|
PD::TT::Scope __st("MainLoop");
|
||||||
PD::Hid::Update();
|
PD::Hid::Update();
|
||||||
PD::Gfx::NewFrame();
|
PD::Gfx::NewFrame();
|
||||||
pOs->ClearViewPort();
|
pOs->ClearViewPort();
|
||||||
@@ -219,7 +220,7 @@ int main(int argc, char** argv) {
|
|||||||
PD::Hid::Gamepad::CSUp | PD::Hid::Gamepad::CSDown)) {
|
PD::Hid::Gamepad::CSUp | PD::Hid::Gamepad::CSDown)) {
|
||||||
RightStick.pPos.y += PD::Hid::GetRightStick().y * 15;
|
RightStick.pPos.y += PD::Hid::GetRightStick().y * 15;
|
||||||
}
|
}
|
||||||
pList.DrawText(
|
/*pList.DrawText(
|
||||||
PD::fvec2(5, 37),
|
PD::fvec2(5, 37),
|
||||||
std::format(
|
std::format(
|
||||||
"Input:\n Driver: {}\n Gamepad: {}\n {}\n {}\n "
|
"Input:\n Driver: {}\n Gamepad: {}\n {}\n {}\n "
|
||||||
@@ -249,12 +250,12 @@ int main(int argc, char** argv) {
|
|||||||
ComboGpOut(PD::Hid::Gamepad::CSDown), PD::Hid::GetLeftStick(),
|
ComboGpOut(PD::Hid::Gamepad::CSDown), PD::Hid::GetLeftStick(),
|
||||||
PD::Hid::GetRightStick(), LeftStick.pPos)
|
PD::Hid::GetRightStick(), LeftStick.pPos)
|
||||||
.c_str(),
|
.c_str(),
|
||||||
"#ffffff");
|
"#ffffff");*/
|
||||||
LeftStick.Render(pList);
|
// LeftStick.Render(pList);
|
||||||
RightStick.Render(pList);
|
// RightStick.Render(pList);
|
||||||
pList.UnbindTexture();
|
pList.UnbindTexture();
|
||||||
pList.PathRect(50, PD::fvec2(450, 240));
|
pList.PathRect(50, PD::fvec2(450, 240));
|
||||||
pList.PathFillGradient("#ff0000", "#990000", PD::Radians(135));
|
/*pList.PathFillGradient("#ff0000", "#990000", PD::Radians(135));
|
||||||
pList.PathAdd(PD::fvec2(100, 120));
|
pList.PathAdd(PD::fvec2(100, 120));
|
||||||
pList.PathAdd(PD::fvec2(250, 260));
|
pList.PathAdd(PD::fvec2(250, 260));
|
||||||
pList.PathAdd(PD::fvec2(420, 180));
|
pList.PathAdd(PD::fvec2(420, 180));
|
||||||
@@ -262,9 +263,20 @@ int main(int argc, char** argv) {
|
|||||||
pList.PathAdd(PD::fvec2(820, 220));
|
pList.PathAdd(PD::fvec2(820, 220));
|
||||||
pList.PathAdd(PD::fvec2(1000, 360));
|
pList.PathAdd(PD::fvec2(1000, 360));
|
||||||
|
|
||||||
pList.PathStroke("#ff00ff", 10, LiDrawFlags_AA);
|
pList.PathStroke("#ff00ff", 10, LiDrawFlags_AA);*/
|
||||||
PD::Gfx::Reset(); // needs to be on top now
|
int __i = 0;
|
||||||
|
for (auto& it : PD::TT::GetTraceMap()) {
|
||||||
|
pList.DrawText(
|
||||||
|
PD::fvec2(2, 2 + (__i++) * 17),
|
||||||
|
std::format("{}: {}", it.second.GetID(),
|
||||||
|
PD::Strings::FormatNanos(it.second.GetLastDiff()))
|
||||||
|
.c_str(),
|
||||||
|
"#ff00ff");
|
||||||
|
}
|
||||||
|
PD::Gfx::Reset();
|
||||||
|
PD::TT::Beg("PD::Gfx::Draw");
|
||||||
PD::Gfx::Draw(pList);
|
PD::Gfx::Draw(pList);
|
||||||
|
PD::TT::End("PD::Gfx::Draw");
|
||||||
pList.Clear();
|
pList.Clear();
|
||||||
pOs->SwapBuffers();
|
pOs->SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ void DesktopOS::Init() {
|
|||||||
d3dpp.Windowed = TRUE;
|
d3dpp.Windowed = TRUE;
|
||||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||||
d3dpp.hDeviceWindow = hwnd;
|
d3dpp.hDeviceWindow = hwnd;
|
||||||
|
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
|
||||||
|
d3dpp.EnableAutoDepthStencil = TRUE;
|
||||||
|
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
|
||||||
|
|
||||||
HRESULT hr = impl->d3d->CreateDevice(
|
HRESULT hr = impl->d3d->CreateDevice(
|
||||||
D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd,
|
D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd,
|
||||||
|
|||||||
Reference in New Issue
Block a user