Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Sep 30, 2023
1 parent d214166 commit f839d61
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/Graphics_Dreamcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include "Errors.h"
#include "Logger.h"
#include "Window.h"
#include "GL/gl.h"
#include "GL/glkos.h"
#include "../third_party/gldc/include/gldc.h"
#include <malloc.h>
#include <kos.h>
#include <dc/matrix.h>
Expand All @@ -20,9 +19,10 @@ static cc_bool renderingDisabled;
*---------------------------------------------------------General---------------------------------------------------------*
*#########################################################################################################################*/
void Gfx_Create(void) {
glKosInit();
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &Gfx.MaxTexWidth);
Gfx.MaxTexHeight = Gfx.MaxTexWidth;
if (!Gfx.Created) glKosInit();
// NOTE: technically 1024 is supported by hardware
Gfx.MaxTexWidth = 512;
Gfx.MaxTexHeight = 512;
Gfx.Created = true;
Gfx_RestoreState();
}
Expand Down Expand Up @@ -243,9 +243,10 @@ static unsigned Interleave(unsigned x) {
}

/*static int CalcTwiddledIndex(int x, int y, int w, int h) {
// Twiddled index looks like this (starting from lowest numbered bits):
// e.g. w > h: yx_yx_xx_xx
// e.g. h > w: yx_yx_yy_yy
// Twiddled index looks like this (lowest numbered bits are leftmost):
// - w = h: yxyx yxyx
// - w > h: yxyx xxxx
// - h > w: yxyx yyyy
// And can therefore be broken down into two components:
// 1) interleaved lower bits
// 2) masked and then shifted higher bits
Expand Down Expand Up @@ -485,8 +486,6 @@ static CC_NOINLINE void UnshiftTextureCoords(int count) {
static void Gfx_FreeState(void) { FreeDefaultResources(); }
static void Gfx_RestoreState(void) {
InitDefaultResources();
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
gfx_format = -1;

glAlphaFunc(GL_GREATER, 0.5f);
Expand Down Expand Up @@ -520,10 +519,8 @@ void Gfx_SetVertexFormat(VertexFormat fmt) {
gfx_stride = strideSizes[fmt];

if (fmt == VERTEX_FORMAT_TEXTURED) {
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);
} else {
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D);
}
}
Expand Down

0 comments on commit f839d61

Please sign in to comment.