mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
Effects page in the session menu: scaling modes, screen effects and texture filtering (#198)
This commit is contained in:
1 parent
33f7213599
commit
423cf11919
16 files changed
+664
-51
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
|
||||
class TextureFilteringTest {
|
||||
@Test fun autoBiasFollowsFsrGuidanceAndStopsAtNoEnlargement() {
|
||||
assertEquals(0f, TextureFiltering.autoLodBias(1f), 0f)
|
||||
assertEquals(0f, TextureFiltering.autoLodBias(0f), 0f)
|
||||
assertEquals(0f, TextureFiltering.autoLodBias(Float.NaN), 0f)
|
||||
assertEquals(-0.58f, TextureFiltering.autoLodBias(1.5f), 0.01f)
|
||||
assertEquals(-1f, TextureFiltering.autoLodBias(2f), 0.001f)
|
||||
assertEquals(-2f, TextureFiltering.autoLodBias(16f), 0f)
|
||||
}
|
||||
|
||||
@Test fun optionsNameBothApisAndUseDotDecimals() {
|
||||
assertEquals("", TextureFiltering.dxvkOptions(0, TextureFiltering.LOD_BIAS_OFF, -0.58f))
|
||||
assertEquals("d3d9.samplerAnisotropy = 16; d3d11.samplerAnisotropy = 16", TextureFiltering.dxvkOptions(16, "0", 0f))
|
||||
assertEquals(
|
||||
"d3d9.samplerLodBias = -0.58; d3d11.samplerLodBias = -0.58",
|
||||
TextureFiltering.dxvkOptions(0, TextureFiltering.LOD_BIAS_AUTO, -0.58f),
|
||||
)
|
||||
assertEquals(
|
||||
"d3d9.samplerAnisotropy = 8; d3d11.samplerAnisotropy = 8; d3d9.samplerLodBias = -0.50; d3d11.samplerLodBias = -0.50",
|
||||
TextureFiltering.dxvkOptions(8, "-0.5", 0f),
|
||||
)
|
||||
}
|
||||
|
||||
@Test fun unknownValuesLeaveTheGameAlone() {
|
||||
assertEquals("", TextureFiltering.dxvkOptions(3, "junk", 0f))
|
||||
assertEquals("", TextureFiltering.dxvkOptions(0, TextureFiltering.LOD_BIAS_AUTO, 0f))
|
||||
assertEquals("", TextureFiltering.dxvkOptions(0, "0.5", 0f))
|
||||
assertEquals(-2f, TextureFiltering.lodBias("-9", 0f), 0f)
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,26 @@ class GameEnvironmentStoreTest {
|
||||
assertFalse(JSONObject(guest.readText()).getJSONObject("shared").has("FEX_SMCCHECKS"))
|
||||
}
|
||||
|
||||
@Test fun textureFilteringPublishesDxvkOptionsBesideTheProfiles() {
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config(shared = mapOf("DXVK_CONFIG" to "dxvk.tearFree = True")))
|
||||
assertFalse(JSONObject(guest.readText()).has(GameEnvironmentStore.DXVK_CONFIG))
|
||||
SessionState.upscaleRatio = 1.5f
|
||||
SessionPrefs.setTextureAnisotropy(context, 16)
|
||||
SessionPrefs.setTextureLodBias(context, com.droiddeck.launcher.core.TextureFiltering.LOD_BIAS_AUTO)
|
||||
val json = JSONObject(guest.readText())
|
||||
assertEquals(
|
||||
"d3d9.samplerAnisotropy = 16; d3d11.samplerAnisotropy = 16; d3d9.samplerLodBias = -0.58; d3d11.samplerLodBias = -0.58",
|
||||
json.getString(GameEnvironmentStore.DXVK_CONFIG),
|
||||
)
|
||||
// The user's own entry is untouched; the launcher appends the options at launch.
|
||||
assertEquals("dxvk.tearFree = True", json.getJSONObject("shared").getString("DXVK_CONFIG"))
|
||||
assertEquals(GameEnvironment.Config(shared = mapOf("DXVK_CONFIG" to "dxvk.tearFree = True")), GameEnvironmentStore.read(context))
|
||||
SessionPrefs.setTextureAnisotropy(context, 0)
|
||||
SessionPrefs.setTextureLodBias(context, "0")
|
||||
assertFalse(JSONObject(guest.readText()).has(GameEnvironmentStore.DXVK_CONFIG))
|
||||
SessionState.upscaleRatio = 0f
|
||||
}
|
||||
|
||||
@Test fun unchosenFexPresetPublishesPerformanceTso() {
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config())
|
||||
val shared = JSONObject(guest.readText()).getJSONObject("shared")
|
||||
|
||||
Reference in new issue
Block a user