Skip to content

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

Open
@buhman

Description

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggraphicsRendering issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions