mirror of https://github.com/mgba-emu/mgba.git
DS GX: Clear depth
This commit is contained in:
parent
8322117aab
commit
6509c4fffa
1
CHANGES
1
CHANGES
|
@ -1,6 +1,7 @@
|
|||
medusa alpha 3 (Future)
|
||||
Features:
|
||||
- DS GX: Toon shading
|
||||
- DS GX: Clear depth
|
||||
Bugfixes:
|
||||
- DS GX: Fix vertex texture transformation (fixes mgba.io/i/702)
|
||||
- DS GX: Automatically normalize winding culling calculations (fixes mgba.io/i/699)
|
||||
|
|
|
@ -182,7 +182,6 @@ Missing features on DS are
|
|||
- Edge marking/wireframe
|
||||
- Highlight shading
|
||||
- Fog
|
||||
- Clear depth
|
||||
- Anti-aliasing
|
||||
- Alpha test
|
||||
- Position test
|
||||
|
|
|
@ -95,6 +95,7 @@ struct DSGXSoftwareRenderer {
|
|||
int sort;
|
||||
uint16_t clearStencil;
|
||||
color_t clearColor;
|
||||
uint32_t clearDepth;
|
||||
bool flushPending;
|
||||
|
||||
struct DSGXVertex* verts;
|
||||
|
|
|
@ -1326,6 +1326,7 @@ void DSGXReset(struct DSGX* gx) {
|
|||
gx->currentPoly.polyParams = 0x001F00C0;
|
||||
gx->nextPoly.polyParams = 0x001F00C0;
|
||||
gx->dmaSource = -1;
|
||||
gx->renderer->reset(gx->renderer);
|
||||
}
|
||||
|
||||
void DSGXAssociateRenderer(struct DSGX* gx, struct DSGXRenderer* renderer) {
|
||||
|
|
|
@ -440,6 +440,7 @@ static void DSGXSoftwareRendererReset(struct DSGXRenderer* renderer) {
|
|||
struct DSGXSoftwareRenderer* softwareRenderer = (struct DSGXSoftwareRenderer*) renderer;
|
||||
softwareRenderer->clearColor = 0;
|
||||
softwareRenderer->clearStencil = 0;
|
||||
softwareRenderer->clearDepth = 0xFFFFFF;
|
||||
}
|
||||
|
||||
static void DSGXSoftwareRendererDeinit(struct DSGXRenderer* renderer) {
|
||||
|
@ -738,12 +739,13 @@ static void DSGXSoftwareRendererSetRAM(struct DSGXRenderer* renderer, struct DSG
|
|||
|
||||
color_t clearColor = softwareRenderer->clearColor;
|
||||
uint16_t clearStencil = softwareRenderer->clearStencil;
|
||||
uint32_t clearDepth = softwareRenderer->clearDepth;
|
||||
|
||||
for (i = 0; i < DS_VIDEO_VERTICAL_PIXELS * DS_VIDEO_HORIZONTAL_PIXELS ; i += 4) {
|
||||
softwareRenderer->depthBuffer[i] = INT32_MAX;
|
||||
softwareRenderer->depthBuffer[i + 1] = INT32_MAX;
|
||||
softwareRenderer->depthBuffer[i + 2] = INT32_MAX;
|
||||
softwareRenderer->depthBuffer[i + 3] = INT32_MAX;
|
||||
softwareRenderer->depthBuffer[i] = clearDepth;
|
||||
softwareRenderer->depthBuffer[i + 1] = clearDepth;
|
||||
softwareRenderer->depthBuffer[i + 2] = clearDepth;
|
||||
softwareRenderer->depthBuffer[i + 3] = clearDepth;
|
||||
softwareRenderer->scanlineCache[i] = clearColor;
|
||||
softwareRenderer->scanlineCache[i + 1] = clearColor;
|
||||
softwareRenderer->scanlineCache[i + 2] = clearColor;
|
||||
|
@ -816,5 +818,8 @@ static void DSGXSoftwareRendererWriteRegister(struct DSGXRenderer* renderer, uin
|
|||
softwareRenderer->clearColor |= (value & 0x001F) << 27;
|
||||
softwareRenderer->clearStencil = (value & 0x3F00) >> 8;
|
||||
break;
|
||||
case DS9_REG_CLEAR_DEPTH:
|
||||
softwareRenderer->clearDepth = (value & 0x7FFF) * 0x200 + 0x1FF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue