mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Add right version of last commit
This commit is contained in:
parent
f1fdc2a177
commit
0b8f07f307
@ -16,16 +16,15 @@
|
||||
|
||||
!fv4 = XYZW
|
||||
|
||||
.globl DrawColouredQuads
|
||||
.globl _DrawColouredQuads
|
||||
.align 4
|
||||
.type DrawColouredQuads,%function
|
||||
.type _DrawColouredQuads,%function
|
||||
|
||||
! See https://shared-ptr.com/sh_insns.html
|
||||
! Although there is fmov.s @Rm+,FRn, there isn't fmov.s FRn,@Rm+
|
||||
! So have to use fmov.s FRn,@-Rm instead
|
||||
|
||||
DrawColouredQuads:
|
||||
.fnstart
|
||||
_DrawColouredQuads:
|
||||
! Setup
|
||||
mov.l CMD_COL_VERT, r1 ! r1 = GPU VERT command
|
||||
mov.l CMD_COL_EOS, r2 ! r2 = GPU EOS command
|
||||
@ -121,7 +120,6 @@ DrawColouredQuads:
|
||||
|
||||
rts ! return
|
||||
nop
|
||||
.fnend
|
||||
|
||||
.align 2
|
||||
CMD_COL_VERT: .long 0xe0000000
|
@ -16,12 +16,11 @@
|
||||
|
||||
!fv4 = XYZW
|
||||
|
||||
.globl DrawTexturedQuads
|
||||
.globl _DrawTexturedQuads
|
||||
.align 4
|
||||
.type DrawTexturedQuads,%function
|
||||
.type _DrawTexturedQuads,%function
|
||||
|
||||
DrawTexturedQuads:
|
||||
.fnstart
|
||||
_DrawTexturedQuads:
|
||||
! Setup
|
||||
mov.l CMD_TEX_VERT, r1 ! r1 = GPU VERT command
|
||||
mov.l CMD_TEX_EOS, r2 ! r2 = GPU EOS command
|
||||
@ -123,7 +122,6 @@ DrawTexturedQuads:
|
||||
|
||||
rts ! return
|
||||
nop
|
||||
.fnend
|
||||
|
||||
.align 2
|
||||
CMD_TEX_VERT: .long 0xe0000000
|
@ -1,8 +1,9 @@
|
||||
BUILD_DIR := build-dc
|
||||
SOURCE_DIRS := src third_party/bearssl/src
|
||||
SOURCE_DIRS := src third_party/bearssl/src misc/dreamcast
|
||||
|
||||
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o)))
|
||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||
CFLAGS :=-g -O1 -pipe -fno-math-errno -Ithird_party/bearssl/inc
|
||||
|
||||
GLDC_LIB=third_party/gldc/libGLdc.a
|
||||
@ -31,6 +32,9 @@ $(CC_TEXTURES):
|
||||
$(BUILD_DIR)/%.o: src/%.c
|
||||
kos-cc $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: misc/dreamcast/%.S
|
||||
kos-cc -c $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
||||
kos-cc $(CFLAGS) -c $< -o $@
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "Logger.h"
|
||||
#include "Window.h"
|
||||
#include "../third_party/gldc/gldc.h"
|
||||
#include "../third_party/gldc/src/draw.c"
|
||||
#include <malloc.h>
|
||||
#include <kos.h>
|
||||
#include <dc/matrix.h>
|
||||
@ -465,6 +466,22 @@ cc_bool Gfx_WarnIfNecessary(void) {
|
||||
*----------------------------------------------------------Drawing--------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
#define VB_PTR gfx_vertices
|
||||
static const void* VERTEX_PTR;
|
||||
|
||||
extern void DrawColouredQuads(const void* src, Vertex* dst, int numQuads);
|
||||
extern void DrawTexturedQuads(const void* src, Vertex* dst, int numQuads);
|
||||
|
||||
void DrawQuads(int count) {
|
||||
if (!count) return;
|
||||
Vertex* start = submitVertices(count);
|
||||
|
||||
if (TEXTURES_ENABLED) {
|
||||
DrawTexturedQuads(VERTEX_PTR, start, count >> 2);
|
||||
} else {
|
||||
DrawColouredQuads(VERTEX_PTR, start, count >> 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void SetupVertices(int startVertex) {
|
||||
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
@ -489,29 +506,33 @@ void Gfx_SetVertexFormat(VertexFormat fmt) {
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_Lines(int verticesCount) {
|
||||
SetupVertices(0);
|
||||
//SetupVertices(0);
|
||||
//glDrawArrays(GL_LINES, 0, verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||
SetupVertices(startVertex);
|
||||
glDrawArrays(GL_QUADS, 0, verticesCount);
|
||||
if (gfx_format == VERTEX_FORMAT_TEXTURED) {
|
||||
VERTEX_PTR = gfx_vertices + startVertex * SIZEOF_VERTEX_TEXTURED;
|
||||
} else {
|
||||
VERTEX_PTR = gfx_vertices + startVertex * SIZEOF_VERTEX_COLOURED;
|
||||
}
|
||||
|
||||
DrawQuads(verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||
SetupVertices(0);
|
||||
VERTEX_PTR = gfx_vertices;
|
||||
|
||||
if (textureOffset) ShiftTextureCoords(verticesCount);
|
||||
glDrawArrays(GL_QUADS, 0, verticesCount);
|
||||
DrawQuads(verticesCount);
|
||||
if (textureOffset) UnshiftTextureCoords(verticesCount);
|
||||
}
|
||||
|
||||
void Gfx_DrawIndexedTris_T2fC4b(int verticesCount, int startVertex) {
|
||||
if (renderingDisabled) return;
|
||||
|
||||
cc_uint32 offset = startVertex * SIZEOF_VERTEX_TEXTURED;
|
||||
gldcVertexPointer(SIZEOF_VERTEX_TEXTURED, (void*)(VB_PTR + offset));
|
||||
glDrawArrays(GL_QUADS, 0, verticesCount);
|
||||
VERTEX_PTR = gfx_vertices + startVertex * SIZEOF_VERTEX_TEXTURED;
|
||||
DrawQuads(verticesCount);
|
||||
}
|
||||
|
||||
|
||||
|
21
third_party/gldc/src/draw.c
vendored
21
third_party/gldc/src/draw.c
vendored
@ -2,8 +2,6 @@
|
||||
#include "private.h"
|
||||
#include "platform.h"
|
||||
|
||||
static const GLubyte* VERTEX_PTR;
|
||||
|
||||
extern void apply_poly_header(PolyHeader* header, PolyList* activePolyList);
|
||||
|
||||
GL_FORCE_INLINE Vertex* submitVertices(GLuint vertexCount) {
|
||||
@ -28,22 +26,3 @@ GL_FORCE_INLINE Vertex* submitVertices(GLuint vertexCount) {
|
||||
}
|
||||
return aligned_vector_at(&output->vector, start_offset);
|
||||
}
|
||||
|
||||
extern void DrawColouredQuads(Vertex* dst, const GLubyte* src, const GLuint numQuads);
|
||||
extern void DrawTexturedQuads(Vertex* dst, const GLubyte* src, const GLuint numQuads);
|
||||
|
||||
void APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) {
|
||||
TRACE();
|
||||
if (!count) return;
|
||||
Vertex* start = submitVertices(count);
|
||||
|
||||
if (TEXTURES_ENABLED) {
|
||||
DrawTexturedQuads(start, VERTEX_PTR + (first * 24), count >> 2);
|
||||
} else {
|
||||
DrawColouredQuads(start, VERTEX_PTR + (first * 16), count >> 2);
|
||||
}
|
||||
}
|
||||
|
||||
void APIENTRY gldcVertexPointer(GLsizei stride, const GLvoid * pointer) {
|
||||
VERTEX_PTR = pointer;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user