Skip to content

Update DynamicInputTexture v2 documentation - #2

Closed
tauqua wants to merge 10 commits into
iwubcode:dynamic_input_textures_v2from
tauqua:dynamic_input_textures_v2_fix
Closed

tauqua wants to merge 10 commits into
iwubcode:dynamic_input_textures_v2from
tauqua:dynamic_input_textures_v2_fix

Conversation

@tauqua

@tauqua tauqua commented Aug 15, 2021

Copy link
Copy Markdown

I've corrected some typos in the documentation, as well as adding further examples to explain the new features and updating the remaining examples. This is based on my experience building a pack using this spec, so I can also confirm that the new features are working.

@iwubcode
iwubcode force-pushed the dynamic_input_textures_v2 branch from 13b116d to 5181341 Compare August 15, 2021 18:02
@iwubcode

Copy link
Copy Markdown
Owner

Wow. Thank you for doing this! So the feature worked? That's great to hear. I actually hadn't tested it yet...was waiting on finishing up the tool. I plan on getting back to this in the coming months (finishing up a big new feature atm).

I went ahead and merged these changes in (referencing you) and updated the branch to the latest Dolphin. Thanks again.

@iwubcode iwubcode closed this Aug 15, 2021
@tauqua
tauqua deleted the dynamic_input_textures_v2_fix branch August 24, 2021 14:22
iwubcode pushed a commit that referenced this pull request Nov 19, 2022
Let's take advantage of ARM64's input register shifting one last time,
shall we?

Before:
0x1280005b   mov    w27, #-0x3
0x1b1b7f18   mul    w24, w24, w27

After:
0x4b180b18   sub    w24, w24, w24, lsl #2
iwubcode pushed a commit that referenced this pull request Jan 19, 2025
When HLE-ing the apploader, this is necessary to avoid "Error #2"
errors. Homebrew doesn't care.
iwubcode pushed a commit that referenced this pull request May 2, 2025
There's no guarantee that directory initialization has completed by this
point, so we can't safely use NativeLibrary.

I'm making this change because of a crash being reported in Google Play
Console. The exact way it's crashing is mysterious to me, so I'm not
sure if this commit fixes the crash, but I think this commit is
a reasonable change to make even if it doesn't fix the crash. Backtrace
from Google Play Console:

  #00  pc 0x0000000000469074  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/lib/arm64/libmain.so (std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>::pair[abi:nn180000]<char const* const&, char const* const&, 0>(char const* const&, char const* const&)) (BuildId: 64cfebf5b574b6729ebc51799aa94ccc3238cbcc)
  #1  pc 0x0000000000468e9c  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/lib/arm64/libmain.so (std::__ndk1::pair<std::__ndk1::__tree_iterator<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, std::__ndk1::__tree_node<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, void*>*, long>, bool> std::__ndk1::__tree<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, std::__ndk1::__map_value_compare<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, std::__ndk1::less<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>, true>, std::__ndk1::allocator<std::__ndk1::__value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>>>::__emplace_unique_impl<char const* const&, char const* const&>(char const* const&, char const* const&)) (BuildId: 64cfebf5b574b6729ebc51799aa94ccc3238cbcc)
  #2  pc 0x0000000000462f08  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/lib/arm64/libmain.so (Common::Log::LogManager::GetLogTypes()) (BuildId: 64cfebf5b574b6729ebc51799aa94ccc3238cbcc)
  #3  pc 0x000000000044339c  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/lib/arm64/libmain.so (Java_org_dolphinemu_dolphinemu_NativeLibrary_GetLogTypeNames+56) (BuildId: 64cfebf5b574b6729ebc51799aa94ccc3238cbcc)
  #4  pc 0x000000000031456c  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+108)
  #5  pc 0x0000000000781508  /apex/com.android.art/lib64/libart.so (nterp_helper+152)
  dolphin-emu#6  pc 0x00000000002d94d4  /data/app/~~m0kqybFNfeqnDenQFc53XQ==/org.dolphinemu.dolphinemu-Mtaw0lU8DVUQbte2ZjBp3w==/base.apk (org.dolphinemu.dolphinemu.features.settings.ui.SettingsFragmentPresenter.<clinit>+16)
[...]
iwubcode pushed a commit that referenced this pull request Nov 2, 2026
This replaces the old instruction sequence with one that is considerably
shorter. Main ideas are as follows:

 - Use AND with constant mask to isolate the needed bits.
 - Use ORR + LSL/LSR to shift the bits into position and combine in one
   instruction where possible.
 - Red and blue are already sequential, so don't need to wait for the
   byteswap. This is especially handy for red, where the bits are
   already where they need to be.
 - Red and blue can be expanded from 5 to 8 bits together.

Before:

ldurh  w14, [x0, #0x1]
rev16  w14, w14
and    w15, w14, #0x1f
orr    w15, wzr, w15, lsl #3
orr    w15, w15, w15, lsr #5
orr    w16, wzr, w15, lsl dolphin-emu#16
ubfx   w15, w14, #5, dolphin-emu#6
orr    w15, wzr, w15, lsl #2
orr    w15, w15, w15, lsr dolphin-emu#6
orr    w16, w16, w15, lsl dolphin-emu#8
ubfx   w15, w14, dolphin-emu#11, #5
orr    w16, w16, w15, lsl #3
orr    w16, w16, w15, lsr #2
orr    w16, w16, #0xff000000
str    w16, [x1, #0xc]

After:

ldurh  w14, [x0, #0x1]
rev16  w15, w14
bfi    w14, w14, dolphin-emu#11, dolphin-emu#13
and    w16, w14, #0xf800f8
and    w14, w14, #0xe000e0
orr    w16, w16, #0xff000000
orr    w16, w16, w14, lsr #5
and    w14, w15, #0x7e0
and    w15, w15, #0x600
orr    w14, w14, w15, lsr dolphin-emu#6
orr    w16, w16, w14, lsl #5
str    w16, [x1, #0xc]
iwubcode pushed a commit that referenced this pull request Nov 2, 2026
This commit replaces the old instruction sequence with one that is
considerably shorter. Main ideas are as follows:

 - Use AND with constant mask to isolate the needed bits.
 - Use ORR + LSL/LSR to shirt the bits into position and combine in one
   instruction where possible.
 - Red and alpha are already sequential, so don't need to wait for the
   byteswap.
 - Do the expansion from 6 to 8 bits at the end for all 4 components
   in one step.

Before:

ldur   w14, [x0]
rev    w14, w14
ubfx   w15, w14, #0, dolphin-emu#6
orr    w15, wzr, w15, lsl #2
orr    w15, w15, w15, lsr dolphin-emu#6
orr    w16, wzr, w15, lsl dolphin-emu#24
ubfx   w15, w14, dolphin-emu#6, dolphin-emu#6
orr    w15, wzr, w15, lsl #2
orr    w15, w15, w15, lsr dolphin-emu#6
orr    w16, w16, w15, lsl dolphin-emu#16
ubfx   w15, w14, dolphin-emu#12, dolphin-emu#6
orr    w15, wzr, w15, lsl #2
orr    w15, w15, w15, lsr dolphin-emu#6
orr    w16, w16, w15, lsl dolphin-emu#8
ubfx   w15, w14, dolphin-emu#18, dolphin-emu#6
orr    w16, w16, w15, lsl #2
orr    w16, w16, w15, lsr #4
str    w16, [x1, #0xc]

After:

ldur   w14, [x0]
rev    w15, w14
and    w16, w14, #0xfc00
and    w14, w14, #0x3f000000
lsr    w16, w16, dolphin-emu#8
orr    w16, w16, w14, lsl #2
and    w14, w15, #0xfc0
and    w15, w15, #0x3f000
orr    w15, w15, w14, lsl dolphin-emu#14
orr    w16, w16, w15, lsr #2
and    w15, w16, #0xc0c0c0c0
orr    w16, w16, w15, lsr dolphin-emu#6
str    w16, [x1, #0xc]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants