example: refresh
All examples work again, except macaw_multipass--this never worked entirely, so I'm not worried about fixing it at the moment.
This commit is contained in:
parent
e4303dbcf1
commit
5c2b45b70d
@ -2,7 +2,7 @@ MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
DIR := $(dir $(MAKEFILE_PATH))
|
||||
|
||||
LIB ?= .
|
||||
OPT ?= -Os
|
||||
OPT ?= -O3
|
||||
DEBUG ?= -g -gdwarf-4
|
||||
GENERATED ?=
|
||||
|
||||
|
@ -120,3 +120,10 @@ MAPLE_VIBRATOR_OBJ = \
|
||||
|
||||
example/maple_vibrator.elf: LDSCRIPT = $(LIB)/alt.lds
|
||||
example/maple_vibrator.elf: $(START_OBJ) $(MAPLE_VIBRATOR_OBJ)
|
||||
|
||||
SERIAL_TRANSFER_OBJ = \
|
||||
example/serial_transfer.o \
|
||||
serial_load.o
|
||||
|
||||
example/serial_transfer.elf: LDSCRIPT = $(LIB)/alt.lds
|
||||
example/serial_transfer.elf: $(START_OBJ) $(SERIAL_TRANSFER_OBJ)
|
||||
|
@ -148,7 +148,6 @@ void main()
|
||||
|
||||
core_start_render(frame_ix, num_frames);
|
||||
|
||||
v_sync_out();
|
||||
v_sync_in();
|
||||
core_wait_end_of_render_video(frame_ix, num_frames);
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "align.hpp"
|
||||
#include "vga.hpp"
|
||||
|
||||
#include "holly/texture_memory_alloc.hpp"
|
||||
#include "vga.hpp"
|
||||
#include "holly.hpp"
|
||||
#include "holly/core.hpp"
|
||||
#include "holly/core_bits.hpp"
|
||||
@ -12,6 +11,7 @@
|
||||
#include "holly/ta_bits.hpp"
|
||||
#include "holly/region_array.hpp"
|
||||
#include "holly/background.hpp"
|
||||
#include "holly/texture_memory_alloc.hpp"
|
||||
#include "memorymap.hpp"
|
||||
|
||||
#include "serial.hpp"
|
||||
|
@ -176,7 +176,6 @@ void main()
|
||||
|
||||
core_start_render(frame_ix, num_frames);
|
||||
|
||||
v_sync_out();
|
||||
v_sync_in();
|
||||
core_wait_end_of_render_video(frame_ix, num_frames);
|
||||
|
||||
|
@ -105,7 +105,6 @@ void main()
|
||||
vga();
|
||||
|
||||
while (1) {
|
||||
v_sync_out();
|
||||
v_sync_in();
|
||||
do_device_request();
|
||||
};
|
||||
|
@ -4,14 +4,14 @@
|
||||
#include "sh7091_bits.hpp"
|
||||
|
||||
#include "cache.hpp"
|
||||
#include "load.hpp"
|
||||
#include "serial_load.hpp"
|
||||
|
||||
extern uint32_t __bss_link_start __asm("__bss_link_start");
|
||||
extern uint32_t __bss_link_end __asm("__bss_link_end");
|
||||
|
||||
void main()
|
||||
{
|
||||
cache_init();
|
||||
cache::init();
|
||||
|
||||
uint32_t * start = &__bss_link_start;
|
||||
uint32_t * end = &__bss_link_end;
|
||||
|
@ -6,8 +6,13 @@
|
||||
#include "holly.hpp"
|
||||
#include "holly/core.hpp"
|
||||
#include "holly/core_bits.hpp"
|
||||
#include "holly/ta_parameter.hpp"
|
||||
#include "holly/ta_fifo_polygon_converter.hpp"
|
||||
#include "holly/ta_parameter.hpp"
|
||||
#include "holly/ta_bits.hpp"
|
||||
#include "holly/background.hpp"
|
||||
#include "holly/region_array.hpp"
|
||||
#include "holly/texture_memory_alloc.hpp"
|
||||
#include "memorymap.hpp"
|
||||
|
||||
struct vertex {
|
||||
float x;
|
||||
@ -48,34 +53,65 @@ uint32_t transform(uint32_t * ta_parameter_buf)
|
||||
return parameter.offset;
|
||||
}
|
||||
|
||||
void init_texture_memory(const struct opb_size& opb_size)
|
||||
{
|
||||
volatile texture_memory_alloc * mem = reinterpret_cast<volatile texture_memory_alloc *>(texture_memory);
|
||||
|
||||
background_parameter(mem->background);
|
||||
|
||||
region_array2(mem->region_array,
|
||||
(offsetof (struct texture_memory_alloc, object_list)),
|
||||
640 / 32, // width
|
||||
480 / 32, // height
|
||||
opb_size
|
||||
);
|
||||
}
|
||||
|
||||
uint32_t _ta_parameter_buf[((32 + 64 + 32) + 32) / 4];
|
||||
|
||||
void main()
|
||||
{
|
||||
vga();
|
||||
|
||||
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
|
||||
// This is mandatory for ch2-dma to the ta fifo polygon converter.
|
||||
uint32_t * ta_parameter_buf = align_32byte(_ta_parameter_buf);
|
||||
|
||||
constexpr uint32_t ta_alloc = ta_alloc_ctrl::pt_opb::no_list
|
||||
| ta_alloc_ctrl::tm_opb::no_list
|
||||
| ta_alloc_ctrl::t_opb::no_list
|
||||
| ta_alloc_ctrl::om_opb::no_list
|
||||
| ta_alloc_ctrl::o_opb::_16x4byte;
|
||||
|
||||
constexpr struct opb_size opb_size = { .opaque = 16 * 4
|
||||
, .opaque_modifier = 0
|
||||
, .translucent = 0
|
||||
, .translucent_modifier = 0
|
||||
, .punch_through = 0
|
||||
};
|
||||
|
||||
constexpr uint32_t tiles = (640 / 32) * (320 / 32);
|
||||
|
||||
holly.SOFTRESET = softreset::pipeline_soft_reset
|
||||
| softreset::ta_soft_reset;
|
||||
holly.SOFTRESET = 0;
|
||||
|
||||
core_init();
|
||||
core_init_texture_memory();
|
||||
init_texture_memory(opb_size);
|
||||
|
||||
// The address of `ta_parameter_buf` must be a multiple of 32 bytes.
|
||||
// This is mandatory for ch2-dma to the ta fifo polygon converter.
|
||||
uint32_t * ta_parameter_buf = align_32byte(_ta_parameter_buf);
|
||||
uint32_t frame_ix = 0;
|
||||
constexpr uint32_t num_frames = 1;
|
||||
|
||||
while (true) {
|
||||
v_sync_out();
|
||||
v_sync_in();
|
||||
|
||||
ta_polygon_converter_init();
|
||||
ta_polygon_converter_init(opb_size.total() * tiles, ta_alloc);
|
||||
uint32_t ta_parameter_size = transform(ta_parameter_buf);
|
||||
ta_polygon_converter_transfer(ta_parameter_buf, ta_parameter_size);
|
||||
ta_wait_opaque_list();
|
||||
|
||||
constexpr int frame_ix = 0;
|
||||
constexpr int num_frames = 0;
|
||||
core_start_render(frame_ix, num_frames);
|
||||
|
||||
v_sync_in();
|
||||
core_wait_end_of_render_video(frame_ix, num_frames);
|
||||
frame_ix += 1;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,18 @@ uint32_t transform(uint32_t * ta_parameter_buf,
|
||||
uint32_t texture_address = (offsetof (struct texture_memory_alloc, texture));
|
||||
if (translucent) {
|
||||
// translucent untextured
|
||||
parameter.append<global_polygon_type_0>() = global_polygon_type_0();
|
||||
auto polygon = global_polygon_type_0();
|
||||
polygon.parameter_control_word = para_control::para_type::polygon_or_modifier_volume
|
||||
| para_control::list_type::translucent
|
||||
| obj_control::col_type::packed_color
|
||||
| obj_control::gouraud;
|
||||
|
||||
polygon.tsp_instruction_word = tsp_instruction_word::src_alpha_instr::one
|
||||
| tsp_instruction_word::dst_alpha_instr::src_alpha
|
||||
| tsp_instruction_word::fog_control::no_fog
|
||||
| tsp_instruction_word::use_alpha;
|
||||
|
||||
parameter.append<global_polygon_type_0>() = polygon;
|
||||
} else {
|
||||
// opaque textured
|
||||
parameter.append<global_polygon_type_0>() = global_polygon_type_0(texture_address);
|
||||
@ -100,7 +111,6 @@ uint32_t _ta_parameter_buf[((32 * (strip_length + 2)) * 2 + 32) / 4];
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
vga();
|
||||
|
||||
auto src = reinterpret_cast<const uint8_t *>(&_binary_macaw_data_start);
|
||||
@ -154,7 +164,6 @@ void main()
|
||||
|
||||
core_start_render(frame_ix, num_frames);
|
||||
|
||||
v_sync_out();
|
||||
v_sync_in();
|
||||
core_wait_end_of_render_video(frame_ix, num_frames);
|
||||
|
||||
|
@ -174,6 +174,7 @@ struct global_polygon_type_0 {
|
||||
// untextured
|
||||
global_polygon_type_0()
|
||||
: parameter_control_word( para_control::para_type::polygon_or_modifier_volume
|
||||
| para_control::list_type::opaque
|
||||
| obj_control::col_type::packed_color )
|
||||
|
||||
, isp_tsp_instruction_word( isp_tsp_instruction_word::depth_compare_mode::always
|
||||
|
Loading…
x
Reference in New Issue
Block a user