Skip to content
Snippets Groups Projects

d3dx9: Rework color key handling.

Open Connor McAdams requested to merge cmcadams/wine:UPSTREAM/d3dx9-color-key-v1 into master
3 unresolved threads

Merge request reports

Members who can merge are allowed to add commits.
Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Matteo Bruni
  • Matteo Bruni
    Matteo Bruni @Mystral started a thread on an outdated change in commit 544a05f3
  • 2208 {
    2209 const uint8_t *dst_expected_row = ((uint8_t *)tests[i].expected_dst_data) + (16 * y);
    2210 const uint8_t *dst_row = ((uint8_t *)lock_rect.pBits) + (lock_rect.Pitch * y);
    2211
    2212 for (x = 0; x < 4; ++x)
    2213 {
    2214 const uint8_t *dst_expected_pixel = dst_expected_row + (4 * x);
    2215 const uint8_t *dst_pixel = dst_row + (4 * x);
    2216
    2217 if (memcmp(dst_pixel, dst_expected_pixel, 4))
    2218 mismatch_count++;
    2219 }
    2220 }
    2221 IDirect3DSurface9_UnlockRect(surf);
    2222
    2223 todo_wine_if(tests[i].todo) ok(!mismatch_count, "Unexpected number of mismatched pixels %u.\n", mismatch_count);
    • Technically you're counting bytes on a 4 byte-per-pixel format, so the message isn't entirely correct 🤓

    • Author Developer

      Erm ackshully I'm checking lines now in the current revision, I'm not sure if that is better or not though so I'll let you mark this as resolved just in case :)

    • Please register or sign in to reply
  • Matteo Bruni
  • Matteo Bruni
    Matteo Bruni @Mystral started a thread on commit 544a05f3
  • 2144
    2145 const void *expected_dst_data;
    2146 D3DCOLOR color_key;
    2147 BOOL todo;
    2148 } tests[] =
    2149 {
    2150 /* Color key with alpha channel unset. */
    2151 {
    2152 D3DFMT_R8G8B8, NULL, { 0, 0, 4, 4 }, r8g8b8_4_4, r8g8b8_4_4_expected, 0x00008080,
    2153 .todo = TRUE
    2154 },
    2155 /* Same color key as before except the alpha channel is set. */
    2156 {
    2157 D3DFMT_R8G8B8, NULL, { 0, 0, 4, 4 }, r8g8b8_4_4, r8g8b8_4_4_expected, 0xff008080,
    2158 .todo = TRUE
    2159 },
    • Comment on lines +2150 to +2159

      I'd be curious to see a test with some pixels matching the color key in the RGB part but not alpha, to make sure that alpha isn't just ignored.

    • Author Developer

      I think I've added tests that do what you're describing here now in tests 7 and 8, but I'll let you mark as resolved just to be sure.

    • Please register or sign in to reply
  • Matteo Bruni
  • Matteo Bruni
    • While reviewing this I did explore the idea of fixing the color key check without moving it to the source format. I'm attaching the result of that here, for reference.

      It's a bunch of debug stuff, test changes, fixes to the color key checks which kinda required splitting up the rgb_range into individual per-component ranges. It's not exactly beautiful or thought out (e.g. I more or less blindly replaced rgb_range with r_range all over the place, which isn't necessarily correct), but I guess it might be somewhat useful.

      d3dx-per-channel-range.txt

      This was on top of commit 3/6

      Edited by Matteo Bruni
    • Author Developer

      This felt a little bit overkill, I've tried a different method in patch 5 that solves the same problem. Let me know what you think :)

    • Please register or sign in to reply
  • Matteo Bruni left review comments

    left review comments

  • Connor McAdams added 6 commits

    added 6 commits

    • 78ce92de - d3dx9: Make functions for pixel copying/conversion/filtering static.
    • d9c4f4e0 - d3dx9: Move code for format conversion of a single pixel into a common helper function.
    • 621d1d66 - d3dx9/tests: Add some color key tests.
    • 4691a6f8 - d3dx9: Set all color channels to zero when color keying.
    • 3768002d - d3dx9: Fixup color key value in d3dx_load_pixels_from_pixels() if necessary.
    • f5378395 - d3dx9: Don't color key compressed pixel formats on 32-bit d3dx9.

    Compare with previous version

  • Please register or sign in to reply
    Loading