Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon "with two volumes" incorrect color palette selection #1528

Open
buhman opened this issue May 25, 2024 · 0 comments
Open

Polygon "with two volumes" incorrect color palette selection #1528

buhman opened this issue May 25, 2024 · 0 comments
Labels
bug Something isn't working graphics Rendering issues

Comments

@buhman
Copy link

buhman commented May 25, 2024

Platform / OS / Hardware: Linux / Dreamcast

Github hash: e85fa82

Hardware: AMD Ryzen 5 4500U with Radeon Graphics / Hitachi SH-4 SH7091 with Holly Graphics

Description of the Issue

Flycast appears to ignore the palette selector from the second texture control word for a "with two volumes" polygon, and instead uses the palette selector from the first texture control word for both textures. Minimal testcase attached.

Debugging Steps Tested

sierpinski.elf.zip

Flycast, running sierpinski.elf, produces this image (incorrect result):

Screenshot from 2024-05-25 17-14-27

Real hardware, running sierpinski.bin, produces this image (expected result):

mpv-shot0020

Specifically, the color/palette of the strawberry texture in the Flycast screenshot is incorrect.

Logs Gathered

Global parameter: polygon type 3
Vertex parameter: polygon type 11

  const uint32_t parameter_control_word = para_control::para_type::polygon_or_modifier_volume
                                        | para_control::list_type::opaque
                                        | obj_control::col_type::packed_color
                                        | obj_control::shadow
                                        | obj_control::volume::polygon::with_two_volumes
                                        | obj_control::texture;

  const uint32_t isp_tsp_instruction_word = isp_tsp_instruction_word::depth_compare_mode::greater
                                          | isp_tsp_instruction_word::culling_mode::no_culling;

  const uint32_t tsp_instruction_word = tsp_instruction_word::src_alpha_instr::one
                                      | tsp_instruction_word::dst_alpha_instr::zero
                                      | tsp_instruction_word::fog_control::no_fog
                                      | tsp_instruction_word::texture_u_size::from_int(1024)
                                      | tsp_instruction_word::texture_v_size::from_int(1024);

  const uint32_t texture_address_0 = texture_memory_alloc::texture.start + 1024 * 1024 * 0;
  const uint32_t texture_control_word_0 = texture_control_word::pixel_format::_8bpp_palette
                                        | texture_control_word::scan_order::twiddled
                                        | texture_control_word::texture_address(texture_address_0 / 8)
                                        | texture_control_word::palette_selector8(0);

  const uint32_t texture_address_1 = texture_memory_alloc::texture.start + 1024 * 1024 * 1;
  const uint32_t texture_control_word_1 = texture_control_word::pixel_format::_8bpp_palette
                                        | texture_control_word::scan_order::twiddled
                                        | texture_control_word::texture_address(texture_address_1 / 8)
                                        | texture_control_word::palette_selector8(1);

Screenshots

(screenshots relocated to description section)

@buhman buhman added the bug Something isn't working label May 25, 2024
@flyinghead flyinghead added the graphics Rendering issues label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working graphics Rendering issues
Projects
None yet
Development

No branches or pull requests

2 participants