add clear with dma

This commit is contained in:
milang 2019-08-29 09:51:19 +02:00
parent c752472509
commit 2ac26a1f9e
No known key found for this signature in database
GPG Key ID: D287C9D6C33D9035
1 changed files with 20 additions and 13 deletions

View File

@ -2,6 +2,7 @@
#include <fxengine/render/parameters.h>
#include <stdbool.h>
#include <stdint.h>
#include <gint/display.h>
#include <gint/std/stdio.h>
#include <gint/std/stdlib.h>
@ -18,25 +19,31 @@ static const int size_char = size_uint32 * sizeof(uint32_t);
static int32_t *zbuffer = (void *)0x88080000 - ((size_char / 32) * 32 + 1);
GALIGNED(32) GSECTION(".rodata") static const int32_t clearval[8]={render_max_dist,render_max_dist,render_max_dist,render_max_dist,render_max_dist,render_max_dist,render_max_dist,render_max_dist};
// gint doesn't provide any prototype for that function which is implemented
extern void dma_memset(void *dst, uint32_t l, size_t size);
void render_zbuffer_clear()
{
uint32_t indice = 0;
uint32_t indice = 0;
if (isSH3())
for (indice = 0; indice < size_uint32; indice ++)
zbuffer[indice] = render_max_dist;
else
dma_memset(zbuffer, render_max_dist, size_char);
for (indice = 0; indice < size_uint32; indice ++)
zbuffer[indice] = render_max_dist;
}
bool render_zbuffer_set_px(uint32_t x, uint32_t y, uint32_t dist)
{
const int indice = x * render_height + y;
if (zbuffer[indice]>dist && dist>=render_min_dist && dist<=render_max_dist)
{
zbuffer[indice] = dist;
return true;
}
return false;
const int indice = x * render_height + y;
if (zbuffer[indice]>dist && dist>=render_min_dist && dist<=render_max_dist)
{
zbuffer[indice] = dist;
return true;
}
return false;
}