diff --git a/CONFIG/vita/cxml/config_plugin.xml b/CONFIG/vita/cxml/config_plugin.xml index d6f66d71..2bce7c2e 100644 --- a/CONFIG/vita/cxml/config_plugin.xml +++ b/CONFIG/vita/cxml/config_plugin.xml @@ -1,13 +1,229 @@ - + + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -16,18 +232,71 @@ - - - + + + + + + + + + + + + + + + + + + + + + + - + + + + + + \ No newline at end of file diff --git a/CONFIG/vita/cxml/locale/en.xml b/CONFIG/vita/cxml/locale/en.xml new file mode 100644 index 00000000..79bb95af --- /dev/null +++ b/CONFIG/vita/cxml/locale/en.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CONFIG/vita/cxml/textures/shark.png b/CONFIG/vita/cxml/textures/shark.png new file mode 100644 index 00000000..58b96386 Binary files /dev/null and b/CONFIG/vita/cxml/textures/shark.png differ diff --git a/CONFIG/vita/cxml/textures/tex_settings_bg.gim b/CONFIG/vita/cxml/textures/tex_settings_bg.gim new file mode 100644 index 00000000..ee68e0ee Binary files /dev/null and b/CONFIG/vita/cxml/textures/tex_settings_bg.gim differ diff --git a/CONFIG/vita/src/main.cpp b/CONFIG/vita/src/main.cpp index f881dd14..b856b664 100644 --- a/CONFIG/vita/src/main.cpp +++ b/CONFIG/vita/src/main.cpp @@ -12,11 +12,15 @@ void loadPluginCB(paf::Plugin* plugin) paf::Plugin::PageOpenParam pageOpenParam; pageOpenParam.option = paf::Plugin::PageOption_None; + plugin->SetLocale(Locale_EN); + paf::ui::Scene* pScene = plugin->PageOpen("page_main", pageOpenParam); g_rootPage = pScene; - paf::ui::Widget* pText = (paf::ui::Text*) pScene->FindChild("test_strings_id"); - pText->SetString(L"Test Text"); + pScene->SetDebugMode(paf::ui::Scene::DEBUG_AUTH_LAYOUT_RULER); + + //paf::ui::Widget* pText = (paf::ui::Text*) pScene->FindChild("title_text"); + //pText->SetString(L"Test Text"); } int paf_main(void) diff --git a/miniwin/src/d3drm/backends/gxm/renderer.cpp b/miniwin/src/d3drm/backends/gxm/renderer.cpp index c83e4d0f..05274899 100644 --- a/miniwin/src/d3drm/backends/gxm/renderer.cpp +++ b/miniwin/src/d3drm/backends/gxm/renderer.cpp @@ -80,12 +80,16 @@ typedef struct GXMVertex { typedef struct GXMDisplayData { void* address; + int index; } GXMDisplayData; static void display_callback(const void* callback_data) { const GXMDisplayData* display_data = (const GXMDisplayData*) callback_data; + GXMRenderer* renderer = static_cast(DDRenderer); + renderer->DeleteTextures(display_data->index); + SceDisplayFrameBuf framebuf; SDL_memset(&framebuf, 0x00, sizeof(SceDisplayFrameBuf)); framebuf.size = sizeof(SceDisplayFrameBuf); @@ -154,7 +158,7 @@ int gxm_library_init() return 0; } -#ifdef WITH_RAZOR +#ifdef GXM_WITH_RAZOR load_razor(); #endif @@ -654,6 +658,7 @@ void GXMContext::swap_display() // display GXMDisplayData displayData; displayData.address = this->displayBuffers[this->backBufferIndex]; + displayData.index = this->backBufferIndex; sceGxmDisplayQueueAddEntry( this->displayBuffersSync[this->frontBufferIndex], this->displayBuffersSync[this->backBufferIndex], @@ -913,21 +918,24 @@ void GXMRenderer::AddTextureDestroyCallback(Uint32 id, IDirect3DRMTexture* textu [](IDirect3DRMObject* obj, void* arg) { auto* ctx = static_cast(arg); auto& cache = ctx->renderer->m_textures[ctx->textureId]; - for (int i = 0; i < cache.bufferCount; i++) { - if (cache.notifications[i]) { - sceGxmNotificationWait(cache.notifications[i]); - } - void* textureData = sceGxmTextureGetData(&cache.gxmTexture[i]); - gxm->free(textureData); - memset(&cache.gxmTexture[i], 0, sizeof(SceGxmTexture)); - } + ctx->renderer->m_textures_delete[gxm->backBufferIndex].push_back(cache.gxmTexture); cache.texture = nullptr; + memset(&cache.gxmTexture, 0, sizeof(SceGxmTexture)); delete ctx; }, ctx ); } +void GXMRenderer::DeleteTextures(int index) +{ + for(auto& del : this->m_textures_delete[index]) { + void* textureData = sceGxmTextureGetData(&del); + gxm->free(textureData); + } + this->m_textures_delete[index].clear(); +} + static void convertTextureMetadata( SDL_Surface* surface, bool* supportedFormat, @@ -1046,22 +1054,9 @@ Uint32 GXMRenderer::GetTextureId(IDirect3DRMTexture* iTexture, bool isUi, float auto& tex = m_textures[i]; if (tex.texture == texture) { if (tex.version != texture->m_version) { - if (tex.bufferCount != GXM_TEXTURE_BUFFER_COUNT) { - for (int i = 1; i < GXM_TEXTURE_BUFFER_COUNT; i++) { - tex.gxmTexture[i] = tex.gxmTexture[0]; - uint8_t* textureData = (uint8_t*) gxm->alloc(textureSize, textureAlignment); - sceGxmTextureSetData(&tex.gxmTexture[i], textureData); - } - tex.bufferCount = GXM_TEXTURE_BUFFER_COUNT; - } - if (tex.bufferCount > 1) { - tex.currentIndex = (tex.currentIndex + 1) % GXM_TEXTURE_BUFFER_COUNT; - } - if (tex.notifications[tex.currentIndex]) { - sceGxmNotificationWait(tex.notifications[tex.currentIndex]); - } - tex.notifications[tex.currentIndex] = &this->fragmentNotifications[this->currentFragmentBufferIndex]; - uint8_t* textureData = (uint8_t*) sceGxmTextureGetData(&tex.gxmTexture[tex.currentIndex]); + sceGxmNotificationWait(tex.notification); + tex.notification = &this->fragmentNotifications[this->currentFragmentBufferIndex]; + uint8_t* textureData = (uint8_t*) sceGxmTextureGetData(&tex.gxmTexture); copySurfaceToGxm(surface, textureData, textureStride, textureSize); tex.version = texture->m_version; } @@ -1107,10 +1102,8 @@ Uint32 GXMRenderer::GetTextureId(IDirect3DRMTexture* iTexture, bool isUi, float memset(&tex, 0, sizeof(tex)); tex.texture = texture; tex.version = texture->m_version; - tex.bufferCount = 1; - tex.currentIndex = 0; - tex.gxmTexture[0] = gxmTexture; - tex.notifications[0] = &this->fragmentNotifications[this->currentFragmentBufferIndex]; + tex.gxmTexture = gxmTexture; + tex.notification = &this->fragmentNotifications[this->currentFragmentBufferIndex]; AddTextureDestroyCallback(i, texture); return i; } @@ -1120,16 +1113,20 @@ Uint32 GXMRenderer::GetTextureId(IDirect3DRMTexture* iTexture, bool isUi, float memset(&tex, 0, sizeof(tex)); tex.texture = texture; tex.version = texture->m_version; - tex.bufferCount = 1; - tex.currentIndex = 0; - tex.gxmTexture[0] = gxmTexture; - tex.notifications[0] = &this->fragmentNotifications[this->currentFragmentBufferIndex]; + tex.gxmTexture = gxmTexture; + tex.notification = &this->fragmentNotifications[this->currentFragmentBufferIndex]; m_textures.push_back(tex); Uint32 textureId = (Uint32) (m_textures.size() - 1); AddTextureDestroyCallback(textureId, texture); return textureId; } +const SceGxmTexture* GXMRenderer::UseTexture(GXMTextureCacheEntry& texture) { + texture.notification = &this->fragmentNotifications[this->currentFragmentBufferIndex]; + sceGxmSetFragmentTexture(gxm->context, 0, &texture.gxmTexture); + return &texture.gxmTexture; +} + GXMMeshCacheEntry GXMRenderer::GXMUploadMesh(const MeshGroup& meshGroup) { GXMMeshCacheEntry cache{&meshGroup, meshGroup.version}; diff --git a/miniwin/src/internal/d3drmrenderer_gxm.h b/miniwin/src/internal/d3drmrenderer_gxm.h index eade6312..ced0046e 100644 --- a/miniwin/src/internal/d3drmrenderer_gxm.h +++ b/miniwin/src/internal/d3drmrenderer_gxm.h @@ -16,17 +16,14 @@ DEFINE_GUID(GXM_GUID, 0x682656F3, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, #define GXM_VERTEX_BUFFER_COUNT 2 #define GXM_FRAGMENT_BUFFER_COUNT 3 -#define GXM_TEXTURE_BUFFER_COUNT 2 #define GXM_WITH_RAZOR DEBUG struct GXMTextureCacheEntry { IDirect3DRMTexture* texture; Uint32 version; - int bufferCount; - int currentIndex; - SceGxmTexture gxmTexture[GXM_TEXTURE_BUFFER_COUNT]; - SceGxmNotification* notifications[GXM_TEXTURE_BUFFER_COUNT]; + SceGxmTexture gxmTexture; + SceGxmNotification* notification; // latest frame it was used in }; struct GXMMeshCacheEntry { @@ -81,6 +78,7 @@ class GXMRenderer : public Direct3DRMRenderer { void Download(SDL_Surface* target) override; void SetDither(bool dither) override; + void DeleteTextures(int index); private: void AddTextureDestroyCallback(Uint32 id, IDirect3DRMTexture* texture); void AddMeshDestroyCallback(Uint32 id, IDirect3DRMMesh* mesh); @@ -88,13 +86,7 @@ class GXMRenderer : public Direct3DRMRenderer { GXMMeshCacheEntry GXMUploadMesh(const MeshGroup& meshGroup); void StartScene(); - inline const SceGxmTexture* UseTexture(GXMTextureCacheEntry& texture) - { - texture.notifications[texture.currentIndex] = &this->fragmentNotifications[this->currentFragmentBufferIndex]; - const SceGxmTexture* gxmTexture = &texture.gxmTexture[texture.currentIndex]; - sceGxmSetFragmentTexture(gxm->context, 0, gxmTexture); - return gxmTexture; - } + const SceGxmTexture* UseTexture(GXMTextureCacheEntry& texture); inline GXMVertex2D* QuadVerticesBuffer() { @@ -113,6 +105,7 @@ class GXMRenderer : public Direct3DRMRenderer { std::vector m_meshes; D3DRMMATRIX4D m_projection; std::vector m_lights; + std::vector m_textures_delete[GXM_FRAGMENT_BUFFER_COUNT]; bool transparencyEnabled = false;