Offthread gfx #22

Merged
merged 16 commits into from Jan 24, 2016

scan line increment command

Also I still am trying to figure out what the best command buffer queue
size will turn out to be.
  • Loading branch information...
taisel committed Jan 23, 2016
commit 9eb01b5199d5203ad480f8f4ca238040730f357d
@@ -1,11 +1,11 @@
"use strict";
/*
- Copyright (C) 2012-2015 Grant Galitz
-
+ Copyright (C) 2012-2016 Grant Galitz
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function GameBoyAdvanceRendererProxy(IOCore) {
@@ -17,7 +17,7 @@ GameBoyAdvanceRendererProxy.prototype.initialize = function () {
this.IOData16 = getUint16View(this.IOData8);
this.IOData32 = getInt32View(this.IOData8);
this.gfxState = this.IOCore.gfxState;
- this.renderer = new GameBoyAdvanceGraphicsRenderer(this.IOCore.coreExposed, !!this.IOCore.SKIPBoot);
+ this.renderer = getGameBoyAdvanceGraphicsRenderer(this.IOCore.coreExposed, !!this.IOCore.SKIPBoot);
}
GameBoyAdvanceRendererProxy.prototype.incrementScanLineQueue = function () {
this.renderer.incrementScanLineQueue();
@@ -1224,4 +1224,4 @@ GameBoyAdvanceRendererProxy.prototype.readPalette8 = function (address) {
address = address | 0;
var data = this.renderer.readPalette8(address | 0) | 0;
return data | 0;
-}
+}
@@ -29,7 +29,7 @@
}
GameBoyAdvanceGraphicsRendererShim.prototype.initializeBuffers = function () {
//Graphics Buffers:
- this.gfxCommandBuffer = getSharedInt32Array(0x40000);
+ this.gfxCommandBuffer = getSharedInt32Array(0x80000);
this.gfxCommandCounters = getSharedInt32Array(2);
}
GameBoyAdvanceGraphicsRendererShim.prototype.shareBuffers = function (skippingBIOS) {
@@ -54,9 +54,9 @@ GameBoyAdvanceGraphicsRendererShim.prototype.pushCommand = function (command, da
//Load the write counter value:
var end = this.gfxCommandCounters[1] | 0;
//Block while full:
- Atomics.futexWait(this.gfxCommandCounters, 0, ((end | 0) - 0x40000) | 0);
+ Atomics.futexWait(this.gfxCommandCounters, 0, ((end | 0) - 0x80000) | 0);
//Get the write offset into the ring buffer:
- var endCorrected = end & 0x3FFFF;
+ var endCorrected = end & 0x7FFFF;
//Push command into buffer:
this.gfxCommandBuffer[endCorrected | 0] = command | 0;
//Push data into buffer:
@@ -66,3 +66,7 @@ GameBoyAdvanceGraphicsRendererShim.prototype.pushCommand = function (command, da
//Atomic store to commit writes to memory:
Atomics.store(this.gfxCommandCounters, 1, end | 0);
}
+GameBoyAdvanceGraphicsRendererShim.prototype.incrementScanLineQueue = function () {
+ //Increment scan line command:
+ this.pushCommand(0, 0);
+}
View
@@ -28,6 +28,7 @@
<script src="IodineGBA/core/CPU/THUMB.js"></script>
<script src="IodineGBA/core/CPU/CPSR.js"></script>
<script src="IodineGBA/core/graphics/Renderer.js"></script>
+ <script src="IodineGBA/core/graphics/RendererShim.js"></script>
<script src="IodineGBA/core/graphics/RendererProxy.js"></script>
<script src="IodineGBA/core/graphics/BGTEXT.js"></script>
<script src="IodineGBA/core/graphics/BG2FrameBuffer.js"></script>
@@ -114,4 +115,4 @@
</div>
</div>
</body>
-</html>
+</html>
@@ -1,6 +1,6 @@
"use strict";
/*
- Copyright (C) 2012-2015 Grant Galitz
+ Copyright (C) 2012-2016 Grant Galitz
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: