[Scummvm-git-logs] scummvm master -> e9b1df95ffeff6f63d29786060bad70f1f89cea0

bgK bastien.bouclet at gmail.com
Fri Oct 25 19:14:56 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e9b1df95ff 3DS: Upload the textures to VRAM in a separate frame


Commit: e9b1df95ffeff6f63d29786060bad70f1f89cea0
    https://github.com/scummvm/scummvm/commit/e9b1df95ffeff6f63d29786060bad70f1f89cea0
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-10-25T19:13:40+02:00

Commit Message:
3DS: Upload the textures to VRAM in a separate frame

So rendering waits for the textures to finish uploading before using
them. Fixes glitchy mouse pointer in Riven.

Changed paths:
    backends/platform/3ds/osystem-graphics.cpp
    backends/platform/3ds/sprite.cpp
    backends/platform/3ds/sprite.h


diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index 9dd9c5a..c143417 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -265,13 +265,22 @@ void OSystem_3DS::unlockScreen() {
 }
 
 void OSystem_3DS::updateScreen() {
-
 	if (sleeping || exiting)
 		return;
 
 // 	updateFocus();
 
-	C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
+	C3D_FrameBegin(0);
+		_gameTopTexture.transfer();
+		if (_overlayVisible) {
+			_overlay.transfer();
+		}
+		if (_cursorVisible && config.showCursor) {
+			_cursorTexture.transfer();
+		}
+	C3D_FrameEnd(0);
+
+	C3D_FrameBegin(0);
 		// Render top screen
 		C3D_RenderTargetClear(_renderTargetTop, C3D_CLEAR_ALL, 0x00000000, 0);
 		C3D_FrameDrawOn(_renderTargetTop);
@@ -279,7 +288,6 @@ void OSystem_3DS::updateScreen() {
 			C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _projectionLocation, &_projectionTop);
 			C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _modelviewLocation, _gameTopTexture.getMatrix());
 			_gameTopTexture.render();
-			_gameTopTexture.render();
 			if (_overlayVisible && config.screen == kScreenTop) {
 				C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _modelviewLocation, _overlay.getMatrix());
 				_overlay.render();
@@ -297,7 +305,6 @@ void OSystem_3DS::updateScreen() {
 			C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _projectionLocation, &_projectionBottom);
 			C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _modelviewLocation, _gameBottomTexture.getMatrix());
 			_gameTopTexture.render();
-			_gameTopTexture.render();
 			if (_overlayVisible) {
 				C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, _modelviewLocation, _overlay.getMatrix());
 				_overlay.render();
diff --git a/backends/platform/3ds/sprite.cpp b/backends/platform/3ds/sprite.cpp
index 78082f3..b2785e2 100644
--- a/backends/platform/3ds/sprite.cpp
+++ b/backends/platform/3ds/sprite.cpp
@@ -100,13 +100,15 @@ void Sprite::convertToInPlace(const Graphics::PixelFormat &dstFormat, const byte
 	//
 }
 
-void Sprite::render() {
+void Sprite::transfer() {
 	if (dirtyPixels) {
 		dirtyPixels = false;
 		GSPGPU_FlushDataCache(pixels, w * h * format.bytesPerPixel);
 		C3D_SyncDisplayTransfer((u32*)pixels, GX_BUFFER_DIM(w, h), (u32*)texture.data, GX_BUFFER_DIM(w, h), TEXTURE_TRANSFER_FLAGS);
-// 		gspWaitForPPF();
 	}
+}
+
+void Sprite::render() {
 	C3D_TexBind(0, &texture);
 
 	C3D_BufInfo *bufInfo = C3D_GetBufInfo();
diff --git a/backends/platform/3ds/sprite.h b/backends/platform/3ds/sprite.h
index 35c048c..1e9c0b4 100644
--- a/backends/platform/3ds/sprite.h
+++ b/backends/platform/3ds/sprite.h
@@ -46,6 +46,7 @@ public:
 	void create(uint16 width, uint16 height, const Graphics::PixelFormat &format);
 	void free();
 	void convertToInPlace(const Graphics::PixelFormat &dstFormat, const byte *palette = 0);
+	void transfer();
 	void render();
 	void clear(uint32 color = 0);
 	void markDirty(){ dirtyPixels = true; }





More information about the Scummvm-git-logs mailing list