You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(19) |
Jul
(26) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Lawrence S. <ljs...@us...> - 2014-10-30 17:24:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 91d73d25a35fed150512761ff6436c5cb7aa4976 (commit) from ab350dc00140bf51c8f9a54a204fa4f39b9df943 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 91d73d25a35fed150512761ff6436c5cb7aa4976 Author: Lawrence Sebald <ljs...@us...> Date: Thu Oct 30 13:23:19 2014 -0400 Add a small bumpmapping example. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/pvr/Makefile | 10 +- examples/dreamcast/pvr/bumpmap/Makefile | 35 +++ examples/dreamcast/pvr/bumpmap/bricks.png | Bin 0 -> 151425 bytes examples/dreamcast/pvr/bumpmap/bump.c | 235 ++++++++++++++++++++ examples/dreamcast/pvr/bumpmap/bumpmap.png | Bin 0 -> 112321 bytes .../dreamcast/pvr/bumpmap/romdisk}/.keepme | 0 6 files changed, 277 insertions(+), 3 deletions(-) create mode 100644 examples/dreamcast/pvr/bumpmap/Makefile create mode 100644 examples/dreamcast/pvr/bumpmap/bricks.png create mode 100644 examples/dreamcast/pvr/bumpmap/bump.c create mode 100644 examples/dreamcast/pvr/bumpmap/bumpmap.png copy {addons/lib => examples/dreamcast/pvr/bumpmap/romdisk}/.keepme (100%) diff --git a/examples/dreamcast/pvr/Makefile b/examples/dreamcast/pvr/Makefile index 856464a..884bf4b 100644 --- a/examples/dreamcast/pvr/Makefile +++ b/examples/dreamcast/pvr/Makefile @@ -12,6 +12,8 @@ all: $(KOS_MAKE) -C texture_render $(KOS_MAKE) -C modifier_volume $(KOS_MAKE) -C modifier_volume_tex + $(KOS_MAKE) -C cheap_shadow + $(KOS_MAKE) -C bumpmap clean: $(KOS_MAKE) -C plasma clean @@ -21,7 +23,9 @@ clean: $(KOS_MAKE) -C texture_render clean $(KOS_MAKE) -C modifier_volume clean $(KOS_MAKE) -C modifier_volume_tex clean - + $(KOS_MAKE) -C cheap_shadow clean + $(KOS_MAKE) -C bumpmap clean + dist: $(KOS_MAKE) -C plasma dist $(KOS_MAKE) -C pvrmark dist @@ -30,5 +34,5 @@ dist: $(KOS_MAKE) -C texture_render dist $(KOS_MAKE) -C modifier_volume dist $(KOS_MAKE) -C modifier_volume_tex dist - - + $(KOS_MAKE) -C cheap_shadow dist + $(KOS_MAKE) -C bumpmap dist diff --git a/examples/dreamcast/pvr/bumpmap/Makefile b/examples/dreamcast/pvr/bumpmap/Makefile new file mode 100644 index 0000000..448098a --- /dev/null +++ b/examples/dreamcast/pvr/bumpmap/Makefile @@ -0,0 +1,35 @@ +TARGET = bump.elf +OBJS = bump.o romdisk.o + +all: rm-elf $(TARGET) + +include $(KOS_BASE)/Makefile.rules + +clean: + -rm -f $(TARGET) $(OBJS) romdisk.* romdisk/*.kmg romdisk/*.raw + +rm-elf: + -rm -f $(TARGET) + +$(TARGET): $(OBJS) + kos-cc -o $(TARGET) $(OBJS) -lkmg -lkosutils + +romdisk.img: romdisk/bricks.kmg romdisk/bumpmap.raw + $(KOS_GENROMFS) -f romdisk.img -d romdisk -v + +romdisk.o: romdisk.img + $(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o + +romdisk/bricks.kmg: bricks.png + $(KOS_BASE)/utils/vqenc/vqenc -t -v -q -k bricks.png + mv bricks.kmg romdisk/ + +romdisk/bumpmap.raw: bumpmap.png + $(KOS_BASE)/utils/dcbumpgen/dcbumpgen $+ $@ + +run: $(TARGET) + $(KOS_LOADER) $(TARGET) -n + +dist: + rm -f $(OBJS) + $(KOS_STRIP) $(TARGET) diff --git a/examples/dreamcast/pvr/bumpmap/bricks.png b/examples/dreamcast/pvr/bumpmap/bricks.png new file mode 100644 index 0000000..cb76ceb Binary files /dev/null and b/examples/dreamcast/pvr/bumpmap/bricks.png differ diff --git a/examples/dreamcast/pvr/bumpmap/bump.c b/examples/dreamcast/pvr/bumpmap/bump.c new file mode 100644 index 0000000..86af312 --- /dev/null +++ b/examples/dreamcast/pvr/bumpmap/bump.c @@ -0,0 +1,235 @@ +/* KallistiOS ##version## + + examples/dreamcast/pvr/bumpmap/bump.c + Copyright (C) 2014 Lawrence Sebald + + This example demonstrates the use of bumpmaps on a surface. +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <errno.h> + +#include <dc/pvr.h> +#include <dc/maple.h> +#include <dc/fmath.h> +#include <dc/maple/controller.h> + +#include <kmg/kmg.h> + +static pvr_sprite_txr_t sprites[2]; + +static pvr_sprite_hdr_t shdr[2]; +static float bumpiness = 0.5f; +static pvr_ptr_t bump, txr; +static int textured = 1; + +#define SIZE 256 + +extern uint8 romdisk[]; +KOS_INIT_ROMDISK(romdisk); + +#define CLAMP(low, high, value) (value < low ? low : (value > high ? high : value)) + +static pvr_ptr_t load_texture(const char fn[]) { + FILE *fp; + pvr_ptr_t rv; + + if(!(rv = pvr_mem_malloc(SIZE * SIZE * 2))) { + printf("Failed to allocate PVR memory!\n"); + return NULL; + } + + if(!(fp = fopen(fn, "rb"))) { + printf("Couldn't open file: %s\n", strerror(errno)); + pvr_mem_free(rv); + return NULL; + } + + if(fread(rv, 1, SIZE * SIZE * 2, fp) != SIZE * SIZE * 2) { + printf("Failed to read texture from file!\n"); + fclose(fp); + pvr_mem_free(rv); + return NULL; + } + + fclose(fp); + + return rv; +} + +static pvr_ptr_t load_kmg(const char fn[]) { + kos_img_t img; + pvr_ptr_t rv; + + if(kmg_to_img(fn, &img)) { + printf("Failed to load image file: %s\n", fn); + return NULL; + } + + if(!(rv = pvr_mem_malloc(img.byte_count))) { + printf("Couldn't allocate memory for texture!\n"); + kos_img_free(&img, 0); + return NULL; + } + + pvr_txr_load_kimg(&img, rv, 0); + kos_img_free(&img, 0); + + return rv; +} + +static void setup() { + pvr_sprite_cxt_t cxt; + + /* Load the textures. */ + if(!(bump = load_texture("/rd/bumpmap.raw"))) + exit(EXIT_FAILURE); + + if(!(txr = load_kmg("/rd/bricks.kmg"))) { + pvr_mem_free(bump); + exit(EXIT_FAILURE); + } + + /* Fill in the sprite context for the bumpmap itself. This is not for the + polygon that will actually appear bumped. */ + pvr_sprite_cxt_txr(&cxt, PVR_LIST_OP_POLY, + PVR_TXRFMT_BUMP | PVR_TXRFMT_TWIDDLED, 256, 256, bump, + PVR_FILTER_NONE); + cxt.gen.specular = PVR_SPECULAR_ENABLE; + cxt.txr.env = PVR_TXRENV_DECAL; + pvr_sprite_compile(&shdr[0], &cxt); + + /* Fill in the sprite context for the polygon to be "bumped" by the map. */ + pvr_sprite_cxt_txr(&cxt, PVR_LIST_PT_POLY, + PVR_TXRFMT_RGB565 | PVR_TXRFMT_TWIDDLED | + PVR_TXRFMT_VQ_ENABLE, 256, 256, txr, PVR_FILTER_NONE); + cxt.blend.src = PVR_BLEND_DESTCOLOR; + cxt.blend.dst = PVR_BLEND_ZERO; + pvr_sprite_compile(&shdr[1], &cxt); + + /* Set up the two sprites. */ + sprites[0].flags = sprites[1].flags = PVR_CMD_VERTEX_EOL; + sprites[0].ax = sprites[1].ax = 320.0f - 128.0f; + sprites[0].ay = sprites[1].ay = 240.0f + 128.0f; + sprites[0].az = sprites[1].az = 1.0f; + sprites[0].bx = sprites[1].bx = 320.0f - 128.0f; + sprites[0].by = sprites[1].by = 240.0f - 128.0f; + sprites[0].bz = sprites[1].bz = 1.0f; + sprites[0].cx = sprites[1].cx = 320.0f + 128.0f; + sprites[0].cy = sprites[1].cy = 240.0f - 128.0f; + sprites[0].cz = sprites[1].cz = 1.0f; + sprites[0].dx = sprites[1].dx = 320.0f + 128.0f; + sprites[0].dy = sprites[1].dy = 240.0f + 128.0f; + sprites[0].dummy = sprites[1].dummy = 0; + sprites[0].auv = sprites[1].auv = PVR_PACK_16BIT_UV(0.0f, 1.0f); + sprites[0].buv = sprites[1].buv = PVR_PACK_16BIT_UV(0.0f, 0.0f); + sprites[0].cuv = sprites[1].cuv = PVR_PACK_16BIT_UV(1.0f, 0.0f); +} + +static void switch_textured() { + pvr_sprite_cxt_t cxt; + + if(!textured) + pvr_sprite_cxt_txr(&cxt, PVR_LIST_PT_POLY, + PVR_TXRFMT_RGB565 | PVR_TXRFMT_TWIDDLED | + PVR_TXRFMT_VQ_ENABLE, 256, 256, txr, + PVR_FILTER_NONE); + else + pvr_sprite_cxt_col(&cxt, PVR_LIST_PT_POLY); + + cxt.blend.src = PVR_BLEND_DESTCOLOR; + cxt.blend.dst = PVR_BLEND_ZERO; + pvr_sprite_compile(&shdr[1], &cxt); + + textured = !textured; +} + +static int check_start() { + maple_device_t *cont; + cont_state_t *state; + static int taken = 0; + + cont = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); + + if(cont) { + state = (cont_state_t *)maple_dev_status(cont); + + if(!state) + return 0; + + if(state->buttons & CONT_START) + return 1; + + if(state->buttons & CONT_A) { + if(!taken) + switch_textured(); + + taken = 1; + } + else { + taken = 0; + } + + if(state->joyy < -64) + bumpiness = CLAMP(0.0f, 1.0f, bumpiness - 0.01f); + else if(state->joyy > 64) + bumpiness = CLAMP(0.0f, 1.0f, bumpiness + 0.01f); + } + + return 0; +} + +static void do_frame() { + shdr[0].oargb = pvr_pack_bump(bumpiness, F_PI / 4.0f, 5.0f * F_PI / 6.0f); + shdr[0].argb = 0; + + pvr_wait_ready(); + pvr_scene_begin(); + + pvr_list_begin(PVR_LIST_OP_POLY); + pvr_prim(&shdr[0], sizeof(pvr_sprite_hdr_t)); + pvr_prim(&sprites[0], sizeof(pvr_sprite_txr_t)); + pvr_list_finish(); + + pvr_list_begin(PVR_LIST_PT_POLY); + pvr_prim(&shdr[1], sizeof(pvr_sprite_hdr_t)); + pvr_prim(&sprites[1], sizeof(pvr_sprite_txr_t)); + pvr_list_finish(); + + pvr_scene_finish(); +} + +static pvr_init_params_t pvr_params = { + /* Enable only opaque and punchthru polygons. */ + { + PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, + PVR_BINSIZE_16 + }, + 512 * 1024 +}; + +int main(int argc, char *argv[]) { + printf("---KallistiOS PVR Bumpmap Example---\n"); + printf("Press A to switch between textured and non-textured mode.\n"); + printf("Use up and down on the joystick to control the bumpiness.\n"); + printf("Press Start to exit.\n"); + + srand(time(NULL)); + + pvr_init(&pvr_params); + + setup(); + + /* Go as long as the user hasn't pressed start on controller 1. */ + while(!check_start()) { + do_frame(); + } + + pvr_mem_free(bump); + pvr_mem_free(txr); + + return 0; +} diff --git a/examples/dreamcast/pvr/bumpmap/bumpmap.png b/examples/dreamcast/pvr/bumpmap/bumpmap.png new file mode 100644 index 0000000..9da36ed Binary files /dev/null and b/examples/dreamcast/pvr/bumpmap/bumpmap.png differ diff --git a/addons/lib/.keepme b/examples/dreamcast/pvr/bumpmap/romdisk/.keepme similarity index 100% copy from addons/lib/.keepme copy to examples/dreamcast/pvr/bumpmap/romdisk/.keepme hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-30 16:00:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ab350dc00140bf51c8f9a54a204fa4f39b9df943 (commit) from 6c0f58d8c23df880fca843438e65eb7bd23bcc6d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ab350dc00140bf51c8f9a54a204fa4f39b9df943 Author: Lawrence Sebald <ljs...@us...> Date: Thu Oct 30 12:00:07 2014 -0400 Add a function for calculating bumpmap parameters. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/dc/fmath.h | 35 ++++++++++++++++++++++++++++++ kernel/arch/dreamcast/math/fmath.c | 11 +++++++++ 2 files changed, 46 insertions(+), 0 deletions(-) diff --git a/kernel/arch/dreamcast/include/dc/fmath.h b/kernel/arch/dreamcast/include/dc/fmath.h index 5859ff5..6f5c423 100644 --- a/kernel/arch/dreamcast/include/dc/fmath.h +++ b/kernel/arch/dreamcast/include/dc/fmath.h @@ -145,6 +145,41 @@ __FMINLINE void fsincosr(float f, float *s, float *c) { __fsincosr(f, *s, *c); } +/** \brief Calculate the offset color value for a set of bumpmap parameters. + + This function calculates the value to be placed into the oargb value for the + use of bumpmapping on a polygon. The angles specified should be expressed in + radians and within the limits specified for the individual parameter. + + \param h Weighting value in the range [0, 1] for how defined + the bumpiness of the surface should be. + \param t Spherical elevation angle in the range [0, pi/2] + between the surface and the lighting source. A value + of pi/2 implies that the light is directly overhead. + \param q Spherical rotation angle in the range [0, 2*pi] + between the surface and the lighting source. + \return 32-bit packed value to be used as an offset color on + the surface to be bump mapped. + + \note For more information about how bumpmapping on the PVR works, refer + to <a href="https://google.com/patents/US6819319">US Patent + 6,819,319</a>, which describes the algorithm implemented in the + hardware (specifically look at Figures 2 and 3, along with the + description in the Detailed Description section). + \note Thanks to Fredrik Ehnbom for figuring this stuff out and posting it + to the mailing list back in 2005! +*/ +__FMINLINE uint32 pvr_pack_bump(float h, float t, float q) { + uint8 hp = (uint8)(h * 255.0f); + uint8 k1 = ~hp; + uint8 k2 = (uint8)(hp * __fsin(t)); + uint8 k3 = (uint8)(hp * __fcos(t)); + uint8 qp = (uint8)((q / (2 * F_PI)) * 255.0f); + + + return (k1 << 24) | (k2 << 16) | (k3 << 8) | qp; +} + /* Make sure we declare the non-inline versions for C99 and non-gcc. Why they'd ever be needed, since they're inlined above, who knows? I guess in case someone tries to take the address of one of them? */ diff --git a/kernel/arch/dreamcast/math/fmath.c b/kernel/arch/dreamcast/math/fmath.c index 8e61816..1c64ac7 100644 --- a/kernel/arch/dreamcast/math/fmath.c +++ b/kernel/arch/dreamcast/math/fmath.c @@ -4,6 +4,7 @@ Copyright (C) 2001 Andrew Kieschnick */ +#include <arch/types.h> #include <dc/fmath_base.h> /* v1 dot v2 (inner product) */ @@ -64,3 +65,13 @@ void fsincos(float f, float *s, float *c) { void fsincosr(float f, float *s, float *c) { __fsincosr(f, *s, *c); } + +uint32 pvr_pack_bump(float h, float t, float q) { + uint8 hp = (uint8)(h * 255.0f); + uint8 k1 = ~hp; + uint8 k2 = (uint8)(hp * __fsin(t)); + uint8 k3 = (uint8)(hp * __fcos(t)); + uint8 qp = (uint8)((q / (2 * F_PI)) * 255.0f); + + return (k1 << 24) | (k2 << 16) | (k3 << 8) | qp; +} hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-30 15:32:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 6c0f58d8c23df880fca843438e65eb7bd23bcc6d (commit) from e6dc229c0254dc084bc290b121d4f0da8d7c0457 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6c0f58d8c23df880fca843438e65eb7bd23bcc6d Author: Lawrence Sebald <ljs...@us...> Date: Thu Oct 30 11:32:14 2014 -0400 Sprites can have specular values too. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/pvr/pvr_prim.c | 1 + kernel/arch/dreamcast/include/dc/pvr.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c index be7f84c..bcc9a5b 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c @@ -338,6 +338,7 @@ void pvr_sprite_compile(pvr_sprite_hdr_t *dst, pvr_sprite_cxt_t *src) { dst->cmd |= (src->list_type << PVR_TA_CMD_TYPE_SHIFT) & PVR_TA_CMD_TYPE_MASK; dst->cmd |= (PVR_UVFMT_16BIT << PVR_TA_CMD_UVFMT_SHIFT) & PVR_TA_CMD_UVFMT_MASK; dst->cmd |= (src->gen.clip_mode << PVR_TA_CMD_USERCLIP_SHIFT) & PVR_TA_CMD_USERCLIP_MASK; + dst->cmd |= (src->gen.specular << PVR_TA_CMD_SPECULAR_SHIFT) & PVR_TA_CMD_SPECULAR_MASK; /* Polygon mode 1 */ dst->mode1 = (src->depth.comparison << PVR_TA_PM1_DEPTHCMP_SHIFT) & PVR_TA_PM1_DEPTHCMP_MASK; diff --git a/kernel/arch/dreamcast/include/dc/pvr.h b/kernel/arch/dreamcast/include/dc/pvr.h index 1daf19c..3bc6ce4 100644 --- a/kernel/arch/dreamcast/include/dc/pvr.h +++ b/kernel/arch/dreamcast/include/dc/pvr.h @@ -195,25 +195,27 @@ typedef struct { int list_type; /**< \brief Primitive list \see pvr_lists */ struct { - int alpha; /**< \brief Enable or disable alpha outside modifier + int alpha; /**< \brief Enable or disable alpha \see pvr_alpha_switch */ - int fog_type; /**< \brief Fog type outside modifier + int fog_type; /**< \brief Fog type \see pvr_fog_types */ int culling; /**< \brief Culling mode \see pvr_cull_modes */ - int color_clamp; /**< \brief Color clamp enable/disable outside modifier + int color_clamp; /**< \brief Color clamp enable/disable \see pvr_colclamp_switch */ int clip_mode; /**< \brief Clipping mode \see pvr_clip_modes */ + int specular; /**< \brief Offset color enable/disable + \see pvr_offset_switch */ } gen; /**< \brief General parameters */ struct { - int src; /**< \brief Source blending mode outside modifier + int src; /**< \brief Source blending mode \see pvr_blend_modes */ - int dst; /**< \brief Dest blending mode outside modifier + int dst; /**< \brief Dest blending mode \see pvr_blend_modes */ - int src_enable; /**< \brief Source blending enable outside modifier + int src_enable; /**< \brief Source blending enable \see pvr_blend_switch */ - int dst_enable; /**< \brief Dest blending enable outside modifier + int dst_enable; /**< \brief Dest blending enable \see pvr_blend_switch */ } blend; struct { @@ -819,8 +821,6 @@ static inline uint32 PVR_PACK_16BIT_UV(float u, float v) { (((*((uint32 *) &v)) >> 16) & 0x0000FFFF); } -/* ... other vertex structs omitted for now ... */ - /** \defgroup pvr_commands TA command values These are are appropriate values for TA commands. Use whatever goes with the hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-27 20:55:56
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via e6dc229c0254dc084bc290b121d4f0da8d7c0457 (commit) via bb4fb14687e6851fcb97479fb189621f895c8980 (commit) from 1a5bdd8d5db26e40840b842d1493faa2ca6e932d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e6dc229c0254dc084bc290b121d4f0da8d7c0457 Merge: 1a5bdd8 bb4fb14 Author: Lawrence Sebald <ljs...@us...> Date: Mon Oct 27 16:55:07 2014 -0400 Merge branch 'bogglez-master' dcbumpgen needs -lm on some systems. commit bb4fb14687e6851fcb97479fb189621f895c8980 Author: bogglez <bogglez@the.mind> Date: Mon Oct 27 19:19:02 2014 +0100 dcbumpgen wouldn't compile without -lm ----------------------------------------------------------------------- Summary of changes: utils/dcbumpgen/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/utils/dcbumpgen/Makefile b/utils/dcbumpgen/Makefile index c5417d6..a681a91 100644 --- a/utils/dcbumpgen/Makefile +++ b/utils/dcbumpgen/Makefile @@ -2,7 +2,7 @@ # Makefile stolen from the kmgenc program. CFLAGS = -O2 -Wall -DINLINE=inline -I/usr/local/include -LDFLAGS = -s -lpng -ljpeg -lz -L/usr/local/lib +LDFLAGS = -s -lpng -ljpeg -lm -lz -L/usr/local/lib all: dcbumpgen hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-25 23:42:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The collection of ports that can be used in KallistiOS programs.". The branch, master has been updated via 9769a05de2c7c6e34f32191ac355e1ae3fd5e030 (commit) from 7b3b060c2c1af76b9c56d236199c95d9abc1f1d6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9769a05de2c7c6e34f32191ac355e1ae3fd5e030 Author: Lawrence Sebald <ljs...@us...> Date: Sat Oct 25 19:42:17 2014 -0400 Update libgl version in kos-ports. ----------------------------------------------------------------------- Summary of changes: libgl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libgl b/libgl index 97dc259..8c34258 160000 --- a/libgl +++ b/libgl @@ -1 +1 @@ -Subproject commit 97dc25918a2ca2b4cae868813e026bbf8889a85b +Subproject commit 8c34258eb439eed86efa79c403c6ebd07d833894 hooks/post-receive -- The collection of ports that can be used in KallistiOS programs. |
From: Lawrence S. <ljs...@us...> - 2014-10-25 23:41:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of OpenGL.". The branch, master has been updated via 8c34258eb439eed86efa79c403c6ebd07d833894 (commit) from 97dc25918a2ca2b4cae868813e026bbf8889a85b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8c34258eb439eed86efa79c403c6ebd07d833894 Author: Lawrence Sebald <ljs...@us...> Date: Sat Oct 25 19:41:00 2014 -0400 Make sure output parameters to _glKosSpotlight() are aligned to an 8-byte boundary. ----------------------------------------------------------------------- Summary of changes: gl-light.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gl-light.c b/gl-light.c index cf2887e..c2961cd 100755 --- a/gl-light.c +++ b/gl-light.c @@ -406,7 +406,7 @@ void _glKosVertexLights(glVertex *P, pvr_vertex_t *v, GLuint count) { float S; #endif unsigned char i; - float L[4]; + float L[4] __attribute__((aligned(8))); float C[3] = { 0, 0, 0 }; colorui *color = (colorui *)&v->argb; @@ -456,7 +456,7 @@ void _glKosVertexLight(glVertex *P, pvr_vertex_t *v) { float S; #endif unsigned char i; - float L[4]; + float L[4] __attribute__((aligned(8))); /* Compute Ambient */ float C[3] = { GL_MATERIAL.Ke[0] + GL_MATERIAL.Ka[0] *GL_GLOBAL_AMBIENT[0], @@ -501,7 +501,7 @@ GLuint _glKosVertexLightColor(glVertex *P) { #endif GLuint color; GLubyte i; - float L[4]; + float L[4] __attribute__((aligned(8))); /* Compute Ambient */ float C[3] = { GL_MATERIAL.Ke[0] + GL_MATERIAL.Ka[0] *GL_GLOBAL_AMBIENT[0], hooks/post-receive -- The KallistiOS port of OpenGL. |
From: Lawrence S. <ljs...@us...> - 2014-10-25 15:01:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The collection of ports that can be used in KallistiOS programs.". The branch, master has been updated via 7b3b060c2c1af76b9c56d236199c95d9abc1f1d6 (commit) via 24c5f9031bff1efb48e2fd9f6c8bf2980eb30989 (commit) from 7753d2df6797b37744c1e286e386f6b423e31c24 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7b3b060c2c1af76b9c56d236199c95d9abc1f1d6 Merge: 24c5f90 7753d2d Author: Lawrence Sebald <ljs...@us...> Date: Sat Oct 25 11:01:31 2014 -0400 Merge branch 'master' of ssh://git.code.sf.net/p/cadcdev/kos-ports commit 24c5f9031bff1efb48e2fd9f6c8bf2980eb30989 Author: Lawrence Sebald <ljs...@us...> Date: Sat Oct 25 11:01:12 2014 -0400 Update libparallax. ----------------------------------------------------------------------- Summary of changes: libparallax | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libparallax b/libparallax index 9e70727..4db5606 160000 --- a/libparallax +++ b/libparallax @@ -1 +1 @@ -Subproject commit 9e70727da97a2dc7919a759d5b937c8011461551 +Subproject commit 4db5606797c628c29fdf9c97acf28988ac46edf9 hooks/post-receive -- The collection of ports that can be used in KallistiOS programs. |
From: Lawrence S. <ljs...@us...> - 2014-10-25 15:00:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT". The branch, master has been updated via 4db5606797c628c29fdf9c97acf28988ac46edf9 (commit) from 9e70727da97a2dc7919a759d5b937c8011461551 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4db5606797c628c29fdf9c97acf28988ac46edf9 Author: Lawrence Sebald <ljs...@us...> Date: Sat Oct 25 10:59:28 2014 -0400 Add Jim Ursetto's old parallax specular patch. ----------------------------------------------------------------------- Summary of changes: include/context.h | 10 +++++++++- src/context.c | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/context.h b/include/context.h index e058291..844b310 100644 --- a/include/context.h +++ b/include/context.h @@ -70,6 +70,15 @@ void plx_cxt_fog(int type); #define PLX_FOG_TABLE PVR_FOG_TABLE /** + Set the specular highlight mode. + */ +void plx_cxt_specular(int type); + +/* Constants for specular modes */ +#define PLX_SPECULAR_NONE PVR_SPECULAR_DISABLE +#define PLX_SPECULAR PVR_SPECULAR_ENABLE + +/** Submit the selected context for rendering. */ void plx_cxt_send(int list); @@ -77,4 +86,3 @@ void plx_cxt_send(int list); __END_DECLS #endif /* __PARALLAX_TEXTURE */ - diff --git a/src/context.c b/src/context.c index ed617a7..3b3de60 100644 --- a/src/context.c +++ b/src/context.c @@ -68,6 +68,11 @@ void plx_cxt_fog(int type) { compile_cxts(); } +void plx_cxt_specular(int type) { + cxt_working.gen.specular = type; + compile_cxts(); +} + void plx_cxt_send(int type) { switch (type) { case PVR_LIST_OP_POLY: @@ -83,4 +88,3 @@ void plx_cxt_send(int type) { assert_msg( 0, "List type not handled by plx_cxt_send" ); } } - hooks/post-receive -- UNNAMED PROJECT |
From: Lawrence S. <ljs...@us...> - 2014-10-25 14:55:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 1a5bdd8d5db26e40840b842d1493faa2ca6e932d (commit) via 1e77dc4e82d9b4d96455eaf10304afd49c2c9948 (commit) via b38b503b4729a2602af24f44e6a2a5095348541b (commit) from 0b0f7a4d32285b116a164ef26cee364f5605cc3f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1a5bdd8d5db26e40840b842d1493faa2ca6e932d Author: Lawrence Sebald <ljs...@us...> Date: Sat Oct 25 01:21:33 2014 -0400 Add dcbumpgen to the utils that are built by default. commit 1e77dc4e82d9b4d96455eaf10304afd49c2c9948 Author: Lawrence Sebald <ljs...@us...> Date: Sat Oct 25 01:20:08 2014 -0400 Add dcbumpgen to the .gitignore commit b38b503b4729a2602af24f44e6a2a5095348541b Author: Lawrence Sebald <ljs...@us...> Date: Sat Oct 25 01:18:54 2014 -0400 Add support for offset color values (aka specular values). ----------------------------------------------------------------------- Summary of changes: .gitignore | 1 + kernel/arch/dreamcast/hardware/pvr/pvr_prim.c | 2 ++ kernel/arch/dreamcast/include/dc/pvr.h | 21 +++++++++++++++++++++ utils/Makefile | 2 +- 4 files changed, 25 insertions(+), 1 deletions(-) diff --git a/.gitignore b/.gitignore index 5a2d891..f539093 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ utils/bincnv/bincnv utils/gentexfont/gentexfont utils/isotest/isotest utils/makejitter/makejitter +utils/dcbumpgen/dcbumpgen examples/dreamcast/basic/exec/romdisk/sub.bin examples/dreamcast/kgl/basic/vq/fruit.vq examples/dreamcast/conio/adventure/data.c diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c index 8105f69..be7f84c 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c @@ -41,6 +41,7 @@ void pvr_poly_compile(pvr_poly_hdr_t *dst, pvr_poly_cxt_t *src) { dst->cmd |= (src->gen.clip_mode << PVR_TA_CMD_USERCLIP_SHIFT) & PVR_TA_CMD_USERCLIP_MASK; dst->cmd |= (src->fmt.modifier << PVR_TA_CMD_MODIFIER_SHIFT) & PVR_TA_CMD_MODIFIER_MASK; dst->cmd |= (src->gen.modifier_mode << PVR_TA_CMD_MODIFIERMODE_SHIFT) & PVR_TA_CMD_MODIFIERMODE_MASK; + dst->cmd |= (src->gen.specular << PVR_TA_CMD_SPECULAR_SHIFT) & PVR_TA_CMD_SPECULAR_MASK; /* Polygon mode 1 */ dst->mode1 = (src->depth.comparison << PVR_TA_PM1_DEPTHCMP_SHIFT) & PVR_TA_PM1_DEPTHCMP_MASK; @@ -476,6 +477,7 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, pvr_poly_cxt_t *src) { dst->cmd |= (src->gen.clip_mode << PVR_TA_CMD_USERCLIP_SHIFT) & PVR_TA_CMD_USERCLIP_MASK; dst->cmd |= (src->fmt.modifier << PVR_TA_CMD_MODIFIER_SHIFT) & PVR_TA_CMD_MODIFIER_MASK; dst->cmd |= (src->gen.modifier_mode << PVR_TA_CMD_MODIFIERMODE_SHIFT) & PVR_TA_CMD_MODIFIERMODE_MASK; + dst->cmd |= (src->gen.specular << PVR_TA_CMD_SPECULAR_SHIFT) & PVR_TA_CMD_SPECULAR_MASK; /* Polygon mode 1 */ dst->mode1 = (src->depth.comparison << PVR_TA_PM1_DEPTHCMP_SHIFT) & PVR_TA_PM1_DEPTHCMP_MASK; diff --git a/kernel/arch/dreamcast/include/dc/pvr.h b/kernel/arch/dreamcast/include/dc/pvr.h index 4f5c59e..1daf19c 100644 --- a/kernel/arch/dreamcast/include/dc/pvr.h +++ b/kernel/arch/dreamcast/include/dc/pvr.h @@ -90,6 +90,8 @@ typedef struct { int clip_mode; /**< \brief Clipping mode \see pvr_clip_modes */ int modifier_mode; /**< \brief Modifier mode */ + int specular; /**< \brief Offset color enable/disable outside modifier + \see pvr_offset_switch */ int alpha2; /**< \brief Enable/disable alpha inside modifier \see pvr_alpha_switch */ int fog_type2; /**< \brief Fog type inside modifier @@ -376,6 +378,22 @@ typedef struct { #define PVR_CLRCLAMP_ENABLE 1 /**< \brief Enable color clamping */ /** @} */ +/** \defgroup pvr_offset_switch Enable or disable offset color + + Enabling offset color calculation allows for "specular" like effects on a + per-vertex basis, by providing an additive color in the calculation of the + final pixel colors. In vertex types with a "oargb" parameter, that's what it + is for. + + Note that this must be enabled for bumpmap polygons in order to allow you to + specify the parameters in the oargb field of the vertices. + + @{ +*/ +#define PVR_SPECULAR_DISABLE 0 /**< \brief Disable offset colors */ +#define PVR_SPECULAR_ENABLE 1 /**< \brief Enable offset colors */ +/** @} */ + /** \defgroup pvr_alpha_switch Enable or disable alpha blending This causes the alpha value in the vertex color to be paid attention to. It @@ -836,6 +854,9 @@ Striplength set to 2 */ #define PVR_TA_CMD_CLRFMT_SHIFT 4 #define PVR_TA_CMD_CLRFMT_MASK (7 << PVR_TA_CMD_CLRFMT_SHIFT) +#define PVR_TA_CMD_SPECULAR_SHIFT 2 +#define PVR_TA_CMD_SPECULAR_MASK (1 << PVR_TA_CMD_SPECULAR_SHIFT) + #define PVR_TA_CMD_SHADE_SHIFT 1 #define PVR_TA_CMD_SHADE_MASK (1 << PVR_TA_CMD_SHADE_SHIFT) diff --git a/utils/Makefile b/utils/Makefile index 55098f5..392c0d9 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -4,7 +4,7 @@ # (c)2001 Dan Potter # -DIRS = genromfs wav2adpcm vqenc scramble +DIRS = genromfs wav2adpcm vqenc scramble dcbumpgen # Ok for these to fail atm... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-25 00:46:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 0b0f7a4d32285b116a164ef26cee364f5605cc3f (commit) from a17ed9f7a4c99a8d59636077d6814b90e87cc9e4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0b0f7a4d32285b116a164ef26cee364f5605cc3f Author: Lawrence Sebald <ljs...@us...> Date: Fri Oct 24 20:45:40 2014 -0400 Add Fredrik Ehnbom's dcbumpgen program. This really should've been added in a long time ago, as it was sent to the mailing list back in 2005! ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 2 + utils/dcbumpgen/Makefile | 14 ++++ utils/dcbumpgen/dcbumpgen.c | 123 ++++++++++++++++++++++++++++++ utils/dcbumpgen/get_image.c | 18 +++++ utils/{kmgenc => dcbumpgen}/get_image.h | 12 ++-- utils/dcbumpgen/get_image_jpg.c | 124 +++++++++++++++++++++++++++++++ utils/dcbumpgen/get_image_png.c | 96 ++++++++++++++++++++++++ utils/{kmgenc => dcbumpgen}/readpng.c | 73 +++++++++---------- utils/{vqenc => dcbumpgen}/readpng.h | 10 +-- 9 files changed, 422 insertions(+), 50 deletions(-) create mode 100644 utils/dcbumpgen/Makefile create mode 100644 utils/dcbumpgen/dcbumpgen.c create mode 100644 utils/dcbumpgen/get_image.c copy utils/{kmgenc => dcbumpgen}/get_image.h (70%) create mode 100644 utils/dcbumpgen/get_image_jpg.c create mode 100644 utils/dcbumpgen/get_image_png.c copy utils/{kmgenc => dcbumpgen}/readpng.c (71%) copy utils/{vqenc => dcbumpgen}/readpng.h (83%) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 553f49d..176f26f 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -50,6 +50,8 @@ KallistiOS version 2.0.1 ----------------------------------------------- - DC Added a utility function to the PVR code for controlling the cheap shadow scale register [LS] - DC Added an example of the PVR's cheap shadow functionality [LS] +- DC Added a tool for generation of bumpmaps that was sent to the mailing list + all the way back in 2005 [Fredrik Ehnbom = FE] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/utils/dcbumpgen/Makefile b/utils/dcbumpgen/Makefile new file mode 100644 index 0000000..c5417d6 --- /dev/null +++ b/utils/dcbumpgen/Makefile @@ -0,0 +1,14 @@ + +# Makefile stolen from the kmgenc program. + +CFLAGS = -O2 -Wall -DINLINE=inline -I/usr/local/include +LDFLAGS = -s -lpng -ljpeg -lz -L/usr/local/lib + +all: dcbumpgen + +dcbumpgen: dcbumpgen.o get_image.o get_image_jpg.o get_image_png.o readpng.o + $(CC) -o $@ $+ $(LDFLAGS) + +clean: + rm -f dcbumpgen *.o + diff --git a/utils/dcbumpgen/dcbumpgen.c b/utils/dcbumpgen/dcbumpgen.c new file mode 100644 index 0000000..7f3d241 --- /dev/null +++ b/utils/dcbumpgen/dcbumpgen.c @@ -0,0 +1,123 @@ +/* + dcbumpgen - creates polar angles to be used for bumpmapping + Copyright (c) 2005 Fredrik Ehnbom + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any + damages arising from the use of this software. + + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and + redistribute it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you use + this software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and + must not be misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. + */ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +/* TODO: + * With this utility included, there are now three utilities + * (the other two being "vqenc" and "kmgenc") using common texture + * operations such as twiddling and loading of png and jpeg images. + * Maybe it is time to break that stuff out into its own library + * or create a megatool consisting of all the tree tools in one + * executable. + */ +#include "get_image.h" + +void printUsage() { + printf("dcbumpgen - Dreamcast bumpmap generator v0.1\n"); + printf("Copyright (c) 2005 Fredrik Ehnbom\n"); + printf("usage: dcbumpgen <infile.png/.jpg> <outfile.raw>\n"); +} + +/* twiddling stuff copied from kmgenc.c */ +#define TWIDTAB(x) ( (x&1)|((x&2)<<1)|((x&4)<<2)|((x&8)<<3)|((x&16)<<4)| \ + ((x&32)<<5)|((x&64)<<6)|((x&128)<<7)|((x&256)<<8)|((x&512)<<9) ) +#define TWIDOUT(x, y) ( TWIDTAB((y)) | (TWIDTAB((x)) << 1) ) +#define MIN(a, b) ( (a)<(b)? (a):(b) ) + +int main(int argc, char **argv) { + image_t img; + FILE *fp; + int y, x; + unsigned char *buffer; + int imgpos, dest; + + if (argc != 3) { + printUsage(); + exit(1); + } + + if (get_image(argv[1], &img) < 0) { + fprintf(stderr, "couldn't open %s\n", argv[1]); + return -1; + } + + /* TODO: + * - error-checking for missing files and other file failures + * - check that image is power of two + */ + fp = fopen(argv[2], "wb"); + buffer = malloc(2 * img.w * img.h); + + imgpos = 1; /* 1 to skip the alpha-channel */ + dest = 0; + for (y = 0; y < img.h; y++) { + for (x = 0; x < img.w; x++, imgpos += 4) { + double diffy = 0; + double diffx = 0; + if (y > 0 && x > 0) { + diffy = (img.data[imgpos - img.stride] - img.data[imgpos]) / 255.0; + diffx = (img.data[imgpos - 4] - img.data[imgpos]) / 255.0; + } + + /* Rotation = R + 0 -> almost 360 degrees */ + double rot = atan2(diffy, diffx); + int rotation = (int) ((rot / (2 * 3.1415927)) * 255); + + /* Elevation = S + 0 -> almost 90 degrees */ + int elevation = (int) (255 * (1 - fabs(diffx) - fabs(diffy))); + if (elevation < 0) elevation = 0; + + buffer[dest] = rotation; dest++; + buffer[dest] = elevation; dest++; + } + } + + /* twiddle code based on code from kmgenc.c */ + int min = MIN(img.w, img.h); + int mask = min-1; + short *sbuffer = (short*) buffer; + short *twidbuffer = malloc(2 * img.w * img.h); + for (y=0; y<img.h; y++) { + int yout = y; + for (x=0; x<img.w; x++) { + twidbuffer[TWIDOUT(x&mask, yout&mask) + + (x/min + yout/min)*min*min] = sbuffer[y*img.w+x]; + } + } + + fwrite(twidbuffer, 1, 2* img.w * img.h, fp); + fclose(fp); + + free(buffer); + free(twidbuffer); + if (img.data) { + free(img.data); + } + return 0; +} + diff --git a/utils/dcbumpgen/get_image.c b/utils/dcbumpgen/get_image.c new file mode 100644 index 0000000..9e84c86 --- /dev/null +++ b/utils/dcbumpgen/get_image.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include "get_image.h" + +int get_image(const char *filename, image_t *image) { + int len = strlen(filename); + + if (!strcmp(filename + len - 3, "png")) { + return get_image_png(filename, image); + } else if (!strcmp(filename + len - 3, "jpg")) { + return get_image_jpg(filename, image); + } else { + fprintf(stderr, "FATAL: Unknown extension on input file '%s'\n", filename); + return -1; + } +} diff --git a/utils/kmgenc/get_image.h b/utils/dcbumpgen/get_image.h similarity index 70% copy from utils/kmgenc/get_image.h copy to utils/dcbumpgen/get_image.h index 23446be..83f515d 100644 --- a/utils/kmgenc/get_image.h +++ b/utils/dcbumpgen/get_image.h @@ -1,13 +1,13 @@ #ifndef __GET_IMAGE_H -#define __GET_IMAGE_H +#define __GET_IMAGE_H typedef struct image_t { - int w; - int h; - int bpp; - int stride; - unsigned char *data; + int w; + int h; + int bpp; + int stride; + unsigned char *data; } image_t; int get_image(const char *filename, image_t *image); diff --git a/utils/dcbumpgen/get_image_jpg.c b/utils/dcbumpgen/get_image_jpg.c new file mode 100644 index 0000000..2211187 --- /dev/null +++ b/utils/dcbumpgen/get_image_jpg.c @@ -0,0 +1,124 @@ + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <jpeglib.h> +#include "get_image.h" + +/* get_image() is merely a copy of Andrew's jpeg_to_texture routine */ +int get_image_jpg(const char *filename, image_t *image) +{ + FILE *infile; + int i; + + /* This struct contains the JPEG decompression parameters and pointers to + * working space (which is allocated as needed by the JPEG library). + */ + struct jpeg_decompress_struct cinfo; + + struct jpeg_error_mgr jerr; + + /* More stuff */ + JSAMPARRAY buffer; /* Output row buffer */ + + /* In this example we want to open the input file before doing anything else, + * so that the setjmp() error recovery below can assume the file is open. + * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that + * requires it in order to read binary files. + */ + + infile = fopen(filename, "rb"); + if (infile == NULL) { + return -errno; + } + + /* Step 1: allocate and initialize JPEG decompression object */ + + /* We set up the normal JPEG error routines */ + cinfo.err = jpeg_std_error(&jerr); + + /* Now we can initialize the JPEG decompression object. */ + jpeg_create_decompress(&cinfo); + + /* Step 2: specify data source (eg, a file) */ + jpeg_stdio_src(&cinfo, (FILE*)infile); + + /* Step 3: read file parameters with jpeg_read_header() */ + (void)jpeg_read_header(&cinfo, TRUE); + /* We can ignore the return value from jpeg_read_header since + * (a) suspension is not possible with the stdio data source, and + * (b) we passed TRUE to reject a tables-only JPEG file as an error. + * See libjpeg.doc for more info. + */ + + (void)jpeg_start_decompress(&cinfo); + + /* Allocate the output buffers */ + image->w = cinfo.image_width; + image->h = cinfo.image_height; + image->bpp = cinfo.output_components; + image->stride = 4*image->w; + image->data = (unsigned char*)malloc(image->stride * image->h); + if (image->data == NULL) { + /* ouch */ + fclose(infile); + return -ENOMEM; + } + + /* Step 4: set parameters for decompression */ + cinfo.scale_denom = 1; /* must be 1, 2, 4, or 8 */ + + /* We may need to do some setup of our own at this point before reading + * the data. After jpeg_start_decompress() we have the correct scaled + * output image dimensions available, as well as the output colormap + * if we asked for color quantization. + * In this example, we need to make an output work buffer of the right size. + */ + /* JSAMPLEs per row in output buffer */ + + /* Make a one-row-high sample array that will go away when done with image */ + buffer = (*cinfo.mem->alloc_sarray) + ((j_common_ptr) &cinfo, JPOOL_IMAGE, image->stride, 1); + + /* Step 6: while (scan lines remain to be read) */ + /* jpeg_read_scanlines(...); */ + + /* Here we use the library's state variable cinfo.output_scanline as the + * loop counter, so that we don't have to keep track ourselves. + */ + while (cinfo.output_scanline < cinfo.output_height) { + /* jpeg_read_scanlines expects an array of pointers to scanlines. + * Here the array is only one element long, but you could ask for + * more than one scanline at a time if that's more convenient. + */ + (void)jpeg_read_scanlines(&cinfo, buffer, 1); + + for (i=0; i<image->w; i++) { + int offs = (cinfo.output_scanline-1) * 4*image->w; + image->data[offs + i*4 + 0] = 0xff; + image->data[offs + i*4 + 1] = buffer[0][i*3 + 0]; + image->data[offs + i*4 + 2] = buffer[0][i*3 + 1]; + image->data[offs + i*4 + 3] = buffer[0][i*3 + 2]; + } + // memcpy(image->data + (cinfo.output_scanline-1) * image->stride, buffer[0], image->stride); + } + + /* Step 7: Finish decompression */ + (void)jpeg_finish_decompress(&cinfo); + /* We can ignore the return value since suspension is not possible + * with the stdio data source. + */ + + /* Step 8: Release JPEG decompression object */ + /* This is an important step since it will release a good deal of memory. */ + jpeg_destroy_decompress(&cinfo); + + /* At this point you may want to check to see whether any corrupt-data + * warnings occurred (test whether jerr.pub.num_warnings is nonzero). + */ + + /* And we're done! */ + fclose(infile); + return 0; +} diff --git a/utils/dcbumpgen/get_image_png.c b/utils/dcbumpgen/get_image_png.c new file mode 100644 index 0000000..96ed967 --- /dev/null +++ b/utils/dcbumpgen/get_image_png.c @@ -0,0 +1,96 @@ +/* KallistiOS ##version## + + kos_img.c + (c)2002 Jeffrey McBeth, Dan Potter + + Based on Jeff's png_load_texture routine, but loads into a + KOS plat-independent image. +*/ + +#include <assert.h> +#include <stdlib.h> +#include <png.h> +#include "readpng.h" +#include "get_image.h" + +/* load an n x n texture from a png */ + +/* not to be used outside of here */ +void _png_copy_texture(uint8 *buffer, uint8 *temp_tex, + uint32 channels, uint32 stride, + uint32 w, uint32 h) +{ + uint32 i,j; + uint8 *ourbuffer; + uint8 *pRow; + + for(i = 0; i < h; i++) { + pRow = &buffer[i*stride]; + ourbuffer = &temp_tex[i*w*4]; + + if (channels == 3) { + for (j=0; j<w; j++) { + ourbuffer[j*4+0] = 0xff; + ourbuffer[j*4+1] = pRow[j*3+0]; + ourbuffer[j*4+2] = pRow[j*3+1]; + ourbuffer[j*4+3] = pRow[j*3+2]; + } + } + else if (channels == 4) { + for (j=0; j<w; j++) { + ourbuffer[j*4+0] = pRow[j*4+3]; + ourbuffer[j*4+1] = pRow[j*4+0]; + ourbuffer[j*4+2] = pRow[j*4+1]; + ourbuffer[j*4+3] = pRow[j*4+2]; + } + } + } +} + +int get_image_png(const char * filename, image_t * image) { + uint8 *temp_tex; + + /* More stuff */ + uint8 *buffer; /* Output row buffer */ + uint32 row_stride; /* physical row width in output buffer */ + uint32 channels; /* 3 for RGB 4 for RGBA */ + + FILE *infile; /* source file */ + + assert( image != NULL ); + + if ((infile = fopen(filename, "r")) == 0) { + printf("png_to_texture: can't open %s\n", filename); + return -1; + } + + /* Step 1: Initialize loader */ + if (readpng_init(infile)) { + fclose(infile); + return -2; + } + + /* Step 1.5: Create output kos_img_t */ + /* rv = (kos_img_t *)malloc(sizeof(kos_img_t)); */ + + /* Step 2: Read file */ + buffer = readpng_get_image(&channels, &row_stride, &image->w, &image->h); + temp_tex = (uint8 *)malloc(sizeof(uint8) * 4 * image->w * image->h); + image->data = (unsigned char *)temp_tex; + image->bpp = 4; + image->stride = image->w*4; + + _png_copy_texture(buffer, temp_tex, + channels, row_stride, + image->w, image->h); + + /* Step 3: Finish decompression */ + free(buffer); + readpng_cleanup(); + + fclose(infile); + + /* And we're done! */ + return 0; +} + diff --git a/utils/kmgenc/readpng.c b/utils/dcbumpgen/readpng.c similarity index 71% copy from utils/kmgenc/readpng.c copy to utils/dcbumpgen/readpng.c index 642fdeb..f9372d7 100644 --- a/utils/kmgenc/readpng.c +++ b/utils/dcbumpgen/readpng.c @@ -3,6 +3,7 @@ readpng.c Copyright (C)2002 Jeffrey McBeth + $Id: readpng.c,v 1.1 2003/04/24 03:19:42 bardtx Exp $ */ /* Modified for vqenc by Dan Potter */ @@ -10,44 +11,43 @@ #include <stdio.h> #include <stdlib.h> -#include <png.h> /* libpng header; includes zlib.h */ +#include <png.h> /* libpng header */ #include <zlib.h> #include "readpng.h" /* typedefs, common macros, public prototypes */ static png_structp png_ptr = NULL; static png_infop info_ptr = NULL; -void readpng_version_info(void) { +void readpng_version_info(void) +{ fprintf(stderr, " Compiled with libpng %s; using libpng %s.\n", - PNG_LIBPNG_VER_STRING, png_libpng_ver); + PNG_LIBPNG_VER_STRING, png_libpng_ver); fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n", - ZLIB_VERSION, zlib_version); + ZLIB_VERSION, zlib_version); } /* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */ -uint32 readpng_init(FILE *infile) { +uint32 readpng_init(FILE *infile) +{ uint8 sig[8]; /* first do a quick check that the file really is a PNG image; could * have used slightly more general png_sig_cmp() function instead */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-24 23:22:05
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a17ed9f7a4c99a8d59636077d6814b90e87cc9e4 (commit) from 8c941dfdb8fe3068e413d5dc28cf40bdaf411b16 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a17ed9f7a4c99a8d59636077d6814b90e87cc9e4 Author: Lawrence Sebald <ljs...@us...> Date: Fri Oct 24 19:20:25 2014 -0400 Add in some code related to PVR cheap shadows. This commit adds in a utility function to the PVR code related to setting the cheap shadow scale register and makes a minor correction to the polygon header compile code to fix cheap shadow mode. Also included is a small example of cheap shadow modifiers. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 3 + .../dns-client => pvr/cheap_shadow}/Makefile | 8 +-- .../modifier.c => cheap_shadow/shadow.c} | 61 +++++++++++++------- kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 10 +++- kernel/arch/dreamcast/hardware/pvr/pvr_prim.c | 4 +- kernel/arch/dreamcast/include/dc/pvr.h | 18 ++++++ 6 files changed, 76 insertions(+), 28 deletions(-) copy examples/dreamcast/{network/dns-client => pvr/cheap_shadow}/Makefile (62%) copy examples/dreamcast/pvr/{modifier_volume/modifier.c => cheap_shadow/shadow.c} (72%) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 9a526e4..553f49d 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -47,6 +47,9 @@ KallistiOS version 2.0.1 ----------------------------------------------- DNS server with a timeout between messages [LS] - DC Fixed pvr_mem_available() to report all available texture memory, not just what was available in the pvr_malloc() arena [LS] +- DC Added a utility function to the PVR code for controlling the cheap shadow + scale register [LS] +- DC Added an example of the PVR's cheap shadow functionality [LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/examples/dreamcast/network/dns-client/Makefile b/examples/dreamcast/pvr/cheap_shadow/Makefile similarity index 62% copy from examples/dreamcast/network/dns-client/Makefile copy to examples/dreamcast/pvr/cheap_shadow/Makefile index adfe504..ddce956 100644 --- a/examples/dreamcast/network/dns-client/Makefile +++ b/examples/dreamcast/pvr/cheap_shadow/Makefile @@ -1,8 +1,5 @@ -# Put the filename of the output binary here -TARGET = dns-client.elf - -# List all of your C files here, but change the extension to ".o" -OBJS = dns-client.o +TARGET = shadow.elf +OBJS = shadow.o all: rm-elf $(TARGET) @@ -23,3 +20,4 @@ run: $(TARGET) dist: rm -f $(OBJS) $(KOS_STRIP) $(TARGET) + diff --git a/examples/dreamcast/pvr/modifier_volume/modifier.c b/examples/dreamcast/pvr/cheap_shadow/shadow.c similarity index 72% copy from examples/dreamcast/pvr/modifier_volume/modifier.c copy to examples/dreamcast/pvr/cheap_shadow/shadow.c index ca74ea7..33065e4 100644 --- a/examples/dreamcast/pvr/modifier_volume/modifier.c +++ b/examples/dreamcast/pvr/cheap_shadow/shadow.c @@ -1,9 +1,10 @@ /* KallistiOS ##version## - examples/dreamcast/pvr/modifier_volume/modifier.c - Copyright (C) 2009 Lawrence Sebald + examples/dreamcast/pvr/cheap_shadow/shadow.c + Copyright (C) 2014 Lawrence Sebald - This example shows off how to do a basic modifier volume. + This example shows off how to use the PVR's "Cheap Shadow" feature to create + shadows. */ #include <stdio.h> @@ -16,12 +17,15 @@ #define NUM_POLYS 10 -static pvr_vertex_pcm_t verts[NUM_POLYS * 4]; +static pvr_vertex_t verts[NUM_POLYS * 4]; -static pvr_poly_mod_hdr_t phdr; +static pvr_poly_hdr_t phdr; static pvr_mod_hdr_t mhdr, mhdr2; static float mx = 320.0f, my = 240.0f; static pvr_list_t list = PVR_LIST_OP_POLY; +static float shadow = 0.5f; + +#define CLAMP(low, high, value) (value < low ? low : (value > high ? high : value)) void setup() { pvr_poly_cxt_t cxt; @@ -29,8 +33,10 @@ void setup() { float x, y, z; uint32 argb = list == PVR_LIST_OP_POLY ? 0xFF0000FF : 0x80FF00FF; - pvr_poly_cxt_col_mod(&cxt, list); - pvr_poly_mod_compile(&phdr, &cxt); + pvr_poly_cxt_col(&cxt, list); + cxt.gen.modifier_mode = PVR_MODIFIER_CHEAP_SHADOW; + cxt.fmt.modifier = PVR_MODIFIER_ENABLE; + pvr_poly_compile(&phdr, &cxt); pvr_mod_compile(&mhdr, list + 1, PVR_MODIFIER_OTHER_POLY, PVR_CULLING_NONE); pvr_mod_compile(&mhdr2, list + 1, PVR_MODIFIER_INCLUDE_LAST_POLY, @@ -45,33 +51,33 @@ void setup() { verts[i * 4].x = x - 50; verts[i * 4].y = y + 50; verts[i * 4].z = z; - verts[i * 4].argb0 = argb; - verts[i * 4].argb1 = 0xFF00FF00; - verts[i * 4].d1 = verts[i * 4].d2 = 0; + verts[i * 4].u = verts[i * 4].v = 0.0f; + verts[i * 4].argb = argb; + verts[i * 4].oargb = 0; verts[i * 4 + 1].flags = PVR_CMD_VERTEX; verts[i * 4 + 1].x = x - 50; verts[i * 4 + 1].y = y - 50; verts[i * 4 + 1].z = z; - verts[i * 4 + 1].argb0 = argb; - verts[i * 4 + 1].argb1 = 0xFF00FF00; - verts[i * 4 + 1].d1 = verts[i * 4 + 1].d2 = 0; + verts[i * 4 + 1].u = verts[i * 4 + 1].v = 0.0f; + verts[i * 4 + 1].argb = argb; + verts[i * 4 + 1].oargb = 0; verts[i * 4 + 2].flags = PVR_CMD_VERTEX; verts[i * 4 + 2].x = x + 50; verts[i * 4 + 2].y = y + 50; verts[i * 4 + 2].z = z; - verts[i * 4 + 2].argb0 = argb; - verts[i * 4 + 2].argb1 = 0xFF00FF00; - verts[i * 4 + 2].d1 = verts[i * 4 + 2].d2 = 0; + verts[i * 4 + 2].u = verts[i * 4 + 2].v = 0.0f; + verts[i * 4 + 2].argb = argb; + verts[i * 4 + 2].oargb = 0; verts[i * 4 + 3].flags = PVR_CMD_VERTEX_EOL; verts[i * 4 + 3].x = x + 50; verts[i * 4 + 3].y = y - 50; verts[i * 4 + 3].z = z; - verts[i * 4 + 3].argb0 = argb; - verts[i * 4 + 3].argb1 = 0xFF00FF00; - verts[i * 4 + 3].d1 = verts[i * 4 + 3].d2 = 0; + verts[i * 4 + 3].u = verts[i * 4 + 3].v = 0.0f; + verts[i * 4 + 3].argb = argb; + verts[i * 4 + 3].oargb = 0; } } @@ -88,6 +94,15 @@ int check_start() { if(!state) return 0; + if(state->joyy > 64) { + shadow = CLAMP(0.0f, 1.0f, shadow + 0.01f); + pvr_set_shadow_scale(1, shadow); + } + else if(state->joyy < -64) { + shadow = CLAMP(0.0f, 1.0f, shadow - 0.01f); + pvr_set_shadow_scale(1, shadow); + } + if(state->buttons & CONT_START) return 1; @@ -183,16 +198,22 @@ static pvr_init_params_t pvr_params = { }; int main(int argc, char *argv[]) { - printf("---KallistiOS PVR Modifier Example---\n"); + printf("---KallistiOS PVR Cheap Shadow Example---\n"); printf("Press A to toggle between translucent and opaque polygons.\n"); printf("Use the DPAD to move the modifier square around (it starts at "); printf("(320, 240))\n"); + printf("Use the joystick (up and down) to raise or lower the intensity "); + printf("of the shadow effect.\n"); printf("Press Start to exit.\n"); srand(time(NULL)); pvr_init(&pvr_params); + /* Enable Cheap Shadow mode and set affected polygons to be at half of their + normal intensity. */ + pvr_set_shadow_scale(1, shadow); + setup(); /* Go as long as the user hasn't pressed start on controller 1. */ diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c index 352fc4f..8df096e 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c @@ -1,7 +1,8 @@ /* KallistiOS ##version## pvr_misc.c - (C)2002 Dan Potter + Copyright (C) 2002 Dan Potter + Copyright (C) 2014 Lawrence Sebald */ @@ -29,6 +30,13 @@ void pvr_set_bg_color(float r, float g, float b) { pvr_state.bg_color = (ir << 16) | (ig << 8) | (ib << 0); } +/* Enable/disable cheap shadow mode and set the cheap shadow scale register. */ +void pvr_set_shadow_scale(int enable, float scale_value) { + int s = (int)(scale_value * 255); + + PVR_SET(PVR_CHEAP_SHADOW, ((!!enable) << 8) | (s & 0xFF)); +} + /* Return the current VBlank count */ int pvr_get_vbl_count() { return pvr_state.vbl_count; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c index 9b22ef6..8105f69 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c @@ -1,7 +1,7 @@ /* KallistiOS ##version## pvr_prim.c - (C)2002 Dan Potter + Copyright (C) 2002 Dan Potter */ @@ -143,7 +143,7 @@ void pvr_poly_compile(pvr_poly_hdr_t *dst, pvr_poly_cxt_t *src) { dst->mode3 |= txr_base; } - if(src->fmt.modifier) { + if(src->fmt.modifier && src->gen.modifier_mode) { /* If we're affected by a modifier volume, silently promote the header to the one that is affected by a modifier volume. */ dst->d1 = dst->mode2; diff --git a/kernel/arch/dreamcast/include/dc/pvr.h b/kernel/arch/dreamcast/include/dc/pvr.h index d1ea601..4f5c59e 100644 --- a/kernel/arch/dreamcast/include/dc/pvr.h +++ b/kernel/arch/dreamcast/include/dc/pvr.h @@ -1141,6 +1141,24 @@ int pvr_shutdown(); */ void pvr_set_bg_color(float r, float g, float b); +/** \brief Set cheap shadow parameters. + + This function sets up the PVR cheap shadow parameters for use. You can only + specify one scale value per frame, so the effect that you can get from this + is somewhat limited, but if you want simple shadows, this is the easiest way + to do it. + + Polygons affected by a shadow modifier volume will effectively multiply + their final color by the scale value set here when shadows are enabled and + the polygon is inside the modifier (or outside for exclusion volumes). + + \param enable Set to non-zero to enable cheap shadow mode. + \param scale_value Floating point value (between 0 and 1) representing + how colors of polygons affected by and inside the + volume will be modified by the shadow volume. +*/ +void pvr_set_shadow_scale(int enable, float scale_value); + /** \brief Retrieve the current VBlank count. This function retrieves the number of VBlank interrupts that have occurred hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-23 23:27:03
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 8c941dfdb8fe3068e413d5dc28cf40bdaf411b16 (commit) from e03439c4086dd4a7a81adfec6d943c22d898bb5a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8c941dfdb8fe3068e413d5dc28cf40bdaf411b16 Author: Lawrence Sebald <ljs...@us...> Date: Thu Oct 23 19:26:33 2014 -0400 Align readdir() a bit more with POSIX. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/fs/fs_dcload.c | 12 ++++++++---- kernel/arch/dreamcast/fs/fs_dclsocket.c | 4 +++- kernel/arch/dreamcast/fs/fs_iso9660.c | 5 ++++- kernel/arch/dreamcast/fs/fs_vmu.c | 1 + kernel/fs/fs.c | 10 +++++++--- kernel/fs/fs_pty.c | 4 +--- kernel/fs/fs_ramdisk.c | 3 +++ kernel/fs/fs_romdisk.c | 2 +- 8 files changed, 28 insertions(+), 13 deletions(-) diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index 55512b7..c7afd94 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -281,10 +281,15 @@ dirent_t *dcload_readdir(void * h) { char *fn; uint32 hnd = (uint32)h; - if(lwip_dclsc && irq_inside_int()) - return 0; + if(lwip_dclsc && irq_inside_int()) { + errno = EAGAIN; + return NULL; + } - if(hnd < 100) return NULL; /* hack */ + if(hnd < 100) { + errno = EBADF; + return NULL; + } spinlock_lock(&mutex); @@ -573,4 +578,3 @@ int fs_dcload_init_lwip(void *p) { /* Register with VFS */ return nmmgr_handler_add(&vh.nmmgr); } - diff --git a/kernel/arch/dreamcast/fs/fs_dclsocket.c b/kernel/arch/dreamcast/fs/fs_dclsocket.c index ed620fd..28948d1 100644 --- a/kernel/arch/dreamcast/fs/fs_dclsocket.c +++ b/kernel/arch/dreamcast/fs/fs_dclsocket.c @@ -438,8 +438,10 @@ static dirent_t *dcls_readdir(void *hnd) { uint32 fd = (uint32) hnd; command_3int_t *cmd = (command_3int_t *)pktbuf; - if(fd < 100) + if(fd < 100) { + errno = EBADF; return NULL; + } locked = mutex_trylock(&mutex); diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index 94a4acd..cf8b5cd 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -820,8 +820,11 @@ static dirent_t *iso_readdir(void * h) { file_t fd = (file_t)h; - if(fd >= MAX_ISO_FILES || fh[fd].first_extent == 0 || !fh[fd].dir || fh[fd].broken) + if(fd >= MAX_ISO_FILES || fh[fd].first_extent == 0 || !fh[fd].dir || + fh[fd].broken) { + errno = EBADF; return NULL; + } /* Scan forwards until we find the next valid entry, an end-of-entry mark, or run out of dir size. */ diff --git a/kernel/arch/dreamcast/fs/fs_vmu.c b/kernel/arch/dreamcast/fs/fs_vmu.c index 14759e1..7bd69ff 100644 --- a/kernel/arch/dreamcast/fs/fs_vmu.c +++ b/kernel/arch/dreamcast/fs/fs_vmu.c @@ -509,6 +509,7 @@ static dirent_t *vmu_readdir(void * fd) { /* Check the handle */ if(!vmu_verify_hnd(fd, VMU_DIR)) { + errno = EBADF; return NULL; } diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index bb1cccf..f9216ed 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -510,12 +510,16 @@ uint64 fs_total64(file_t fd) { dirent_t *fs_readdir(file_t fd) { fs_hnd_t *h = fs_map_hnd(fd); - if(h == NULL) return NULL; + if(h == NULL) { + errno = EBADF; + return NULL; + } - if(h->handler == NULL) return fs_root_readdir(h); + if(h->handler == NULL) + return fs_root_readdir(h); if(h->handler->readdir == NULL) { - errno = EINVAL; + errno = ENOSYS; return NULL; } diff --git a/kernel/fs/fs_pty.c b/kernel/fs/fs_pty.c index 965dc0f..33d8387 100644 --- a/kernel/fs/fs_pty.c +++ b/kernel/fs/fs_pty.c @@ -620,14 +620,13 @@ static dirent_t * pty_readdir(void * h) { assert(h); if(fdobj->type != PF_DIR) { - errno = EINVAL; + errno = EBADF; return NULL; } dl = fdobj->d.d; if(dl->ptr >= dl->cnt) { - errno = 0; /* no error */ return NULL; } @@ -781,4 +780,3 @@ int fs_pty_shutdown() { return 0; } - diff --git a/kernel/fs/fs_ramdisk.c b/kernel/fs/fs_ramdisk.c index a6e6eb4..b661c4a 100644 --- a/kernel/fs/fs_ramdisk.c +++ b/kernel/fs/fs_ramdisk.c @@ -549,6 +549,9 @@ static dirent_t *ramdisk_readdir(void * h) { rv = &fh[fd].dirent; } + else { + errno = EBADF; + } mutex_unlock(&rd_mutex); diff --git a/kernel/fs/fs_romdisk.c b/kernel/fs/fs_romdisk.c index e0716bd..7acbc4b 100644 --- a/kernel/fs/fs_romdisk.c +++ b/kernel/fs/fs_romdisk.c @@ -354,7 +354,7 @@ static dirent_t *romdisk_readdir(void * h) { file_t fd = (file_t)h; if(fd >= MAX_RD_FILES || fh[fd].index == 0 || !fh[fd].dir) { - errno = EINVAL; + errno = EBADF; return NULL; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-23 23:11:26
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via e03439c4086dd4a7a81adfec6d943c22d898bb5a (commit) via c1ba70e506421e35d4ad5107a29f4db46e71c3dc (commit) from 02bbe38aecdac03bd10d69613a23936af3acd379 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e03439c4086dd4a7a81adfec6d943c22d898bb5a Author: Lawrence Sebald <ljs...@us...> Date: Thu Oct 23 19:10:31 2014 -0400 Use the proper header file for the memcpy2() and memset2() functions. commit c1ba70e506421e35d4ad5107a29f4db46e71c3dc Author: Lawrence Sebald <ljs...@us...> Date: Thu Oct 23 19:09:53 2014 -0400 Clean up some of the dirent.h documentation and add a dirfd() function. ----------------------------------------------------------------------- Summary of changes: include/sys/dirent.h | 101 ++++++++++++++++++++----------- kernel/arch/dreamcast/util/fb_console.c | 5 +- kernel/libc/koslib/Makefile | 2 +- kernel/libc/koslib/dirfd.c | 17 +++++ 4 files changed, 85 insertions(+), 40 deletions(-) create mode 100644 kernel/libc/koslib/dirfd.c diff --git a/include/sys/dirent.h b/include/sys/dirent.h index 7655f47..eb30e79 100644 --- a/include/sys/dirent.h +++ b/include/sys/dirent.h @@ -1,12 +1,12 @@ /* KallistiOS ##version## dirent.h - Copyright (C)2003 Dan Potter + Copyright (C) 2003 Dan Potter */ /** \file dirent.h - \brief Standard POSIX dirent functionality + \brief Directory entry functionality. This partially implements the standard POSIX dirent.h functionality. @@ -20,65 +20,97 @@ #include <arch/types.h> #include <kos/fs.h> -/** \brief The POSIX dirent which describes a directory entry +/** \brief POSIX directory entry structure. + + This structure contains information about a single entry in a directory in + the VFS. + + \headerfile sys/dirent.h */ struct dirent { - int d_ino; /**< \brief the file number */ - off_t d_off; /**< \brief the file offset */ - uint16 d_reclen; /**< \brief the record length */ - uint8 d_type; /**< \brief the type */ - char d_name[256]; /**< \brief the entry name */ + int d_ino; /**< \brief File unique identifier. */ + off_t d_off; /**< \brief File offset */ + uint16 d_reclen; /**< \brief Record length */ + uint8 d_type; /**< \brief File type */ + char d_name[256]; /**< \brief Filename */ }; -/** \brief the DIR structure in KOS +/** \brief Type representing a directory stream. + + This type represents a directory stream and is used by the directory reading + functions to trace their position in the directory. - In KOS, DIR * is just an fd, but we use a struct so we can also include the - POSIX dirent. + The values in this function are all private and subject to change. Do not + attempt to use any of them directly. + + \headerfile sys/dirent.h */ typedef struct { - file_t fd; /**< \brief the file descriptor */ - struct dirent d_ent; /**< \brief the POSIX dirent */ + file_t fd; /**< \brief File descriptor for the directory */ + struct dirent d_ent; /**< \brief Current directory entry */ } DIR; // Standard UNIX dir functions. Not all of these are fully functional // right now due to lack of support in KOS. -// All of these work. -/** \brief Opens a directory based on the specified name +/** \brief Open a directory based on the specified name. - The directory specified by name is opened if it exists and returns a - directory structure that must be later closed with closedir. + The directory specified is opened if it exists. A directory stream object is + returned for accessing the entries of the directory. - \param name The string name of the dir to open. - \return A directory structure that can be used with readdir - \note I believe you can use relative paths with opendir, but it depends on - the current working directory (getcwd) - \see closedir - \see readdir + \param name The name of the directory to open. + \return A directory stream object to be used with readdir() on + success, NULL on failure. Sets errno as appropriate. + \note As with other functions for opening files on the VFS, + relative paths are permitted for the name parameter of + this function. + \see closedir + \see readdir */ DIR *opendir(const char *name); -/** \brief Closes a currently opened directory +/** \brief Closes a directory that was previously opened. - Close a DIR that was previously opened with opendir. + This function is used to close a directory stream that was previously opened + with the opendir() function. You must do this to clean up any resources + associated with the directory stream. - \param dir The DIR that was returned from an opendir. - \return 0 on success, or -1 on error. + \param dir The directory stream to close. + \return 0 on success. -1 on error, setting errno as appropriate. */ int closedir(DIR *dir); -/** \brief Read the contents of an open directory +/** \brief Read an entry from a directory stream. + + This function reads the next entry from the directory stream provided, + returning the directory entry associated with the next object in the + directory. - Read the contents of an open directory and returns a pointer to the current - directory entry. Recurring calls to readdir return the next directory entry. + \param dir The directory stream to read from. + \return A pointer to the next directory entry in the directory + or NULL if there are no other entries in the directory. + If an error is incurred, NULL will be returned and errno + set to indicate the error. - \note Do not free the returned dirent - \param dir The directory structure that was returned from an opendir - \return A pointer to the current diretory entry or NULL when there are no - more entries. + \note Do not free the returned dirent! */ struct dirent *readdir(DIR *dir); +/** \brief Retrieve the file descriptor of an opened directory stream. + + This function retrieves the file descriptor of a directory stream that was + previously opened with opendir(). + + \param dir The directory stream to retrieve the descriptor of. + \return The file descriptor from the directory stream on success + or -1 on failure (sets errno as appropriate). + + \note Do not close() the returned file descriptor. It will be + closed when closedir() is called on the directory + stream. +*/ +int dirfd(DIR *dirp); + /** \brief Not implemented */ void rewinddir(DIR *dir); /** \brief Not implemented */ @@ -91,4 +123,3 @@ void seekdir(DIR *dir, off_t offset); off_t telldir(DIR *dir); #endif - diff --git a/kernel/arch/dreamcast/util/fb_console.c b/kernel/arch/dreamcast/util/fb_console.c index b9951ea..745ddf2 100644 --- a/kernel/arch/dreamcast/util/fb_console.c +++ b/kernel/arch/dreamcast/util/fb_console.c @@ -8,6 +8,7 @@ #include <string.h> #include <errno.h> #include <kos/dbgio.h> +#include <kos/string.h> #include <dc/fb_console.h> #include <dc/biosfont.h> #include <dc/video.h> @@ -22,10 +23,6 @@ static int fb_w, fb_h; static int cur_x, cur_y; static int min_x, min_y, max_x, max_y; -/* I don't think this is in a header anywhere any more. */ -extern void *memcpy2(void *dest, const void *src, size_t count); -extern void *memset2(void *s, unsigned short c, size_t count); - #define FONT_CHAR_WIDTH 12 #define FONT_CHAR_HEIGHT 24 diff --git a/kernel/libc/koslib/Makefile b/kernel/libc/koslib/Makefile index 2b3d0c9..edb1aa1 100644 --- a/kernel/libc/koslib/Makefile +++ b/kernel/libc/koslib/Makefile @@ -13,6 +13,6 @@ OBJS = abort.o byteorder.o memset2.o memset4.o memcpy2.o memcpy4.o \ telldir.o usleep.o inet_addr.o realpath.o getcwd.o chdir.o mkdir.o \ creat.o sleep.o rmdir.o rename.o inet_pton.o inet_ntop.o \ inet_ntoa.o inet_aton.o poll.o select.o symlink.o readlink.o \ - gethostbyname.o getaddrinfo.o + gethostbyname.o getaddrinfo.o dirfd.o include $(KOS_BASE)/Makefile.prefab diff --git a/kernel/libc/koslib/dirfd.c b/kernel/libc/koslib/dirfd.c new file mode 100644 index 0000000..0c41383 --- /dev/null +++ b/kernel/libc/koslib/dirfd.c @@ -0,0 +1,17 @@ +/* KallistiOS ##version## + + dirfd.c + Copyright (C) 2014 Lawrence Sebald +*/ + +#include <dirent.h> +#include <errno.h> + +int dirfd(DIR *dirp) { + if(!dirp) { + errno = EINVAL; + return -1; + } + + return dirp->fd; +} hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-22 13:59:17
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 02bbe38aecdac03bd10d69613a23936af3acd379 (commit) from a4103c6f5857fda92b8c829735c550425733d2a7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 02bbe38aecdac03bd10d69613a23936af3acd379 Author: Lawrence Sebald <ljs...@us...> Date: Wed Oct 22 09:58:41 2014 -0400 Update copyright date in banner.c for 2014. I'm just a couple of months late on this one. ;) ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/banner.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/arch/dreamcast/kernel/banner.c b/kernel/arch/dreamcast/kernel/banner.c index c69d85e..333b43a 100644 --- a/kernel/arch/dreamcast/kernel/banner.c +++ b/kernel/arch/dreamcast/kernel/banner.c @@ -8,7 +8,7 @@ #include "authors.h" static const char license[] = -"Copyright (C) 1997-2013 KallistiOS Contributors. All rights reserved.\n" +"Copyright (C) 1997-2014 KallistiOS Contributors. All rights reserved.\n" "\n" "Redistribution and use in source and binary forms, with or without\n" "modification, are permitted provided that the following conditions\n" hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-22 00:18:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a4103c6f5857fda92b8c829735c550425733d2a7 (commit) from 82cbecab7846369019b215da8b0c02edd8a95ea5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a4103c6f5857fda92b8c829735c550425733d2a7 Author: Lawrence Sebald <ljs...@us...> Date: Tue Oct 21 20:17:57 2014 -0400 Fix pvr_mem_available() to return all available texture memory. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 2 ++ kernel/arch/dreamcast/hardware/pvr/pvr_mem.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index abd4a07..9a526e4 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -45,6 +45,8 @@ KallistiOS version 2.0.1 ----------------------------------------------- - *** Fixed a problem where poll() would deadlock if the timeout expired [LS] - *** Modified getaddrinfo() so that it would try multiple times to contact the DNS server with a timeout between messages [LS] +- DC Fixed pvr_mem_available() to report all available texture memory, not just + what was available in the pvr_malloc() arena [LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_mem.c b/kernel/arch/dreamcast/hardware/pvr/pvr_mem.c index 5d57849..61deb09 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_mem.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_mem.c @@ -1,7 +1,7 @@ /* KallistiOS ##version## pvr_mem.c - (C)2002 Dan Potter + Copyright (C) 2002 Dan Potter */ @@ -171,10 +171,11 @@ static uint32 pvr_mem_available_int() { /* This magic formula is modeled after mstats() */ return mi.arena - mi.uordblks; } + uint32 pvr_mem_available() { CHECK_MEM_BASE; - return pvr_mem_available_int(); + return pvr_mem_available_int() + (PVR_RAM_INT_TOP - (uint32)pvr_mem_base); } /* Reset the memory pool, equivalent to freeing all textures currently hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-21 23:17:29
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 82cbecab7846369019b215da8b0c02edd8a95ea5 (commit) from a89994e65bfe0eb67a1fd1ef1c73cbe78ff5c818 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 82cbecab7846369019b215da8b0c02edd8a95ea5 Author: Lawrence Sebald <ljs...@us...> Date: Tue Oct 21 19:17:01 2014 -0400 Remove old stuff from the utils tree that's not really useful anymore. ----------------------------------------------------------------------- Summary of changes: utils/cvs_utils/vcheck.py | 93 ------- utils/gba-crcfix/Makefile | 12 - utils/gba-crcfix/gba-crcfix.c | 103 -------- utils/gba-elf2bin/gba-elf2bin | 25 -- utils/newlib/newlib-1.12.0-kos.patch | 435 ---------------------------------- utils/svn_utils/svnpull.py | 263 -------------------- utils/svn_utils/svnpush.py | 361 ---------------------------- 7 files changed, 0 insertions(+), 1292 deletions(-) delete mode 100755 utils/cvs_utils/vcheck.py delete mode 100644 utils/gba-crcfix/Makefile delete mode 100644 utils/gba-crcfix/gba-crcfix.c delete mode 100755 utils/gba-elf2bin/gba-elf2bin delete mode 100644 utils/newlib/newlib-1.12.0-kos.patch delete mode 100755 utils/svn_utils/svnpull.py delete mode 100644 utils/svn_utils/svnpush.py diff --git a/utils/cvs_utils/vcheck.py b/utils/cvs_utils/vcheck.py deleted file mode 100755 index f40a73a..0000000 --- a/utils/cvs_utils/vcheck.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python - -# A simple little script which takes the output of a "cvs status" command -# and parses it into a more usable format for a large number of files. -# -# (c)2002 Dan Potter -# -# - -import sys, string, os, re - -# Exclude any files which match these patterns -exclude_files = [ - ".*elf", ".*bz2", ".*run.gdb", ".*romdisk.*img", - ".*environ.*" -] - -def main(): - # Run cvs status and get the output - p = os.popen("cvs status") - # p = os.popen("cat test.txt") - cvs_output = p.read() - p.close() - - # Parse the output into lines - lines = string.split(cvs_output, "\n") - line_count = len(lines) - - # Get the unknown file names and remove them from the main list - unknown_lines = filter(lambda x:len(x)>0 and x[0]=='?', lines) - unknown_names = map(lambda x:x[2:], unknown_lines) - lines = filter(lambda x,l=unknown_lines:x not in l, lines) - assert ( len(lines) + len(unknown_lines) ) == line_count - - # Now seperate everything else into buckets - buckets = [ ] - cur_bucket = None - for i in range(len(lines)): - line = lines[i] - if line[:4] == "====": - if cur_bucket is not None: - buckets.append(cur_bucket) - cur_bucket = [ ] - else: - if len(line) > 0: - cur_bucket.append(line) - if len(cur_bucket) > 0: - buckets.append(cur_bucket) - - print "Processed %d files" % ( len(buckets) + len(unknown_names) ) - - # Now for each bucket, extract the filename and the version - if len(unknown_names) > 0: - files = { 'Unknown': unknown_names } - else: - files = { } - for i in buckets: - j = i[0] - w = string.find(j, "Status:"); - assert w != -1 - status = j[w+8:] - - j = i[2] - w = string.split(j, "\t") - if len(w) == 3: - file = w[2] - else: - file = string.split(i[0])[1] - - if files.has_key(status): - files[status].append(file) - else: - files[status] = [ file ] - - # Output a list of each file not in the Up-to-date status - for i in files.keys(): - if i == "Up-to-date": continue - print "Files with status '%s':" % i - skipped_cnt = 0 - for j in files[i]: - pas = 1 - for k in exclude_files: - if re.compile(k).match(j, 1): - pas = 0 - if pas: - print " %s" % j - else: - skipped_cnt = skipped_cnt + 1 - if skipped_cnt > 0: - print " (%d files excluded)" % skipped_cnt - -main() - diff --git a/utils/gba-crcfix/Makefile b/utils/gba-crcfix/Makefile deleted file mode 100644 index 8628728..0000000 --- a/utils/gba-crcfix/Makefile +++ /dev/null @@ -1,12 +0,0 @@ - -CFLAGS = -O2 -Wall -DINLINE=inline #-g# -#LDFLAGS = -s -g - -TARGET=gba-crcfix -OBJS=gba-crcfix.o - -all: $(TARGET) -$(TARGET): $(OBJS) - -clean: - rm -f $(TARGET) $(OBJS) diff --git a/utils/gba-crcfix/gba-crcfix.c b/utils/gba-crcfix/gba-crcfix.c deleted file mode 100644 index 39a8286..0000000 --- a/utils/gba-crcfix/gba-crcfix.c +++ /dev/null @@ -1,103 +0,0 @@ -/* KallistiOS ##version## - - gba-crcfix.c - (c)2002 Gil Megidish - - Calculate the header checksum (complement check) - -*/ - -#include <stdio.h> -#include <string.h> -#include <errno.h> - -/* We do this instead of stdint.h since that (ironically) seems to be - non-portable */ -#define uint8_t unsigned char - -#define HEADER_SIZE 0xc0 - -static void fix_header(uint8_t *header) { - - uint8_t sum = 0; - uint8_t count = 0xbc - 0xa0; - - /* complement check of 0xa0 - 0xbc */ - header = header + 0xa0; - - while(count-- > 0) { - sum = sum - *header++; - } - - sum = (sum - 0x19); - *header = sum; -} - -static int process(const char *filename) { - - FILE *fp; - uint8_t header[HEADER_SIZE]; - - fp = fopen(filename, "r+b"); - - if(fp == NULL) { - fprintf(stderr, "Failed to open %s for reading/writing\n", filename); - return -errno; - } - - if(fread(header, 1, HEADER_SIZE, fp) != HEADER_SIZE) { - fclose(fp); - fprintf(stderr, "Error reading from %s\n", filename); - return -errno; - } - - fix_header(header); - - if(fseek(fp, 0, SEEK_SET) < 0) { - fclose(fp); - fprintf(stderr, "Failed to rewind file %s\n", filename); - return -errno; - } - - if(fwrite(header, 1, HEADER_SIZE, fp) != HEADER_SIZE) { - fclose(fp); - fprintf(stderr, "Error writing header back to file %s\n", filename); - return -errno; - } - - fclose(fp); - return 0; -} - -static void usage(const char *ego) { - const char *name; - - name = strrchr(ego, '/'); - - if(name == NULL) - name = ego; - else - name++; - - printf("GBA Complement Check fix\n"); - printf("Usage: %s file1 [file2...]\n", name); -} - -int main(int argc, char *argv[]) { - - int i; - - if(argc < 2) { - usage(argv[0]); - return 0; - } - - for(i = 1; i < argc; i++) { - int ok = process(argv[i]); - - if(ok != 0) - return ok; - } - - return 0; -} diff --git a/utils/gba-elf2bin/gba-elf2bin b/utils/gba-elf2bin/gba-elf2bin deleted file mode 100755 index 4ef1305..0000000 --- a/utils/gba-elf2bin/gba-elf2bin +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -# Converts an ELF file to a GBA-compatible ROM file -# (c)2001 Chuck mason -# -# This program was originally included as part of the libgba -# library for GBA development, and is probably covered under -# the GPL or LGPL license. -# -# usage: gba-elf2bin <elf> <bin> -# - -rm -f /tmp/tmp.{text,rodata,data,bss} - -OBJCOPY=arm-elf-objcopy - -$OBJCOPY -O binary -j .text $1 /tmp/tmp.text -$OBJCOPY -O binary -j .sarm --change-section-lma .sarm=0 $1 /tmp/tmp.data -$OBJCOPY -O binary -j .data --change-section-lma .data=0 $1 /tmp/tmp.data -$OBJCOPY -O binary -j .rodata $1 /tmp/tmp.rodata -$OBJCOPY -O binary -j .bss $1 /tmp/tmp.bss -cat /tmp/tmp.{text,rodata,data,bss} > $2 - -rm -f /tmp/tmp.{text,data,rodata,bss} - diff --git a/utils/newlib/newlib-1.12.0-kos.patch b/utils/newlib/newlib-1.12.0-kos.patch deleted file mode 100644 index 227ee3f..0000000 --- a/utils/newlib/newlib-1.12.0-kos.patch +++ /dev/null @@ -1,435 +0,0 @@ -diff -ruN newlib-1.12.0/config-ml.in newlib-1.12.0-kos/config-ml.in ---- newlib-1.12.0/config-ml.in 2004-01-04 16:42:16.000000000 -0800 -+++ newlib-1.12.0-kos/config-ml.in 2004-08-07 09:30:51.000000000 -0700 -@@ -196,19 +196,19 @@ - - if [ "${ml_toplevel_p}" = yes ]; then - --multidirs= --for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do -- dir=`echo $i | sed -e 's/;.*$//'` -- if [ "${dir}" = "." ]; then -- true -- else -- if [ -z "${multidirs}" ]; then -- multidirs="${dir}" -- else -- multidirs="${multidirs} ${dir}" -- fi -- fi --done -+multidirs=ml/m4-single-only -+#for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do -+# dir=`echo $i | sed -e 's/;.*$//'` -+# if [ "${dir}" = "." ]; then -+# true -+# else -+# if [ -z "${multidirs}" ]; then -+# multidirs="${dir}" -+# else -+# multidirs="${multidirs} ${dir}" -+# fi -+# fi -+#done - - # Target libraries are configured for the host they run on, so we check - # $host here, not $target. -diff -ruN newlib-1.12.0/newlib/configure.host newlib-1.12.0-kos/newlib/configure.host ---- newlib-1.12.0/newlib/configure.host 2004-02-02 08:59:51.000000000 -0800 -+++ newlib-1.12.0-kos/newlib/configure.host 2004-08-07 10:34:46.000000000 -0700 -@@ -178,6 +178,7 @@ - ;; - sh | sh64) - machine_dir=sh -+ newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DABORT_PROVIDED -fno-crossjumping -fno-optimize-sibling-calls" - ;; - sparc*) - machine_dir=sparc -diff -ruN newlib-1.12.0/newlib/libc/sys/sh/ftruncate.c newlib-1.12.0-kos/newlib/libc/sys/sh/ftruncate.c ---- newlib-1.12.0/newlib/libc/sys/sh/ftruncate.c 2003-07-10 08:31:30.000000000 -0700 -+++ newlib-1.12.0-kos/newlib/libc/sys/sh/ftruncate.c 2004-08-07 09:40:01.000000000 -0700 -@@ -2,8 +2,8 @@ - #include <sys/types.h> - #include "sys/syscall.h" - --int -+/* int - ftruncate (int file, off_t length) - { - return __trap34 (SYS_ftruncate, file, length, 0); --} -+} */ -diff -ruN newlib-1.12.0/newlib/libc/sys/sh/sys/_types.h newlib-1.12.0-kos/newlib/libc/sys/sh/sys/_types.h ---- newlib-1.12.0/newlib/libc/sys/sh/sys/_types.h 1969-12-31 16:00:00.000000000 -0800 -+++ newlib-1.12.0-kos/newlib/libc/sys/sh/sys/_types.h 2004-08-07 09:22:27.000000000 -0700 -@@ -0,0 +1,42 @@ -+/* ANSI C namespace clean utility typedefs */ -+ -+/* This file defines various typedefs needed by the system calls that support -+ the C library. Basically, they're just the POSIX versions with an '_' -+ prepended. This file lives in the `sys' directory so targets can provide -+ their own if desired (or they can put target dependant conditionals here). -+*/ -+ -+#ifndef _SYS__TYPES_H -+#define _SYS__TYPES_H -+ -+#include "lock.h" -+ -+typedef long _off_t; -+__extension__ typedef long long _off64_t; -+ -+#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647 -+typedef int _ssize_t; -+#else -+typedef long _ssize_t; -+#endif -+ -+#define __need_wint_t -+#include <stddef.h> -+ -+/* Conversion state information. */ -+typedef struct -+{ -+ int __count; -+ union -+ { -+ wint_t __wch; -+ unsigned char __wchb[4]; -+ } __value; /* Value so far. */ -+} _mbstate_t; -+ -+typedef _LOCK_RECURSIVE_T _flock_t; -+ -+/* Iconv descriptor type */ -+typedef void *_iconv_t; -+ -+#endif /* _SYS__TYPES_H */ -diff -ruN newlib-1.12.0/newlib/libc/sys/sh/sys/lock.h newlib-1.12.0-kos/newlib/libc/sys/sh/sys/lock.h ---- newlib-1.12.0/newlib/libc/sys/sh/sys/lock.h 1969-12-31 16:00:00.000000000 -0800 -+++ newlib-1.12.0-kos/newlib/libc/sys/sh/sys/lock.h 2004-08-07 10:41:28.000000000 -0700 -@@ -0,0 +1,36 @@ -+#ifndef __SYS_LOCK_H__ -+#define __SYS_LOCK_H__ -+ -+/* Map everything (approximately) to KOS stuff. Note that if the definition -+ of spinlock_t changes size, or the definition of SPINLOCK_INITIALIZER -+ changes, this will also have to be changed. */ -+typedef int _LOCK_T; -+typedef struct { int a, b, c; } _LOCK_RECURSIVE_T; -+ -+#define __LOCK_INIT(class,lock) class _LOCK_T lock = 0; -+#define __LOCK_INIT_RECURSIVE(class,lock) class _LOCK_RECURSIVE_T lock = { 0, 0, 0 }; -+#define __lock_init(lock) __newlib_lock_init(&(lock)) -+#define __lock_init_recursive(lock) __newlib_lock_init_recursive(&(lock)) -+#define __lock_close(lock) __newlib_lock_close(&(lock)) -+#define __lock_close_recursive(lock) __newlib_lock_close_recursive(&(lock)) -+#define __lock_acquire(lock) __newlib_lock_acquire(&(lock)) -+#define __lock_acquire_recursive(lock) __newlib_lock_acquire_recursive(&(lock)) -+#define __lock_try_acquire(lock) __newlib_lock_try_acquire(&(lock)) -+#define __lock_try_acquire_recursive(lock) __newlib_lock_try_acquire_recursive(&(lock)) -+#define __lock_release(lock) __newlib_lock_release(&(lock)) -+#define __lock_release_recursive(lock) __newlib_lock_release_recursive(&(lock)) -+ -+/* These are defined in KOS */ -+void __newlib_lock_init(_LOCK_T *); -+void __newlib_lock_close(_LOCK_T *); -+void __newlib_lock_acquire(_LOCK_T *); -+void __newlib_lock_try_acquire(_LOCK_T *); -+void __newlib_lock_release(_LOCK_T *); -+ -+void __newlib_lock_init_recursive(_LOCK_RECURSIVE_T *); -+void __newlib_lock_close_recursive(_LOCK_RECURSIVE_T *); -+void __newlib_lock_acquire_recursive(_LOCK_RECURSIVE_T *); -+void __newlib_lock_try_acquire_recursive(_LOCK_RECURSIVE_T *); -+void __newlib_lock_release_recursive(_LOCK_RECURSIVE_T *); -+ -+#endif /* __SYS_LOCK_H__ */ -diff -ruN newlib-1.12.0/newlib/libc/sys/sh/syscalls.c newlib-1.12.0-kos/newlib/libc/sys/sh/syscalls.c ---- newlib-1.12.0/newlib/libc/sys/sh/syscalls.c 2001-02-01 13:25:56.000000000 -0800 -+++ newlib-1.12.0-kos/newlib/libc/sys/sh/syscalls.c 2004-08-07 10:24:07.000000000 -0700 -@@ -1,221 +1,2 @@ --#include <_ansi.h> --#include <sys/types.h> --#include <sys/stat.h> --#include <sys/time.h> --#include "sys/syscall.h" --int errno; -- --/* This is used by _sbrk. */ --register char *stack_ptr asm ("r15"); -- --int --_read (int file, -- char *ptr, -- int len) --{ -- return __trap34 (SYS_read, file, ptr, len); --} -- --int --_lseek (int file, -- int ptr, -- int dir) --{ -- return __trap34 (SYS_lseek, file, ptr, dir); --} -- --int --_write ( int file, -- char *ptr, -- int len) --{ -- return __trap34 (SYS_write, file, ptr, len); --} -- --int --_close (int file) --{ -- return __trap34 (SYS_close, file, 0, 0); --} -- --int --_link (char *old, char *new) --{ -- return -1; --} -- --caddr_t --_sbrk (int incr) --{ -- extern char end; /* Defined by the linker */ -- static char *heap_end; -- char *prev_heap_end; -- -- if (heap_end == 0) -- { -- heap_end = &end; -- } -- prev_heap_end = heap_end; -- if (heap_end + incr > stack_ptr) -- { -- _write (1, "Heap and stack collision\n", 25); -- abort (); -- } -- heap_end += incr; -- return (caddr_t) prev_heap_end; --} -- --int --_fstat (int file, -- struct stat *st) --{ -- st->st_mode = S_IFCHR; -- return 0; --} -- --int --_open (const char *path, -- int flags) --{ -- return __trap34 (SYS_open, path, flags, 0); --} -- ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-10-21 22:18:47
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a89994e65bfe0eb67a1fd1ef1c73cbe78ff5c818 (commit) via a888062ef95093af9fa07fdea0dc556c2bc2a516 (commit) from ad11962ae7619322492de3cacee8810bc1936f70 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a89994e65bfe0eb67a1fd1ef1c73cbe78ff5c818 Merge: a888062 ad11962 Author: Lawrence Sebald <ljs...@us...> Date: Tue Oct 21 18:18:22 2014 -0400 Merge branch 'master' of ssh://git.code.sf.net/p/cadcdev/kallistios commit a888062ef95093af9fa07fdea0dc556c2bc2a516 Author: Lawrence Sebald <ljs...@us...> Date: Tue Oct 21 18:17:58 2014 -0400 Add ARGB1555 to vqenc. ----------------------------------------------------------------------- Summary of changes: utils/vqenc/vqenc.c | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/utils/vqenc/vqenc.c b/utils/vqenc/vqenc.c index b62db0b..bf07146 100644 --- a/utils/vqenc/vqenc.c +++ b/utils/vqenc/vqenc.c @@ -33,6 +33,7 @@ static int use_hq = 0; static int use_kmg = 0; static int use_alpha = 0; +#define PACK1555(a, r, g, b) ( (a ? 0x8000 : 0) | ((r>>3)<<10) | ((g>>3)<<5) | ((b >>3))) #define PACK4444(a, r, g, b) ( ((a>>4) << 12) | ((r>>4)<<8) | ((g>>4)<<4) | ((b>>4)) ) #define PACK565(r, g, b) (((r>>3)<<11) | ((g>>2)<<5) | ((b>>3))) #define LIMIT(x,low,high) (x) < low ? low : (x) > high ? high : (x); @@ -256,8 +257,10 @@ static uint16 pack(fcolor_t *c) { g = LIMIT(c->g, 0, 255); b = LIMIT(c->b, 0, 255); - if(use_alpha) + if(use_alpha == 1) return PACK4444(a, r, g, b); + else if(use_alpha == 2) + return PACK1555(a, r, g, b); else return PACK565(r, g, b); } @@ -404,7 +407,13 @@ static int save(const char *filename, context_t *cb, mipmap_t *m, image_t *img) hdr.magic = KMG_MAGIC; hdr.version = KMG_VERSION; hdr.platform = KMG_PLAT_DC; - hdr.format = (use_alpha ? KMG_DCFMT_ARGB4444 : KMG_DCFMT_RGB565) | KMG_DCFMT_VQ; + + if(use_alpha == 1) + hdr.format = KMG_DCFMT_ARGB4444 | KMG_DCFMT_VQ; + else if(use_alpha == 2) + hdr.format = KMG_DCFMT_ARGB1555 | KMG_DCFMT_VQ; + else + hdr.format = KMG_DCFMT_RGB565 | KMG_DCFMT_VQ; if(use_twiddle) hdr.format |= KMG_DCFMT_TWIDDLED; @@ -479,6 +488,7 @@ static void banner(const char *progname) { printf("\t-q, --highq\thigher quality (much slower)\n"); printf("\t-k, --kmg\twrite a KMG for output\n"); printf("\t-a, --alpha\tuse alpha channel (and output ARGB4444)\n"); + printf("\t-b, --amask\tuse 1-bit alpha mask (and output ARGB1555)\n"); } static int mipmap_index(int s) { @@ -797,6 +807,8 @@ static int process_long_options(char *arg) { use_kmg = 1; else if(! strcmp(arg, "alpha")) use_alpha = 1; + else if(! strcmp(arg, "amask")) + use_alpha = 2; else return -EINVAL; @@ -837,6 +849,10 @@ static int process_option(char *arg) { use_alpha = 1; return 0; + case 'b': + use_alpha = 2; + return 0; + case '-': return process_long_options(arg + 1); } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: PH3NOM <ph...@us...> - 2014-09-29 03:16:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ad11962ae7619322492de3cacee8810bc1936f70 (commit) from a7f57a3eb284c7090142a31aa6440e0a4ba0ca76 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ad11962ae7619322492de3cacee8810bc1936f70 Author: Josh Pearson <ph...@us...> Date: Sun Sep 28 20:16:33 2014 -0700 First major update to the GL API 9-28-14 ----------------------------------------------------------------------- Summary of changes: .../dreamcast/kgl/basic/elements/pvr-texture.c | 14 +-- examples/dreamcast/kgl/basic/gl/gltest.c | 4 +- examples/dreamcast/kgl/basic/scissor/scissor.c | 4 +- examples/dreamcast/kgl/basic/txrenv/main.c | 11 +- examples/dreamcast/kgl/basic/vq/vq-example.c | 14 +- .../dreamcast/kgl/basic/zclip_arrays/pvr-texture.c | 10 +- .../dreamcast/kgl/benchmarks/quadmark/quadmark.c | 4 + .../dreamcast/kgl/benchmarks/trimark/trimark.c | 4 + .../kgl/benchmarks/tristripmark/tristripmark.c | 4 + examples/dreamcast/kgl/demos/blur/main.c | 64 +++++++-- examples/dreamcast/kgl/demos/blur/pvr-texture.c | 4 +- examples/dreamcast/kgl/demos/mipmap/pvr-texture.c | 8 +- .../kgl/demos/multitexture-arrays/Makefile | 38 ----- .../dreamcast/kgl/demos/multitexture-arrays/main.c | 115 ---------------- .../kgl/demos/multitexture-arrays/pvr-texture.c | 145 -------------------- .../multitexture-arrays/romdisk/FlareWS_256.pvr | Bin 131104 -> 0 bytes .../demos/multitexture-arrays/romdisk/wp001vq.pvr | Bin 67616 -> 0 bytes examples/dreamcast/kgl/demos/multitexture/Makefile | 38 ----- examples/dreamcast/kgl/demos/multitexture/main.c | 145 -------------------- .../dreamcast/kgl/demos/multitexture/pvr-texture.c | 145 -------------------- .../kgl/demos/multitexture/romdisk/FlareWS_256.pvr | Bin 131104 -> 0 bytes .../kgl/demos/multitexture/romdisk/wp001vq.pvr | Bin 67616 -> 0 bytes examples/dreamcast/kgl/demos/specular/texture.c | 4 +- examples/dreamcast/kgl/nehe/nehe06/main.c | 18 +-- examples/dreamcast/kgl/nehe/nehe08/main.c | 2 +- examples/dreamcast/kgl/nehe/nehe09/main.c | 2 +- examples/dreamcast/kgl/nehe/nehe16/nehe16.c | 2 +- 27 files changed, 102 insertions(+), 697 deletions(-) delete mode 100755 examples/dreamcast/kgl/demos/multitexture-arrays/Makefile delete mode 100755 examples/dreamcast/kgl/demos/multitexture-arrays/main.c delete mode 100755 examples/dreamcast/kgl/demos/multitexture-arrays/pvr-texture.c delete mode 100755 examples/dreamcast/kgl/demos/multitexture-arrays/romdisk/FlareWS_256.pvr delete mode 100755 examples/dreamcast/kgl/demos/multitexture-arrays/romdisk/wp001vq.pvr delete mode 100755 examples/dreamcast/kgl/demos/multitexture/Makefile delete mode 100755 examples/dreamcast/kgl/demos/multitexture/main.c delete mode 100755 examples/dreamcast/kgl/demos/multitexture/pvr-texture.c delete mode 100755 examples/dreamcast/kgl/demos/multitexture/romdisk/FlareWS_256.pvr delete mode 100755 examples/dreamcast/kgl/demos/multitexture/romdisk/wp001vq.pvr diff --git a/examples/dreamcast/kgl/basic/elements/pvr-texture.c b/examples/dreamcast/kgl/basic/elements/pvr-texture.c index 8af2cf2..4e2a009 100755 --- a/examples/dreamcast/kgl/basic/elements/pvr-texture.c +++ b/examples/dreamcast/kgl/basic/elements/pvr-texture.c @@ -1,19 +1,15 @@ -/* +/* KallistiOS 2.0.0 pvr-texture.c - (c)2014 Josh Pearson + (c)2014 Josh PH3NOM Pearson Load A PVR Texture to the PVR using Open GL */ -#include <stdio.h> -#include <stdlib.h> -#include <malloc.h> - +#include <kos.h> #include <GL/gl.h> #include <GL/glu.h> -#include <GL/glut.h> #define PVR_HDR_SIZE 0x20 @@ -76,10 +72,10 @@ GLuint glTextureLoadPVR(char *fname, unsigned char isMipMapped, unsigned char gl /* If the texture is MipMapped, tell Open GL to use the MipMap levels of the texture */ if(isMipMapped || glMipMap) - glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, texW, texH, 0, texFormat, texColor, TEX0); + glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, texW, texH, 0, GL_RGB, texFormat | texColor, TEX0); /* If the texture is not MipMapped, tell Open GL to use the base level of the texture */ else - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, texFormat, texColor, TEX0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, GL_RGB, texFormat | texColor, TEX0); free(TEX0); diff --git a/examples/dreamcast/kgl/basic/gl/gltest.c b/examples/dreamcast/kgl/basic/gl/gltest.c index 81e6813..de6ad4b 100755 --- a/examples/dreamcast/kgl/basic/gl/gltest.c +++ b/examples/dreamcast/kgl/basic/gl/gltest.c @@ -207,7 +207,7 @@ void loadtxr(const char *fname, GLuint *txr) { glBindTexture(GL_TEXTURE_2D, *txr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, - texFormat, texColor, texBuf + PVR_HDR_SIZE); + GL_RGB, texFormat | texColor, texBuf + PVR_HDR_SIZE); } extern uint8 romdisk[]; @@ -242,7 +242,7 @@ int main(int argc, char **argv) { /* Load a texture and make to look nice */ loadtxr("/rd/glass.pvr", &texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_FILTER, GL_FILTER_BILINEAR); - glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATEALPHA); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATEALPHA); glClearColor(0.3f, 0.4f, 0.5f, 1.0f); diff --git a/examples/dreamcast/kgl/basic/scissor/scissor.c b/examples/dreamcast/kgl/basic/scissor/scissor.c index 4c0e4ab..9157e48 100755 --- a/examples/dreamcast/kgl/basic/scissor/scissor.c +++ b/examples/dreamcast/kgl/basic/scissor/scissor.c @@ -45,7 +45,7 @@ void loadtxr(const char *fname, GLuint *txr) { #define PVR_HDR_SIZE 0x20 FILE *tex = NULL; unsigned char *texBuf; - unsigned int texID, texSize; + unsigned int texSize; tex = fopen(fname, "rb"); @@ -136,7 +136,7 @@ void loadtxr(const char *fname, GLuint *txr) { glBindTexture(GL_TEXTURE_2D, *txr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, - texFormat, texColor, texBuf + PVR_HDR_SIZE); + GL_RGB, texFormat | texColor, texBuf + PVR_HDR_SIZE); } void quad(int x, int y) { diff --git a/examples/dreamcast/kgl/basic/txrenv/main.c b/examples/dreamcast/kgl/basic/txrenv/main.c index 766a3d9..0e209da 100755 --- a/examples/dreamcast/kgl/basic/txrenv/main.c +++ b/examples/dreamcast/kgl/basic/txrenv/main.c @@ -122,7 +122,7 @@ GLuint glTextureLoadPVR(char *fname, unsigned char UseMipMap) { glBindTexture(GL_TEXTURE_2D, texID); glTexImage2D(GL_TEXTURE_2D, UseMipMap, GL_RGB, texW, texH, 0, - texFormat, texColor, texBuf + PVR_HDR_SIZE); + GL_RGB, texFormat | texColor, texBuf + PVR_HDR_SIZE); return texID; } @@ -140,13 +140,13 @@ void glDrawQuads(float x, float y, float w, float h, int count, while(count--) { glTexCoord2f(0.0f + 0.01f, 0.0f + 0.01f); - glVertex2f(x, y); + glKosVertex2f(x, y); glTexCoord2f(1.0f - 0.01f, 0.0f + 0.01f); - glVertex2f(x + w, y); + glKosVertex2f(x + w, y); glTexCoord2f(1.0f - 0.01f, 1.0f - 0.01f); - glVertex2f(x + w, y + h); + glKosVertex2f(x + w, y + h); glTexCoord2f(0.0f + 0.01f, 1.0f - 0.01f); - glVertex2f(x, y + h); + glKosVertex2f(x, y + h); x += w * 2; } @@ -227,6 +227,7 @@ int main(int argc, char **argv) { glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); + glEnable(GL_TEXTURE_2D); tex[0] = glTextureLoadPVR("/rd/wp001vq.pvr", 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_FILTER, GL_LINEAR); diff --git a/examples/dreamcast/kgl/basic/vq/vq-example.c b/examples/dreamcast/kgl/basic/vq/vq-example.c index f6feba4..d095286 100755 --- a/examples/dreamcast/kgl/basic/vq/vq-example.c +++ b/examples/dreamcast/kgl/basic/vq/vq-example.c @@ -38,17 +38,15 @@ static int loadtxr() { glTexImage2D(GL_TEXTURE_2D, /* This must be GL_TEXTURE_2D */ 0, /* 0 = Texture does not contain Mip-Maps | 1 = Texture contains Mip-Maps */ - GL_RGB, /* This bit is actually ignored by this OpenGL API */ + GL_RGB, /* GL_RGB = Has No ALPHA, GL_RGBA = Has ALPHA */ 512, /* Texture Width */ 512, /* Texture Height */ 0, /* This bit is actually ignored by this OpenGL API */ - PVR_TXRFMT_VQ_ENABLE, /* PVR texture format */ - PVR_TXRFMT_RGB565, /* PVR texture color - You can use GL_UNSIGNED_SHORT_5_6_5 as PVR_TXRFMT_RGB565, - GL_UNSIGNED_SHORT_1_5_5_5 as PVR_TXRFMT_ARGB1555, or - GL_UNSIGNED_SHORT_4_4_4_4 as PVR_TXRFMT_ARGB4444. */ + GL_RGB, /* Must Match Previous Format */ + GL_UNSIGNED_SHORT_5_6_5_VQ_TWID, /* Texture color and Format */ fruit); /* Address of texture data in RAM: OpenGL will load the texture into VRAM for you. - Because of this, make sure to call glDelTextures() as needed, as that will - free the VRAM allocated for the texture. */ + Because of this, make sure to call glDeleteTextures() as needed, as that will + free the VRAM allocated for the texture. */ return 0; } @@ -197,7 +195,7 @@ int main(int argc, char **argv) { glutSwapBuffers(); } - glDelTextures(1, texture); + glDeleteTextures(1, texture); return 0; } diff --git a/examples/dreamcast/kgl/basic/zclip_arrays/pvr-texture.c b/examples/dreamcast/kgl/basic/zclip_arrays/pvr-texture.c index 316aa20..4e2a009 100755 --- a/examples/dreamcast/kgl/basic/zclip_arrays/pvr-texture.c +++ b/examples/dreamcast/kgl/basic/zclip_arrays/pvr-texture.c @@ -7,13 +7,9 @@ Load A PVR Texture to the PVR using Open GL */ -#include <stdio.h> -#include <stdlib.h> -#include <malloc.h> - +#include <kos.h> #include <GL/gl.h> #include <GL/glu.h> -#include <GL/glut.h> #define PVR_HDR_SIZE 0x20 @@ -76,10 +72,10 @@ GLuint glTextureLoadPVR(char *fname, unsigned char isMipMapped, unsigned char gl /* If the texture is MipMapped, tell Open GL to use the MipMap levels of the texture */ if(isMipMapped || glMipMap) - glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, texW, texH, 0, texFormat, texColor, TEX0); + glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, texW, texH, 0, GL_RGB, texFormat | texColor, TEX0); /* If the texture is not MipMapped, tell Open GL to use the base level of the texture */ else - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, texFormat, texColor, TEX0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, GL_RGB, texFormat | texColor, TEX0); free(TEX0); diff --git a/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c b/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c index ad27442..61b2b5d 100755 --- a/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c +++ b/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c @@ -7,7 +7,11 @@ */ #include <kos.h> + #include <GL/gl.h> +#include <GL/glut.h> + +#include <stdlib.h> #include <time.h> pvr_init_params_t pvr_params = { diff --git a/examples/dreamcast/kgl/benchmarks/trimark/trimark.c b/examples/dreamcast/kgl/benchmarks/trimark/trimark.c index ab88390..79ddcab 100755 --- a/examples/dreamcast/kgl/benchmarks/trimark/trimark.c +++ b/examples/dreamcast/kgl/benchmarks/trimark/trimark.c @@ -7,7 +7,11 @@ */ #include <kos.h> + #include <GL/gl.h> +#include <GL/glut.h> + +#include <stdlib.h> #include <time.h> pvr_init_params_t pvr_params = { diff --git a/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c b/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c index c6a606f..82b4c7f 100755 --- a/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c +++ b/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c @@ -7,7 +7,11 @@ */ #include <kos.h> + #include <GL/gl.h> +#include <GL/glut.h> + +#include <stdlib.h> #include <time.h> pvr_init_params_t pvr_params = { diff --git a/examples/dreamcast/kgl/demos/blur/main.c b/examples/dreamcast/kgl/demos/blur/main.c index 45dbc2d..33991ce 100755 --- a/examples/dreamcast/kgl/demos/blur/main.c +++ b/examples/dreamcast/kgl/demos/blur/main.c @@ -12,6 +12,7 @@ #include <kos.h> #include <GL/gl.h> +#include <GL/glext.h> #include <GL/glu.h> #include <GL/glut.h> @@ -45,30 +46,46 @@ static GLfloat xspeed; /* X Rotation Speed */ static GLfloat yspeed; /* Y Rotation Speed */ static GLfloat z = -5.0f; /* Depth Into The Screen */ -static pvr_ptr_t *RENDER_TEXTURE = NULL; /* PVR Memory Pointer for Render-To-Texture result */ static GLuint RENDER_TEXTURE_ID; /* Render-To-Texture GL Texture ID */ static long unsigned int RENDER_TEXTURE_W; /* Render-To-Texture width */ static long unsigned int RENDER_TEXTURE_H; /* Render-To-Texture height */ +static GLuint fbo[1]; + extern GLuint glTextureLoadPVR(char *fname, unsigned char isMipMapped, unsigned char glMipMap); -void InitRenderTexture(long unsigned int width, long unsigned int height) { - /* 1.) Allcoate PVR Texture Memory for Render-To-Texture */ +GLubyte InitRenderTexture(GLsizei width, GLsizei height) { RENDER_TEXTURE_W = width; RENDER_TEXTURE_H = height; - RENDER_TEXTURE = pvr_mem_malloc(RENDER_TEXTURE_W * RENDER_TEXTURE_H * 2); - /* 2.) Generate a texture for Open GL, and bind that texxture */ + /* Generate a texture for Open GL, and bind that texture */ glGenTextures(1, &RENDER_TEXTURE_ID); glBindTexture(GL_TEXTURE_2D, RENDER_TEXTURE_ID); - /* 3.) Use glKosTexImage2D() to bind the texture address for the Render-To-Texture */ - glKosTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, - RENDER_TEXTURE_W, RENDER_TEXTURE_H, 0, - PVR_TXRFMT_NONTWIDDLED, PVR_TXRFMT_RGB565, RENDER_TEXTURE); + /* Submit an empty texture for storing the Frame Buffer Texture */ + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, + RENDER_TEXTURE_W, RENDER_TEXTURE_H, 0, + GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 0); - /* 4.) Enable GL_LINEAR Texture Filter to enable the PVR's bilinear filtering */ + /* Enable GL_LINEAR Texture Filter to enable bilinear filtering */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_FILTER, GL_LINEAR); + + /* Generate and Bind A Frame Buffer Object (FBO) For Open GL */ + glGenFramebuffers(1, fbo); + glBindFramebuffer(GL_FRAMEBUFFER, fbo[0]); + + /* Set the Generated texture as the storage for the FBO */ + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, + RENDER_TEXTURE_ID, 0); + + /* Verify the Frame Buffer Object is ready */ + if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) + return 0; + + /* Un-bind the Frame Buffer Object, to restore the window-frame-buffer */ + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + return 1; } void RenderBlurEffect(int times, float inc, long unsigned int width, long unsigned int height, @@ -134,7 +151,7 @@ void RenderBlurEffect(int times, float inc, long unsigned int width, long unsign glEnable(GL_LIGHTING); // Enable Lighting } -void draw_gl(GLuint texID) { +void DrawGL(GLuint texID) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0f, 0.0f, z); @@ -301,7 +318,7 @@ int main(int argc, char **argv) { /* Set up the textures */ GLuint tex0 = glTextureLoadPVR("/rd/glass.pvr", 0, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_FILTER, GL_FILTER_BILINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_FILTER, GL_LINEAR); /* Set the Render Texture and Render-To-Texture Viewport Dimensions - Must be Power of two */ InitRenderTexture(1024, 512); @@ -309,16 +326,31 @@ int main(int argc, char **argv) { GLubyte enable_radial = 0, radial_iterations = 8; while(1) { - /* Draw the GL "scene" */ - draw_gl(tex0); + /* Draw the GL "scene" */ if(enable_radial) { - glutCopyBufferToTexture(RENDER_TEXTURE, &RENDER_TEXTURE_W, &RENDER_TEXTURE_H); + /* Bind the Frame Buffer Object to GL, for render-to-texture */ + glBindFramebuffer(GL_FRAMEBUFFER, fbo[0]); + + DrawGL(tex0); + + glutSwapBuffers(); + + /* Un-Bind the Frame Buffer Object, for render-to-window */ + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + DrawGL(tex0); RenderBlurEffect(radial_iterations, 0.02f, RENDER_TEXTURE_W, RENDER_TEXTURE_H, RENDER_TEXTURE_ID); + + glutSwapBuffers(); /* Finish the GL "scene" */ } + else{ + DrawGL(tex0); - glutSwapBuffers(); /* Finish the GL "scene" */ + glutSwapBuffers(); /* Finish the GL "scene" */ + } + /* Very simple callback to handle user input based on static global vars */ switch(InputCallback()) { diff --git a/examples/dreamcast/kgl/demos/blur/pvr-texture.c b/examples/dreamcast/kgl/demos/blur/pvr-texture.c index 550634b..4e2a009 100755 --- a/examples/dreamcast/kgl/demos/blur/pvr-texture.c +++ b/examples/dreamcast/kgl/demos/blur/pvr-texture.c @@ -72,10 +72,10 @@ GLuint glTextureLoadPVR(char *fname, unsigned char isMipMapped, unsigned char gl /* If the texture is MipMapped, tell Open GL to use the MipMap levels of the texture */ if(isMipMapped || glMipMap) - glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, texW, texH, 0, texFormat, texColor, TEX0); + glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, texW, texH, 0, GL_RGB, texFormat | texColor, TEX0); /* If the texture is not MipMapped, tell Open GL to use the base level of the texture */ else - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, texFormat, texColor, TEX0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, GL_RGB, texFormat | texColor, TEX0); free(TEX0); diff --git a/examples/dreamcast/kgl/demos/mipmap/pvr-texture.c b/examples/dreamcast/kgl/demos/mipmap/pvr-texture.c index ffcd5d5..4e2a009 100755 --- a/examples/dreamcast/kgl/demos/mipmap/pvr-texture.c +++ b/examples/dreamcast/kgl/demos/mipmap/pvr-texture.c @@ -1,8 +1,8 @@ -/* +/* KallistiOS 2.0.0 pvr-texture.c - (c)2014 Josh Pearson + (c)2014 Josh PH3NOM Pearson Load A PVR Texture to the PVR using Open GL */ @@ -72,10 +72,10 @@ GLuint glTextureLoadPVR(char *fname, unsigned char isMipMapped, unsigned char gl /* If the texture is MipMapped, tell Open GL to use the MipMap levels of the texture */ if(isMipMapped || glMipMap) - glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, texW, texH, 0, texFormat, texColor, TEX0); + glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, texW, texH, 0, GL_RGB, texFormat | texColor, TEX0); /* If the texture is not MipMapped, tell Open GL to use the base level of the texture */ else - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, texFormat, texColor, TEX0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texW, texH, 0, GL_RGB, texFormat | texColor, TEX0); free(TEX0); diff --git a/examples/dreamcast/kgl/demos/multitexture-arrays/Makefile b/examples/dreamcast/kgl/demos/multitexture-arrays/Makefile deleted file mode 100755 index 8d84f9e..0000000 --- a/examples/dreamcast/kgl/demos/multitexture-arrays/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# OpenGL Dreamcast Multi-Texture Example -# (c)2014 Josh Pearson -# - -TARGET = gl-multitex-arrays.elf - -OBJS = main.o pvr-texture.o - -OBJS += romdisk.o - -all: rm-elf $(TARGET) - -include $(KOS_BASE)/Makefile.rules - -clean: - -rm -f $(TARGET) $(OBJS) - -rm-elf: - -rm -f $(TARGET) - -$(TARGET): $(OBJS) - $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \ - $(OBJS) $(OBJEXTRA) -L$(KOS_BASE)/lib -lgl -lm $(KOS_LIBS) - -romdisk.img: - $(KOS_GENROMFS) -f romdisk.img -d romdisk -v - -romdisk.o: romdisk.img - $(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o - -run: $(TARGET) - $(KOS_LOADER) $(TARGET) - -dist: - rm -f $(OBJS) - $(KOS_STRIP) $(TARGET) - diff --git a/examples/dreamcast/kgl/demos/multitexture-arrays/main.c b/examples/dreamcast/kgl/demos/multitexture-arrays/main.c deleted file mode 100755 index d0bb855..0000000 --- a/examples/dreamcast/kgl/demos/multitexture-arrays/main.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - KallistiOS 2.0.0 - - main.c - (c)2014 Josh Pearson - - Open GL Multi-Texture example using Vertex Array Submission. -*/ - -#include <kos.h> -#include <GL/gl.h> -#include <GL/glu.h> -#include <GL/glut.h> - -/* Load a PVR texture - located in pvr-texture.c */ -extern GLuint glTextureLoadPVR(char *fname, unsigned char isMipMapped, unsigned char glMipMap); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: PH3NOM <ph...@us...> - 2014-09-29 03:03:55
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The collection of ports that can be used in KallistiOS programs.". The branch, master has been updated via 7753d2df6797b37744c1e286e386f6b423e31c24 (commit) from 93a4373a3cfbf337d3a90e5582c4743680d04bbb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7753d2df6797b37744c1e286e386f6b423e31c24 Author: Josh Pearson <ph...@us...> Date: Sun Sep 28 20:03:02 2014 -0700 First major update to the API 9-24-14 ----------------------------------------------------------------------- Summary of changes: libgl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libgl b/libgl index b6e9ff7..97dc259 160000 --- a/libgl +++ b/libgl @@ -1 +1 @@ -Subproject commit b6e9ff70b5413975cc40084a8dfd9a891741c690 +Subproject commit 97dc25918a2ca2b4cae868813e026bbf8889a85b hooks/post-receive -- The collection of ports that can be used in KallistiOS programs. |
From: PH3NOM <ph...@us...> - 2014-09-29 03:00:39
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of OpenGL.". The branch, master has been updated via 97dc25918a2ca2b4cae868813e026bbf8889a85b (commit) from b6e9ff70b5413975cc40084a8dfd9a891741c690 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 97dc25918a2ca2b4cae868813e026bbf8889a85b Author: Josh Pearson <ph...@us...> Date: Sun Sep 28 19:40:41 2014 -0700 First major update to the API 9-28-14 ----------------------------------------------------------------------- Summary of changes: Makefile | 4 +- gl-api.c | 1389 ++++++++++++++++++----------------------------------- gl-api.h | 69 +++- gl-arrays.c | 180 ++------ gl-arrays.h | 5 +- gl-cap.c | 250 ++++++++++ gl-clip.c | 2 +- gl-clip.h | 2 +- gl-error.c | 72 +++ gl-fog.c | 8 +- gl-framebuffer.c | 181 +++++++ gl-light.c | 26 +- gl-light.h | 2 +- gl-matrix.c | 2 +- gl-pvr.c | 29 +- gl-pvr.h | 2 +- gl-rgb.c | 2 +- gl-rgb.h | 2 +- gl-sh4.h | 2 +- gl-texture.c | 298 ++++++++++++ glu-texture.c | 20 +- include/gl.h | 120 ++++- include/glext.h | 49 ++ include/glut.h | 5 +- 24 files changed, 1591 insertions(+), 1130 deletions(-) create mode 100755 gl-cap.c create mode 100755 gl-error.c create mode 100755 gl-framebuffer.c create mode 100755 gl-texture.c create mode 100755 include/glext.h mode change 100644 => 100755 kos/dreamcast.cnf diff --git a/Makefile b/Makefile index 56756b9..246c828 100755 --- a/Makefile +++ b/Makefile @@ -6,7 +6,9 @@ TARGET = libgl.a OBJS = gl-rgb.o gl-fog.o gl-sh4-light.o gl-light.o gl-clip.o gl-pvr.o -OBJS += gl-arrays.o gl-matrix.o gl-api.o glu-texture.o +OBJS += gl-arrays.o gl-matrix.o gl-api.o gl-texture.o glu-texture.o +OBJS += gl-framebuffer.o gl-cap.o gl-error.o + SUBDIRS = KOS_CFLAGS += -ffast-math -O3 -Iinclude diff --git a/gl-api.c b/gl-api.c index c1d1f52..bc417bf 100755 --- a/gl-api.c +++ b/gl-api.c @@ -1,7 +1,7 @@ /* KallistiGL for KallistiOS ##version## libgl/gl-api.c - Copyright (C) 2013-2014 Josh "PH3NOM" Pearson + Copyright (C) 2013-2014 Josh Pearson Copyright (C) 2014 Lawrence Sebald Some functionality adapted from the original KOS libgl: @@ -21,421 +21,151 @@ #include "gl-sh4.h" #include "gl-pvr.h" -/* Texture Submission Functions ************************************************************************/ -/* The texutre sumbission uses a fixed-size buffer, that defaults to 1024 textures. - That means that you must manage your texture submission by calling glDelTextures(...) - when you are done using a texture that was created by glGenTextures(...). - The size of the texture buffer can be controlled by setting GL_MAX_TEXTURES on gl-pvr.h. +//====================================================================================================// +//== Local API State Macine Variables ==// - glTexImage2D(..) is used for loading texture data to OpenGL that is located in Main RAM: - OpenGL will allocate VRAM for the texture, and copy the texture data from Main RAM to VRAM. +static GLubyte GL_KOS_DEPTH_FUNC = PVR_DEPTHCMP_GEQUAL; +static GLubyte GL_KOS_DEPTH_WRITE = PVR_DEPTHWRITE_ENABLE; +static GLubyte GL_KOS_BLEND_FUNC = (PVR_BLEND_ONE << 4) | (PVR_BLEND_ZERO & 0x0F); +static GLubyte GL_KOS_SHADE_FUNC = PVR_SHADE_GOURAUD; +static GLubyte GL_KOS_CULL_FUNC = PVR_CULLING_NONE; +static GLubyte GL_KOS_FACE_FRONT = 0; +static GLubyte GL_KOS_SUPERSAMPLE = 0; - glKosTexImage2D(...) is used for loading texture data to OpenGL that is already in VRAM: - This mode must be used for a render-to-texture if you are using glutSwapBuffersToTexture(). -*/ - -typedef struct { - GLenum target; - GLint level; - GLint border; - GLenum format; - GLenum type; - GLint filter, env; - GLuint width, height; - GLuint internalFormat; - GLvoid *data; -} glTexCxt; - -static glTexCxt GL_TEX_LIST[GL_MAX_TEXTURES]; -static GLint GL_BOUND_TEX = -1, GL_LAST_BOUND_TEX = -1, - GL_BOUND_TEX1 = -1, GL_LAST_BOUND_TEX1 = -1; - -static GLubyte BLEND_SRC = PVR_BLEND_ONE; -static GLubyte BLEND_DST = PVR_BLEND_ZERO; - -static GLubyte GL_SHADE_FUNC = PVR_SHADE_GOURAUD; - -static GLubyte GL_CULL_FUNC = PVR_CULLING_NONE; - -static GLubyte GL_DEPTH_CMP = PVR_DEPTHCMP_GEQUAL; -static GLubyte GL_DEPTH_ENABLE = PVR_DEPTHWRITE_ENABLE; - -static GLubyte GL_TEX_ENV = PVR_TXRENV_MODULATEALPHA; - -static GLubyte GL_ENABLE_CLIPZ = 0; -static GLubyte GL_ENABLE_LIGHTING = 0; -static GLubyte GL_ENABLE_SCISSOR = 0; -static GLubyte GL_ENABLE_FOG = 0; -static GLubyte GL_ENABLE_CULLING = 0; -static GLubyte GL_ENABLE_DEPTH_TEST = 0; -static GLubyte GL_ENABLE_SUPERSAMP = 0; - -static GLubyte GL_FACE_FRONT = 0; -static GLubyte GL_CLAMP_ST = 0; - -/* Primitive 3D Position Submission */ -void (*glVertex3f)(float, float, float); -void (*glVertex3fv)(float *); - -#define GL_CLAMP_U 0x0F -#define GL_CLAMP_V 0xF0 -#define GL_CLAMP_UV 0xFF - -#define GL_TEXTURE_0 1<<0 -#define GL_TEXTURE_1 1<<1 - -static GLuint GL_TEXTURE_ENABLED = 0; -static GLuint GL_CUR_ACTIVE_TEX = 0; - -void glActiveTexture(GLenum texture) { - if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS) - return; - - GL_CUR_ACTIVE_TEX = ((texture & 0xFF) - (GL_TEXTURE0 & 0xFF)); -} - -void glBindTexture(GLenum target, GLuint texture) { - if(target == GL_TEXTURE_2D) { - switch(GL_CUR_ACTIVE_TEX) { - case 0: - GL_BOUND_TEX = texture; - GL_LAST_BOUND_TEX = GL_BOUND_TEX; - break; - - case 1: - GL_BOUND_TEX1 = texture; - GL_LAST_BOUND_TEX1 = GL_BOUND_TEX1; - break; - } - } -} - -void glGetIntegerv(GLenum pname, GLint *params) { - switch(pname) { - case GL_ACTIVE_TEXTURE: - *params = GL_CUR_ACTIVE_TEX; - break; - - case GL_BLEND: - *params = _glKosList(); - break; - - case GL_BLEND_DST: - *params = BLEND_SRC; - break; - - case GL_BLEND_SRC: - *params = BLEND_DST; - break; - - case GL_CULL_FACE: - *params = GL_ENABLE_CULLING; - break; - - case GL_CULL_FACE_MODE: - *params = GL_CULL_FUNC; - break; - - case GL_DEPTH_FUNC: - *params = GL_DEPTH_CMP; - break; - - case GL_DEPTH_TEST: - *params = GL_ENABLE_DEPTH_TEST; - break; - - case GL_DEPTH_WRITEMASK: - *params = GL_DEPTH_ENABLE; - break; - - case GL_FRONT_FACE: - *params = GL_FACE_FRONT; - break; - - case GL_SCISSOR_TEST: - *params = GL_ENABLE_SCISSOR; - break; - - default: - *params = -1; // Indicate invalid parameter // - break; - } -} - -void glGetFloatv(GLenum pname, GLfloat *params) { - switch(pname) { - case GL_MODELVIEW_MATRIX: - case GL_PROJECTION_MATRIX: - case GL_TEXTURE_MATRIX: - glKosGetMatrix(pname - GL_MODELVIEW_MATRIX + 1, params); - break; - - default: - *params = (GLfloat)GL_INVALID_ENUM; - break; - } -} - -static void _glKosInitTextures() { - GLuint i; - - for(i = 0; i < GL_MAX_TEXTURES; i++) - GL_TEX_LIST[i].data = NULL; -} - -static GLuint _glKosNextTexture() { - GLint i; - - for(i = 0; i < GL_MAX_TEXTURES; i++) - if(GL_TEX_LIST[i].data == NULL) - return i; +static GLuint GL_KOS_VERTEX_COUNT = 0; +static GLuint GL_KOS_VERTEX_MODE = GL_TRIANGLES; +static GLuint GL_KOS_VERTEX_COLOR = 0xFFFFFFFF; +static GLfloat GL_KOS_VERTEX_UV[2] = { 0, 0 }; - return 0; /* Invalid Texture! */ -} - -void glGenTextures(GLsizei n, GLuint *textures) { - while(n--) - *textures++ = _glKosNextTexture(); -} - -void glDelTextures(GLsizei n, GLuint *textures) { - while(n--) { - if(GL_TEX_LIST[*textures].data != NULL) { - pvr_mem_free(GL_TEX_LIST[*textures].data); - GL_TEX_LIST[*textures].data = NULL; - } - - textures++; - } -} - -void glTexImage2D(GLenum target, GLint level, GLint internalFormat, - GLsizei width, GLsizei height, GLint border, - GLenum format, GLenum type, GLvoid *data) { - if(target != GL_TEXTURE_2D) return; - - GL_TEX_LIST[GL_BOUND_TEX].target = target; - GL_TEX_LIST[GL_BOUND_TEX].level = level; - GL_TEX_LIST[GL_BOUND_TEX].border = border; - GL_TEX_LIST[GL_BOUND_TEX].format = format; - GL_TEX_LIST[GL_BOUND_TEX].type = type; - - GLuint bytes; - - if(!level) - bytes = width * height * 2; - else - bytes = glKosMipMapTexSize(width, height); - - if(format == PVR_TXRFMT_VQ_ENABLE) - bytes /= 4; - - GL_TEX_LIST[GL_BOUND_TEX].data = pvr_mem_malloc(bytes); - - GL_TEX_LIST[GL_BOUND_TEX].width = width; - GL_TEX_LIST[GL_BOUND_TEX].height = height; - GL_TEX_LIST[GL_BOUND_TEX].internalFormat = internalFormat; +static GLfloat GL_KOS_COLOR_CLEAR[3] = { 0, 0, 0 }; - GL_TEX_LIST[GL_BOUND_TEX].filter = PVR_FILTER_NONE; - - sq_cpy(GL_TEX_LIST[GL_BOUND_TEX].data, data, bytes); -} - -void glKosTexImage2D(GLenum target, GLint level, GLint internalFormat, - GLsizei width, GLsizei height, GLint border, - GLenum format, GLenum type, GLvoid *data) { - if(target != GL_TEXTURE_2D) return; - - GL_TEX_LIST[GL_BOUND_TEX].target = target; - GL_TEX_LIST[GL_BOUND_TEX].level = level; - GL_TEX_LIST[GL_BOUND_TEX].border = border; - GL_TEX_LIST[GL_BOUND_TEX].format = format; - GL_TEX_LIST[GL_BOUND_TEX].type = type; - - GL_TEX_LIST[GL_BOUND_TEX].data = data; - - GL_TEX_LIST[GL_BOUND_TEX].width = width; - GL_TEX_LIST[GL_BOUND_TEX].height = height; - GL_TEX_LIST[GL_BOUND_TEX].internalFormat = internalFormat; - - GL_TEX_LIST[GL_BOUND_TEX].filter = PVR_FILTER_NONE; -} - -void glTexParameteri(GLenum target, GLenum pname, GLint param) { - if(target == GL_TEXTURE_2D) { - switch(pname) { - case GL_TEXTURE_MAG_FILTER: - case GL_TEXTURE_MIN_FILTER: - switch(param) { - case GL_LINEAR: - GL_TEX_LIST[GL_BOUND_TEX].filter = PVR_FILTER_BILINEAR; - break; - - case GL_NEAREST: - GL_TEX_LIST[GL_BOUND_TEX].filter = PVR_FILTER_NEAREST; - break; - - case GL_FILTER_NONE: /* Compatabile with deprecated kgl */ - GL_TEX_LIST[GL_BOUND_TEX].filter = PVR_FILTER_NONE; - break; - - case GL_FILTER_BILINEAR: /* Compatabile with deprecated kgl */ - GL_TEX_LIST[GL_BOUND_TEX].filter = PVR_FILTER_BILINEAR; - break; - - case GL_NEAREST_MIPMAP_NEAREST: - GL_TEX_LIST[GL_BOUND_TEX].level = PVR_MIPMAP_ENABLE; - break; - - default: - break; - } - - break; +static GLfloat GL_KOS_POINT_SIZE = 0.02; - case GL_TEXTURE_WRAP_S: - switch(param) { - case GL_CLAMP: - GL_CLAMP_ST |= GL_CLAMP_U; - break; +static pvr_poly_cxt_t GL_KOS_POLY_CXT; - case GL_REPEAT: - GL_CLAMP_ST ^= GL_CLAMP_U; - break; - } +static inline void _glKosFlagsSetTriangleStrip(); +static inline void _glKosFlagsSetTriangle(); +static inline void _glKosFlagsSetQuad(); - break; +//====================================================================================================// +//== API Initialization ==// - case GL_TEXTURE_WRAP_T: - switch(param) { - case GL_CLAMP: - GL_CLAMP_ST |= GL_CLAMP_V; - break; +void APIENTRY glKosInit() { + _glKosInitPVR(); - case GL_REPEAT: - GL_CLAMP_ST ^= GL_CLAMP_V; - break; - } + _glKosInitTextures(); - break; - } - } -} + _glKosInitMatrix(); -void glTexEnvi(GLenum target, GLenum pname, GLint param) { - if(target == GL_TEXTURE_ENV) - if(pname == GL_TEXTURE_ENV_MODE) - if(param >= PVR_TXRENV_REPLACE && param <= PVR_TXRENV_MODULATEALPHA) - GL_TEX_ENV = param; -} + _glKosInitLighting(); -void glTexEnvf(GLenum target, GLenum pname, GLfloat param) { - /* GL_TEXTURE_LOD_BIAS Not Implemented */ - glTexEnvi(target, pname, param); + _glKosInitFrameBuffers(); } -/* Blending / Shading functions ********************************************************/ +//====================================================================================================// +//== Blending / Shading functions ==// -void glShadeModel(GLenum mode) { +void APIENTRY glShadeModel(GLenum mode) { switch(mode) { case GL_FLAT: - GL_SHADE_FUNC = PVR_SHADE_FLAT; + GL_KOS_SHADE_FUNC = PVR_SHADE_FLAT; break; case GL_SMOOTH: - GL_SHADE_FUNC = PVR_SHADE_GOURAUD; + GL_KOS_SHADE_FUNC = PVR_SHADE_GOURAUD; break; } } -void glBlendFunc(GLenum sfactor, GLenum dfactor) { +void APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) { + GL_KOS_BLEND_FUNC = 0; + switch(sfactor) { case GL_ONE: - BLEND_SRC = PVR_BLEND_ONE; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_ONE & 0XF) << 4; break; case GL_ZERO: - BLEND_SRC = PVR_BLEND_ZERO; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_ZERO & 0XF) << 4; break; case GL_SRC_COLOR: - BLEND_SRC = PVR_BLEND_SRCALPHA; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_SRCALPHA & 0XF) << 4; break; case GL_DST_COLOR: - BLEND_SRC = PVR_BLEND_DESTCOLOR; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_DESTCOLOR & 0XF) << 4; break; case GL_SRC_ALPHA: - BLEND_SRC = PVR_BLEND_SRCALPHA; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_SRCALPHA << 4); break; case GL_DST_ALPHA: - BLEND_SRC = PVR_BLEND_DESTALPHA; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_DESTALPHA & 0XF) << 4; break; case GL_ONE_MINUS_SRC_ALPHA: - BLEND_SRC = PVR_BLEND_INVSRCALPHA; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_INVSRCALPHA & 0XF) << 4; break; case GL_ONE_MINUS_DST_ALPHA: - BLEND_SRC = PVR_BLEND_INVDESTALPHA; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_INVDESTALPHA & 0XF) << 4; break; case GL_ONE_MINUS_DST_COLOR: - BLEND_SRC = PVR_BLEND_INVDESTCOLOR; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_INVDESTCOLOR & 0XF) << 4; break; } switch(dfactor) { case GL_ONE: - BLEND_DST = PVR_BLEND_ONE; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_ONE & 0XF); break; case GL_ZERO: - BLEND_DST = PVR_BLEND_ZERO; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_ZERO & 0XF); break; case GL_SRC_COLOR: - BLEND_DST = PVR_BLEND_SRCALPHA; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_SRCALPHA & 0XF); break; case GL_DST_COLOR: - BLEND_DST = PVR_BLEND_DESTCOLOR; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_DESTCOLOR & 0XF); break; case GL_SRC_ALPHA: - BLEND_DST = PVR_BLEND_SRCALPHA; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_SRCALPHA & 0XF); break; case GL_DST_ALPHA: - BLEND_DST = PVR_BLEND_DESTALPHA; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_DESTALPHA & 0XF); break; case GL_ONE_MINUS_SRC_ALPHA: - BLEND_DST = PVR_BLEND_INVSRCALPHA; + GL_KOS_BLEND_FUNC |= (PVR_BLEND_INVSRCALPHA & 0XF); break; case GL_ONE_MINUS_DST_ALPHA: - BLEND_DST = PVR_BLEND_INVDESTALPHA; ...<truncated>... hooks/post-receive -- The KallistiOS port of OpenGL. |
From: Donald H. <qu...@us...> - 2014-09-09 16:30:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a7f57a3eb284c7090142a31aa6440e0a4ba0ca76 (commit) via 8f833ef8e0afac872dbffca1565fe947eadbac4e (commit) via 3f6567cf7b3f1f0ed284d5dfa90046304bacd2a9 (commit) from 8912cb704e2c491bb4b04f9e30a3cce6b2a64d9a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a7f57a3eb284c7090142a31aa6440e0a4ba0ca76 Author: Donald Haase <qu...@co...> Date: Tue Sep 9 12:12:53 2014 -0400 Mutex lock within the gdc command execution wrapper. This allows for it to be called by users without concern for the mutex. commit 8f833ef8e0afac872dbffca1565fe947eadbac4e Author: Donald Haase <qu...@co...> Date: Tue Sep 9 11:47:06 2014 -0400 Add recursive locks to the gd command execution command. Now is thread-safe even if a user calls it manually. commit 3f6567cf7b3f1f0ed284d5dfa90046304bacd2a9 Author: Donald Haase <qu...@co...> Date: Tue Sep 9 11:38:20 2014 -0400 Now that the g1ata mutex is recursive, lock in the command executer. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/cdrom.c | 9 +++++---- kernel/arch/dreamcast/include/dc/cdrom.h | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/cdrom.c b/kernel/arch/dreamcast/hardware/cdrom.c index 56822b2..a41cd69 100644 --- a/kernel/arch/dreamcast/hardware/cdrom.c +++ b/kernel/arch/dreamcast/hardware/cdrom.c @@ -102,13 +102,12 @@ int cdrom_set_sector_size(int size) { } /* Command execution sequence */ -/* XXX: It might make sense to have a version of this that takes a timeout. - The only time this could cause an issue is if for some inane reason a user - were to cdrom_init/reinit in one thread and expect to be able to get a - reliable read in another. */ +/* XXX: It might make sense to have a version of this that takes a timeout. */ int cdrom_exec_cmd(int cmd, void *param) { int status[4] = {0}; int f, n; + + mutex_lock(&_g1_ata_mutex); /* Make sure to select the GD-ROM drive. */ g1_ata_select_device(G1_ATA_MASTER); @@ -124,6 +123,8 @@ int cdrom_exec_cmd(int cmd, void *param) { thd_pass(); } while(n == PROCESSING); + + mutex_unlock(&_g1_ata_mutex); if(n == COMPLETED) return ERR_OK; diff --git a/kernel/arch/dreamcast/include/dc/cdrom.h b/kernel/arch/dreamcast/include/dc/cdrom.h index bdac277..a350580 100644 --- a/kernel/arch/dreamcast/include/dc/cdrom.h +++ b/kernel/arch/dreamcast/include/dc/cdrom.h @@ -212,8 +212,7 @@ int cdrom_set_sector_size(int size); /** \brief Execute a CD-ROM command. This function executes the specified command using the BIOS syscall for - executing GD-ROM commands. This is *NOT* thread-safe. You must track the - G1_ATA mutex yourself. + executing GD-ROM commands. This is now thread-safe to be called by users. \param cmd The command number to execute. \param param Data to pass to the syscall. hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: PH3NOM <ph...@us...> - 2014-09-08 02:35:54
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 8912cb704e2c491bb4b04f9e30a3cce6b2a64d9a (commit) from ffe2f28f04e73f54cdb039edddbdc2a049a31c8f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8912cb704e2c491bb4b04f9e30a3cce6b2a64d9a Author: U-PH3NOM-PC\PH3NOM <PH3NOM@PH3NOM-PC.(none)> Date: Sun Sep 7 20:00:46 2014 -0700 Updated libgl examples 9-06-2014 ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/kgl/basic/elements/main.c | 22 +++++------------- examples/dreamcast/kgl/demos/blur/main.c | 27 ++++----------------- examples/dreamcast/kgl/demos/mipmap/main.c | 8 +++--- examples/dreamcast/kgl/demos/multitexture/main.c | 8 +++--- examples/dreamcast/kgl/demos/specular/font.c | 8 +++--- 5 files changed, 23 insertions(+), 50 deletions(-) diff --git a/examples/dreamcast/kgl/basic/elements/main.c b/examples/dreamcast/kgl/basic/elements/main.c index e3c8a8b..f8315e0 100755 --- a/examples/dreamcast/kgl/basic/elements/main.c +++ b/examples/dreamcast/kgl/basic/elements/main.c @@ -18,35 +18,25 @@ /* Load a PVR texture - located in pvr-texture.c */ extern GLuint glTextureLoadPVR(char *fname, unsigned char isMipMapped, unsigned char glMipMap); -GLfloat VERTEX_ARRAY[4 * 3 * 2] = { -100.0f, -10.0f, 100.0f, +GLfloat VERTEX_ARRAY[4 * 3 * 1] = { -100.0f, -10.0f, 100.0f, 100.0f, -10.0f, 100.0f, 100.0f, -10.0f, -100.0f, -100.0f, -10.0f, -100.0f }; -GLfloat TEXCOORD_ARRAY[4 * 2 * 2] = { 0, 0, +GLfloat TEXCOORD_ARRAY[4 * 2 * 1] = { 0, 0, 1, 0, 1, 1, - 0, 1, - 1, 0, - 0, 0, - 0, 1, - 1, 1 + 0, 1 }; -GLfloat NORMAL_ARRAY[4 * 3 * 2] = { 0, -1, 0, - 0, 1, 0, - 0, 1, 0, - 0, 1, 0, - 0, 1, 0, +GLfloat NORMAL_ARRAY[4 * 3 * 1] = { 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0 }; -GLubyte INDEX_ARRAY[4 * 2] = { 0, 1, 2, 3, - 4, 5, 6, 7 - }; +GLubyte INDEX_ARRAY[4 * 1] = { 0, 1, 2, 3 }; /* Example using Open GL Vertex Array Submission using glDrawElements().*/ static float rx = 1.0f; @@ -71,7 +61,7 @@ void RenderCallback(GLuint texID) { glBindTexture(GL_TEXTURE_2D, texID); /* Bind Array Data */ - glNormalPointer(3, GL_FLOAT, 0, NORMAL_ARRAY); + glNormalPointer(GL_FLOAT, 0, NORMAL_ARRAY); glTexCoordPointer(2, GL_FLOAT, 0, TEXCOORD_ARRAY); glVertexPointer(3, GL_FLOAT, 0, VERTEX_ARRAY); diff --git a/examples/dreamcast/kgl/demos/blur/main.c b/examples/dreamcast/kgl/demos/blur/main.c index 5dad52a..45dbc2d 100755 --- a/examples/dreamcast/kgl/demos/blur/main.c +++ b/examples/dreamcast/kgl/demos/blur/main.c @@ -71,8 +71,6 @@ void InitRenderTexture(long unsigned int width, long unsigned int height) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_FILTER, GL_LINEAR); } -#define DEBUG_NULL_DC 1 - void RenderBlurEffect(int times, float inc, long unsigned int width, long unsigned int height, GLuint texID) @@ -82,20 +80,6 @@ void RenderBlurEffect(int times, float inc, long unsigned int width, long unsign float alpha = 0.2f; // Starting Alpha Value float U, V; -#ifdef DEBUG_NULL_DC // Null DC does not accuratley handle render-to-texture u/v coords - - if(width > (float)vid_mode->width) - U = 1; - else - U = width / (float)vid_mode->width; - - if(height > (float)vid_mode->height) - V = 1; - else - V = height / (float)vid_mode->height; - -#else - if(width > (float)vid_mode->width) U = (float)vid_mode->width / width; else @@ -106,7 +90,6 @@ void RenderBlurEffect(int times, float inc, long unsigned int width, long unsign else V = 1; -#endif float W = (float)vid_mode->width; float H = (float)vid_mode->height; @@ -127,16 +110,16 @@ void RenderBlurEffect(int times, float inc, long unsigned int width, long unsign glColor4f(1.0f, 1.0f, 1.0f, alpha); // Set The Alpha Value (Starts At 0.2) glTexCoord2f(0 + spost, 0 + spost); - glVertex2f(0, 0); + glKosVertex2f(0, 0); glTexCoord2f(U - spost, 0 + spost); - glVertex2f(W, 0); + glKosVertex2f(W, 0); glTexCoord2f(U - spost, V - spost); - glVertex2f(W, H); + glKosVertex2f(W, H); glTexCoord2f(0 + spost, V - spost); - glVertex2f(0, H); + glKosVertex2f(0, H); spost += inc; // Gradually Increase spost (Zooming Closer To Texture Center) @@ -323,7 +306,7 @@ int main(int argc, char **argv) { /* Set the Render Texture and Render-To-Texture Viewport Dimensions - Must be Power of two */ InitRenderTexture(1024, 512); - GLubyte enable_radial = 0, radial_iterations = 1; + GLubyte enable_radial = 0, radial_iterations = 8; while(1) { /* Draw the GL "scene" */ diff --git a/examples/dreamcast/kgl/demos/mipmap/main.c b/examples/dreamcast/kgl/demos/mipmap/main.c index e797d9e..840b56b 100755 --- a/examples/dreamcast/kgl/demos/mipmap/main.c +++ b/examples/dreamcast/kgl/demos/mipmap/main.c @@ -74,16 +74,16 @@ void RenderTexturedQuadCentered(GLuint texID, GLfloat width, GLfloat height) { glBegin(GL_QUADS); glTexCoord2f(0, 0); - glVertex2f(x1, y1); + glKosVertex2f(x1, y1); glTexCoord2f(1, 0); - glVertex2f(x2, y1); + glKosVertex2f(x2, y1); glTexCoord2f(1, 1); - glVertex2f(x2, y2); + glKosVertex2f(x2, y2); glTexCoord2f(0, 1); - glVertex2f(x1, y2); + glKosVertex2f(x1, y2); glEnd(); } diff --git a/examples/dreamcast/kgl/demos/multitexture/main.c b/examples/dreamcast/kgl/demos/multitexture/main.c index c27f645..f80eb7e 100755 --- a/examples/dreamcast/kgl/demos/multitexture/main.c +++ b/examples/dreamcast/kgl/demos/multitexture/main.c @@ -81,19 +81,19 @@ void RenderMultiTexturedQuadCentered(GLuint texID0, GLuint texID1, GLfloat width glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f); glMultiTexCoord2f(GL_TEXTURE1, 0.2f, 0.2f); - glVertex2f(x1, y1); + glKosVertex2f(x1, y1); glMultiTexCoord2f(GL_TEXTURE0, 1.0f, 0.0f); glMultiTexCoord2f(GL_TEXTURE1, 0.8f, 0.2f); - glVertex2f(x2, y1); + glKosVertex2f(x2, y1); glMultiTexCoord2f(GL_TEXTURE0, 1.0f, 1.0f); glMultiTexCoord2f(GL_TEXTURE1, 0.8f, 0.8f); - glVertex2f(x2, y2); + glKosVertex2f(x2, y2); glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1.0f); glMultiTexCoord2f(GL_TEXTURE1, 0.2f, 0.8f); - glVertex2f(x1, y2); + glKosVertex2f(x1, y2); glEnd(); diff --git a/examples/dreamcast/kgl/demos/specular/font.c b/examples/dreamcast/kgl/demos/specular/font.c index 25c9002..dc82fb1 100755 --- a/examples/dreamcast/kgl/demos/specular/font.c +++ b/examples/dreamcast/kgl/demos/specular/font.c @@ -53,16 +53,16 @@ void FontDrawChar(Font *font, int index, float x, float y, float w, float h) { glColor1ui(font->Color); glTexCoord2f(font->TexUV[index][0], font->TexUV[index][3]); - glVertex2f(x, y + h); + glKosVertex2f(x, y + h); glTexCoord2f(font->TexUV[index][1], font->TexUV[index][3]); - glVertex2f(x + w, y + h); + glKosVertex2f(x + w, y + h); glTexCoord2f(font->TexUV[index][1], font->TexUV[index][2]); - glVertex2f(x + w, y); + glKosVertex2f(x + w, y); glTexCoord2f(font->TexUV[index][0], font->TexUV[index][2]); - glVertex2f(x, y); + glKosVertex2f(x, y); } void FontPrintString(Font *font, char *str, float xpos, float ypos, hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: PH3NOM <ph...@us...> - 2014-09-08 02:17:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The collection of ports that can be used in KallistiOS programs.". The branch, master has been updated via 93a4373a3cfbf337d3a90e5582c4743680d04bbb (commit) from 47d297747864df3d4546683a36e811e278471515 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 93a4373a3cfbf337d3a90e5582c4743680d04bbb Author: U-PH3NOM-PC\PH3NOM <PH3NOM@PH3NOM-PC.(none)> Date: Sun Sep 7 15:42:46 2014 -0700 Fixed libgl bugs reported as of 9-06-2014 ----------------------------------------------------------------------- Summary of changes: libgl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libgl b/libgl index be969bd..b6e9ff7 160000 --- a/libgl +++ b/libgl @@ -1 +1 @@ -Subproject commit be969bd840b9623640c5d9992034a8b5db4e3c01 +Subproject commit b6e9ff70b5413975cc40084a8dfd9a891741c690 hooks/post-receive -- The collection of ports that can be used in KallistiOS programs. |
From: PH3NOM <ph...@us...> - 2014-09-08 02:16:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of OpenGL.". The branch, master has been updated via b6e9ff70b5413975cc40084a8dfd9a891741c690 (commit) from 092a04cccfa14f305188edc653ebd511630463ae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b6e9ff70b5413975cc40084a8dfd9a891741c690 Author: U-PH3NOM-PC\PH3NOM <PH3NOM@PH3NOM-PC.(none)> Date: Sun Sep 7 15:41:26 2014 -0700 Fixed bugs reported as of 9-06-2014 ----------------------------------------------------------------------- Summary of changes: Makefile | 2 +- gl-api.c | 101 +------------------------------------------------- gl-arrays.c | 25 +++++------- gl-rgb.c | 16 ++++---- glu-texture.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/gl.h | 5 +- 6 files changed, 138 insertions(+), 126 deletions(-) create mode 100755 glu-texture.c diff --git a/Makefile b/Makefile index b018d22..56756b9 100755 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ TARGET = libgl.a OBJS = gl-rgb.o gl-fog.o gl-sh4-light.o gl-light.o gl-clip.o gl-pvr.o -OBJS += gl-arrays.o gl-matrix.o gl-api.o +OBJS += gl-arrays.o gl-matrix.o gl-api.o glu-texture.o SUBDIRS = KOS_CFLAGS += -ffast-math -O3 -Iinclude diff --git a/gl-api.c b/gl-api.c index a53aacd..c1d1f52 100755 --- a/gl-api.c +++ b/gl-api.c @@ -193,22 +193,6 @@ static GLuint _glKosNextTexture() { return 0; /* Invalid Texture! */ } -GLuint glKosMipMapTexSize(GLuint width, GLuint height) { - GLuint b = 0; - - while(width >= 1 && height >= 1) { - b += width * height * 2; - - if(width >= 1) - width /= 2; - - if(height >= 1) - height /= 2; - } - - return b; -} - void glGenTextures(GLsizei n, GLuint *textures) { while(n--) *textures++ = _glKosNextTexture(); @@ -350,89 +334,6 @@ void glTexEnvf(GLenum target, GLenum pname, GLfloat param) { glTexEnvi(target, pname, param); } -GLint gluBuild2DBiMipmaps(GLenum target, GLint internalFormat, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void *data) { - if(target != GL_TEXTURE_2D) - return -1; - - if(width < 1 || height < 1) - return 0; - - uint32 i = 0; - uint16 x , y; - - uint16 *src = (uint16 *)data; - uint16 *dst = (uint16 *)data + (width * height); - - for(y = 0; y < height; y += 2) { - for(x = 0; x < width; x += 2) { - switch(type) { - case GL_UNSIGNED_SHORT_5_6_5: - dst[i++] = __glKosAverageBiPixelRGB565(*src, *(src + 1)); - break; - - case GL_UNSIGNED_SHORT_4_4_4_4: - dst[i++] = __glKosAverageBiPixelARGB4444(*src, *(src + 1)); - break; - - case GL_UNSIGNED_SHORT_1_5_5_5: - dst[i++] = __glKosAverageBiPixelARGB1555(*src, *(src + 1)); - break; - } - - src += 2; - } - - src += width; - } - - return gluBuild2DBiMipmaps(target, internalFormat, width / 2, height / 2, - format, type, (uint16 *)data + (width * height)); -} - -GLint gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void *data) { - if(target != GL_TEXTURE_2D) - return -1; - - if(width < 1 || height < 1) - return 0; - - if(width == 1 || height == 1) - return gluBuild2DBiMipmaps(target, internalFormat, width, height, format, type, data); - - uint32 i = 0; - uint16 x, y; - - uint16 *src = (uint16 *)data; - uint16 *dst = (uint16 *)data + (width * height); - - for(y = 0; y < height; y += 2) { - for(x = 0; x < width; x += 2) { - switch(type) { - case GL_UNSIGNED_SHORT_5_6_5: - dst[i++] = __glKosAverageQuadPixelRGB565(*src, *(src + 1), *(src + width), *(src + width + 1)); - break; - - case GL_UNSIGNED_SHORT_4_4_4_4: - dst[i++] = __glKosAverageQuadPixelARGB4444(*src, *(src + 1), *(src + width), *(src + width + 1)); - break; - - case GL_UNSIGNED_SHORT_1_5_5_5: - dst[i++] = __glKosAverageQuadPixelARGB1555(*src, *(src + 1), *(src + width), *(src + width + 1)); - break; - } - - src += 2; - } - - src += width; - } - - return gluBuild2DMipmaps(target, internalFormat, width / 2, height / 2, - format, type, (uint16 *)data + (width * height)); -} - /* Blending / Shading functions ********************************************************/ void glShadeModel(GLenum mode) { @@ -1022,7 +923,7 @@ void glBegin(unsigned int mode) { GL_VERTEX_MODE = mode; - GL_BOUND_TEX < 0 ? _glKosCompileHdr() : _glKosCompileHdrTx(); + !GL_TEXTURE_ENABLED ? _glKosCompileHdr() : _glKosCompileHdrTx(); if(GL_TEXTURE_ENABLED & GL_TEXTURE_1) _glKosCompileHdrTx2(); diff --git a/gl-arrays.c b/gl-arrays.c index a4f61ab..06f3597 100755 --- a/gl-arrays.c +++ b/gl-arrays.c @@ -43,7 +43,7 @@ static GLuint GL_VERTEX_PTR_MODE = 0; static GLuint GL_ARRAY_TEXTURE_ENABLED = 0; static GLuint GL_ARRAY_ACTIVE_TEXTURE = 0; -void glClientActiveTexture(GLenum texture) { +GLAPI void APIENTRY glClientActiveTexture(GLenum texture) { if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS) return; @@ -140,8 +140,8 @@ static inline void _glKosArraysTransformPositions(GLfloat *position, GLuint coun //== Open GL API Public Functions ==// /* Submit a Vertex Position Pointer */ -void glVertexPointer(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer) { +GLAPI void APIENTRY glVertexPointer(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer) { if(size != 3) return; /* Expect 3D X,Y,Z vertex... could do 2d X,Y later */ if(type != GL_FLOAT) return; /* Expect Floating point vertices */ @@ -154,10 +154,7 @@ void glVertexPointer(GLint size, GLenum type, } /* Submit a Vertex Normal Pointer */ -void glNormalPointer(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer) { - if(size != 3) return; - +GLAPI void APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) { if(type != GL_FLOAT) return; /* Expect Floating point vertices */ (stride) ? (GL_NORMAL_STRIDE = stride / 4) : (GL_NORMAL_STRIDE = 3); @@ -168,8 +165,8 @@ void glNormalPointer(GLint size, GLenum type, } /* Submit a Texture Coordinate Pointer */ -void glTexCoordPointer(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer) { +GLAPI void APIENTRY glTexCoordPointer(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer) { if(size != 2) return; /* Expect u and v */ if(type != GL_FLOAT) return; /* Expect Floating point vertices */ @@ -193,8 +190,8 @@ void glTexCoordPointer(GLint size, GLenum type, } /* Submit a Color Pointer */ -void glColorPointer(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer) { +GLAPI void APIENTRY glColorPointer(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer) { if((type == GL_UNSIGNED_INT) && (size == 1)) { GL_COLOR_COMPONENTS = 1; GL_COLOR_POINTER = (GLvoid *)pointer; @@ -639,7 +636,7 @@ void _glKosPrintErrorString(GLuint error) { //========================================================================================// //== OpenGL Elemental Array Submission ==// -void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { +GLAPI void APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { /* Before we process the vertex data, ensure all parameters are valid */ GLuint error = _glKosArraysVerifyParameter(mode, count, type, 1); @@ -909,9 +906,9 @@ static inline void _glKosArrayTexCoord2f(pvr_vertex_t *dst, GLuint count) { } //========================================================================================// -//== Openg GL Draw Arrays ==// +//== Open GL Draw Arrays ==// -void glDrawArrays(GLenum mode, GLint first, GLsizei count) { +GLAPI void APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) { /* Before we process the vertex data, ensure all parameters are valid */ GLuint error = _glKosArraysVerifyParameter(mode, count, first, 0); diff --git a/gl-rgb.c b/gl-rgb.c index c63dd05..d2daca4 100755 --- a/gl-rgb.c +++ b/gl-rgb.c @@ -96,20 +96,20 @@ uint16 __glKosAverageBiPixelRGB565(uint16 p1, uint16 p2) { } uint16 __glKosAverageBiPixelARGB1555(uint16 p1, uint16 p2) { - uint8 A = (ARGB1555_ALPHA(p1) + ARGB1555_ALPHA(p2)) / 4; - uint8 R = (ARGB1555_RED(p1) + ARGB1555_RED(p2)) / 4; - uint8 G = (ARGB1555_GREEN(p1) + ARGB1555_GREEN(p2)) / 4; - uint8 B = (ARGB1555_BLUE(p1) + ARGB1555_BLUE(p2)) / 4; + uint8 A = (ARGB1555_ALPHA(p1) + ARGB1555_ALPHA(p2)) / 2; + uint8 R = (ARGB1555_RED(p1) + ARGB1555_RED(p2)) / 2; + uint8 G = (ARGB1555_GREEN(p1) + ARGB1555_GREEN(p2)) / 2; + uint8 B = (ARGB1555_BLUE(p1) + ARGB1555_BLUE(p2)) / 2; return ((A & RGB1_MAX) << ARGB1555_ALPHA_SHIFT) | ((R & RGB5_MAX) << ARGB1555_RED_SHIFT) | ((G & RGB5_MAX) << ARGB1555_GREEN_SHIFT) | (B & RGB5_MAX); } uint16 __glKosAverageBiPixelARGB4444(uint16 p1, uint16 p2) { - uint8 A = (ARGB4444_ALPHA(p1) + ARGB4444_ALPHA(p2)) / 4; - uint8 R = (ARGB4444_RED(p1) + ARGB4444_RED(p2)) / 4; - uint8 G = (ARGB4444_GREEN(p1) + ARGB4444_GREEN(p2)) / 4; - uint8 B = (ARGB4444_BLUE(p1) + ARGB4444_BLUE(p2)) / 4; + uint8 A = (ARGB4444_ALPHA(p1) + ARGB4444_ALPHA(p2)) / 2; + uint8 R = (ARGB4444_RED(p1) + ARGB4444_RED(p2)) / 2; + uint8 G = (ARGB4444_GREEN(p1) + ARGB4444_GREEN(p2)) / 2; + uint8 B = (ARGB4444_BLUE(p1) + ARGB4444_BLUE(p2)) / 2; return ((A & RGB4_MAX) << ARGB4444_ALPHA_SHIFT) | ((R & RGB4_MAX) << ARGB4444_RED_SHIFT) | ((G & RGB4_MAX) << ARGB4444_GREEN_SHIFT) | (B & RGB4_MAX); diff --git a/glu-texture.c b/glu-texture.c new file mode 100755 index 0000000..7b08eac --- /dev/null +++ b/glu-texture.c @@ -0,0 +1,115 @@ +/* KallistiGL for KallistiOS ##version## + + libgl/glu-texture.c + Copyright (C) 2013-2014 Josh "PH3NOM" Pearson + + A set of functions for working with ARGB pixel data, used by gluBuild2DMipmaps(...). +*/ + +#include "gl.h" +#include "gl-api.h" +#include "gl-rgb.h" +#include "glu.h" + +GLAPI GLuint APIENTRY glKosMipMapTexSize(GLuint width, GLuint height) { + GLuint b = 0; + + while(width >= 1 && height >= 1) { + b += width * height * 2; + + if(width >= 1) + width /= 2; + + if(height >= 1) + height /= 2; + } + + return b; +} + +static GLint gluBuild2DBiMipmaps(GLenum target, GLint internalFormat, GLsizei width, + GLsizei height, GLenum format, GLenum type, const void *data) { + if(target != GL_TEXTURE_2D) + return -1; + + if(width < 1 || height < 1) + return 0; + + uint32 i = 0; + uint16 x , y; + + uint16 *src = (uint16 *)data; + uint16 *dst = (uint16 *)data + (width * height); + + for(y = 0; y < height; y += 2) { + for(x = 0; x < width; x += 2) { + switch(type) { + case GL_UNSIGNED_SHORT_5_6_5: + dst[i++] = __glKosAverageBiPixelRGB565(*src, *(src + 1)); + break; + + case GL_UNSIGNED_SHORT_4_4_4_4: + dst[i++] = __glKosAverageBiPixelARGB4444(*src, *(src + 1)); + break; + + case GL_UNSIGNED_SHORT_1_5_5_5: + dst[i++] = __glKosAverageBiPixelARGB1555(*src, *(src + 1)); + break; + } + + src += 2; + } + + src += width; + } + + return gluBuild2DBiMipmaps(target, internalFormat, width / 2, height / 2, + format, type, (uint16 *)data + (width * height)); +} + +GLint APIENTRY gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, + GLsizei height, GLenum format, GLenum type, const void *data) { + if(target != GL_TEXTURE_2D) + return -1; + + if(type != GL_UNSIGNED_SHORT_5_6_5 && type != GL_UNSIGNED_SHORT_4_4_4_4 + && type != GL_UNSIGNED_SHORT_1_5_5_5) + return -1; + + if(width < 1 || height < 1) + return 0; + + if(width == 1 || height == 1) + return gluBuild2DBiMipmaps(target, internalFormat, width, height, format, type, data); + + uint32 i = 0; + uint16 x, y; + + uint16 *src = (uint16 *)data; + uint16 *dst = (uint16 *)data + (width * height); + + for(y = 0; y < height; y += 2) { + for(x = 0; x < width; x += 2) { + switch(type) { + case GL_UNSIGNED_SHORT_5_6_5: + dst[i++] = __glKosAverageQuadPixelRGB565(*src, *(src + 1), *(src + width), *(src + width + 1)); + break; + + case GL_UNSIGNED_SHORT_4_4_4_4: + dst[i++] = __glKosAverageQuadPixelARGB4444(*src, *(src + 1), *(src + width), *(src + width + 1)); + break; + + case GL_UNSIGNED_SHORT_1_5_5_5: + dst[i++] = __glKosAverageQuadPixelARGB1555(*src, *(src + 1), *(src + width), *(src + width + 1)); + break; + } + + src += 2; + } + + src += width; + } + + return gluBuild2DMipmaps(target, internalFormat, width / 2, height / 2, + format, type, (uint16 *)data + (width * height)); +} \ No newline at end of file diff --git a/include/gl.h b/include/gl.h index 3e92d33..e803842 100755 --- a/include/gl.h +++ b/include/gl.h @@ -435,8 +435,7 @@ GLAPI void APIENTRY glTexCoordPointer(GLint size, GLenum type, /* If a Normal Pointer is set and GL Lighting has been enabled, Vertex Lighting will be used instead of glColorPointer */ -GLAPI void APIENTRY glNormalPointer(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer); /* Use either this OR glNormalPointer to color vertices, NOT both */ GLAPI void APIENTRY glColorPointer(GLint size, GLenum type, @@ -515,7 +514,7 @@ GLAPI GLuint APIENTRY glKosMipMapTexSize(GLuint width, GLuint height); void glGetIntegerv(GLenum pname, GLint *params); void glGetFloatv(GLenum pname, GLfloat *params); -/* Multi-Texture Extensions */ +/* Multi-Texture Extensions - Does not currently work with Z-Clipping Enabled */ GLAPI void APIENTRY glActiveTexture(GLenum texture); GLAPI void APIENTRY glClientActiveTexture(GLenum texture); hooks/post-receive -- The KallistiOS port of OpenGL. |
From: Lawrence S. <ljs...@us...> - 2014-09-08 01:59:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ffe2f28f04e73f54cdb039edddbdc2a049a31c8f (commit) from 44a62b490650c4da1fd386da594204aded37e9e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ffe2f28f04e73f54cdb039edddbdc2a049a31c8f Author: Lawrence Sebald <ljs...@us...> Date: Sun Sep 7 21:58:58 2014 -0400 Fix a minor issue with something being declared as static that shouldn't have been in that last commit. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/cdrom.c | 2 +- kernel/arch/dreamcast/include/dc/cdrom.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/cdrom.c b/kernel/arch/dreamcast/hardware/cdrom.c index ce6464e..56822b2 100644 --- a/kernel/arch/dreamcast/hardware/cdrom.c +++ b/kernel/arch/dreamcast/hardware/cdrom.c @@ -106,7 +106,7 @@ int cdrom_set_sector_size(int size) { The only time this could cause an issue is if for some inane reason a user were to cdrom_init/reinit in one thread and expect to be able to get a reliable read in another. */ -static int cdrom_exec_cmd(int cmd, void *param) { +int cdrom_exec_cmd(int cmd, void *param) { int status[4] = {0}; int f, n; diff --git a/kernel/arch/dreamcast/include/dc/cdrom.h b/kernel/arch/dreamcast/include/dc/cdrom.h index 038d477..bdac277 100644 --- a/kernel/arch/dreamcast/include/dc/cdrom.h +++ b/kernel/arch/dreamcast/include/dc/cdrom.h @@ -220,7 +220,7 @@ int cdrom_set_sector_size(int size); \return \ref cd_cmd_response */ -static int cdrom_exec_cmd(int cmd, void *param); +int cdrom_exec_cmd(int cmd, void *param); /** \brief Get the status of the GD-ROM drive. hooks/post-receive -- A pseudo Operating System for the Dreamcast. |