From 67a3a141e11e1531a0f5bec4d1d631df97eb71da Mon Sep 17 00:00:00 2001 From: marat569 Date: Fri, 10 Jan 2025 19:43:29 -0500 Subject: [PATCH] Delete src/games/visionsofmana directory --- src/games/visionsofmana/addon.cpp | 328 ---- src/games/visionsofmana/common.hlsl | 118 -- .../lutbuilder1_0xC1BCC6B5.ps_5_1.hlsl | 1481 ---------------- .../lutbuilder2_0xE6EB2840.ps_5_1.hlsl | 1469 ---------------- .../lutbuilder3_0x61C2EA30.ps_5_1.hlsl | 1543 ----------------- .../movies_0x82F9B4AC.ps_5_1.hlsl | 96 - .../sample1_0xBBA0606A.ps_5_1.hlsl | 127 -- .../sandSample_0x3FA88630.ps_5_1.hlsl | 164 -- src/games/visionsofmana/shared.h | 37 - .../swap_chain_proxy_pixel_shader.ps_5_1.hlsl | 17 - ...swap_chain_proxy_vertex_shader.vs_5_1.hlsl | 6 - 11 files changed, 5386 deletions(-) delete mode 100644 src/games/visionsofmana/addon.cpp delete mode 100644 src/games/visionsofmana/common.hlsl delete mode 100644 src/games/visionsofmana/lutbuilder1_0xC1BCC6B5.ps_5_1.hlsl delete mode 100644 src/games/visionsofmana/lutbuilder2_0xE6EB2840.ps_5_1.hlsl delete mode 100644 src/games/visionsofmana/lutbuilder3_0x61C2EA30.ps_5_1.hlsl delete mode 100644 src/games/visionsofmana/movies_0x82F9B4AC.ps_5_1.hlsl delete mode 100644 src/games/visionsofmana/sample1_0xBBA0606A.ps_5_1.hlsl delete mode 100644 src/games/visionsofmana/sandSample_0x3FA88630.ps_5_1.hlsl delete mode 100644 src/games/visionsofmana/shared.h delete mode 100644 src/games/visionsofmana/swap_chain_proxy_pixel_shader.ps_5_1.hlsl delete mode 100644 src/games/visionsofmana/swap_chain_proxy_vertex_shader.vs_5_1.hlsl diff --git a/src/games/visionsofmana/addon.cpp b/src/games/visionsofmana/addon.cpp deleted file mode 100644 index 3bbfb883..00000000 --- a/src/games/visionsofmana/addon.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (C) 2023 Carlos Lopez - * SPDX-License-Identifier: MIT - */ - -#define ImTextureID ImU64 - -#define DEBUG_LEVEL_0 - -// #define DEBUG_LEVEL_1 //added - -#include - -#include -#include - -#include "../../mods/shader.hpp" -#include "../../mods/swapchain.hpp" -#include "../../utils/settings.hpp" -#include "./shared.h" - -namespace { - -renodx::mods::shader::CustomShaders custom_shaders = { - - //// - - // Sample shaders [Depricated] - // CustomShaderEntry(0xBBA0606A), // Sample1 - // Lutbuilders - CustomShaderEntry(0xC1BCC6B5), // Lutbuilder1 - CustomShaderEntry(0xE6EB2840), // Lutbuilder2 - CustomShaderEntry(0x61C2EA30), // Lutbuilder3 - -}; - -ShaderInjectData shader_injection; - -renodx::utils::settings::Settings settings = { - new renodx::utils::settings::Setting{ - .key = "toneMapType", - .binding = &shader_injection.toneMapType, - .value_type = renodx::utils::settings::SettingValueType::INTEGER, - .default_value = 2.f, - .can_reset = false, - .label = "Tone Mapper", - .section = "Tone Mapping", - .tooltip = "Sets the tone mapper type", - .labels = {"Vanilla", "None", "ACES", "RenoDRT"}, - //.is_enabled = []() { return shader_injection.toneMapType != 2; }, - }, - - new renodx::utils::settings::Setting{ - .key = "toneMapPeakNits", - .binding = &shader_injection.toneMapPeakNits, - .default_value = 1000.f, - .can_reset = false, - .label = "Peak Brightness", - .section = "Tone Mapping", - .tooltip = "Sets the value of peak white in nits", - .min = 48.f, - .max = 4000.f, - }, - new renodx::utils::settings::Setting{ - .key = "toneMapGameNits", - .binding = &shader_injection.toneMapGameNits, - .default_value = 203.f, - .label = "Game Brightness", - .section = "Tone Mapping", - .tooltip = "Sets the value of 100%% white in nits", - .min = 48.f, - .max = 500.f, - }, - new renodx::utils::settings::Setting{ - .key = "toneMapUINits", - .binding = &shader_injection.toneMapUINits, - .default_value = 203.f, - .label = "UI Brightness", - .section = "Tone Mapping", - .tooltip = "Sets the brightness of UI and HUD elements in nits", - .min = 48.f, - .max = 500.f, - }, - new renodx::utils::settings::Setting{ - .key = "colorGradeExposure", - .binding = &shader_injection.colorGradeExposure, - .default_value = 1.f, - .label = "Exposure", - .section = "Color Grading", - .max = 10.f, - .format = "%.2f", - }, - new renodx::utils::settings::Setting{ - .key = "colorGradeHighlights", - .binding = &shader_injection.colorGradeHighlights, - .default_value = 50.f, - .label = "Highlights", - .section = "Color Grading", - .max = 100.f, - .parse = [](float value) { return value * 0.02f; }, - }, - new renodx::utils::settings::Setting{ - .key = "colorGradeShadows", - .binding = &shader_injection.colorGradeShadows, - .default_value = 50.f, - .label = "Shadows", - .section = "Color Grading", - .max = 100.f, - .parse = [](float value) { return value * 0.02f; }, - }, - new renodx::utils::settings::Setting{ - .key = "colorGradeContrast", - .binding = &shader_injection.colorGradeContrast, - .default_value = 50.f, - .label = "Contrast", - .section = "Color Grading", - .max = 100.f, - .parse = [](float value) { return value * 0.02f; }, - }, - new renodx::utils::settings::Setting{ - .key = "colorGradeSaturation", - .binding = &shader_injection.colorGradeSaturation, - .default_value = 50.f, - .label = "Saturation", - .section = "Color Grading", - .max = 100.f, - .parse = [](float value) { return value * 0.02f; }, - }, - - new renodx::utils::settings::Setting{ - .key = "colorGradeBlowout", - .binding = &shader_injection.colorGradeBlowout, - .default_value = 50.f, - .label = "Blowout", - .section = "Color Grading", - .tooltip = "Controls highlight desaturation due to overexposure.", - .max = 100.f, - .is_enabled = []() { return shader_injection.toneMapType == 3; }, - .parse = [](float value) { return value * 0.02f - 1.f; }, - }, - - new renodx::utils::settings::Setting{ - .key = "colorGradeFlare", - .binding = &shader_injection.colorGradeFlare, - .default_value = 0.f, - .label = "Flare", - .section = "Color Grading", - .tooltip = "Flare/Glare", - .max = 100.f, - .is_enabled = []() { return shader_injection.toneMapType == 3; }, - .parse = [](float value) { return value * 0.02f; }, - }, - - new renodx::utils::settings::Setting{ - .key = "toneMapHueCorrection", - .binding = &shader_injection.toneMapHueCorrection, - .default_value = 100.f, - .label = "Hue Correction", - .section = "Tone Mapping", - .tooltip = "Emulates Vanilla hue shifts.", - .min = 0.f, - .max = 100.f, - //.is_enabled = []() { return shader_injection.toneMapHueCorrectionMethod != 0; }, - .parse = [](float value) { return value * 0.01f; }, - }, - - new renodx::utils::settings::Setting{ - .value_type = renodx::utils::settings::SettingValueType::TEXT, - .label = " - Please make sure 'Screen Brightness' and 'Field Brightness' are set to default in System Settings/Graphics Settings. \r\n - You can hit 'Revert Category' under Graphics settings to reset said settings to default. \r\n \r\n - Join the HDR Den discord for help!", - .section = "Instructions", - }, - - new renodx::utils::settings::Setting{ - .value_type = renodx::utils::settings::SettingValueType::BUTTON, - .label = "HDR Den Discord", - .section = "About", - .group = "button-line-1", - .tint = 0x5865F2, - .on_change = []() { - static const std::string obfuscated_link = std::string("start https://discord.gg/5WZX") + std::string("DpmbpP"); - system(obfuscated_link.c_str()); - }, - }, - - new renodx::utils::settings::Setting{ - .value_type = renodx::utils::settings::SettingValueType::BUTTON, - .label = "Get more RenoDX mods!", - .section = "About", - .group = "button-line-1", - .tint = 0x5865F2, - .on_change = []() { - system("start https://github.com/clshortfuse/renodx/wiki/Mods"); - }, - }, - - new renodx::utils::settings::Setting{ - .key = "ToneMapPerChannel", - .binding = &shader_injection.toneMapPerChannel, - .value_type = renodx::utils::settings::SettingValueType::INTEGER, - .default_value = 1.f, - .label = "Per Channel", - .section = "Tone Mapping", - .tooltip = "Applies tonemapping per-channel instead of by luminance", - .labels = {"Off", "On"}, - .is_enabled = []() { return shader_injection.toneMapType == 3; }, - }, - - new renodx::utils::settings::Setting{ - .key = "ToneMapHueProcessor", - .binding = &shader_injection.ToneMapHueProcessor, - .value_type = renodx::utils::settings::SettingValueType::INTEGER, - .default_value = 0.f, - .label = "Hue Processor", - .section = "Tone Mapping", - .tooltip = "Selects hue processor", - .labels = {"OKLab", "ICtCp", "darkTable UCS"}, - .is_enabled = []() { return shader_injection.toneMapType == 3; }, - - }, - - new renodx::utils::settings::Setting{ - .key = "ToneMapHueCorrectionMethod", - .binding = &shader_injection.toneMapHueCorrectionMethod, - .value_type = renodx::utils::settings::SettingValueType::INTEGER, - .default_value = 0.f, - .label = "Hue Correction Method", - .section = "Tone Mapping", - .tooltip = "Applies hue shift emulation before tonemapping", - .labels = {"Default", "ACES AP1", "Filmic", "SDR Grade"}, - .is_enabled = []() { return shader_injection.toneMapType == 3; }, - - }, - -}; - -void OnPresetOff() { - renodx::utils::settings::UpdateSetting("toneMapType", 0.f); - renodx::utils::settings::UpdateSetting("toneMapPeakNits", 203.f); - renodx::utils::settings::UpdateSetting("toneMapGameNits", 203.f); - renodx::utils::settings::UpdateSetting("toneMapUINits", 203.f); - renodx::utils::settings::UpdateSetting("toneMapHueCorrection", 0.f); - renodx::utils::settings::UpdateSetting("colorGradeExposure", 1.f); - renodx::utils::settings::UpdateSetting("colorGradeHighlights", 50.f); - renodx::utils::settings::UpdateSetting("colorGradeShadows", 50.f); - renodx::utils::settings::UpdateSetting("colorGradeContrast", 50.f); - renodx::utils::settings::UpdateSetting("colorGradeSaturation", 50.f); - renodx::utils::settings::UpdateSetting("colorGradeBlowout", 0.f); - renodx::utils::settings::UpdateSetting("colorGradeColorSpace", 0.f); -} - -} // namespace - -// NOLINTBEGIN(readability-identifier-naming) - -extern "C" __declspec(dllexport) const char* NAME = "RenoDX"; -extern "C" __declspec(dllexport) const char* DESCRIPTION = "RenoDX for SMT5V"; - -// NOLINTEND(readability-identifier-naming) - -BOOL APIENTRY DllMain(HMODULE h_module, DWORD fdw_reason, LPVOID lpv_reserved) { - switch (fdw_reason) { - case DLL_PROCESS_ATTACH: - if (!reshade::register_addon(h_module)) return FALSE; - renodx::mods::shader::on_init_pipeline_layout = [](reshade::api::device* device, auto, auto) { - return device->get_api() == reshade::api::device_api::d3d12; // So overlays dont kill the game - }; - renodx::mods::shader::expected_constant_buffer_space = 50; // cbuffer slot 50 - // renodx::mods::shader::allow_multiple_push_constants = true; - renodx::mods::swapchain::expected_constant_buffer_space = 50; - - renodx::mods::shader::force_pipeline_cloning = true; // So the mod works with the toolkit - renodx::mods::swapchain::use_resource_cloning = true; // - renodx::mods::swapchain::swapchain_proxy_compatibility_mode = true; - - renodx::mods::swapchain::swap_chain_proxy_vertex_shader = { - _swap_chain_proxy_vertex_shader, - _swap_chain_proxy_vertex_shader + sizeof(_swap_chain_proxy_vertex_shader), - }; - renodx::mods::swapchain::swap_chain_proxy_pixel_shader = { - _swap_chain_proxy_pixel_shader, - _swap_chain_proxy_pixel_shader + sizeof(_swap_chain_proxy_pixel_shader), - }; - - renodx::mods::swapchain::force_borderless = false; // needed for stability - renodx::mods::swapchain::prevent_full_screen = false; // needed for stability - - // //// RGB10_A2 32x32x32 lutbuilder - renodx::mods::swapchain::swap_chain_upgrade_targets.push_back({ - .old_format = reshade::api::format::r10g10b10a2_unorm, - .new_format = reshade::api::format::r16g16b16a16_float, - .ignore_size = true, - .dimensions = {.width = 32, .height = 32, .depth = 32}, - }); - - // renodx::mods::swapchain::swap_chain_upgrade_targets.push_back({ - // .old_format = reshade::api::format::r8g8b8a8_unorm, - // .new_format = reshade::api::format::r16g16b16a16_float, - // }); - - // renodx::mods::swapchain::swap_chain_upgrade_targets.push_back({ - // .old_format = reshade::api::format::b8g8r8a8_unorm, - // .new_format = reshade::api::format::r16g16b16a16_float, - // }); - - // renodx::mods::swapchain::swap_chain_upgrade_targets.push_back({ - // .old_format = reshade::api::format::r8g8b8a8_typeless, - // .new_format = reshade::api::format::r16g16b16a16_float, - // }); - - // renodx::mods::swapchain::swap_chain_upgrade_targets.push_back({ - // .old_format = reshade::api::format::b8g8r8a8_typeless, - // .new_format = reshade::api::format::r16g16b16a16_float, - // }); - - break; - case DLL_PROCESS_DETACH: - reshade::unregister_addon(h_module); - break; - } - - renodx::utils::settings::Use(fdw_reason, &settings, &OnPresetOff); - - renodx::mods::swapchain::Use(fdw_reason, &shader_injection); - - renodx::mods::shader::Use(fdw_reason, custom_shaders, &shader_injection); - - return TRUE; -} diff --git a/src/games/visionsofmana/common.hlsl b/src/games/visionsofmana/common.hlsl deleted file mode 100644 index 6873731f..00000000 --- a/src/games/visionsofmana/common.hlsl +++ /dev/null @@ -1,118 +0,0 @@ -#include "./shared.h" - -// Common functions - -float3 RenoDRTSmoothClamp(float3 untonemapped) { - renodx::tonemap::renodrt::Config renodrt_config = - renodx::tonemap::renodrt::config::Create(); - renodrt_config.nits_peak = 100.f; - renodrt_config.mid_gray_value = 0.18f; - renodrt_config.mid_gray_nits = 18.f; - renodrt_config.exposure = 1.f; - renodrt_config.highlights = 1.f; - renodrt_config.shadows = 1.f; - renodrt_config.contrast = 1.05f; - renodrt_config.saturation = 1.05f; - renodrt_config.dechroma = 0.f; - renodrt_config.flare = 0.f; - renodrt_config.hue_correction_strength = 0.f; - renodrt_config.tone_map_method = - renodx::tonemap::renodrt::config::tone_map_method::DANIELE; - renodrt_config.working_color_space = 2u; - - return renodx::tonemap::renodrt::BT709(untonemapped, renodrt_config); -} -float UpgradeToneMapRatio(float ap1_color_hdr, float ap1_color_sdr, float ap1_post_process_color) { - if (ap1_color_hdr < ap1_color_sdr) { - // If substracting (user contrast or paperwhite) scale down instead - // Should only apply on mismatched HDR - return ap1_color_hdr / ap1_color_sdr; - } else { - float ap1_delta = ap1_color_hdr - ap1_color_sdr; - ap1_delta = max(0, ap1_delta); // Cleans up NaN - const float ap1_new = ap1_post_process_color + ap1_delta; - - const bool ap1_valid = (ap1_post_process_color > 0); // Cleans up NaN and ignore black - return ap1_valid ? (ap1_new / ap1_post_process_color) : 0; - } -} -float3 UpgradeToneMapPerChannel(float3 color_hdr, float3 color_sdr, float3 post_process_color, float post_process_strength) { - // float ratio = 1.f; - - float3 ap1_hdr = max(0, renodx::color::ap1::from::BT709(color_hdr)); - float3 ap1_sdr = max(0, renodx::color::ap1::from::BT709(color_sdr)); - float3 ap1_post_process = max(0, renodx::color::ap1::from::BT709(post_process_color)); - - float3 ratio = float3( - UpgradeToneMapRatio(ap1_hdr.r, ap1_sdr.r, ap1_post_process.r), - UpgradeToneMapRatio(ap1_hdr.g, ap1_sdr.g, ap1_post_process.g), - UpgradeToneMapRatio(ap1_hdr.b, ap1_sdr.b, ap1_post_process.b)); - - float3 color_scaled = max(0, ap1_post_process * ratio); - color_scaled = renodx::color::bt709::from::AP1(color_scaled); - float peak_correction = saturate(1.f - renodx::color::y::from::AP1(ap1_post_process)); - color_scaled = renodx::color::correct::Hue(color_scaled, post_process_color, peak_correction); - return lerp(color_hdr, color_scaled, post_process_strength); -} - -void tonemap(in float3 ap1_graded_color, in float3 ap1_aces_colored, in float3 film_graded_color, in float3 hdr_color, in float3 sdr_color, inout float3 sdr_ap1_color, out float3 final_color) { - float3 bt709_graded_color = renodx::color::bt709::from::AP1(ap1_graded_color); - float3 bt709_aces_color = renodx::color::bt709::from::AP1(ap1_aces_colored); - - float3 neutral_sdr_color = RenoDRTSmoothClamp(bt709_graded_color); - - float3 color_graded = UpgradeToneMapPerChannel(bt709_graded_color, neutral_sdr_color, film_graded_color, 1); - - renodx::tonemap::Config config = renodx::tonemap::config::Create(); - config.type = injectedData.toneMapType; - config.peak_nits = injectedData.toneMapPeakNits; - // config.peak_nits = 10000.f; - config.game_nits = injectedData.toneMapGameNits; - config.gamma_correction = 1.f; - config.exposure = injectedData.colorGradeExposure; - config.highlights = injectedData.colorGradeHighlights; - config.shadows = injectedData.colorGradeShadows; - config.contrast = injectedData.colorGradeContrast; - config.saturation = injectedData.colorGradeSaturation; - - config.reno_drt_highlights = 1.0f; - config.reno_drt_shadows = 1.0f; - config.reno_drt_contrast = 1.05f; - config.reno_drt_saturation = 1.05f; - config.reno_drt_dechroma = 0; - config.reno_drt_blowout = injectedData.colorGradeBlowout; - config.reno_drt_flare = injectedData.colorGradeFlare; - config.reno_drt_working_color_space = 2u; - - if (injectedData.toneMapPerChannel) { - config.reno_drt_per_channel = true; - } - - config.reno_drt_hue_correction_method = (uint)injectedData.ToneMapHueProcessor; - - config.hue_correction_type = - renodx::tonemap::config::hue_correction_type::CUSTOM; - config.hue_correction_strength = injectedData.toneMapHueCorrection; - // config.hue_correction_color = color; - if (injectedData.toneMapHueCorrectionMethod == 1.f) { - config.hue_correction_color = renodx::tonemap::ACESFittedAP1(bt709_graded_color); - } else if (injectedData.toneMapHueCorrectionMethod == 2.f) { - config.hue_correction_color = renodx::tonemap::uncharted2::BT709(bt709_graded_color * 2.f); - } else if (injectedData.toneMapHueCorrectionMethod == 3.f) { - config.hue_correction_color = bt709_aces_color; - } else { - config.hue_correction_type = - renodx::tonemap::config::hue_correction_type::INPUT; - } - - final_color = renodx::tonemap::config::Apply(color_graded, config); -} - -float3 scalePaperWhite(float3 color) { - color = renodx::color::srgb::EncodeSafe(color); - color = renodx::math::PowSafe(color, 2.2f); // - color *= injectedData.toneMapGameNits / injectedData.toneMapUINits; - color = renodx::math::PowSafe(color, 1.f / 2.2f); // - - return color; -} diff --git a/src/games/visionsofmana/lutbuilder1_0xC1BCC6B5.ps_5_1.hlsl b/src/games/visionsofmana/lutbuilder1_0xC1BCC6B5.ps_5_1.hlsl deleted file mode 100644 index 5759d814..00000000 --- a/src/games/visionsofmana/lutbuilder1_0xC1BCC6B5.ps_5_1.hlsl +++ /dev/null @@ -1,1481 +0,0 @@ -// ---- Created with 3Dmigoto v1.3.16 on Thu Sep 5 00:04:50 2024 -// ACES Lutbuilder - -#include "./common.hlsl" -#include "./shared.h" - -cbuffer cb0 : register(b0) { - float4 cb0[67]; -} - -// 3Dmigoto declarations -#define cmp - - -void main( - linear noperspective float2 v0 : TEXCOORD0, - float4 v1 : SV_POSITION0, - uint v2 : SV_RenderTargetArrayIndex0, - out float4 o0 : SV_Target0) { - const float4 icb[] = - { - {-4.000000, -0.718548, -4.970622, 0.808913}, - {-4.000000, 2.081031, -3.029378, 1.191087}, - {-3.157377, 3.668124, -2.126200, 1.568300}, - {-0.485250, 4.000000, -1.510500, 1.948300}, - {1.847732, 4.000000, -1.057800, 2.308300}, - {1.847732, 4.000000, -0.466800, 2.638400}, - {-2.301030, 0.801995, 0.119380, 2.859500}, - {-2.301030, 1.198005, 0.708813, 2.987261}, - {-1.931200, 1.594300, 1.291187, 3.012739}, - {-1.520500, 1.997300, 1.291187, 3.012739}, - {-1.057800, 2.378300, 0, 0}, - {-0.466800, 2.768400, 0, 0}, - {0.119380, 3.051500, 0, 0}, - {0.708813, 3.274629, 0, 0}, - {1.291187, 3.327431, 0, 0}, - {1.291187, 3.327431, 0, 0}}; - float4 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12; - uint4 bitmask, uiDest; - float4 fDest; - - r0.xy = float2(-0.015625, -0.015625) + v0.xy; - r0.xy = float2(1.03225803, 1.03225803) * r0.xy; - r0.z = (uint)v2.x; - r1.z = 0.0322580636 * r0.z; - r0.z = cmp(asuint(cb0[65].z) >= 3); // checks if output device is under 3 (SDR) - r2.xy = log2(r0.xy); - r2.z = log2(r1.z); - r0.xyw = float3(0.0126833133, 0.0126833133, 0.0126833133) * r2.xyz; - r0.xyw = exp2(r0.xyw); - r2.xyz = float3(-0.8359375, -0.8359375, -0.8359375) + r0.xyw; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r0.xyw = -r0.xyw * float3(18.6875, 18.6875, 18.6875) + float3(18.8515625, 18.8515625, 18.8515625); // PQ - r0.xyw = r2.xyz / r0.xyw; - r0.xyw = log2(r0.xyw); - r0.xyw = float3(6.27739477, 6.27739477, 6.27739477) * r0.xyw; - r0.xyw = exp2(r0.xyw); - r0.xyw = float3(100, 100, 100) * r0.xyw; - r1.xy = v0.xy * float2(1.03225803, 1.03225803) + float2(-0.0161290318, -0.0161290318); - r1.xyz = float3(-0.434017599, -0.434017599, -0.434017599) + r1.xyz; - r1.xyz = float3(14, 14, 14) * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = r1.xyz * float3(0.180000007, 0.180000007, 0.180000007) + float3(-0.00266771927, -0.00266771927, -0.00266771927); - - float3 pq_input_color = r0.xyw; - float3 log_input_color = r1.rgb; - - r0.xyz = r0.zzz ? r0.xyw : r1.xyz; - // r0.rgb = pq_input_color; - - float3 lut_input_color = r0.rgb; - - // 709_TO_AP1_MAT - r1.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r0.xyz); - r1.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r0.xyz); - r1.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r0.xyz); - // r1.xyz = ap1 pre gamut expansion - - // Gamut Expansion - // AP1_RGB2Y - r0.x = dot(r1.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); // AP1 pre-gamut expansion - r0.yzw = r1.xyz / r0.xxx; - r0.yzw = float3(-1, -1, -1) + r0.yzw; - r0.y = dot(r0.yzw, r0.yzw); - r0.y = -4 * r0.y; // Gamut expansion has a 4 in it ? - r0.y = exp2(r0.y); - r0.x = r0.x * r0.x; - r0.x = cb0[66].y * r0.x; - r0.x = -4 * r0.x; - r0.x = exp2(r0.x); - r0.xy = float2(1, 1) + -r0.xy; - r0.x = r0.y * r0.x; - // float3x3 Wide_2_XYZ_MAT - r2.x = dot(float3(1.37041271, -0.329291314, -0.0636827648), r1.xyz); - r2.y = dot(float3(-0.0834341869, 1.09709096, -0.0108615728), r1.xyz); - r2.z = dot(float3(-0.0257932581, -0.0986256376, 1.20369434), r1.xyz); - r0.yzw = r2.xyz + -r1.xyz; - r0.xyz = r0.xxx * r0.yzw + r1.xyz; - r0.xyz = cb0[44].yyy ? r1.xyz : r0.xyz; - - // start of nuke color correct - // //ColorCorrectAll - // AP1_RGB2Y - r0.w = dot(r0.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r1.xyzw = cb0[50].xyzw * cb0[45].xyzw; - r2.xyzw = cb0[51].xyzw * cb0[46].xyzw; - r3.xyzw = cb0[52].xyzw * cb0[47].xyzw; - r4.xyzw = cb0[53].xyzw * cb0[48].xyzw; - r5.xyzw = cb0[54].xyzw + cb0[49].xyzw; - r1.xyz = r1.xyz * r1.www; - r0.xyz = r0.xyz + -r0.www; - r1.xyz = r1.xyz * r0.xyz + r0.www; - r1.xyz = max(float3(0, 0, 0), r1.xyz); - r1.xyz = float3(5.55555534, 5.55555534, 5.55555534) * r1.xyz; - r2.xyz = r2.xyz * r2.www; - r1.xyz = log2(r1.xyz); - r1.xyz = r2.xyz * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = float3(0.180000007, 0.180000007, 0.180000007) * r1.xyz; - r2.xyz = r3.xyz * r3.www; - r2.xyz = float3(1, 1, 1) / r2.xyz; - r1.xyz = log2(r1.xyz); - r1.xyz = r2.xyz * r1.xyz; - r1.xyz = exp2(r1.xyz); - r2.xyz = r4.xyz * r4.www; - r3.xyz = r5.xyz + r5.www; - r1.xyz = r1.xyz * r2.xyz + r3.xyz; - r1.w = 1 / cb0[65].x; - r1.w = saturate(r1.w * r0.w); - r2.x = r1.w * -2 + 3; - r1.w = r1.w * r1.w; - r1.w = -r2.x * r1.w + 1; - r2.xyzw = cb0[60].xyzw * cb0[45].xyzw; - r3.xyzw = cb0[61].xyzw * cb0[46].xyzw; - r4.xyzw = cb0[62].xyzw * cb0[47].xyzw; - r5.xyzw = cb0[63].xyzw * cb0[48].xyzw; - r6.xyzw = cb0[64].xyzw + cb0[49].xyzw; - r2.xyz = r2.xyz * r2.www; - r2.xyz = r2.xyz * r0.xyz + r0.www; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r2.xyz = float3(5.55555534, 5.55555534, 5.55555534) * r2.xyz; - r3.xyz = r3.xyz * r3.www; - r2.xyz = log2(r2.xyz); - r2.xyz = r3.xyz * r2.xyz; - r2.xyz = exp2(r2.xyz); - r2.xyz = float3(0.180000007, 0.180000007, 0.180000007) * r2.xyz; - r3.xyz = r4.xyz * r4.www; - r3.xyz = float3(1, 1, 1) / r3.xyz; - r2.xyz = log2(r2.xyz); - r2.xyz = r3.xyz * r2.xyz; - r2.xyz = exp2(r2.xyz); - r3.xyz = r5.xyz * r5.www; - r4.xyz = r6.xyz + r6.www; - r2.xyz = r2.xyz * r3.xyz + r4.xyz; - r2.w = 1 + -cb0[65].y; - r3.x = -cb0[65].y + r0.w; - r2.w = 1 / r2.w; - r2.w = saturate(r3.x * r2.w); - r3.x = r2.w * -2 + 3; - r2.w = r2.w * r2.w; - r3.y = r3.x * r2.w; - r4.xyzw = cb0[55].xyzw * cb0[45].xyzw; - r5.xyzw = cb0[56].xyzw * cb0[46].xyzw; - r6.xyzw = cb0[57].xyzw * cb0[47].xyzw; - r7.xyzw = cb0[58].xyzw * cb0[48].xyzw; - r8.xyzw = cb0[59].xyzw + cb0[49].xyzw; - r4.xyz = r4.xyz * r4.www; - r0.xyz = r4.xyz * r0.xyz + r0.www; - r0.xyz = max(float3(0, 0, 0), r0.xyz); - r0.xyz = float3(5.55555534, 5.55555534, 5.55555534) * r0.xyz; - r4.xyz = r5.xyz * r5.www; - r0.xyz = log2(r0.xyz); - r0.xyz = r4.xyz * r0.xyz; - r0.xyz = exp2(r0.xyz); - r0.xyz = float3(0.180000007, 0.180000007, 0.180000007) * r0.xyz; - r4.xyz = r6.xyz * r6.www; - r4.xyz = float3(1, 1, 1) / r4.xyz; - r0.xyz = log2(r0.xyz); - r0.xyz = r4.xyz * r0.xyz; - r0.xyz = exp2(r0.xyz); - r4.xyz = r7.xyz * r7.www; - r5.xyz = r8.xyz + r8.www; - r0.xyz = r0.xyz * r4.xyz + r5.xyz; - r0.w = 1 + -r1.w; - r0.w = -r3.x * r2.w + r0.w; - r0.xyz = r0.xyz * r0.www; - r0.xyz = r1.xyz * r1.www + r0.xyz; - r0.xyz = r2.xyz * r3.yyy + r0.xyz; - - // End of Color Correct - float3 ap1_graded_color = r0.rgb; - float3 ap1_aces_colored = ap1_graded_color; - - // Try throwing renodx on r0 here? - - // uint output_type = cb0[65].z; - - // uint output_type = cb0[65].z; - uint output_type = 3u; - - float3 sdr_color; - float3 hdr_color; - float3 sdr_ap1_color; - - float FilmBlackClip = cb0[36].w; - float FilmToe = cb0[36].y; - float FilmWhiteClip = cb0[37].x; - float FilmShoulder = cb0[36].z; - - // bool is_hdr = (output_type >= 3u && output_type <= 6u); - bool is_hdr = true; - - // AP1_2_sRGB (4) : Identity (5) - r1.x = dot(float3(1.70505154, -0.621790707, -0.0832583979), r0.xyz); - r1.y = dot(float3(-0.130257145, 1.14080286, -0.0105485283), r0.xyz); - r1.z = dot(float3(-0.0240032747, -0.128968775, 1.15297174), r0.xyz); - if (cb0[44].y != 0) { // if (bUseMobileTonemapper) - r2.x = dot(r1.xyz, cb0[28].xyz); - r2.y = dot(r1.xyz, cb0[29].xyz); - r2.z = dot(r1.xyz, cb0[30].xyz); - r0.w = dot(r1.xyz, cb0[33].xyz); - r0.w = 1 + r0.w; - r0.w = rcp(r0.w); - r3.xyz = cb0[35].xyz * r0.www + cb0[34].xyz; - r2.xyz = r3.xyz * r2.xyz; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r3.xyz = cb0[31].xxx + -r2.xyz; - r3.xyz = max(float3(0, 0, 0), r3.xyz); - r4.xyz = max(cb0[31].zzz, r2.xyz); - r2.xyz = max(cb0[31].xxx, r2.xyz); - r2.xyz = min(cb0[31].zzz, r2.xyz); - r5.xyz = r4.xyz * cb0[32].xxx + cb0[32].yyy; - r4.xyz = cb0[31].www + r4.xyz; - r4.xyz = rcp(r4.xyz); - r6.xyz = cb0[28].www * r3.xyz; - r3.xyz = cb0[31].yyy + r3.xyz; - r3.xyz = rcp(r3.xyz); - r3.xyz = r6.xyz * r3.xyz + cb0[29].www; - r2.xyz = r2.xyz * cb0[30].www + r3.xyz; - r2.xyz = r5.xyz * r4.xyz + r2.xyz; - r2.xyz = float3(-0.00200000009, -0.00200000009, -0.00200000009) + r2.xyz; - - } else { - // Blue correct -- r0 is still ap1, r1 is sRGB - r3.x = dot(float3(0.938639402, 1.02359565e-10, 0.0613606237), r0.xyz); - r3.y = dot(float3(8.36008554e-11, 0.830794156, 0.169205874), r0.xyz); - r3.z = dot(float3(2.13187367e-12, -5.63307213e-12, 1), r0.xyz); - r3.xyz = r3.xyz + -r0.xyz; - r0.xyz = cb0[66].xxx * r3.xyz + r0.xyz; - - ap1_graded_color = r0.xyz; - - // start of film tonemap - // AP1 => AP0 - // start working here - r3.y = dot(float3(0.695452213, 0.140678704, 0.163869068), r0.xyz); - r3.z = dot(float3(0.0447945632, 0.859671116, 0.0955343172), r0.xyz); - r3.w = dot(float3(-0.00552588236, 0.00402521016, 1.00150073), r0.xyz); - r0.w = min(r3.y, r3.z); - r0.w = min(r0.w, r3.w); - r1.w = max(r3.y, r3.z); - r1.w = max(r1.w, r3.w); - r4.xy = max(float2(1.00000001e-10, 0.00999999978), r1.ww); - r0.w = max(1.00000001e-10, r0.w); - r0.w = r4.x + -r0.w; - r0.w = r0.w / r4.y; - r4.xyz = r3.wzy + -r3.zyw; - r4.xy = r4.xy * r3.wz; - r1.w = r4.x + r4.y; - r1.w = r3.y * r4.z + r1.w; - r1.w = sqrt(r1.w); - r2.w = r3.w + r3.z; - r2.w = r2.w + r3.y; - r1.w = r1.w * 1.75 + r2.w; - r2.w = 0.333333343 * r1.w; - r3.x = -0.400000006 + r0.w; - r4.x = 2.5 * r3.x; - r4.x = 1 + -abs(r4.x); - r4.x = max(0, r4.x); - r4.y = cmp(0 < r3.x); - r3.x = cmp(r3.x < 0); - r3.x = (int)-r4.y + (int)r3.x; - r3.x = (int)r3.x; - r4.x = -r4.x * r4.x + 1; - r3.x = r3.x * r4.x + 1; - r3.x = 0.0250000004 * r3.x; - r4.x = cmp(0.159999996 >= r1.w); - r1.w = cmp(r1.w >= 0.479999989); - r2.w = 0.0799999982 / r2.w; - r2.w = -0.5 + r2.w; - r2.w = r3.x * r2.w; - r1.w = r1.w ? 0 : r2.w; - r1.w = r4.x ? r3.x : r1.w; - r1.w = 1 + r1.w; - r4.yzw = r3.yzw * r1.www; - r5.xy = cmp(r4.zw == r4.yz); - r2.w = r5.y ? r5.x : 0; - r3.x = r3.z * r1.w + -r4.w; - r3.x = 1.73205078 * r3.x; - r3.z = r4.y * 2 + -r4.z; - r3.z = -r3.w * r1.w + r3.z; - r3.w = min(abs(r3.x), abs(r3.z)); - r5.x = max(abs(r3.x), abs(r3.z)); - r5.x = 1 / r5.x; - r3.w = r5.x * r3.w; - r5.x = r3.w * r3.w; - r5.y = r5.x * 0.0208350997 + -0.0851330012; - r5.y = r5.x * r5.y + 0.180141002; - r5.y = r5.x * r5.y + -0.330299497; - r5.x = r5.x * r5.y + 0.999866009; - r5.y = r5.x * r3.w; - r5.z = cmp(abs(r3.z) < abs(r3.x)); - r5.y = r5.y * -2 + 1.57079637; - r5.y = r5.z ? r5.y : 0; - r3.w = r3.w * r5.x + r5.y; - r5.x = cmp(r3.z < -r3.z); - r5.x = r5.x ? -3.141593 : 0; - r3.w = r5.x + r3.w; - r5.x = min(r3.x, r3.z); - r3.x = max(r3.x, r3.z); - r3.z = cmp(r5.x < -r5.x); - r3.x = cmp(r3.x >= -r3.x); - r3.x = r3.x ? r3.z : 0; - r3.x = r3.x ? -r3.w : r3.w; - r3.x = 57.2957802 * r3.x; - r2.w = r2.w ? 0 : r3.x; - r3.x = cmp(r2.w < 0); - r3.z = 360 + r2.w; - r2.w = r3.x ? r3.z : r2.w; - r2.w = max(0, r2.w); - r2.w = min(360, r2.w); - r3.x = cmp(180 < r2.w); - r3.z = -360 + r2.w; - r2.w = r3.x ? r3.z : r2.w; - // aces::hueweight (with smoothstep) - r2.w = 0.0148148146 * r2.w; - r2.w = 1 + -abs(r2.w); - r2.w = max(0, r2.w); - r3.x = r2.w * -2 + 3; - r2.w = r2.w * r2.w; - r2.w = r3.x * r2.w; - r2.w = r2.w * r2.w; - r0.w = r2.w * r0.w; - - r1.w = -r3.y * r1.w + 0.0299999993; - r0.w = r1.w * r0.w; - r4.x = r0.w * 0.180000007 + r4.y; - // AP0 => AP1 - r3.x = dot(float3(1.45143926, -0.236510754, -0.214928567), r4.xzw); - r3.y = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r4.xzw); - r3.z = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r4.xzw); - r3.xyz = max(float3(0, 0, 0), r3.xyz); - // AP1_RGB2Y - r0.w = dot(r3.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r3.xyz = r3.xyz + -r0.www; - - r3.xyz = r3.xyz * float3(0.959999979, 0.959999979, 0.959999979) + r0.www; // End of ACES:RRT - - ap1_aces_colored = r3.xyz; - - r4.xy = float2(1, 0.180000007) + cb0[36].ww; - r0.w = -cb0[36].y + r4.x; - r1.w = 1 + cb0[37].x; - r2.w = -cb0[36].z + r1.w; - - // Film Toe > 0.8 - - r3.w = cmp(0.800000012 < cb0[36].y); - r4.xz = float2(0.819999993, 1) + -cb0[36].yy; - r4.xz = r4.xz / cb0[36].xx; - r4.y = r4.y / r0.w; - r4.xw = float2(-0.744727492, -1) + r4.xy; - r4.w = 1 + -r4.w; - r4.y = r4.y / r4.w; - r4.y = log2(r4.y); - r4.y = 0.346573591 * r4.y; - r4.w = r0.w / cb0[36].x; - r4.y = -r4.y * r4.w + -0.744727492; - r3.w = r3.w ? r4.x : r4.y; - r4.x = r4.z + -r3.w; - r4.y = cb0[36].z / cb0[36].x; - r4.y = r4.y + -r4.x; - r3.xyz = log2(r3.xyz); - r5.xyz = float3(0.30103001, 0.30103001, 0.30103001) * r3.xyz; - r4.xzw = r3.xyz * float3(0.30103001, 0.30103001, 0.30103001) + r4.xxx; - r4.xzw = cb0[36].xxx * r4.xzw; - r5.w = r0.w + r0.w; - r6.x = -2 * cb0[36].x; - r0.w = r6.x / r0.w; - r6.xyz = r3.xyz * float3(0.30103001, 0.30103001, 0.30103001) + -r3.www; - r7.xyz = r6.xyz * r0.www; - r7.xyz = float3(1.44269502, 1.44269502, 1.44269502) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r7.xyz = float3(1, 1, 1) + r7.xyz; - r7.xyz = r5.www / r7.xyz; - r7.xyz = -cb0[36].www + r7.xyz; - r0.w = r2.w + r2.w; - r5.w = cb0[36].x + cb0[36].x; - r2.w = r5.w / r2.w; - r3.xyz = r3.xyz * float3(0.30103001, 0.30103001, 0.30103001) + -r4.yyy; - r3.xyz = r3.xyz * r2.www; - r3.xyz = float3(1.44269502, 1.44269502, 1.44269502) * r3.xyz; - r3.xyz = exp2(r3.xyz); - r3.xyz = float3(1, 1, 1) + r3.xyz; - r3.xyz = r0.www / r3.xyz; - r3.xyz = -r3.xyz + r1.www; - r8.xyz = cmp(r5.xyz < r3.www); - r7.xyz = r8.xyz ? r7.xyz : r4.xzw; - r5.xyz = cmp(r4.yyy < r5.xyz); - r3.xyz = r5.xyz ? r3.xyz : r4.xzw; - r0.w = r4.y + -r3.w; - r4.xzw = saturate(r6.xyz / r0.www); - r0.w = cmp(r4.y < r3.w); - r5.xyz = float3(1, 1, 1) + -r4.xzw; - r4.xyz = r0.www ? r5.xyz : r4.xzw; - r5.xyz = -r4.xyz * float3(2, 2, 2) + float3(3, 3, 3); - r4.xyz = r4.xyz * r4.xyz; - r4.xyz = r4.xyz * r5.xyz; - r3.xyz = r3.xyz + -r7.xyz; - r3.xyz = r4.xyz * r3.xyz + r7.xyz; - // AP1_RGB2Y - r0.w = dot(r3.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r3.xyz = r3.xyz + -r0.www; - - r3.xyz = r3.xyz * float3(0.930000007, 0.930000007, 0.930000007) + r0.www; - r3.xyz = max(float3(0, 0, 0), r3.xyz); - sdr_ap1_color = r3.xyz; - - r3.xyz = sdr_ap1_color; - - // lerp untonemapped/tonemapped via ToneCurveAmount - r3.xyz = r3.xyz + -r0.xyz; - r0.xyz = cb0[66].zzz * r3.xyz + r0.xyz; - // BlueBlueCorrectInv - r3.x = dot(float3(1.06537485, 1.44678506e-06, -0.0653710067), r0.xyz); - r3.y = dot(float3(-3.45525592e-07, 1.20366347, -0.203667715), r0.xyz); - r3.z = dot(float3(1.9865448e-08, 2.12079581e-08, 0.999999583), r0.xyz); - r3.xyz = r3.xyz + -r0.xyz; - r0.xyz = cb0[66].xxx * r3.xyz + r0.xyz; - r3.x = dot(float3(1.70505154, -0.621790707, -0.0832583979), r0.xyz); - r3.y = dot(float3(-0.130257145, 1.14080286, -0.0105485283), r0.xyz); - r3.z = dot(float3(-0.0240032747, -0.128968775, 1.15297174), r0.xyz); - r2.xyz = max(float3(0, 0, 0), r3.xyz); // Convert to Target Colorspace ? - } - - // float3 lut_input_color = r2.xyz; (no lut) - - r0.xyz = r2.xyz * r2.xyz; - r2.xyz = cb0[26].yyy * r2.xyz; - r0.xyz = cb0[26].xxx * r0.xyz + r2.xyz; - r0.xyz = cb0[26].zzz + r0.xyz; - r2.xyz = cb0[42].yzw * r0.xyz; - r0.xyz = -r0.xyz * cb0[42].yzw + cb0[43].xyz; - r0.xyz = cb0[43].www * r0.xyz + r2.xyz; - r2.xyz = max(float3(0, 0, 0), r0.xyz); - r2.xyz = log2(r2.xyz); - r2.xyz = cb0[27].yyy * r2.xyz; - r3.xyz = exp2(r2.xyz); - - float3 film_graded_color = r3.rgb; - - if (injectedData.toneMapType != 0.f) { - float3 final_color; - tonemap(ap1_graded_color, ap1_aces_colored, film_graded_color, hdr_color, sdr_color, sdr_ap1_color, final_color); - - final_color.rgb = scalePaperWhite(final_color.rgb); - - // Scale for UE decoding - final_color *= 1.f / 1.05f; - - o0.rgba = float4(final_color.rgb, 0); - - return; - } - - if (cb0[65].z == 0) { // cb0[65].z = output device - r4.xyz = float3(12.9200001, 12.9200001, 12.9200001) * r3.xyz; // BT709 to SRGB - r5.xyz = cmp(r3.xyz >= float3(0.00313066994, 0.00313066994, 0.00313066994)); // Linear=>SRGB - r2.xyz = float3(0.416666657, 0.416666657, 0.416666657) * r2.xyz; // 1/2.4 - r2.xyz = exp2(r2.xyz); - r2.xyz = r2.xyz * float3(1.05499995, 1.05499995, 1.05499995) + float3(-0.0549999997, -0.0549999997, -0.0549999997); // sRGB - r2.xyz = r5.xyz ? r2.xyz : r4.xyz; - - } else { - r4.xyzw = cmp(asint(cb0[65].wwww) == int4(1, 2, 3, 4)); - r5.xyz = r4.www ? float3(1, 0, 0) : float3(1.70505154, -0.621790707, -0.0832583979); - r6.xyz = r4.www ? float3(0, 1, 0) : float3(-0.130257145, 1.14080286, -0.0105485283); - r7.xyz = r4.www ? float3(0, 0, 1) : float3(-0.0240032747, -0.128968775, 1.15297174); - r5.xyz = r4.zzz ? float3(0.695452213, 0.140678704, 0.163869068) : r5.xyz; - r6.xyz = r4.zzz ? float3(0.0447945632, 0.859671116, 0.0955343172) : r6.xyz; - r7.xyz = r4.zzz ? float3(-0.00552588282, 0.00402521016, 1.00150073) : r7.xyz; - r5.xyz = r4.yyy ? float3(1.02579927, -0.0200525094, -0.00577136781) : r5.xyz; - r6.xyz = r4.yyy ? float3(-0.00223502493, 1.00458264, -0.00235231337) : r6.xyz; - r4.yzw = r4.yyy ? float3(-0.00501400325, -0.0252933875, 1.03044021) : r7.xyz; - r5.xyz = r4.xxx ? float3(1.37915885, -0.308850735, -0.0703467429) : r5.xyz; - r6.xyz = r4.xxx ? float3(-0.0693352968, 1.08229232, -0.0129620517) : r6.xyz; - r4.xyz = r4.xxx ? float3(-0.00215925858, -0.0454653986, 1.04775953) : r4.yzw; - r0.w = cmp(asint(cb0[65].z) == 1); - if (r0.w != 0) { // lut sample somewhere here? || tonemap output? - r7.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r3.xyz); - r7.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r3.xyz); - r7.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r3.xyz); - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = max(float3(6.10351999e-05, 6.10351999e-05, 6.10351999e-05), r8.xyz); - r8.xyz = float3(4.5, 4.5, 4.5) * r7.xyz; - r7.xyz = max(float3(0.0179999992, 0.0179999992, 0.0179999992), r7.xyz); - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.449999988, 0.449999988, 0.449999988) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r7.xyz = r7.xyz * float3(1.09899998, 1.09899998, 1.09899998) + float3(-0.0989999995, -0.0989999995, -0.0989999995); - r2.xyz = min(r8.xyz, r7.xyz); - } else { - r7.xyz = cb0[42].yzw * r1.xyz; - r1.xyz = -r1.xyz * cb0[42].yzw + cb0[43].xyz; - r1.xyz = cb0[43].www * r1.xyz + r7.xyz; - r7.xy = cmp(asint(cb0[65].zz) == int2(3, 5)); - r0.w = (int)r7.y | (int)r7.x; - if (r0.w != 0) { - r7.xyz = float3(1.5, 1.5, 1.5) * r1.xyz; - r8.y = dot(float3(0.439700812, 0.382978052, 0.1773348), r7.xyz); - r8.z = dot(float3(0.0897923037, 0.813423157, 0.096761629), r7.xyz); - r8.w = dot(float3(0.0175439864, 0.111544058, 0.870704114), r7.xyz); - r0.w = min(r8.y, r8.z); - r0.w = min(r0.w, r8.w); - r1.w = max(r8.y, r8.z); - r1.w = max(r1.w, r8.w); - r7.xy = max(float2(1.00000001e-10, 0.00999999978), r1.ww); - r0.w = max(1.00000001e-10, r0.w); - r0.w = r7.x + -r0.w; - r0.w = r0.w / r7.y; - r7.xyz = r8.wzy + -r8.zyw; - r7.xy = r8.wz * r7.xy; - r1.w = r7.x + r7.y; - r1.w = r8.y * r7.z + r1.w; - r1.w = sqrt(r1.w); - r2.w = r8.w + r8.z; - r2.w = r2.w + r8.y; - r1.w = r1.w * 1.75 + r2.w; - r2.w = 0.333333343 * r1.w; - r3.w = -0.400000006 + r0.w; - r4.w = 2.5 * r3.w; - r4.w = 1 + -abs(r4.w); - r4.w = max(0, r4.w); - r5.w = cmp(0 < r3.w); - r3.w = cmp(r3.w < 0); - r3.w = (int)-r5.w + (int)r3.w; - r3.w = (int)r3.w; - r4.w = -r4.w * r4.w + 1; - r3.w = r3.w * r4.w + 1; - r3.w = 0.0250000004 * r3.w; - r4.w = cmp(0.159999996 >= r1.w); - r1.w = cmp(r1.w >= 0.479999989); - r2.w = 0.0799999982 / r2.w; - r2.w = -0.5 + r2.w; - r2.w = r3.w * r2.w; - r1.w = r1.w ? 0 : r2.w; - r1.w = r4.w ? r3.w : r1.w; - r1.w = 1 + r1.w; - r7.yzw = r8.yzw * r1.www; - r9.xy = cmp(r7.zw == r7.yz); - r2.w = r9.y ? r9.x : 0; - r3.w = r8.z * r1.w + -r7.w; - r3.w = 1.73205078 * r3.w; - r4.w = r7.y * 2 + -r7.z; - r4.w = -r8.w * r1.w + r4.w; - r5.w = min(abs(r4.w), abs(r3.w)); - r6.w = max(abs(r4.w), abs(r3.w)); - r6.w = 1 / r6.w; - r5.w = r6.w * r5.w; - r6.w = r5.w * r5.w; - r8.x = r6.w * 0.0208350997 + -0.0851330012; - r8.x = r6.w * r8.x + 0.180141002; - r8.x = r6.w * r8.x + -0.330299497; - r6.w = r6.w * r8.x + 0.999866009; - r8.x = r6.w * r5.w; - r8.z = cmp(abs(r4.w) < abs(r3.w)); - r8.x = r8.x * -2 + 1.57079637; - r8.x = r8.z ? r8.x : 0; - r5.w = r5.w * r6.w + r8.x; - r6.w = cmp(r4.w < -r4.w); - r6.w = r6.w ? -3.141593 : 0; - r5.w = r6.w + r5.w; - r6.w = min(r4.w, r3.w); - r3.w = max(r4.w, r3.w); - r4.w = cmp(r6.w < -r6.w); - r3.w = cmp(r3.w >= -r3.w); - r3.w = r3.w ? r4.w : 0; - r3.w = r3.w ? -r5.w : r5.w; - r3.w = 57.2957802 * r3.w; - r2.w = r2.w ? 0 : r3.w; - r3.w = cmp(r2.w < 0); - r4.w = 360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r2.w = max(0, r2.w); - r2.w = min(360, r2.w); - r3.w = cmp(180 < r2.w); - r4.w = -360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r3.w = cmp(-67.5 < r2.w); - r4.w = cmp(r2.w < 67.5); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r2.w = 67.5 + r2.w; - r3.w = 0.0296296291 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r2.w = r2.w * 0.0296296291 + -r3.w; - r3.w = r2.w * r2.w; - r5.w = r3.w * r2.w; - r8.xzw = float3(-0.166666672, -0.5, 0.166666672) * r5.www; - r8.xz = r3.ww * float2(0.5, 0.5) + r8.xz; // float2 UV = InUV - float2(0.5f / LUTSize, 0.5f / LUTSize); - r8.xz = r2.ww * float2(-0.5, 0.5) + r8.xz; - r2.w = r5.w * 0.5 + -r3.w; - r2.w = 0.666666687 + r2.w; - r9.xyz = cmp((int3)r4.www == int3(3, 2, 1)); - r8.xz = float2(0.166666672, 0.166666672) + r8.xz; - r3.w = r4.w ? 0 : r8.w; - r3.w = r9.z ? r8.z : r3.w; - r2.w = r9.y ? r2.w : r3.w; - r2.w = r9.x ? r8.x : r2.w; - } else { - r2.w = 0; - } - r0.w = r2.w * r0.w; - r0.w = 1.5 * r0.w; - r1.w = -r8.y * r1.w + 0.0299999993; - r0.w = r1.w * r0.w; - r7.x = r0.w * 0.180000007 + r7.y; - r7.xyz = max(float3(0, 0, 0), r7.xzw); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r8.x = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r8.y = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r8.z = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r7.xyz = max(float3(0, 0, 0), r8.xyz); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - // AP1_RGB2Y - r0.w = dot(r7.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r7.xyz = r7.xyz + -r0.www; - // RRT_SAT_FACTOR (0.96) - r7.xyz = r7.xyz * float3(0.959999979, 0.959999979, 0.959999979) + r0.www; - r8.xyz = cmp(float3(0, 0, 0) >= r7.xyz); - r7.xyz = log2(r7.xyz); - r7.xyz = r8.xyz ? float3(-14, -14, -14) : r7.xyz; - r8.xyz = cmp(float3(-17.4739323, -17.4739323, -17.4739323) >= r7.xyz); - if (r8.x != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.x); - r2.w = cmp(r7.x < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.664385557 + -r2.w; - r8.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r8.x + 0].x; - r10.z = icb[r8.w + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r1.w = cmp(r7.x >= -2.47393107); - r2.w = cmp(r7.x < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.553654671 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r7.x + 0].y; - r10.z = icb[r7.w + 0].y; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.x = exp2(r0.w); - if (r8.y != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.y); - r2.w = cmp(r7.y < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.664385557 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].x; - r11.y = icb[r7.x + 0].x; - r11.z = icb[r7.w + 0].x; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r1.w = cmp(r7.y >= -2.47393107); - r2.w = cmp(r7.y < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.553654671 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].y; - r11.y = icb[r7.x + 0].y; - r11.z = icb[r7.y + 0].y; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.y = exp2(r0.w); - if (r8.z != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.z); - r2.w = cmp(r7.z < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r8.y = r1.w * 0.664385557 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r7.x + 0].x; - r10.z = icb[r7.y + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r0.w = dot(r8.xyz, r11.xyz); - } else { - r1.w = cmp(r7.z >= -2.47393107); - r2.w = cmp(r7.z < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r7.y = r1.w * 0.553654671 + -r2.w; - r8.xy = (int2)r3.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r8.x + 0].y; - r10.z = icb[r8.y + 0].y; - r8.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r10.xy, float2(-1, 1)); - r8.z = dot(r10.xy, float2(0.5, 0.5)); - r7.z = 1; - r0.w = dot(r7.xyz, r8.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.z = exp2(r0.w); - r7.x = dot(float3(0.695452213, 0.140678704, 0.163869068), r9.xyz); - r7.y = dot(float3(0.0447945632, 0.859671116, 0.0955343172), r9.xyz); - r7.z = dot(float3(-0.00552588282, 0.00402521016, 1.00150073), r9.xyz); - r0.w = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r1.w = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r2.w = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r3.w = cmp(0 >= r0.w); - r0.w = log2(r0.w); - r0.w = r3.w ? -13.2877121 : r0.w; - r3.w = cmp(-12.7838678 >= r0.w); - if (r3.w != 0) { - r3.w = r0.w * 0.90309 + 7.54498291; - } else { - r4.w = cmp(-12.7838678 < r0.w); - r5.w = cmp(r0.w < 2.26303458); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + 3.84832764; - r5.w = 1.54540098 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 1.54540098 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 0].z; - r9.y = icb[r8.x + 0].z; - r9.z = icb[r8.y + 0].z; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r4.w = cmp(r0.w >= 2.26303458); - r5.w = cmp(r0.w < 12.1373367); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + -0.681241274; - r5.w = 2.3549509 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 2.3549509 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 0].w; - r9.y = icb[r8.x + 0].w; - r9.z = icb[r8.y + 0].w; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r3.w = r0.w * 0.0180617999 + 2.78077793; - } - } - } - r0.w = 3.32192802 * r3.w; - r7.x = exp2(r0.w); - r0.w = cmp(0 >= r1.w); - r1.w = log2(r1.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = r0.w * 0.90309 + 7.54498291; - } else { - r3.w = cmp(-12.7838678 < r0.w); - r4.w = cmp(r0.w < 2.26303458); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + 3.84832764; - r4.w = 1.54540098 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 1.54540098 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 0].z; - r10.y = icb[r9.x + 0].z; - r10.z = icb[r9.y + 0].z; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r3.w = cmp(r0.w >= 2.26303458); - r4.w = cmp(r0.w < 12.1373367); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + -0.681241274; - r4.w = 2.3549509 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 2.3549509 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 0].w; - r10.y = icb[r9.x + 0].w; - r10.z = icb[r9.y + 0].w; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0180617999 + 2.78077793; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.y = exp2(r0.w); - r0.w = cmp(0 >= r2.w); - r1.w = log2(r2.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = r0.w * 0.90309 + 7.54498291; - } else { - r2.w = cmp(-12.7838678 < r0.w); - r3.w = cmp(r0.w < 2.26303458); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + 3.84832764; - r3.w = 1.54540098 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 1.54540098 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 0].z; - r10.y = icb[r9.x + 0].z; - r10.z = icb[r9.y + 0].z; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r2.w = cmp(r0.w >= 2.26303458); - r3.w = cmp(r0.w < 12.1373367); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + -0.681241274; - r3.w = 2.3549509 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 2.3549509 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 0].w; - r10.y = icb[r9.x + 0].w; - r10.z = icb[r9.y + 0].w; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0180617999 + 2.78077793; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.z = exp2(r0.w); - r7.xyz = float3(-3.50738446e-05, -3.50738446e-05, -3.50738446e-05) + r7.xyz; - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = float3(9.99999975e-05, 9.99999975e-05, 9.99999975e-05) * r8.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.159301758, 0.159301758, 0.159301758) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r8.xyz = r7.xyz * float3(18.8515625, 18.8515625, 18.8515625) + float3(0.8359375, 0.8359375, 0.8359375); - r7.xyz = r7.xyz * float3(18.6875, 18.6875, 18.6875) + float3(1, 1, 1); - r7.xyz = rcp(r7.xyz); - r7.xyz = r8.xyz * r7.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(78.84375, 78.84375, 78.84375) * r7.xyz; - r2.xyz = exp2(r7.xyz); - - } else { - r7.xy = cmp(asint(cb0[65].zz) == int2(4, 6)); - r0.w = (int)r7.y | (int)r7.x; - if (r0.w != 0) { - r7.xyz = float3(1.5, 1.5, 1.5) * r1.xyz; - r8.y = dot(float3(0.439700812, 0.382978052, 0.1773348), r7.xyz); - r8.z = dot(float3(0.0897923037, 0.813423157, 0.096761629), r7.xyz); - r8.w = dot(float3(0.0175439864, 0.111544058, 0.870704114), r7.xyz); - r0.w = min(r8.y, r8.z); - r0.w = min(r0.w, r8.w); - r1.w = max(r8.y, r8.z); - r1.w = max(r1.w, r8.w); - r7.xy = max(float2(1.00000001e-10, 0.00999999978), r1.ww); - r0.w = max(1.00000001e-10, r0.w); - r0.w = r7.x + -r0.w; - r0.w = r0.w / r7.y; - r7.xyz = r8.wzy + -r8.zyw; - r7.xy = r8.wz * r7.xy; - r1.w = r7.x + r7.y; - r1.w = r8.y * r7.z + r1.w; - r1.w = sqrt(r1.w); - r2.w = r8.w + r8.z; - r2.w = r2.w + r8.y; - r1.w = r1.w * 1.75 + r2.w; - r2.w = 0.333333343 * r1.w; - r3.w = -0.400000006 + r0.w; - r4.w = 2.5 * r3.w; - r4.w = 1 + -abs(r4.w); - r4.w = max(0, r4.w); - r5.w = cmp(0 < r3.w); - r3.w = cmp(r3.w < 0); - r3.w = (int)-r5.w + (int)r3.w; - r3.w = (int)r3.w; - r4.w = -r4.w * r4.w + 1; - r3.w = r3.w * r4.w + 1; - r3.w = 0.0250000004 * r3.w; - r4.w = cmp(0.159999996 >= r1.w); - r1.w = cmp(r1.w >= 0.479999989); - r2.w = 0.0799999982 / r2.w; - r2.w = -0.5 + r2.w; - r2.w = r3.w * r2.w; - r1.w = r1.w ? 0 : r2.w; - r1.w = r4.w ? r3.w : r1.w; - r1.w = 1 + r1.w; - r7.yzw = r8.yzw * r1.www; - r9.xy = cmp(r7.zw == r7.yz); - r2.w = r9.y ? r9.x : 0; - r3.w = r8.z * r1.w + -r7.w; - r3.w = 1.73205078 * r3.w; - r4.w = r7.y * 2 + -r7.z; - r4.w = -r8.w * r1.w + r4.w; - r5.w = min(abs(r4.w), abs(r3.w)); - r6.w = max(abs(r4.w), abs(r3.w)); - r6.w = 1 / r6.w; - r5.w = r6.w * r5.w; - r6.w = r5.w * r5.w; - r8.x = r6.w * 0.0208350997 + -0.0851330012; - r8.x = r6.w * r8.x + 0.180141002; - r8.x = r6.w * r8.x + -0.330299497; - r6.w = r6.w * r8.x + 0.999866009; - r8.x = r6.w * r5.w; - r8.z = cmp(abs(r4.w) < abs(r3.w)); - r8.x = r8.x * -2 + 1.57079637; - r8.x = r8.z ? r8.x : 0; - r5.w = r5.w * r6.w + r8.x; - r6.w = cmp(r4.w < -r4.w); - r6.w = r6.w ? -3.141593 : 0; - r5.w = r6.w + r5.w; - r6.w = min(r4.w, r3.w); - r3.w = max(r4.w, r3.w); - r4.w = cmp(r6.w < -r6.w); - r3.w = cmp(r3.w >= -r3.w); - r3.w = r3.w ? r4.w : 0; - r3.w = r3.w ? -r5.w : r5.w; - r3.w = 57.2957802 * r3.w; - r2.w = r2.w ? 0 : r3.w; - r3.w = cmp(r2.w < 0); - r4.w = 360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r2.w = max(0, r2.w); - r2.w = min(360, r2.w); - r3.w = cmp(180 < r2.w); - r4.w = -360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r3.w = cmp(-67.5 < r2.w); - r4.w = cmp(r2.w < 67.5); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r2.w = 67.5 + r2.w; - r3.w = 0.0296296291 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r2.w = r2.w * 0.0296296291 + -r3.w; - r3.w = r2.w * r2.w; - r5.w = r3.w * r2.w; - r8.xzw = float3(-0.166666672, -0.5, 0.166666672) * r5.www; - r8.xz = r3.ww * float2(0.5, 0.5) + r8.xz; - r8.xz = r2.ww * float2(-0.5, 0.5) + r8.xz; - r2.w = r5.w * 0.5 + -r3.w; - r2.w = 0.666666687 + r2.w; - r9.xyz = cmp((int3)r4.www == int3(3, 2, 1)); - r8.xz = float2(0.166666672, 0.166666672) + r8.xz; - r3.w = r4.w ? 0 : r8.w; - r3.w = r9.z ? r8.z : r3.w; - r2.w = r9.y ? r2.w : r3.w; - r2.w = r9.x ? r8.x : r2.w; - } else { - r2.w = 0; - } - r0.w = r2.w * r0.w; - r0.w = 1.5 * r0.w; - r1.w = -r8.y * r1.w + 0.0299999993; - r0.w = r1.w * r0.w; - r7.x = r0.w * 0.180000007 + r7.y; - r7.xyz = max(float3(0, 0, 0), r7.xzw); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r8.x = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r8.y = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r8.z = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r7.xyz = max(float3(0, 0, 0), r8.xyz); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - // AP1_RGB2Y - r0.w = dot(r7.xyz, float3(0.93008718, 0.674081743, 0.0536895171)); - r7.xyz = r7.xyz + -r0.www; - r7.xyz = r7.xyz * float3(0.959999979, 0.959999979, 0.959999979) + r0.www; - r8.xyz = cmp(float3(0, 0, 0) >= r7.xyz); - r7.xyz = log2(r7.xyz); - r7.xyz = r8.xyz ? float3(-14, -14, -14) : r7.xyz; - r8.xyz = cmp(float3(-17.4739323, -17.4739323, -17.4739323) >= r7.xyz); - if (r8.x != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.x); - r2.w = cmp(r7.x < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.664385557 + -r2.w; - r8.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r8.x + 0].x; - r10.z = icb[r8.w + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r1.w = cmp(r7.x >= -2.47393107); - r2.w = cmp(r7.x < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.553654671 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r7.x + 0].y; - r10.z = icb[r7.w + 0].y; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.x = exp2(r0.w); - if (r8.y != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.y); - r2.w = cmp(r7.y < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.664385557 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].x; - r11.y = icb[r7.x + 0].x; - r11.z = icb[r7.w + 0].x; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r1.w = cmp(r7.y >= -2.47393107); - r2.w = cmp(r7.y < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.553654671 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].y; - r11.y = icb[r7.x + 0].y; - r11.z = icb[r7.y + 0].y; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.y = exp2(r0.w); - if (r8.z != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.z); - r2.w = cmp(r7.z < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r8.y = r1.w * 0.664385557 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r7.x + 0].x; - r10.z = icb[r7.y + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r0.w = dot(r8.xyz, r11.xyz); - } else { - r1.w = cmp(r7.z >= -2.47393107); - r2.w = cmp(r7.z < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r7.y = r1.w * 0.553654671 + -r2.w; - r8.xy = (int2)r3.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r8.x + 0].y; - r10.z = icb[r8.y + 0].y; - r8.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r10.xy, float2(-1, 1)); - r8.z = dot(r10.xy, float2(0.5, 0.5)); - r7.z = 1; - r0.w = dot(r7.xyz, r8.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.z = exp2(r0.w); - r7.x = dot(float3(0.695452213, 0.140678704, 0.163869068), r9.xyz); - r7.y = dot(float3(0.0447945632, 0.859671116, 0.0955343172), r9.xyz); - r7.z = dot(float3(-0.00552588282, 0.00402521016, 1.00150073), r9.xyz); - r0.w = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r1.w = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r2.w = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r3.w = cmp(0 >= r0.w); - r0.w = log2(r0.w); - r0.w = r3.w ? -13.2877121 : r0.w; - r3.w = cmp(-12.7838678 >= r0.w); - if (r3.w != 0) { - r3.w = -2.30102992; - } else { - r4.w = cmp(-12.7838678 < r0.w); - r5.w = cmp(r0.w < 2.26303458); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + 3.84832764; - r5.w = 1.54540098 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 1.54540098 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 6].x; - r9.y = icb[r8.x + 6].x; - r9.z = icb[r8.y + 6].x; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r4.w = cmp(r0.w >= 2.26303458); - r5.w = cmp(r0.w < 12.4948215); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + -0.681241274; - r5.w = 2.27267218 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 2.27267218 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 6].y; - r9.y = icb[r8.x + 6].y; - r9.z = icb[r8.y + 6].y; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r3.w = r0.w * 0.0361235999 + 2.84967208; - } - } - } - r0.w = 3.32192802 * r3.w; - r7.x = exp2(r0.w); - r0.w = cmp(0 >= r1.w); - r1.w = log2(r1.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = -2.30102992; - } else { - r3.w = cmp(-12.7838678 < r0.w); - r4.w = cmp(r0.w < 2.26303458); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + 3.84832764; - r4.w = 1.54540098 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 1.54540098 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 6].x; - r10.y = icb[r9.x + 6].x; - r10.z = icb[r9.y + 6].x; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r3.w = cmp(r0.w >= 2.26303458); - r4.w = cmp(r0.w < 12.4948215); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + -0.681241274; - r4.w = 2.27267218 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 2.27267218 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 6].y; - r10.y = icb[r9.x + 6].y; - r10.z = icb[r9.y + 6].y; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0361235999 + 2.84967208; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.y = exp2(r0.w); - r0.w = cmp(0 >= r2.w); - r1.w = log2(r2.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = -2.30102992; - } else { - r2.w = cmp(-12.7838678 < r0.w); - r3.w = cmp(r0.w < 2.26303458); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + 3.84832764; - r3.w = 1.54540098 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 1.54540098 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 6].x; - r10.y = icb[r9.x + 6].x; - r10.z = icb[r9.y + 6].x; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r2.w = cmp(r0.w >= 2.26303458); - r3.w = cmp(r0.w < 12.4948215); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + -0.681241274; - r3.w = 2.27267218 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 2.27267218 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 6].y; - r10.y = icb[r9.x + 6].y; - r10.z = icb[r9.y + 6].y; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0361235999 + 2.84967208; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.z = exp2(r0.w); - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = float3(9.99999975e-05, 9.99999975e-05, 9.99999975e-05) * r8.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.159301758, 0.159301758, 0.159301758) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r8.xyz = r7.xyz * float3(18.8515625, 18.8515625, 18.8515625) + float3(0.8359375, 0.8359375, 0.8359375); - r7.xyz = r7.xyz * float3(18.6875, 18.6875, 18.6875) + float3(1, 1, 1); - r7.xyz = rcp(r7.xyz); - r7.xyz = r8.xyz * r7.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(78.84375, 78.84375, 78.84375) * r7.xyz; - r2.xyz = exp2(r7.xyz); - - } else { - r0.w = cmp(asint(cb0[65].z) == 7); - if (r0.w != 0) { - r7.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r1.xyz); - r7.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r1.xyz); - r7.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r1.xyz); - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = float3(9.99999975e-05, 9.99999975e-05, 9.99999975e-05) * r8.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.159301758, 0.159301758, 0.159301758) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r8.xyz = r7.xyz * float3(18.8515625, 18.8515625, 18.8515625) + float3(0.8359375, 0.8359375, 0.8359375); - r7.xyz = r7.xyz * float3(18.6875, 18.6875, 18.6875) + float3(1, 1, 1); - r7.xyz = rcp(r7.xyz); - r7.xyz = r8.xyz * r7.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(78.84375, 78.84375, 78.84375) * r7.xyz; - r2.xyz = exp2(r7.xyz); - - } else { - r7.xy = cmp(asint(cb0[65].zz) == int2(8, 9)); - r8.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r0.xyz); - r8.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r0.xyz); - r8.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r0.xyz); - r0.x = dot(r5.xyz, r8.xyz); - r0.y = dot(r6.xyz, r8.xyz); - r0.z = dot(r4.xyz, r8.xyz); - r8.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r3.xyz); - r8.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r3.xyz); - r8.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r3.xyz); - r0.w = dot(r5.xyz, r8.xyz); - r1.w = dot(r6.xyz, r8.xyz); - r2.w = dot(r4.xyz, r8.xyz); - r3.x = log2(r0.w); - r3.y = log2(r1.w); - r3.z = log2(r2.w); - r3.xyz = cb0[27].zzz * r3.xyz; - r3.xyz = exp2(r3.xyz); - r0.xyz = r7.yyy ? r0.xyz : r3.xyz; - r2.xyz = r7.xxx ? r1.xyz : r0.xyz; - } - } - } - } - } - o0.xyz = float3(0.952381015, 0.952381015, 0.952381015) * r2.xyz; - o0.w = 0; - - return; -} \ No newline at end of file diff --git a/src/games/visionsofmana/lutbuilder2_0xE6EB2840.ps_5_1.hlsl b/src/games/visionsofmana/lutbuilder2_0xE6EB2840.ps_5_1.hlsl deleted file mode 100644 index 28b60cca..00000000 --- a/src/games/visionsofmana/lutbuilder2_0xE6EB2840.ps_5_1.hlsl +++ /dev/null @@ -1,1469 +0,0 @@ -// ---- Created with 3Dmigoto v1.3.16 on Sun Sep 29 01:17:09 2024 -// Lutbuilder 2, Tokyo -#include "./common.hlsl" - -#include "./shared.h" - -Texture2D t0 : register(t0); - -SamplerState s0_s : register(s0); - -cbuffer cb0 : register(b0) { - float4 cb0[67]; -} - -// 3Dmigoto declarations -#define cmp - - -void main( - linear noperspective float2 v0 : TEXCOORD0, - float4 v1 : SV_POSITION0, - uint v2 : SV_RenderTargetArrayIndex0, - out float4 o0 : SV_Target0) { - const float4 icb[] = { - {-4.000000, -0.718548, -4.970622, 0.808913}, - {-4.000000, 2.081031, -3.029378, 1.191087}, - {-3.157377, 3.668124, -2.126200, 1.568300}, - {-0.485250, 4.000000, -1.510500, 1.948300}, - {1.847732, 4.000000, -1.057800, 2.308300}, - {1.847732, 4.000000, -0.466800, 2.638400}, - {-2.301030, 0.801995, 0.119380, 2.859500}, - {-2.301030, 1.198005, 0.708813, 2.987261}, - {-1.931200, 1.594300, 1.291187, 3.012739}, - {-1.520500, 1.997300, 1.291187, 3.012739}, - {-1.057800, 2.378300, 0, 0}, - {-0.466800, 2.768400, 0, 0}, - {0.119380, 3.051500, 0, 0}, - {0.708813, 3.274629, 0, 0}, - {1.291187, 3.327431, 0, 0}, - {1.291187, 3.327431, 0, 0}}; - float4 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12; - uint4 bitmask, uiDest; - float4 fDest; - - r0.xy = float2(-0.015625, -0.015625) + v0.xy; - r0.xy = float2(1.03225803, 1.03225803) * r0.xy; - r0.z = (uint)v2.x; - r1.z = 0.0322580636 * r0.z; - r0.z = cmp(asuint(cb0[65].z) >= 3); - r2.xy = log2(r0.xy); - r2.z = log2(r1.z); - r0.xyw = float3(0.0126833133, 0.0126833133, 0.0126833133) * r2.xyz; - r0.xyw = exp2(r0.xyw); - r2.xyz = float3(-0.8359375, -0.8359375, -0.8359375) + r0.xyw; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r0.xyw = -r0.xyw * float3(18.6875, 18.6875, 18.6875) + float3(18.8515625, 18.8515625, 18.8515625); - r0.xyw = r2.xyz / r0.xyw; - r0.xyw = log2(r0.xyw); - r0.xyw = float3(6.27739477, 6.27739477, 6.27739477) * r0.xyw; - r0.xyw = exp2(r0.xyw); - r0.xyw = float3(100, 100, 100) * r0.xyw; - r1.xy = v0.xy * float2(1.03225803, 1.03225803) + float2(-0.0161290318, -0.0161290318); - r1.xyz = float3(-0.434017599, -0.434017599, -0.434017599) + r1.xyz; - r1.xyz = float3(14, 14, 14) * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = r1.xyz * float3(0.180000007, 0.180000007, 0.180000007) + float3(-0.00266771927, -0.00266771927, -0.00266771927); - - float3 pq_input_color = r0.xyw; - float3 log_input_color = r1.rgb; - - r0.xyz = r0.zzz ? r0.xyw : r1.xyz; - // r0.rgb = pq_input_color; - - float3 lut_input_color = r0.rgb; - - r1.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r0.xyz); - r1.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r0.xyz); - r1.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r0.xyz); - r0.x = dot(r1.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r0.yzw = r1.xyz / r0.xxx; - r0.yzw = float3(-1, -1, -1) + r0.yzw; - r0.y = dot(r0.yzw, r0.yzw); - r0.y = -4 * r0.y; - r0.y = exp2(r0.y); - r0.x = r0.x * r0.x; - r0.x = cb0[66].y * r0.x; - r0.x = -4 * r0.x; - r0.x = exp2(r0.x); - r0.xy = float2(1, 1) + -r0.xy; - r0.x = r0.y * r0.x; - r2.x = dot(float3(1.37041271, -0.329291314, -0.0636827648), r1.xyz); - r2.y = dot(float3(-0.0834341869, 1.09709096, -0.0108615728), r1.xyz); - r2.z = dot(float3(-0.0257932581, -0.0986256376, 1.20369434), r1.xyz); - r0.yzw = r2.xyz + -r1.xyz; - r0.xyz = r0.xxx * r0.yzw + r1.xyz; - r0.xyz = cb0[44].yyy ? r1.xyz : r0.xyz; - r0.w = dot(r0.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r1.xyzw = cb0[50].xyzw * cb0[45].xyzw; - r2.xyzw = cb0[51].xyzw * cb0[46].xyzw; - r3.xyzw = cb0[52].xyzw * cb0[47].xyzw; - r4.xyzw = cb0[53].xyzw * cb0[48].xyzw; - r5.xyzw = cb0[54].xyzw + cb0[49].xyzw; - r1.xyz = r1.xyz * r1.www; - r0.xyz = r0.xyz + -r0.www; - r1.xyz = r1.xyz * r0.xyz + r0.www; - r1.xyz = max(float3(0, 0, 0), r1.xyz); - r1.xyz = float3(5.55555534, 5.55555534, 5.55555534) * r1.xyz; - r2.xyz = r2.xyz * r2.www; - r1.xyz = log2(r1.xyz); - r1.xyz = r2.xyz * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = float3(0.180000007, 0.180000007, 0.180000007) * r1.xyz; - r2.xyz = r3.xyz * r3.www; - r2.xyz = float3(1, 1, 1) / r2.xyz; - r1.xyz = log2(r1.xyz); - r1.xyz = r2.xyz * r1.xyz; - r1.xyz = exp2(r1.xyz); - r2.xyz = r4.xyz * r4.www; - r3.xyz = r5.xyz + r5.www; - r1.xyz = r1.xyz * r2.xyz + r3.xyz; - r1.w = 1 / cb0[65].x; - r1.w = saturate(r1.w * r0.w); - r2.x = r1.w * -2 + 3; - r1.w = r1.w * r1.w; - r1.w = -r2.x * r1.w + 1; - r2.xyzw = cb0[60].xyzw * cb0[45].xyzw; - r3.xyzw = cb0[61].xyzw * cb0[46].xyzw; - r4.xyzw = cb0[62].xyzw * cb0[47].xyzw; - r5.xyzw = cb0[63].xyzw * cb0[48].xyzw; - r6.xyzw = cb0[64].xyzw + cb0[49].xyzw; - r2.xyz = r2.xyz * r2.www; - r2.xyz = r2.xyz * r0.xyz + r0.www; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r2.xyz = float3(5.55555534, 5.55555534, 5.55555534) * r2.xyz; - r3.xyz = r3.xyz * r3.www; - r2.xyz = log2(r2.xyz); - r2.xyz = r3.xyz * r2.xyz; - r2.xyz = exp2(r2.xyz); - r2.xyz = float3(0.180000007, 0.180000007, 0.180000007) * r2.xyz; - r3.xyz = r4.xyz * r4.www; - r3.xyz = float3(1, 1, 1) / r3.xyz; - r2.xyz = log2(r2.xyz); - r2.xyz = r3.xyz * r2.xyz; - r2.xyz = exp2(r2.xyz); - r3.xyz = r5.xyz * r5.www; - r4.xyz = r6.xyz + r6.www; - r2.xyz = r2.xyz * r3.xyz + r4.xyz; - r2.w = 1 + -cb0[65].y; - r3.x = -cb0[65].y + r0.w; - r2.w = 1 / r2.w; - r2.w = saturate(r3.x * r2.w); - r3.x = r2.w * -2 + 3; - r2.w = r2.w * r2.w; - r3.y = r3.x * r2.w; - r4.xyzw = cb0[55].xyzw * cb0[45].xyzw; - r5.xyzw = cb0[56].xyzw * cb0[46].xyzw; - r6.xyzw = cb0[57].xyzw * cb0[47].xyzw; - r7.xyzw = cb0[58].xyzw * cb0[48].xyzw; - r8.xyzw = cb0[59].xyzw + cb0[49].xyzw; - r4.xyz = r4.xyz * r4.www; - r0.xyz = r4.xyz * r0.xyz + r0.www; - r0.xyz = max(float3(0, 0, 0), r0.xyz); - r0.xyz = float3(5.55555534, 5.55555534, 5.55555534) * r0.xyz; - r4.xyz = r5.xyz * r5.www; - r0.xyz = log2(r0.xyz); - r0.xyz = r4.xyz * r0.xyz; - r0.xyz = exp2(r0.xyz); - r0.xyz = float3(0.180000007, 0.180000007, 0.180000007) * r0.xyz; - r4.xyz = r6.xyz * r6.www; - r4.xyz = float3(1, 1, 1) / r4.xyz; - r0.xyz = log2(r0.xyz); - r0.xyz = r4.xyz * r0.xyz; - r0.xyz = exp2(r0.xyz); - r4.xyz = r7.xyz * r7.www; - r5.xyz = r8.xyz + r8.www; - r0.xyz = r0.xyz * r4.xyz + r5.xyz; - r0.w = 1 + -r1.w; - r0.w = -r3.x * r2.w + r0.w; - r0.xyz = r0.xyz * r0.www; - r0.xyz = r1.xyz * r1.www + r0.xyz; - r0.xyz = r2.xyz * r3.yyy + r0.xyz; - - // End of Color Correct - float3 ap1_graded_color = r0.rgb; - float3 ap1_aces_colored = ap1_graded_color; - - // uint output_type = cb0[65].z; - - // uint output_type = cb0[65].z; - uint output_type = 3u; - - float3 sdr_color; - float3 hdr_color; - float3 sdr_ap1_color; - - float FilmBlackClip = cb0[36].w; - float FilmToe = cb0[36].y; - float FilmWhiteClip = cb0[37].x; - float FilmShoulder = cb0[36].z; - - // bool is_hdr = (output_type >= 3u && output_type <= 6u); - bool is_hdr = true; - - r1.x = dot(float3(1.70505154, -0.621790707, -0.0832583979), r0.xyz); - r1.y = dot(float3(-0.130257145, 1.14080286, -0.0105485283), r0.xyz); - r1.z = dot(float3(-0.0240032747, -0.128968775, 1.15297174), r0.xyz); - if (cb0[44].y != 0) { - r2.x = dot(r1.xyz, cb0[28].xyz); - r2.y = dot(r1.xyz, cb0[29].xyz); - r2.z = dot(r1.xyz, cb0[30].xyz); - r0.w = dot(r1.xyz, cb0[33].xyz); - r0.w = 1 + r0.w; - r0.w = rcp(r0.w); - r3.xyz = cb0[35].xyz * r0.www + cb0[34].xyz; - r2.xyz = r3.xyz * r2.xyz; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r3.xyz = cb0[31].xxx + -r2.xyz; - r3.xyz = max(float3(0, 0, 0), r3.xyz); - r4.xyz = max(cb0[31].zzz, r2.xyz); - r2.xyz = max(cb0[31].xxx, r2.xyz); - r2.xyz = min(cb0[31].zzz, r2.xyz); - r5.xyz = r4.xyz * cb0[32].xxx + cb0[32].yyy; - r4.xyz = cb0[31].www + r4.xyz; - r4.xyz = rcp(r4.xyz); - r6.xyz = cb0[28].www * r3.xyz; - r3.xyz = cb0[31].yyy + r3.xyz; - r3.xyz = rcp(r3.xyz); - r3.xyz = r6.xyz * r3.xyz + cb0[29].www; - r2.xyz = r2.xyz * cb0[30].www + r3.xyz; - r2.xyz = r5.xyz * r4.xyz + r2.xyz; - r2.xyz = float3(-0.00200000009, -0.00200000009, -0.00200000009) + r2.xyz; - } else { - r3.x = dot(float3(0.938639402, 1.02359565e-10, 0.0613606237), r0.xyz); - r3.y = dot(float3(8.36008554e-11, 0.830794156, 0.169205874), r0.xyz); - r3.z = dot(float3(2.13187367e-12, -5.63307213e-12, 1), r0.xyz); - r3.xyz = r3.xyz + -r0.xyz; - r0.xyz = cb0[66].xxx * r3.xyz + r0.xyz; - ap1_graded_color = r0.xyz; - r3.y = dot(float3(0.695452213, 0.140678704, 0.163869068), r0.xyz); - r3.z = dot(float3(0.0447945632, 0.859671116, 0.0955343172), r0.xyz); - r3.w = dot(float3(-0.00552588236, 0.00402521016, 1.00150073), r0.xyz); - r0.w = min(r3.y, r3.z); - r0.w = min(r0.w, r3.w); - r1.w = max(r3.y, r3.z); - r1.w = max(r1.w, r3.w); - r4.xy = max(float2(1.00000001e-10, 0.00999999978), r1.ww); - r0.w = max(1.00000001e-10, r0.w); - r0.w = r4.x + -r0.w; - r0.w = r0.w / r4.y; - r4.xyz = r3.wzy + -r3.zyw; - r4.xy = r4.xy * r3.wz; - r1.w = r4.x + r4.y; - r1.w = r3.y * r4.z + r1.w; - r1.w = sqrt(r1.w); - r2.w = r3.w + r3.z; - r2.w = r2.w + r3.y; - r1.w = r1.w * 1.75 + r2.w; - r2.w = 0.333333343 * r1.w; - r3.x = -0.400000006 + r0.w; - r4.x = 2.5 * r3.x; - r4.x = 1 + -abs(r4.x); - r4.x = max(0, r4.x); - r4.y = cmp(0 < r3.x); - r3.x = cmp(r3.x < 0); - r3.x = (int)-r4.y + (int)r3.x; - r3.x = (int)r3.x; - r4.x = -r4.x * r4.x + 1; - r3.x = r3.x * r4.x + 1; - r3.x = 0.0250000004 * r3.x; - r4.x = cmp(0.159999996 >= r1.w); - r1.w = cmp(r1.w >= 0.479999989); - r2.w = 0.0799999982 / r2.w; - r2.w = -0.5 + r2.w; - r2.w = r3.x * r2.w; - r1.w = r1.w ? 0 : r2.w; - r1.w = r4.x ? r3.x : r1.w; - r1.w = 1 + r1.w; - r4.yzw = r3.yzw * r1.www; - r5.xy = cmp(r4.zw == r4.yz); - r2.w = r5.y ? r5.x : 0; - r3.x = r3.z * r1.w + -r4.w; - r3.x = 1.73205078 * r3.x; - r3.z = r4.y * 2 + -r4.z; - r3.z = -r3.w * r1.w + r3.z; - r3.w = min(abs(r3.x), abs(r3.z)); - r5.x = max(abs(r3.x), abs(r3.z)); - r5.x = 1 / r5.x; - r3.w = r5.x * r3.w; - r5.x = r3.w * r3.w; - r5.y = r5.x * 0.0208350997 + -0.0851330012; - r5.y = r5.x * r5.y + 0.180141002; - r5.y = r5.x * r5.y + -0.330299497; - r5.x = r5.x * r5.y + 0.999866009; - r5.y = r5.x * r3.w; - r5.z = cmp(abs(r3.z) < abs(r3.x)); - r5.y = r5.y * -2 + 1.57079637; - r5.y = r5.z ? r5.y : 0; - r3.w = r3.w * r5.x + r5.y; - r5.x = cmp(r3.z < -r3.z); - r5.x = r5.x ? -3.141593 : 0; - r3.w = r5.x + r3.w; - r5.x = min(r3.x, r3.z); - r3.x = max(r3.x, r3.z); - r3.z = cmp(r5.x < -r5.x); - r3.x = cmp(r3.x >= -r3.x); - r3.x = r3.x ? r3.z : 0; - r3.x = r3.x ? -r3.w : r3.w; - r3.x = 57.2957802 * r3.x; - r2.w = r2.w ? 0 : r3.x; - r3.x = cmp(r2.w < 0); - r3.z = 360 + r2.w; - r2.w = r3.x ? r3.z : r2.w; - r2.w = max(0, r2.w); - r2.w = min(360, r2.w); - r3.x = cmp(180 < r2.w); - r3.z = -360 + r2.w; - r2.w = r3.x ? r3.z : r2.w; - r2.w = 0.0148148146 * r2.w; - r2.w = 1 + -abs(r2.w); - r2.w = max(0, r2.w); - r3.x = r2.w * -2 + 3; - r2.w = r2.w * r2.w; - r2.w = r3.x * r2.w; - r2.w = r2.w * r2.w; - r0.w = r2.w * r0.w; - r1.w = -r3.y * r1.w + 0.0299999993; - r0.w = r1.w * r0.w; - r4.x = r0.w * 0.180000007 + r4.y; - r3.x = dot(float3(1.45143926, -0.236510754, -0.214928567), r4.xzw); - r3.y = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r4.xzw); - r3.z = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r4.xzw); - r3.xyz = max(float3(0, 0, 0), r3.xyz); - r0.w = dot(r3.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r3.xyz = r3.xyz + -r0.www; - r3.xyz = r3.xyz * float3(0.959999979, 0.959999979, 0.959999979) + r0.www; - ap1_aces_colored = r3.xyz; - - r4.xy = float2(1, 0.180000007) + cb0[36].ww; - r0.w = -cb0[36].y + r4.x; - r1.w = 1 + cb0[37].x; - r2.w = -cb0[36].z + r1.w; - r3.w = cmp(0.800000012 < cb0[36].y); - r4.xz = float2(0.819999993, 1) + -cb0[36].yy; - r4.xz = r4.xz / cb0[36].xx; - r4.y = r4.y / r0.w; - r4.xw = float2(-0.744727492, -1) + r4.xy; - r4.w = 1 + -r4.w; - r4.y = r4.y / r4.w; - r4.y = log2(r4.y); - r4.y = 0.346573591 * r4.y; - r4.w = r0.w / cb0[36].x; - r4.y = -r4.y * r4.w + -0.744727492; - r3.w = r3.w ? r4.x : r4.y; - r4.x = r4.z + -r3.w; - r4.y = cb0[36].z / cb0[36].x; - r4.y = r4.y + -r4.x; - r3.xyz = log2(r3.xyz); - r5.xyz = float3(0.30103001, 0.30103001, 0.30103001) * r3.xyz; - r4.xzw = r3.xyz * float3(0.30103001, 0.30103001, 0.30103001) + r4.xxx; - r4.xzw = cb0[36].xxx * r4.xzw; - r5.w = r0.w + r0.w; - r6.x = -2 * cb0[36].x; - r0.w = r6.x / r0.w; - r6.xyz = r3.xyz * float3(0.30103001, 0.30103001, 0.30103001) + -r3.www; - r7.xyz = r6.xyz * r0.www; - r7.xyz = float3(1.44269502, 1.44269502, 1.44269502) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r7.xyz = float3(1, 1, 1) + r7.xyz; - r7.xyz = r5.www / r7.xyz; - r7.xyz = -cb0[36].www + r7.xyz; - r0.w = r2.w + r2.w; - r5.w = cb0[36].x + cb0[36].x; - r2.w = r5.w / r2.w; - r3.xyz = r3.xyz * float3(0.30103001, 0.30103001, 0.30103001) + -r4.yyy; - r3.xyz = r3.xyz * r2.www; - r3.xyz = float3(1.44269502, 1.44269502, 1.44269502) * r3.xyz; - r3.xyz = exp2(r3.xyz); - r3.xyz = float3(1, 1, 1) + r3.xyz; - r3.xyz = r0.www / r3.xyz; - r3.xyz = -r3.xyz + r1.www; - r8.xyz = cmp(r5.xyz < r3.www); - r7.xyz = r8.xyz ? r7.xyz : r4.xzw; - r5.xyz = cmp(r4.yyy < r5.xyz); - r3.xyz = r5.xyz ? r3.xyz : r4.xzw; - r0.w = r4.y + -r3.w; - r4.xzw = saturate(r6.xyz / r0.www); - r0.w = cmp(r4.y < r3.w); - r5.xyz = float3(1, 1, 1) + -r4.xzw; - r4.xyz = r0.www ? r5.xyz : r4.xzw; - r5.xyz = -r4.xyz * float3(2, 2, 2) + float3(3, 3, 3); - r4.xyz = r4.xyz * r4.xyz; - r4.xyz = r4.xyz * r5.xyz; - r3.xyz = r3.xyz + -r7.xyz; - r3.xyz = r4.xyz * r3.xyz + r7.xyz; - r0.w = dot(r3.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r3.xyz = r3.xyz + -r0.www; - r3.xyz = r3.xyz * float3(0.930000007, 0.930000007, 0.930000007) + r0.www; - r3.xyz = max(float3(0, 0, 0), r3.xyz); - sdr_ap1_color = r3.xyz; - - r3.xyz = sdr_ap1_color; - r3.xyz = r3.xyz + -r0.xyz; - r0.xyz = cb0[66].zzz * r3.xyz + r0.xyz; - r3.x = dot(float3(1.06537485, 1.44678506e-06, -0.0653710067), r0.xyz); - r3.y = dot(float3(-3.45525592e-07, 1.20366347, -0.203667715), r0.xyz); - r3.z = dot(float3(1.9865448e-08, 2.12079581e-08, 0.999999583), r0.xyz); - r3.xyz = r3.xyz + -r0.xyz; - r0.xyz = cb0[66].xxx * r3.xyz + r0.xyz; - r3.x = dot(float3(1.70505154, -0.621790707, -0.0832583979), r0.xyz); - r3.y = dot(float3(-0.130257145, 1.14080286, -0.0105485283), r0.xyz); - r3.z = dot(float3(-0.0240032747, -0.128968775, 1.15297174), r0.xyz); - r2.xyz = max(float3(0, 0, 0), r3.xyz); - } - - r2.xyz = saturate(r2.xyz); - r0.xyz = float3(12.9200001, 12.9200001, 12.9200001) * r2.xyz; - r3.xyz = cmp(r2.xyz >= float3(0.00313066994, 0.00313066994, 0.00313066994)); - r2.xyz = log2(r2.xyz); - r2.xyz = float3(0.416666657, 0.416666657, 0.416666657) * r2.xyz; - r2.xyz = exp2(r2.xyz); - r2.xyz = r2.xyz * float3(1.05499995, 1.05499995, 1.05499995) + float3(-0.0549999997, -0.0549999997, -0.0549999997); - r0.xyz = r3.xyz ? r2.xyz : r0.xyz; - r2.yzw = r0.xyz * float3(0.9375, 0.9375, 0.9375) + float3(0.03125, 0.03125, 0.03125); - r0.w = r2.w * 16 + -0.5; - r1.w = floor(r0.w); - r0.w = -r1.w + r0.w; - r1.w = r2.y + r1.w; - r2.x = 0.0625 * r1.w; - r3.xyz = t0.Sample(s0_s, r2.xz).xyz; - r2.xy = float2(0.0625, 0) + r2.xz; - r2.xyz = t0.Sample(s0_s, r2.xy).xyz; - r2.xyz = r2.xyz + -r3.xyz; - r2.xyz = r0.www * r2.xyz + r3.xyz; - r2.xyz = cb0[39].xxx * r2.xyz; - r0.xyz = cb0[38].xxx * r0.xyz + r2.xyz; - r0.xyz = max(float3(6.10351999e-05, 6.10351999e-05, 6.10351999e-05), r0.xyz); - r2.xyz = cmp(float3(0.0404499993, 0.0404499993, 0.0404499993) < r0.xyz); - r3.xyz = r0.xyz * float3(0.947867274, 0.947867274, 0.947867274) + float3(0.0521326996, 0.0521326996, 0.0521326996); - r3.xyz = log2(r3.xyz); - r3.xyz = float3(2.4000001, 2.4000001, 2.4000001) * r3.xyz; - r3.xyz = exp2(r3.xyz); - r0.xyz = float3(0.0773993805, 0.0773993805, 0.0773993805) * r0.xyz; - r0.xyz = r2.xyz ? r3.xyz : r0.xyz; - r2.xyz = r0.xyz * r0.xyz; - r0.xyz = cb0[26].yyy * r0.xyz; - r0.xyz = cb0[26].xxx * r2.xyz + r0.xyz; - r0.xyz = cb0[26].zzz + r0.xyz; - r2.xyz = cb0[42].yzw * r0.xyz; - r0.xyz = -r0.xyz * cb0[42].yzw + cb0[43].xyz; - r0.xyz = cb0[43].www * r0.xyz + r2.xyz; - r2.xyz = max(float3(0, 0, 0), r0.xyz); - r2.xyz = log2(r2.xyz); - r2.xyz = cb0[27].yyy * r2.xyz; - r3.xyz = exp2(r2.xyz); - - float3 film_graded_color = r3.rgb; - - if (injectedData.toneMapType != 0.f) { - float3 final_color; - tonemap(ap1_graded_color, ap1_aces_colored, film_graded_color, hdr_color, sdr_color, sdr_ap1_color, final_color); - - final_color.rgb = scalePaperWhite(final_color.rgb); - - // Scale for UE decoding - final_color *= 1.f / 1.05f; - - o0.rgba = float4(final_color.rgb, 0); - - return; - } - - if (cb0[65].z == 0) { - r4.xyz = float3(12.9200001, 12.9200001, 12.9200001) * r3.xyz; - r5.xyz = cmp(r3.xyz >= float3(0.00313066994, 0.00313066994, 0.00313066994)); - r2.xyz = float3(0.416666657, 0.416666657, 0.416666657) * r2.xyz; - r2.xyz = exp2(r2.xyz); - r2.xyz = r2.xyz * float3(1.05499995, 1.05499995, 1.05499995) + float3(-0.0549999997, -0.0549999997, -0.0549999997); - r2.xyz = r5.xyz ? r2.xyz : r4.xyz; - } else { - r4.xyzw = cmp(asint(cb0[65].wwww) == int4(1, 2, 3, 4)); - r5.xyz = r4.www ? float3(1, 0, 0) : float3(1.70505154, -0.621790707, -0.0832583979); - r6.xyz = r4.www ? float3(0, 1, 0) : float3(-0.130257145, 1.14080286, -0.0105485283); - r7.xyz = r4.www ? float3(0, 0, 1) : float3(-0.0240032747, -0.128968775, 1.15297174); - r5.xyz = r4.zzz ? float3(0.695452213, 0.140678704, 0.163869068) : r5.xyz; - r6.xyz = r4.zzz ? float3(0.0447945632, 0.859671116, 0.0955343172) : r6.xyz; - r7.xyz = r4.zzz ? float3(-0.00552588282, 0.00402521016, 1.00150073) : r7.xyz; - r5.xyz = r4.yyy ? float3(1.02579927, -0.0200525094, -0.00577136781) : r5.xyz; - r6.xyz = r4.yyy ? float3(-0.00223502493, 1.00458264, -0.00235231337) : r6.xyz; - r4.yzw = r4.yyy ? float3(-0.00501400325, -0.0252933875, 1.03044021) : r7.xyz; - r5.xyz = r4.xxx ? float3(1.37915885, -0.308850735, -0.0703467429) : r5.xyz; - r6.xyz = r4.xxx ? float3(-0.0693352968, 1.08229232, -0.0129620517) : r6.xyz; - r4.xyz = r4.xxx ? float3(-0.00215925858, -0.0454653986, 1.04775953) : r4.yzw; - r0.w = cmp(asint(cb0[65].z) == 1); - if (r0.w != 0) { - r7.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r3.xyz); - r7.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r3.xyz); - r7.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r3.xyz); - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = max(float3(6.10351999e-05, 6.10351999e-05, 6.10351999e-05), r8.xyz); - r8.xyz = float3(4.5, 4.5, 4.5) * r7.xyz; - r7.xyz = max(float3(0.0179999992, 0.0179999992, 0.0179999992), r7.xyz); - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.449999988, 0.449999988, 0.449999988) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r7.xyz = r7.xyz * float3(1.09899998, 1.09899998, 1.09899998) + float3(-0.0989999995, -0.0989999995, -0.0989999995); - r2.xyz = min(r8.xyz, r7.xyz); - } else { - r7.xyz = cb0[42].yzw * r1.xyz; - r1.xyz = -r1.xyz * cb0[42].yzw + cb0[43].xyz; - r1.xyz = cb0[43].www * r1.xyz + r7.xyz; - r7.xy = cmp(asint(cb0[65].zz) == int2(3, 5)); - r0.w = (int)r7.y | (int)r7.x; - if (r0.w != 0) { - r7.xyz = float3(1.5, 1.5, 1.5) * r1.xyz; - r8.y = dot(float3(0.439700812, 0.382978052, 0.1773348), r7.xyz); - r8.z = dot(float3(0.0897923037, 0.813423157, 0.096761629), r7.xyz); - r8.w = dot(float3(0.0175439864, 0.111544058, 0.870704114), r7.xyz); - r0.w = min(r8.y, r8.z); - r0.w = min(r0.w, r8.w); - r1.w = max(r8.y, r8.z); - r1.w = max(r1.w, r8.w); - r7.xy = max(float2(1.00000001e-10, 0.00999999978), r1.ww); - r0.w = max(1.00000001e-10, r0.w); - r0.w = r7.x + -r0.w; - r0.w = r0.w / r7.y; - r7.xyz = r8.wzy + -r8.zyw; - r7.xy = r8.wz * r7.xy; - r1.w = r7.x + r7.y; - r1.w = r8.y * r7.z + r1.w; - r1.w = sqrt(r1.w); - r2.w = r8.w + r8.z; - r2.w = r2.w + r8.y; - r1.w = r1.w * 1.75 + r2.w; - r2.w = 0.333333343 * r1.w; - r3.w = -0.400000006 + r0.w; - r4.w = 2.5 * r3.w; - r4.w = 1 + -abs(r4.w); - r4.w = max(0, r4.w); - r5.w = cmp(0 < r3.w); - r3.w = cmp(r3.w < 0); - r3.w = (int)-r5.w + (int)r3.w; - r3.w = (int)r3.w; - r4.w = -r4.w * r4.w + 1; - r3.w = r3.w * r4.w + 1; - r3.w = 0.0250000004 * r3.w; - r4.w = cmp(0.159999996 >= r1.w); - r1.w = cmp(r1.w >= 0.479999989); - r2.w = 0.0799999982 / r2.w; - r2.w = -0.5 + r2.w; - r2.w = r3.w * r2.w; - r1.w = r1.w ? 0 : r2.w; - r1.w = r4.w ? r3.w : r1.w; - r1.w = 1 + r1.w; - r7.yzw = r8.yzw * r1.www; - r9.xy = cmp(r7.zw == r7.yz); - r2.w = r9.y ? r9.x : 0; - r3.w = r8.z * r1.w + -r7.w; - r3.w = 1.73205078 * r3.w; - r4.w = r7.y * 2 + -r7.z; - r4.w = -r8.w * r1.w + r4.w; - r5.w = min(abs(r4.w), abs(r3.w)); - r6.w = max(abs(r4.w), abs(r3.w)); - r6.w = 1 / r6.w; - r5.w = r6.w * r5.w; - r6.w = r5.w * r5.w; - r8.x = r6.w * 0.0208350997 + -0.0851330012; - r8.x = r6.w * r8.x + 0.180141002; - r8.x = r6.w * r8.x + -0.330299497; - r6.w = r6.w * r8.x + 0.999866009; - r8.x = r6.w * r5.w; - r8.z = cmp(abs(r4.w) < abs(r3.w)); - r8.x = r8.x * -2 + 1.57079637; - r8.x = r8.z ? r8.x : 0; - r5.w = r5.w * r6.w + r8.x; - r6.w = cmp(r4.w < -r4.w); - r6.w = r6.w ? -3.141593 : 0; - r5.w = r6.w + r5.w; - r6.w = min(r4.w, r3.w); - r3.w = max(r4.w, r3.w); - r4.w = cmp(r6.w < -r6.w); - r3.w = cmp(r3.w >= -r3.w); - r3.w = r3.w ? r4.w : 0; - r3.w = r3.w ? -r5.w : r5.w; - r3.w = 57.2957802 * r3.w; - r2.w = r2.w ? 0 : r3.w; - r3.w = cmp(r2.w < 0); - r4.w = 360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r2.w = max(0, r2.w); - r2.w = min(360, r2.w); - r3.w = cmp(180 < r2.w); - r4.w = -360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r3.w = cmp(-67.5 < r2.w); - r4.w = cmp(r2.w < 67.5); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r2.w = 67.5 + r2.w; - r3.w = 0.0296296291 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r2.w = r2.w * 0.0296296291 + -r3.w; - r3.w = r2.w * r2.w; - r5.w = r3.w * r2.w; - r8.xzw = float3(-0.166666672, -0.5, 0.166666672) * r5.www; - r8.xz = r3.ww * float2(0.5, 0.5) + r8.xz; - r8.xz = r2.ww * float2(-0.5, 0.5) + r8.xz; - r2.w = r5.w * 0.5 + -r3.w; - r2.w = 0.666666687 + r2.w; - r9.xyz = cmp((int3)r4.www == int3(3, 2, 1)); - r8.xz = float2(0.166666672, 0.166666672) + r8.xz; - r3.w = r4.w ? 0 : r8.w; - r3.w = r9.z ? r8.z : r3.w; - r2.w = r9.y ? r2.w : r3.w; - r2.w = r9.x ? r8.x : r2.w; - } else { - r2.w = 0; - } - r0.w = r2.w * r0.w; - r0.w = 1.5 * r0.w; - r1.w = -r8.y * r1.w + 0.0299999993; - r0.w = r1.w * r0.w; - r7.x = r0.w * 0.180000007 + r7.y; - r7.xyz = max(float3(0, 0, 0), r7.xzw); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r8.x = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r8.y = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r8.z = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r7.xyz = max(float3(0, 0, 0), r8.xyz); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r0.w = dot(r7.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r7.xyz = r7.xyz + -r0.www; - r7.xyz = r7.xyz * float3(0.959999979, 0.959999979, 0.959999979) + r0.www; - r8.xyz = cmp(float3(0, 0, 0) >= r7.xyz); - r7.xyz = log2(r7.xyz); - r7.xyz = r8.xyz ? float3(-14, -14, -14) : r7.xyz; - r8.xyz = cmp(float3(-17.4739323, -17.4739323, -17.4739323) >= r7.xyz); - if (r8.x != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.x); - r2.w = cmp(r7.x < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.664385557 + -r2.w; - r8.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r8.x + 0].x; - r10.z = icb[r8.w + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r1.w = cmp(r7.x >= -2.47393107); - r2.w = cmp(r7.x < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.553654671 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r7.x + 0].y; - r10.z = icb[r7.w + 0].y; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.x = exp2(r0.w); - if (r8.y != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.y); - r2.w = cmp(r7.y < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.664385557 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].x; - r11.y = icb[r7.x + 0].x; - r11.z = icb[r7.w + 0].x; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r1.w = cmp(r7.y >= -2.47393107); - r2.w = cmp(r7.y < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.553654671 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].y; - r11.y = icb[r7.x + 0].y; - r11.z = icb[r7.y + 0].y; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.y = exp2(r0.w); - if (r8.z != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.z); - r2.w = cmp(r7.z < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r8.y = r1.w * 0.664385557 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r7.x + 0].x; - r10.z = icb[r7.y + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r0.w = dot(r8.xyz, r11.xyz); - } else { - r1.w = cmp(r7.z >= -2.47393107); - r2.w = cmp(r7.z < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r7.y = r1.w * 0.553654671 + -r2.w; - r8.xy = (int2)r3.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r8.x + 0].y; - r10.z = icb[r8.y + 0].y; - r8.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r10.xy, float2(-1, 1)); - r8.z = dot(r10.xy, float2(0.5, 0.5)); - r7.z = 1; - r0.w = dot(r7.xyz, r8.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.z = exp2(r0.w); - r7.x = dot(float3(0.695452213, 0.140678704, 0.163869068), r9.xyz); - r7.y = dot(float3(0.0447945632, 0.859671116, 0.0955343172), r9.xyz); - r7.z = dot(float3(-0.00552588282, 0.00402521016, 1.00150073), r9.xyz); - r0.w = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r1.w = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r2.w = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r3.w = cmp(0 >= r0.w); - r0.w = log2(r0.w); - r0.w = r3.w ? -13.2877121 : r0.w; - r3.w = cmp(-12.7838678 >= r0.w); - if (r3.w != 0) { - r3.w = r0.w * 0.90309 + 7.54498291; - } else { - r4.w = cmp(-12.7838678 < r0.w); - r5.w = cmp(r0.w < 2.26303458); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + 3.84832764; - r5.w = 1.54540098 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 1.54540098 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 0].z; - r9.y = icb[r8.x + 0].z; - r9.z = icb[r8.y + 0].z; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r4.w = cmp(r0.w >= 2.26303458); - r5.w = cmp(r0.w < 12.1373367); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + -0.681241274; - r5.w = 2.3549509 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 2.3549509 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 0].w; - r9.y = icb[r8.x + 0].w; - r9.z = icb[r8.y + 0].w; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r3.w = r0.w * 0.0180617999 + 2.78077793; - } - } - } - r0.w = 3.32192802 * r3.w; - r7.x = exp2(r0.w); - r0.w = cmp(0 >= r1.w); - r1.w = log2(r1.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = r0.w * 0.90309 + 7.54498291; - } else { - r3.w = cmp(-12.7838678 < r0.w); - r4.w = cmp(r0.w < 2.26303458); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + 3.84832764; - r4.w = 1.54540098 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 1.54540098 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 0].z; - r10.y = icb[r9.x + 0].z; - r10.z = icb[r9.y + 0].z; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r3.w = cmp(r0.w >= 2.26303458); - r4.w = cmp(r0.w < 12.1373367); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + -0.681241274; - r4.w = 2.3549509 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 2.3549509 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 0].w; - r10.y = icb[r9.x + 0].w; - r10.z = icb[r9.y + 0].w; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0180617999 + 2.78077793; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.y = exp2(r0.w); - r0.w = cmp(0 >= r2.w); - r1.w = log2(r2.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = r0.w * 0.90309 + 7.54498291; - } else { - r2.w = cmp(-12.7838678 < r0.w); - r3.w = cmp(r0.w < 2.26303458); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + 3.84832764; - r3.w = 1.54540098 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 1.54540098 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 0].z; - r10.y = icb[r9.x + 0].z; - r10.z = icb[r9.y + 0].z; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r2.w = cmp(r0.w >= 2.26303458); - r3.w = cmp(r0.w < 12.1373367); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + -0.681241274; - r3.w = 2.3549509 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 2.3549509 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 0].w; - r10.y = icb[r9.x + 0].w; - r10.z = icb[r9.y + 0].w; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0180617999 + 2.78077793; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.z = exp2(r0.w); - r7.xyz = float3(-3.50738446e-05, -3.50738446e-05, -3.50738446e-05) + r7.xyz; - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = float3(9.99999975e-05, 9.99999975e-05, 9.99999975e-05) * r8.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.159301758, 0.159301758, 0.159301758) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r8.xyz = r7.xyz * float3(18.8515625, 18.8515625, 18.8515625) + float3(0.8359375, 0.8359375, 0.8359375); - r7.xyz = r7.xyz * float3(18.6875, 18.6875, 18.6875) + float3(1, 1, 1); - r7.xyz = rcp(r7.xyz); - r7.xyz = r8.xyz * r7.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(78.84375, 78.84375, 78.84375) * r7.xyz; - r2.xyz = exp2(r7.xyz); - } else { - r7.xy = cmp(asint(cb0[65].zz) == int2(4, 6)); - r0.w = (int)r7.y | (int)r7.x; - if (r0.w != 0) { - r7.xyz = float3(1.5, 1.5, 1.5) * r1.xyz; - r8.y = dot(float3(0.439700812, 0.382978052, 0.1773348), r7.xyz); - r8.z = dot(float3(0.0897923037, 0.813423157, 0.096761629), r7.xyz); - r8.w = dot(float3(0.0175439864, 0.111544058, 0.870704114), r7.xyz); - r0.w = min(r8.y, r8.z); - r0.w = min(r0.w, r8.w); - r1.w = max(r8.y, r8.z); - r1.w = max(r1.w, r8.w); - r7.xy = max(float2(1.00000001e-10, 0.00999999978), r1.ww); - r0.w = max(1.00000001e-10, r0.w); - r0.w = r7.x + -r0.w; - r0.w = r0.w / r7.y; - r7.xyz = r8.wzy + -r8.zyw; - r7.xy = r8.wz * r7.xy; - r1.w = r7.x + r7.y; - r1.w = r8.y * r7.z + r1.w; - r1.w = sqrt(r1.w); - r2.w = r8.w + r8.z; - r2.w = r2.w + r8.y; - r1.w = r1.w * 1.75 + r2.w; - r2.w = 0.333333343 * r1.w; - r3.w = -0.400000006 + r0.w; - r4.w = 2.5 * r3.w; - r4.w = 1 + -abs(r4.w); - r4.w = max(0, r4.w); - r5.w = cmp(0 < r3.w); - r3.w = cmp(r3.w < 0); - r3.w = (int)-r5.w + (int)r3.w; - r3.w = (int)r3.w; - r4.w = -r4.w * r4.w + 1; - r3.w = r3.w * r4.w + 1; - r3.w = 0.0250000004 * r3.w; - r4.w = cmp(0.159999996 >= r1.w); - r1.w = cmp(r1.w >= 0.479999989); - r2.w = 0.0799999982 / r2.w; - r2.w = -0.5 + r2.w; - r2.w = r3.w * r2.w; - r1.w = r1.w ? 0 : r2.w; - r1.w = r4.w ? r3.w : r1.w; - r1.w = 1 + r1.w; - r7.yzw = r8.yzw * r1.www; - r9.xy = cmp(r7.zw == r7.yz); - r2.w = r9.y ? r9.x : 0; - r3.w = r8.z * r1.w + -r7.w; - r3.w = 1.73205078 * r3.w; - r4.w = r7.y * 2 + -r7.z; - r4.w = -r8.w * r1.w + r4.w; - r5.w = min(abs(r4.w), abs(r3.w)); - r6.w = max(abs(r4.w), abs(r3.w)); - r6.w = 1 / r6.w; - r5.w = r6.w * r5.w; - r6.w = r5.w * r5.w; - r8.x = r6.w * 0.0208350997 + -0.0851330012; - r8.x = r6.w * r8.x + 0.180141002; - r8.x = r6.w * r8.x + -0.330299497; - r6.w = r6.w * r8.x + 0.999866009; - r8.x = r6.w * r5.w; - r8.z = cmp(abs(r4.w) < abs(r3.w)); - r8.x = r8.x * -2 + 1.57079637; - r8.x = r8.z ? r8.x : 0; - r5.w = r5.w * r6.w + r8.x; - r6.w = cmp(r4.w < -r4.w); - r6.w = r6.w ? -3.141593 : 0; - r5.w = r6.w + r5.w; - r6.w = min(r4.w, r3.w); - r3.w = max(r4.w, r3.w); - r4.w = cmp(r6.w < -r6.w); - r3.w = cmp(r3.w >= -r3.w); - r3.w = r3.w ? r4.w : 0; - r3.w = r3.w ? -r5.w : r5.w; - r3.w = 57.2957802 * r3.w; - r2.w = r2.w ? 0 : r3.w; - r3.w = cmp(r2.w < 0); - r4.w = 360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r2.w = max(0, r2.w); - r2.w = min(360, r2.w); - r3.w = cmp(180 < r2.w); - r4.w = -360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r3.w = cmp(-67.5 < r2.w); - r4.w = cmp(r2.w < 67.5); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r2.w = 67.5 + r2.w; - r3.w = 0.0296296291 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r2.w = r2.w * 0.0296296291 + -r3.w; - r3.w = r2.w * r2.w; - r5.w = r3.w * r2.w; - r8.xzw = float3(-0.166666672, -0.5, 0.166666672) * r5.www; - r8.xz = r3.ww * float2(0.5, 0.5) + r8.xz; - r8.xz = r2.ww * float2(-0.5, 0.5) + r8.xz; - r2.w = r5.w * 0.5 + -r3.w; - r2.w = 0.666666687 + r2.w; - r9.xyz = cmp((int3)r4.www == int3(3, 2, 1)); - r8.xz = float2(0.166666672, 0.166666672) + r8.xz; - r3.w = r4.w ? 0 : r8.w; - r3.w = r9.z ? r8.z : r3.w; - r2.w = r9.y ? r2.w : r3.w; - r2.w = r9.x ? r8.x : r2.w; - } else { - r2.w = 0; - } - r0.w = r2.w * r0.w; - r0.w = 1.5 * r0.w; - r1.w = -r8.y * r1.w + 0.0299999993; - r0.w = r1.w * r0.w; - r7.x = r0.w * 0.180000007 + r7.y; - r7.xyz = max(float3(0, 0, 0), r7.xzw); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r8.x = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r8.y = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r8.z = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r7.xyz = max(float3(0, 0, 0), r8.xyz); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r0.w = dot(r7.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r7.xyz = r7.xyz + -r0.www; - r7.xyz = r7.xyz * float3(0.959999979, 0.959999979, 0.959999979) + r0.www; - r8.xyz = cmp(float3(0, 0, 0) >= r7.xyz); - r7.xyz = log2(r7.xyz); - r7.xyz = r8.xyz ? float3(-14, -14, -14) : r7.xyz; - r8.xyz = cmp(float3(-17.4739323, -17.4739323, -17.4739323) >= r7.xyz); - if (r8.x != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.x); - r2.w = cmp(r7.x < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.664385557 + -r2.w; - r8.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r8.x + 0].x; - r10.z = icb[r8.w + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r1.w = cmp(r7.x >= -2.47393107); - r2.w = cmp(r7.x < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.553654671 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r7.x + 0].y; - r10.z = icb[r7.w + 0].y; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.x = exp2(r0.w); - if (r8.y != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.y); - r2.w = cmp(r7.y < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.664385557 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].x; - r11.y = icb[r7.x + 0].x; - r11.z = icb[r7.w + 0].x; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r1.w = cmp(r7.y >= -2.47393107); - r2.w = cmp(r7.y < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.553654671 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].y; - r11.y = icb[r7.x + 0].y; - r11.z = icb[r7.y + 0].y; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.y = exp2(r0.w); - if (r8.z != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.z); - r2.w = cmp(r7.z < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r8.y = r1.w * 0.664385557 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r7.x + 0].x; - r10.z = icb[r7.y + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r0.w = dot(r8.xyz, r11.xyz); - } else { - r1.w = cmp(r7.z >= -2.47393107); - r2.w = cmp(r7.z < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r7.y = r1.w * 0.553654671 + -r2.w; - r8.xy = (int2)r3.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r8.x + 0].y; - r10.z = icb[r8.y + 0].y; - r8.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r10.xy, float2(-1, 1)); - r8.z = dot(r10.xy, float2(0.5, 0.5)); - r7.z = 1; - r0.w = dot(r7.xyz, r8.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.z = exp2(r0.w); - r7.x = dot(float3(0.695452213, 0.140678704, 0.163869068), r9.xyz); - r7.y = dot(float3(0.0447945632, 0.859671116, 0.0955343172), r9.xyz); - r7.z = dot(float3(-0.00552588282, 0.00402521016, 1.00150073), r9.xyz); - r0.w = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r1.w = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r2.w = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r3.w = cmp(0 >= r0.w); - r0.w = log2(r0.w); - r0.w = r3.w ? -13.2877121 : r0.w; - r3.w = cmp(-12.7838678 >= r0.w); - if (r3.w != 0) { - r3.w = -2.30102992; - } else { - r4.w = cmp(-12.7838678 < r0.w); - r5.w = cmp(r0.w < 2.26303458); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + 3.84832764; - r5.w = 1.54540098 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 1.54540098 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 6].x; - r9.y = icb[r8.x + 6].x; - r9.z = icb[r8.y + 6].x; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r4.w = cmp(r0.w >= 2.26303458); - r5.w = cmp(r0.w < 12.4948215); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + -0.681241274; - r5.w = 2.27267218 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 2.27267218 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 6].y; - r9.y = icb[r8.x + 6].y; - r9.z = icb[r8.y + 6].y; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r3.w = r0.w * 0.0361235999 + 2.84967208; - } - } - } - r0.w = 3.32192802 * r3.w; - r7.x = exp2(r0.w); - r0.w = cmp(0 >= r1.w); - r1.w = log2(r1.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = -2.30102992; - } else { - r3.w = cmp(-12.7838678 < r0.w); - r4.w = cmp(r0.w < 2.26303458); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + 3.84832764; - r4.w = 1.54540098 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 1.54540098 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 6].x; - r10.y = icb[r9.x + 6].x; - r10.z = icb[r9.y + 6].x; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r3.w = cmp(r0.w >= 2.26303458); - r4.w = cmp(r0.w < 12.4948215); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + -0.681241274; - r4.w = 2.27267218 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 2.27267218 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 6].y; - r10.y = icb[r9.x + 6].y; - r10.z = icb[r9.y + 6].y; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0361235999 + 2.84967208; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.y = exp2(r0.w); - r0.w = cmp(0 >= r2.w); - r1.w = log2(r2.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = -2.30102992; - } else { - r2.w = cmp(-12.7838678 < r0.w); - r3.w = cmp(r0.w < 2.26303458); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + 3.84832764; - r3.w = 1.54540098 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 1.54540098 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 6].x; - r10.y = icb[r9.x + 6].x; - r10.z = icb[r9.y + 6].x; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r2.w = cmp(r0.w >= 2.26303458); - r3.w = cmp(r0.w < 12.4948215); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + -0.681241274; - r3.w = 2.27267218 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 2.27267218 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 6].y; - r10.y = icb[r9.x + 6].y; - r10.z = icb[r9.y + 6].y; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0361235999 + 2.84967208; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.z = exp2(r0.w); - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = float3(9.99999975e-05, 9.99999975e-05, 9.99999975e-05) * r8.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.159301758, 0.159301758, 0.159301758) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r8.xyz = r7.xyz * float3(18.8515625, 18.8515625, 18.8515625) + float3(0.8359375, 0.8359375, 0.8359375); - r7.xyz = r7.xyz * float3(18.6875, 18.6875, 18.6875) + float3(1, 1, 1); - r7.xyz = rcp(r7.xyz); - r7.xyz = r8.xyz * r7.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(78.84375, 78.84375, 78.84375) * r7.xyz; - r2.xyz = exp2(r7.xyz); - } else { - r0.w = cmp(asint(cb0[65].z) == 7); - if (r0.w != 0) { - r7.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r1.xyz); - r7.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r1.xyz); - r7.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r1.xyz); - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = float3(9.99999975e-05, 9.99999975e-05, 9.99999975e-05) * r8.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.159301758, 0.159301758, 0.159301758) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r8.xyz = r7.xyz * float3(18.8515625, 18.8515625, 18.8515625) + float3(0.8359375, 0.8359375, 0.8359375); - r7.xyz = r7.xyz * float3(18.6875, 18.6875, 18.6875) + float3(1, 1, 1); - r7.xyz = rcp(r7.xyz); - r7.xyz = r8.xyz * r7.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(78.84375, 78.84375, 78.84375) * r7.xyz; - r2.xyz = exp2(r7.xyz); - } else { - r7.xy = cmp(asint(cb0[65].zz) == int2(8, 9)); - r8.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r0.xyz); - r8.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r0.xyz); - r8.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r0.xyz); - r0.x = dot(r5.xyz, r8.xyz); - r0.y = dot(r6.xyz, r8.xyz); - r0.z = dot(r4.xyz, r8.xyz); - r8.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r3.xyz); - r8.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r3.xyz); - r8.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r3.xyz); - r0.w = dot(r5.xyz, r8.xyz); - r1.w = dot(r6.xyz, r8.xyz); - r2.w = dot(r4.xyz, r8.xyz); - r3.x = log2(r0.w); - r3.y = log2(r1.w); - r3.z = log2(r2.w); - r3.xyz = cb0[27].zzz * r3.xyz; - r3.xyz = exp2(r3.xyz); - r0.xyz = r7.yyy ? r0.xyz : r3.xyz; - r2.xyz = r7.xxx ? r1.xyz : r0.xyz; - } - } - } - } - } - o0.xyz = float3(0.952381015, 0.952381015, 0.952381015) * r2.xyz; - o0.w = 0; - return; -} diff --git a/src/games/visionsofmana/lutbuilder3_0x61C2EA30.ps_5_1.hlsl b/src/games/visionsofmana/lutbuilder3_0x61C2EA30.ps_5_1.hlsl deleted file mode 100644 index f2d99340..00000000 --- a/src/games/visionsofmana/lutbuilder3_0x61C2EA30.ps_5_1.hlsl +++ /dev/null @@ -1,1543 +0,0 @@ -// ---- Created with 3Dmigoto v1.3.16 on Tue Oct 8 22:20:45 2024 -// Another lutbuilder -#include "./common.hlsl" -#include "./shared.h" - -cbuffer cb0 : register(b0) { - float4 cb0[67]; -} - -// 3Dmigoto declarations -#define cmp - - -void main( - linear noperspective float2 v0 : TEXCOORD0, - float4 v1 : SV_POSITION0, - uint v2 : SV_RenderTargetArrayIndex0, - out float4 o0 : SV_Target0) { - const float4 icb[] = {{-4.000000, -0.718548, -4.970622, 0.808913}, - {-4.000000, 2.081031, -3.029378, 1.191087}, - {-3.157377, 3.668124, -2.126200, 1.568300}, - {-0.485250, 4.000000, -1.510500, 1.948300}, - {1.847732, 4.000000, -1.057800, 2.308300}, - {1.847732, 4.000000, -0.466800, 2.638400}, - {-2.301030, 0.801995, 0.119380, 2.859500}, - {-2.301030, 1.198005, 0.708813, 2.987261}, - {-1.931200, 1.594300, 1.291187, 3.012739}, - {-1.520500, 1.997300, 1.291187, 3.012739}, - {-1.057800, 2.378300, 0, 0}, - {-0.466800, 2.768400, 0, 0}, - {0.119380, 3.051500, 0, 0}, - {0.708813, 3.274629, 0, 0}, - {1.291187, 3.327431, 0, 0}, - {1.291187, 3.327431, 0, 0}}; - float4 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12; - uint4 bitmask, uiDest; - float4 fDest; - - r0.xy = float2(-0.015625, -0.015625) + v0.xy; - r0.xy = float2(1.03225803, 1.03225803) * r0.xy; - r0.z = (uint)v2.x; - r1.z = 0.0322580636 * r0.z; - r0.z = cmp(asuint(cb0[65].z) >= 3); - r2.xy = log2(r0.xy); - r2.z = log2(r1.z); - r0.xyw = float3(0.0126833133, 0.0126833133, 0.0126833133) * r2.xyz; - r0.xyw = exp2(r0.xyw); - r2.xyz = float3(-0.8359375, -0.8359375, -0.8359375) + r0.xyw; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r0.xyw = -r0.xyw * float3(18.6875, 18.6875, 18.6875) + float3(18.8515625, 18.8515625, 18.8515625); - r0.xyw = r2.xyz / r0.xyw; - r0.xyw = log2(r0.xyw); - r0.xyw = float3(6.27739477, 6.27739477, 6.27739477) * r0.xyw; - r0.xyw = exp2(r0.xyw); - r0.xyw = float3(100, 100, 100) * r0.xyw; - r1.xy = v0.xy * float2(1.03225803, 1.03225803) + float2(-0.0161290318, -0.0161290318); - r1.xyz = float3(-0.434017599, -0.434017599, -0.434017599) + r1.xyz; - r1.xyz = float3(14, 14, 14) * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = r1.xyz * float3(0.180000007, 0.180000007, 0.180000007) + float3(-0.00266771927, -0.00266771927, -0.00266771927); - - float3 pq_input_color = r0.xyw; - float3 log_input_color = r1.rgb; - - r0.xyz = r0.zzz ? r0.xyw : r1.xyz; - - // r0.rgb = pq_input_color; - - float3 lut_input_color = r0.rgb; - - r0.w = 1.00055635 * cb0[44].z; - r0.w = 1 / r0.w; - r1.x = cmp(6996.10791 >= cb0[44].z); - r1.yz = -r0.ww * float2(4.60700006e+09, 2.0064e+09) + float2(2967800, 1901800); - r1.yz = r1.yz * r0.ww + float2(99.1100006, 247.479996); - r1.yz = r1.yz * r0.ww + float2(0.244063005, 0.237039998); - r1.x = r1.x ? r1.y : r1.z; - r0.w = r1.x * r1.x; - r1.z = 2.86999989 * r1.x; - r0.w = r0.w * -3 + r1.z; - r1.y = -0.275000006 + r0.w; - r2.xyz = cb0[44].zzz * float3(0.000154118257, 0.00084242021, 4.22806261e-05) + float3(0.860117733, 1, 0.317398727); - r0.w = cb0[44].z * cb0[44].z; - r2.xyz = r0.www * float3(1.28641219e-07, 7.08145137e-07, 4.20481676e-08) + r2.xyz; - r2.x = r2.x / r2.y; - r1.z = -cb0[44].z * 2.8974182e-05 + 1; - r0.w = r0.w * 1.61456057e-07 + r1.z; - r2.y = r2.z / r0.w; - r1.zw = r2.xy + r2.xy; - r0.w = 3 * r2.x; - r1.z = -r2.y * 8 + r1.z; - r1.z = 4 + r1.z; - r3.x = r0.w / r1.z; - r3.y = r1.w / r1.z; - r0.w = cmp(cb0[44].z < 4000); - r1.xy = r0.ww ? r3.xy : r1.xy; - r0.w = dot(r2.xy, r2.xy); - r0.w = rsqrt(r0.w); - r1.zw = r2.xy * r0.ww; - r0.w = cb0[44].w * -r1.w; - r0.w = r0.w * 0.0500000007 + r2.x; - r1.z = cb0[44].w * r1.z; - r1.z = r1.z * 0.0500000007 + r2.y; - r1.w = 3 * r0.w; - r0.w = r0.w + r0.w; - r0.w = -r1.z * 8 + r0.w; - r0.w = 4 + r0.w; - r1.z = r1.z + r1.z; - r2.xy = r1.wz / r0.ww; - r1.zw = r2.xy + -r3.xy; - r1.xy = r1.xy + r1.zw; - r1.zw = float2(0.312700003, 0.328999996); - r1.xyzw = cb0[44].xxxx ? r1.xyzw : r1.zwxy; - r2.xy = max(float2(1.00000001e-10, 1.00000001e-10), r1.yw); - r2.zw = float2(1, 1) + -r1.xz; - r1.yw = r2.zw + -r1.yw; - r3.xy = r1.xz / r2.xy; - r1.xy = r1.yw / r2.xy; - r3.z = 1; - r3.w = r1.x; - r0.w = dot(float3(0.895099998, 0.266400009, -0.161400005), r3.xzw); - r1.x = dot(float3(-0.750199974, 1.71350002, 0.0366999991), r3.xzw); - r2.x = dot(float3(0.0388999991, -0.0684999973, 1.02960002), r3.xzw); - r1.zw = r3.yz; - r2.y = dot(float3(-0.161400005, 0.895099998, 0.266400009), r1.yzw); - r2.z = dot(float3(0.0366999991, -0.750199974, 1.71350002), r1.yzw); - r1.y = dot(float3(1.02960002, 0.0388999991, -0.0684999973), r1.yzw); - r0.w = r2.y / r0.w; - r1.x = r2.z / r1.x; - r1.y = r1.y / r2.x; - r2.xyz = float3(0.895099998, 0.266400009, -0.161400005) * r0.www; - r1.xzw = float3(-0.750199974, 1.71350002, 0.0366999991) * r1.xxx; - r3.xyz = float3(0.0388999991, -0.0684999973, 1.02960002) * r1.yyy; - r4.x = r2.x; - r4.y = r1.x; - r4.z = r3.x; - r5.x = dot(float3(0.986992896, -0.1470543, 0.159962699), r4.xyz); - r6.x = r2.y; - r6.y = r1.z; - r6.z = r3.y; - r5.y = dot(float3(0.986992896, -0.1470543, 0.159962699), r6.xyz); - r3.x = r2.z; - r3.y = r1.w; - r5.z = dot(float3(0.986992896, -0.1470543, 0.159962699), r3.xyz); - r1.x = dot(float3(0.432305306, 0.518360317, 0.0492912009), r4.xyz); - r1.y = dot(float3(0.432305306, 0.518360317, 0.0492912009), r6.xyz); - r1.z = dot(float3(0.432305306, 0.518360317, 0.0492912009), r3.xyz); - r2.x = dot(float3(-0.0085287001, 0.040042799, 0.968486726), r4.xyz); - r2.y = dot(float3(-0.0085287001, 0.040042799, 0.968486726), r6.xyz); - r2.z = dot(float3(-0.0085287001, 0.040042799, 0.968486726), r3.xyz); - r3.x = dot(r5.xyz, float3(0.412456393, 0.212672904, 0.0193339009)); - r4.x = dot(r5.xyz, float3(0.357576102, 0.715152204, 0.119191997)); - r5.x = dot(r5.xyz, float3(0.180437505, 0.0721750036, 0.950304091)); - r3.y = dot(r1.xyz, float3(0.412456393, 0.212672904, 0.0193339009)); - r4.y = dot(r1.xyz, float3(0.357576102, 0.715152204, 0.119191997)); - r5.y = dot(r1.xyz, float3(0.180437505, 0.0721750036, 0.950304091)); - r3.z = dot(r2.xyz, float3(0.412456393, 0.212672904, 0.0193339009)); - r4.z = dot(r2.xyz, float3(0.357576102, 0.715152204, 0.119191997)); - r5.z = dot(r2.xyz, float3(0.180437505, 0.0721750036, 0.950304091)); - r1.x = dot(float3(3.2409699, -1.5373832, -0.498610765), r3.xyz); - r1.y = dot(float3(3.2409699, -1.5373832, -0.498610765), r4.xyz); - r1.z = dot(float3(3.2409699, -1.5373832, -0.498610765), r5.xyz); - r2.x = dot(float3(-0.969243646, 1.8759675, 0.0415550582), r3.xyz); - r2.y = dot(float3(-0.969243646, 1.8759675, 0.0415550582), r4.xyz); - r2.z = dot(float3(-0.969243646, 1.8759675, 0.0415550582), r5.xyz); - r3.x = dot(float3(0.0556300804, -0.203976959, 1.05697155), r3.xyz); - r3.y = dot(float3(0.0556300804, -0.203976959, 1.05697155), r4.xyz); - r3.z = dot(float3(0.0556300804, -0.203976959, 1.05697155), r5.xyz); - r1.x = dot(r1.xyz, r0.xyz); - r1.y = dot(r2.xyz, r0.xyz); - r1.z = dot(r3.xyz, r0.xyz); - r0.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r1.xyz); - r0.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r1.xyz); - r0.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r1.xyz); - r0.w = dot(r0.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r1.xyz = r0.xyz / r0.www; - r1.xyz = float3(-1, -1, -1) + r1.xyz; - r1.x = dot(r1.xyz, r1.xyz); - r1.x = -4 * r1.x; - r1.x = exp2(r1.x); - r1.x = 1 + -r1.x; - r0.w = r0.w * r0.w; - r0.w = cb0[66].y * r0.w; - r0.w = -4 * r0.w; - r0.w = exp2(r0.w); - r0.w = 1 + -r0.w; - r0.w = r1.x * r0.w; - r1.x = dot(float3(1.37041271, -0.329291314, -0.0636827648), r0.xyz); - r1.y = dot(float3(-0.0834341869, 1.09709096, -0.0108615728), r0.xyz); - r1.z = dot(float3(-0.0257932581, -0.0986256376, 1.20369434), r0.xyz); - r1.xyz = r1.xyz + -r0.xyz; - r1.xyz = r0.www * r1.xyz + r0.xyz; - r0.xyz = cb0[44].yyy ? r0.xyz : r1.xyz; - r0.w = dot(r0.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r1.xyzw = cb0[50].xyzw * cb0[45].xyzw; - r2.xyzw = cb0[51].xyzw * cb0[46].xyzw; - r3.xyzw = cb0[52].xyzw * cb0[47].xyzw; - r4.xyzw = cb0[53].xyzw * cb0[48].xyzw; - r5.xyzw = cb0[54].xyzw + cb0[49].xyzw; - r1.xyz = r1.xyz * r1.www; - r0.xyz = r0.xyz + -r0.www; - r1.xyz = r1.xyz * r0.xyz + r0.www; - r1.xyz = max(float3(0, 0, 0), r1.xyz); - r1.xyz = float3(5.55555534, 5.55555534, 5.55555534) * r1.xyz; - r2.xyz = r2.xyz * r2.www; - r1.xyz = log2(r1.xyz); - r1.xyz = r2.xyz * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = float3(0.180000007, 0.180000007, 0.180000007) * r1.xyz; - r2.xyz = r3.xyz * r3.www; - r2.xyz = float3(1, 1, 1) / r2.xyz; - r1.xyz = log2(r1.xyz); - r1.xyz = r2.xyz * r1.xyz; - r1.xyz = exp2(r1.xyz); - r2.xyz = r4.xyz * r4.www; - r3.xyz = r5.xyz + r5.www; - r1.xyz = r1.xyz * r2.xyz + r3.xyz; - r1.w = 1 / cb0[65].x; - r1.w = saturate(r1.w * r0.w); - r2.x = r1.w * -2 + 3; - r1.w = r1.w * r1.w; - r1.w = -r2.x * r1.w + 1; - r2.xyzw = cb0[60].xyzw * cb0[45].xyzw; - r3.xyzw = cb0[61].xyzw * cb0[46].xyzw; - r4.xyzw = cb0[62].xyzw * cb0[47].xyzw; - r5.xyzw = cb0[63].xyzw * cb0[48].xyzw; - r6.xyzw = cb0[64].xyzw + cb0[49].xyzw; - r2.xyz = r2.xyz * r2.www; - r2.xyz = r2.xyz * r0.xyz + r0.www; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r2.xyz = float3(5.55555534, 5.55555534, 5.55555534) * r2.xyz; - r3.xyz = r3.xyz * r3.www; - r2.xyz = log2(r2.xyz); - r2.xyz = r3.xyz * r2.xyz; - r2.xyz = exp2(r2.xyz); - r2.xyz = float3(0.180000007, 0.180000007, 0.180000007) * r2.xyz; - r3.xyz = r4.xyz * r4.www; - r3.xyz = float3(1, 1, 1) / r3.xyz; - r2.xyz = log2(r2.xyz); - r2.xyz = r3.xyz * r2.xyz; - r2.xyz = exp2(r2.xyz); - r3.xyz = r5.xyz * r5.www; - r4.xyz = r6.xyz + r6.www; - r2.xyz = r2.xyz * r3.xyz + r4.xyz; - r2.w = 1 + -cb0[65].y; - r3.x = -cb0[65].y + r0.w; - r2.w = 1 / r2.w; - r2.w = saturate(r3.x * r2.w); - r3.x = r2.w * -2 + 3; - r2.w = r2.w * r2.w; - r3.y = r3.x * r2.w; - r4.xyzw = cb0[55].xyzw * cb0[45].xyzw; - r5.xyzw = cb0[56].xyzw * cb0[46].xyzw; - r6.xyzw = cb0[57].xyzw * cb0[47].xyzw; - r7.xyzw = cb0[58].xyzw * cb0[48].xyzw; - r8.xyzw = cb0[59].xyzw + cb0[49].xyzw; - r4.xyz = r4.xyz * r4.www; - r0.xyz = r4.xyz * r0.xyz + r0.www; - r0.xyz = max(float3(0, 0, 0), r0.xyz); - r0.xyz = float3(5.55555534, 5.55555534, 5.55555534) * r0.xyz; - r4.xyz = r5.xyz * r5.www; - r0.xyz = log2(r0.xyz); - r0.xyz = r4.xyz * r0.xyz; - r0.xyz = exp2(r0.xyz); - r0.xyz = float3(0.180000007, 0.180000007, 0.180000007) * r0.xyz; - r4.xyz = r6.xyz * r6.www; - r4.xyz = float3(1, 1, 1) / r4.xyz; - r0.xyz = log2(r0.xyz); - r0.xyz = r4.xyz * r0.xyz; - r0.xyz = exp2(r0.xyz); - r4.xyz = r7.xyz * r7.www; - r5.xyz = r8.xyz + r8.www; - r0.xyz = r0.xyz * r4.xyz + r5.xyz; - r0.w = 1 + -r1.w; - r0.w = -r3.x * r2.w + r0.w; - r0.xyz = r0.xyz * r0.www; - r0.xyz = r1.xyz * r1.www + r0.xyz; - r0.xyz = r2.xyz * r3.yyy + r0.xyz; - - // End of Color Correct - float3 ap1_graded_color = r0.rgb; - float3 ap1_aces_colored = ap1_graded_color; - - // Try throwing renodx on r0 here? - - // uint output_type = cb0[65].z; - - // uint output_type = cb0[65].z; - uint output_type = 3u; - - float3 sdr_color; - float3 hdr_color; - float3 sdr_ap1_color; - - float FilmBlackClip = cb0[36].w; - float FilmToe = cb0[36].y; - float FilmWhiteClip = cb0[37].x; - float FilmShoulder = cb0[36].z; - - // bool is_hdr = (output_type >= 3u && output_type <= 6u); - bool is_hdr = true; - - r1.x = dot(float3(1.70505154, -0.621790707, -0.0832583979), r0.xyz); - r1.y = dot(float3(-0.130257145, 1.14080286, -0.0105485283), r0.xyz); - r1.z = dot(float3(-0.0240032747, -0.128968775, 1.15297174), r0.xyz); - if (cb0[44].y != 0) { - r2.x = dot(r1.xyz, cb0[28].xyz); - r2.y = dot(r1.xyz, cb0[29].xyz); - r2.z = dot(r1.xyz, cb0[30].xyz); - r0.w = dot(r1.xyz, cb0[33].xyz); - r0.w = 1 + r0.w; - r0.w = rcp(r0.w); - r3.xyz = cb0[35].xyz * r0.www + cb0[34].xyz; - r2.xyz = r3.xyz * r2.xyz; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r3.xyz = cb0[31].xxx + -r2.xyz; - r3.xyz = max(float3(0, 0, 0), r3.xyz); - r4.xyz = max(cb0[31].zzz, r2.xyz); - r2.xyz = max(cb0[31].xxx, r2.xyz); - r2.xyz = min(cb0[31].zzz, r2.xyz); - r5.xyz = r4.xyz * cb0[32].xxx + cb0[32].yyy; - r4.xyz = cb0[31].www + r4.xyz; - r4.xyz = rcp(r4.xyz); - r6.xyz = cb0[28].www * r3.xyz; - r3.xyz = cb0[31].yyy + r3.xyz; - r3.xyz = rcp(r3.xyz); - r3.xyz = r6.xyz * r3.xyz + cb0[29].www; - r2.xyz = r2.xyz * cb0[30].www + r3.xyz; - r2.xyz = r5.xyz * r4.xyz + r2.xyz; - r2.xyz = float3(-0.00200000009, -0.00200000009, -0.00200000009) + r2.xyz; - } else { - r3.x = dot(float3(0.938639402, 1.02359565e-10, 0.0613606237), r0.xyz); - r3.y = dot(float3(8.36008554e-11, 0.830794156, 0.169205874), r0.xyz); - r3.z = dot(float3(2.13187367e-12, -5.63307213e-12, 1), r0.xyz); - r3.xyz = r3.xyz + -r0.xyz; - r0.xyz = cb0[66].xxx * r3.xyz + r0.xyz; - - ap1_graded_color = r0.xyz; - - r3.y = dot(float3(0.695452213, 0.140678704, 0.163869068), r0.xyz); - r3.z = dot(float3(0.0447945632, 0.859671116, 0.0955343172), r0.xyz); - r3.w = dot(float3(-0.00552588236, 0.00402521016, 1.00150073), r0.xyz); - r0.w = min(r3.y, r3.z); - r0.w = min(r0.w, r3.w); - r1.w = max(r3.y, r3.z); - r1.w = max(r1.w, r3.w); - r4.xy = max(float2(1.00000001e-10, 0.00999999978), r1.ww); - r0.w = max(1.00000001e-10, r0.w); - r0.w = r4.x + -r0.w; - r0.w = r0.w / r4.y; - r4.xyz = r3.wzy + -r3.zyw; - r4.xy = r4.xy * r3.wz; - r1.w = r4.x + r4.y; - r1.w = r3.y * r4.z + r1.w; - r1.w = sqrt(r1.w); - r2.w = r3.w + r3.z; - r2.w = r2.w + r3.y; - r1.w = r1.w * 1.75 + r2.w; - r2.w = 0.333333343 * r1.w; - r3.x = -0.400000006 + r0.w; - r4.x = 2.5 * r3.x; - r4.x = 1 + -abs(r4.x); - r4.x = max(0, r4.x); - r4.y = cmp(0 < r3.x); - r3.x = cmp(r3.x < 0); - r3.x = (int)-r4.y + (int)r3.x; - r3.x = (int)r3.x; - r4.x = -r4.x * r4.x + 1; - r3.x = r3.x * r4.x + 1; - r3.x = 0.0250000004 * r3.x; - r4.x = cmp(0.159999996 >= r1.w); - r1.w = cmp(r1.w >= 0.479999989); - r2.w = 0.0799999982 / r2.w; - r2.w = -0.5 + r2.w; - r2.w = r3.x * r2.w; - r1.w = r1.w ? 0 : r2.w; - r1.w = r4.x ? r3.x : r1.w; - r1.w = 1 + r1.w; - r4.yzw = r3.yzw * r1.www; - r5.xy = cmp(r4.zw == r4.yz); - r2.w = r5.y ? r5.x : 0; - r3.x = r3.z * r1.w + -r4.w; - r3.x = 1.73205078 * r3.x; - r3.z = r4.y * 2 + -r4.z; - r3.z = -r3.w * r1.w + r3.z; - r3.w = min(abs(r3.x), abs(r3.z)); - r5.x = max(abs(r3.x), abs(r3.z)); - r5.x = 1 / r5.x; - r3.w = r5.x * r3.w; - r5.x = r3.w * r3.w; - r5.y = r5.x * 0.0208350997 + -0.0851330012; - r5.y = r5.x * r5.y + 0.180141002; - r5.y = r5.x * r5.y + -0.330299497; - r5.x = r5.x * r5.y + 0.999866009; - r5.y = r5.x * r3.w; - r5.z = cmp(abs(r3.z) < abs(r3.x)); - r5.y = r5.y * -2 + 1.57079637; - r5.y = r5.z ? r5.y : 0; - r3.w = r3.w * r5.x + r5.y; - r5.x = cmp(r3.z < -r3.z); - r5.x = r5.x ? -3.141593 : 0; - r3.w = r5.x + r3.w; - r5.x = min(r3.x, r3.z); - r3.x = max(r3.x, r3.z); - r3.z = cmp(r5.x < -r5.x); - r3.x = cmp(r3.x >= -r3.x); - r3.x = r3.x ? r3.z : 0; - r3.x = r3.x ? -r3.w : r3.w; - r3.x = 57.2957802 * r3.x; - r2.w = r2.w ? 0 : r3.x; - r3.x = cmp(r2.w < 0); - r3.z = 360 + r2.w; - r2.w = r3.x ? r3.z : r2.w; - r2.w = max(0, r2.w); - r2.w = min(360, r2.w); - r3.x = cmp(180 < r2.w); - r3.z = -360 + r2.w; - r2.w = r3.x ? r3.z : r2.w; - r2.w = 0.0148148146 * r2.w; - r2.w = 1 + -abs(r2.w); - r2.w = max(0, r2.w); - r3.x = r2.w * -2 + 3; - r2.w = r2.w * r2.w; - r2.w = r3.x * r2.w; - r2.w = r2.w * r2.w; - r0.w = r2.w * r0.w; - r1.w = -r3.y * r1.w + 0.0299999993; - r0.w = r1.w * r0.w; - r4.x = r0.w * 0.180000007 + r4.y; - r3.x = dot(float3(1.45143926, -0.236510754, -0.214928567), r4.xzw); - r3.y = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r4.xzw); - r3.z = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r4.xzw); - r3.xyz = max(float3(0, 0, 0), r3.xyz); - r0.w = dot(r3.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r3.xyz = r3.xyz + -r0.www; - r3.xyz = r3.xyz * float3(0.959999979, 0.959999979, 0.959999979) + r0.www; - - ap1_aces_colored = r3.xyz; - - r4.xy = float2(1, 0.180000007) + cb0[36].ww; - r0.w = -cb0[36].y + r4.x; - r1.w = 1 + cb0[37].x; - r2.w = -cb0[36].z + r1.w; - r3.w = cmp(0.800000012 < cb0[36].y); - r4.xz = float2(0.819999993, 1) + -cb0[36].yy; - r4.xz = r4.xz / cb0[36].xx; - r4.y = r4.y / r0.w; - r4.xw = float2(-0.744727492, -1) + r4.xy; - r4.w = 1 + -r4.w; - r4.y = r4.y / r4.w; - r4.y = log2(r4.y); - r4.y = 0.346573591 * r4.y; - r4.w = r0.w / cb0[36].x; - r4.y = -r4.y * r4.w + -0.744727492; - r3.w = r3.w ? r4.x : r4.y; - r4.x = r4.z + -r3.w; - r4.y = cb0[36].z / cb0[36].x; - r4.y = r4.y + -r4.x; - r3.xyz = log2(r3.xyz); - r5.xyz = float3(0.30103001, 0.30103001, 0.30103001) * r3.xyz; - r4.xzw = r3.xyz * float3(0.30103001, 0.30103001, 0.30103001) + r4.xxx; - r4.xzw = cb0[36].xxx * r4.xzw; - r5.w = r0.w + r0.w; - r6.x = -2 * cb0[36].x; - r0.w = r6.x / r0.w; - r6.xyz = r3.xyz * float3(0.30103001, 0.30103001, 0.30103001) + -r3.www; - r7.xyz = r6.xyz * r0.www; - r7.xyz = float3(1.44269502, 1.44269502, 1.44269502) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r7.xyz = float3(1, 1, 1) + r7.xyz; - r7.xyz = r5.www / r7.xyz; - r7.xyz = -cb0[36].www + r7.xyz; - r0.w = r2.w + r2.w; - r5.w = cb0[36].x + cb0[36].x; - r2.w = r5.w / r2.w; - r3.xyz = r3.xyz * float3(0.30103001, 0.30103001, 0.30103001) + -r4.yyy; - r3.xyz = r3.xyz * r2.www; - r3.xyz = float3(1.44269502, 1.44269502, 1.44269502) * r3.xyz; - r3.xyz = exp2(r3.xyz); - r3.xyz = float3(1, 1, 1) + r3.xyz; - r3.xyz = r0.www / r3.xyz; - r3.xyz = -r3.xyz + r1.www; - r8.xyz = cmp(r5.xyz < r3.www); - r7.xyz = r8.xyz ? r7.xyz : r4.xzw; - r5.xyz = cmp(r4.yyy < r5.xyz); - r3.xyz = r5.xyz ? r3.xyz : r4.xzw; - r0.w = r4.y + -r3.w; - r4.xzw = saturate(r6.xyz / r0.www); - r0.w = cmp(r4.y < r3.w); - r5.xyz = float3(1, 1, 1) + -r4.xzw; - r4.xyz = r0.www ? r5.xyz : r4.xzw; - r5.xyz = -r4.xyz * float3(2, 2, 2) + float3(3, 3, 3); - r4.xyz = r4.xyz * r4.xyz; - r4.xyz = r4.xyz * r5.xyz; - r3.xyz = r3.xyz + -r7.xyz; - r3.xyz = r4.xyz * r3.xyz + r7.xyz; - r0.w = dot(r3.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r3.xyz = r3.xyz + -r0.www; - r3.xyz = r3.xyz * float3(0.930000007, 0.930000007, 0.930000007) + r0.www; - sdr_ap1_color = r3.xyz; - - r3.xyz = sdr_ap1_color; - - r3.xyz = max(float3(0, 0, 0), r3.xyz); - r3.xyz = r3.xyz + -r0.xyz; - r0.xyz = cb0[66].zzz * r3.xyz + r0.xyz; - r3.x = dot(float3(1.06537485, 1.44678506e-06, -0.0653710067), r0.xyz); - r3.y = dot(float3(-3.45525592e-07, 1.20366347, -0.203667715), r0.xyz); - r3.z = dot(float3(1.9865448e-08, 2.12079581e-08, 0.999999583), r0.xyz); - r3.xyz = r3.xyz + -r0.xyz; - r0.xyz = cb0[66].xxx * r3.xyz + r0.xyz; - r3.x = dot(float3(1.70505154, -0.621790707, -0.0832583979), r0.xyz); - r3.y = dot(float3(-0.130257145, 1.14080286, -0.0105485283), r0.xyz); - r3.z = dot(float3(-0.0240032747, -0.128968775, 1.15297174), r0.xyz); - r2.xyz = max(float3(0, 0, 0), r3.xyz); - } - - r0.xyz = r2.xyz * r2.xyz; - r2.xyz = cb0[26].yyy * r2.xyz; - r0.xyz = cb0[26].xxx * r0.xyz + r2.xyz; - r0.xyz = cb0[26].zzz + r0.xyz; - r2.xyz = cb0[42].yzw * r0.xyz; - r0.xyz = -r0.xyz * cb0[42].yzw + cb0[43].xyz; - r0.xyz = cb0[43].www * r0.xyz + r2.xyz; - r2.xyz = max(float3(0, 0, 0), r0.xyz); - r2.xyz = log2(r2.xyz); - r2.xyz = cb0[27].yyy * r2.xyz; - r3.xyz = exp2(r2.xyz); - - float3 film_graded_color = r3.rgb; - - if (injectedData.toneMapType != 0.f) { - float3 final_color; - tonemap(ap1_graded_color, ap1_aces_colored, film_graded_color, hdr_color, sdr_color, sdr_ap1_color, final_color); - - final_color.rgb = scalePaperWhite(final_color.rgb); - - // Scale for UE decoding - final_color *= 1.f / 1.05f; - - o0.rgba = float4(final_color.rgb, 0); - - return; - } - - if (cb0[65].z == 0) { - r4.xyz = float3(12.9200001, 12.9200001, 12.9200001) * r3.xyz; - r5.xyz = cmp(r3.xyz >= float3(0.00313066994, 0.00313066994, 0.00313066994)); - r2.xyz = float3(0.416666657, 0.416666657, 0.416666657) * r2.xyz; - r2.xyz = exp2(r2.xyz); - r2.xyz = r2.xyz * float3(1.05499995, 1.05499995, 1.05499995) + float3(-0.0549999997, -0.0549999997, -0.0549999997); - r2.xyz = r5.xyz ? r2.xyz : r4.xyz; - } else { - r4.xyzw = cmp(asint(cb0[65].wwww) == int4(1, 2, 3, 4)); - r5.xyz = r4.www ? float3(1, 0, 0) : float3(1.70505154, -0.621790707, -0.0832583979); - r6.xyz = r4.www ? float3(0, 1, 0) : float3(-0.130257145, 1.14080286, -0.0105485283); - r7.xyz = r4.www ? float3(0, 0, 1) : float3(-0.0240032747, -0.128968775, 1.15297174); - r5.xyz = r4.zzz ? float3(0.695452213, 0.140678704, 0.163869068) : r5.xyz; - r6.xyz = r4.zzz ? float3(0.0447945632, 0.859671116, 0.0955343172) : r6.xyz; - r7.xyz = r4.zzz ? float3(-0.00552588282, 0.00402521016, 1.00150073) : r7.xyz; - r5.xyz = r4.yyy ? float3(1.02579927, -0.0200525094, -0.00577136781) : r5.xyz; - r6.xyz = r4.yyy ? float3(-0.00223502493, 1.00458264, -0.00235231337) : r6.xyz; - r4.yzw = r4.yyy ? float3(-0.00501400325, -0.0252933875, 1.03044021) : r7.xyz; - r5.xyz = r4.xxx ? float3(1.37915885, -0.308850735, -0.0703467429) : r5.xyz; - r6.xyz = r4.xxx ? float3(-0.0693352968, 1.08229232, -0.0129620517) : r6.xyz; - r4.xyz = r4.xxx ? float3(-0.00215925858, -0.0454653986, 1.04775953) : r4.yzw; - r0.w = cmp(asint(cb0[65].z) == 1); - if (r0.w != 0) { - r7.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r3.xyz); - r7.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r3.xyz); - r7.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r3.xyz); - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = max(float3(6.10351999e-05, 6.10351999e-05, 6.10351999e-05), r8.xyz); - r8.xyz = float3(4.5, 4.5, 4.5) * r7.xyz; - r7.xyz = max(float3(0.0179999992, 0.0179999992, 0.0179999992), r7.xyz); - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.449999988, 0.449999988, 0.449999988) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r7.xyz = r7.xyz * float3(1.09899998, 1.09899998, 1.09899998) + float3(-0.0989999995, -0.0989999995, -0.0989999995); - r2.xyz = min(r8.xyz, r7.xyz); - } else { - r7.xyz = cb0[42].yzw * r1.xyz; - r1.xyz = -r1.xyz * cb0[42].yzw + cb0[43].xyz; - r1.xyz = cb0[43].www * r1.xyz + r7.xyz; - r7.xy = cmp(asint(cb0[65].zz) == int2(3, 5)); - r0.w = (int)r7.y | (int)r7.x; - if (r0.w != 0) { - r7.xyz = float3(1.5, 1.5, 1.5) * r1.xyz; - r8.y = dot(float3(0.439700812, 0.382978052, 0.1773348), r7.xyz); - r8.z = dot(float3(0.0897923037, 0.813423157, 0.096761629), r7.xyz); - r8.w = dot(float3(0.0175439864, 0.111544058, 0.870704114), r7.xyz); - r0.w = min(r8.y, r8.z); - r0.w = min(r0.w, r8.w); - r1.w = max(r8.y, r8.z); - r1.w = max(r1.w, r8.w); - r7.xy = max(float2(1.00000001e-10, 0.00999999978), r1.ww); - r0.w = max(1.00000001e-10, r0.w); - r0.w = r7.x + -r0.w; - r0.w = r0.w / r7.y; - r7.xyz = r8.wzy + -r8.zyw; - r7.xy = r8.wz * r7.xy; - r1.w = r7.x + r7.y; - r1.w = r8.y * r7.z + r1.w; - r1.w = sqrt(r1.w); - r2.w = r8.w + r8.z; - r2.w = r2.w + r8.y; - r1.w = r1.w * 1.75 + r2.w; - r2.w = 0.333333343 * r1.w; - r3.w = -0.400000006 + r0.w; - r4.w = 2.5 * r3.w; - r4.w = 1 + -abs(r4.w); - r4.w = max(0, r4.w); - r5.w = cmp(0 < r3.w); - r3.w = cmp(r3.w < 0); - r3.w = (int)-r5.w + (int)r3.w; - r3.w = (int)r3.w; - r4.w = -r4.w * r4.w + 1; - r3.w = r3.w * r4.w + 1; - r3.w = 0.0250000004 * r3.w; - r4.w = cmp(0.159999996 >= r1.w); - r1.w = cmp(r1.w >= 0.479999989); - r2.w = 0.0799999982 / r2.w; - r2.w = -0.5 + r2.w; - r2.w = r3.w * r2.w; - r1.w = r1.w ? 0 : r2.w; - r1.w = r4.w ? r3.w : r1.w; - r1.w = 1 + r1.w; - r7.yzw = r8.yzw * r1.www; - r9.xy = cmp(r7.zw == r7.yz); - r2.w = r9.y ? r9.x : 0; - r3.w = r8.z * r1.w + -r7.w; - r3.w = 1.73205078 * r3.w; - r4.w = r7.y * 2 + -r7.z; - r4.w = -r8.w * r1.w + r4.w; - r5.w = min(abs(r4.w), abs(r3.w)); - r6.w = max(abs(r4.w), abs(r3.w)); - r6.w = 1 / r6.w; - r5.w = r6.w * r5.w; - r6.w = r5.w * r5.w; - r8.x = r6.w * 0.0208350997 + -0.0851330012; - r8.x = r6.w * r8.x + 0.180141002; - r8.x = r6.w * r8.x + -0.330299497; - r6.w = r6.w * r8.x + 0.999866009; - r8.x = r6.w * r5.w; - r8.z = cmp(abs(r4.w) < abs(r3.w)); - r8.x = r8.x * -2 + 1.57079637; - r8.x = r8.z ? r8.x : 0; - r5.w = r5.w * r6.w + r8.x; - r6.w = cmp(r4.w < -r4.w); - r6.w = r6.w ? -3.141593 : 0; - r5.w = r6.w + r5.w; - r6.w = min(r4.w, r3.w); - r3.w = max(r4.w, r3.w); - r4.w = cmp(r6.w < -r6.w); - r3.w = cmp(r3.w >= -r3.w); - r3.w = r3.w ? r4.w : 0; - r3.w = r3.w ? -r5.w : r5.w; - r3.w = 57.2957802 * r3.w; - r2.w = r2.w ? 0 : r3.w; - r3.w = cmp(r2.w < 0); - r4.w = 360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r2.w = max(0, r2.w); - r2.w = min(360, r2.w); - r3.w = cmp(180 < r2.w); - r4.w = -360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r3.w = cmp(-67.5 < r2.w); - r4.w = cmp(r2.w < 67.5); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r2.w = 67.5 + r2.w; - r3.w = 0.0296296291 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r2.w = r2.w * 0.0296296291 + -r3.w; - r3.w = r2.w * r2.w; - r5.w = r3.w * r2.w; - r8.xzw = float3(-0.166666672, -0.5, 0.166666672) * r5.www; - r8.xz = r3.ww * float2(0.5, 0.5) + r8.xz; - r8.xz = r2.ww * float2(-0.5, 0.5) + r8.xz; - r2.w = r5.w * 0.5 + -r3.w; - r2.w = 0.666666687 + r2.w; - r9.xyz = cmp((int3)r4.www == int3(3, 2, 1)); - r8.xz = float2(0.166666672, 0.166666672) + r8.xz; - r3.w = r4.w ? 0 : r8.w; - r3.w = r9.z ? r8.z : r3.w; - r2.w = r9.y ? r2.w : r3.w; - r2.w = r9.x ? r8.x : r2.w; - } else { - r2.w = 0; - } - r0.w = r2.w * r0.w; - r0.w = 1.5 * r0.w; - r1.w = -r8.y * r1.w + 0.0299999993; - r0.w = r1.w * r0.w; - r7.x = r0.w * 0.180000007 + r7.y; - r7.xyz = max(float3(0, 0, 0), r7.xzw); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r8.x = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r8.y = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r8.z = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r7.xyz = max(float3(0, 0, 0), r8.xyz); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r0.w = dot(r7.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r7.xyz = r7.xyz + -r0.www; - r7.xyz = r7.xyz * float3(0.959999979, 0.959999979, 0.959999979) + r0.www; - r8.xyz = cmp(float3(0, 0, 0) >= r7.xyz); - r7.xyz = log2(r7.xyz); - r7.xyz = r8.xyz ? float3(-14, -14, -14) : r7.xyz; - r8.xyz = cmp(float3(-17.4739323, -17.4739323, -17.4739323) >= r7.xyz); - if (r8.x != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.x); - r2.w = cmp(r7.x < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.664385557 + -r2.w; - r8.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r8.x + 0].x; - r10.z = icb[r8.w + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r1.w = cmp(r7.x >= -2.47393107); - r2.w = cmp(r7.x < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.553654671 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r7.x + 0].y; - r10.z = icb[r7.w + 0].y; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.x = exp2(r0.w); - if (r8.y != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.y); - r2.w = cmp(r7.y < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.664385557 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].x; - r11.y = icb[r7.x + 0].x; - r11.z = icb[r7.w + 0].x; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r1.w = cmp(r7.y >= -2.47393107); - r2.w = cmp(r7.y < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.553654671 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].y; - r11.y = icb[r7.x + 0].y; - r11.z = icb[r7.y + 0].y; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.y = exp2(r0.w); - if (r8.z != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.z); - r2.w = cmp(r7.z < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r8.y = r1.w * 0.664385557 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r7.x + 0].x; - r10.z = icb[r7.y + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r0.w = dot(r8.xyz, r11.xyz); - } else { - r1.w = cmp(r7.z >= -2.47393107); - r2.w = cmp(r7.z < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r7.y = r1.w * 0.553654671 + -r2.w; - r8.xy = (int2)r3.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r8.x + 0].y; - r10.z = icb[r8.y + 0].y; - r8.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r10.xy, float2(-1, 1)); - r8.z = dot(r10.xy, float2(0.5, 0.5)); - r7.z = 1; - r0.w = dot(r7.xyz, r8.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.z = exp2(r0.w); - r7.x = dot(float3(0.695452213, 0.140678704, 0.163869068), r9.xyz); - r7.y = dot(float3(0.0447945632, 0.859671116, 0.0955343172), r9.xyz); - r7.z = dot(float3(-0.00552588282, 0.00402521016, 1.00150073), r9.xyz); - r0.w = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r1.w = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r2.w = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r3.w = cmp(0 >= r0.w); - r0.w = log2(r0.w); - r0.w = r3.w ? -13.2877121 : r0.w; - r3.w = cmp(-12.7838678 >= r0.w); - if (r3.w != 0) { - r3.w = r0.w * 0.90309 + 7.54498291; - } else { - r4.w = cmp(-12.7838678 < r0.w); - r5.w = cmp(r0.w < 2.26303458); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + 3.84832764; - r5.w = 1.54540098 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 1.54540098 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 0].z; - r9.y = icb[r8.x + 0].z; - r9.z = icb[r8.y + 0].z; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r4.w = cmp(r0.w >= 2.26303458); - r5.w = cmp(r0.w < 12.1373367); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + -0.681241274; - r5.w = 2.3549509 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 2.3549509 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 0].w; - r9.y = icb[r8.x + 0].w; - r9.z = icb[r8.y + 0].w; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r3.w = r0.w * 0.0180617999 + 2.78077793; - } - } - } - r0.w = 3.32192802 * r3.w; - r7.x = exp2(r0.w); - r0.w = cmp(0 >= r1.w); - r1.w = log2(r1.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = r0.w * 0.90309 + 7.54498291; - } else { - r3.w = cmp(-12.7838678 < r0.w); - r4.w = cmp(r0.w < 2.26303458); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + 3.84832764; - r4.w = 1.54540098 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 1.54540098 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 0].z; - r10.y = icb[r9.x + 0].z; - r10.z = icb[r9.y + 0].z; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r3.w = cmp(r0.w >= 2.26303458); - r4.w = cmp(r0.w < 12.1373367); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + -0.681241274; - r4.w = 2.3549509 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 2.3549509 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 0].w; - r10.y = icb[r9.x + 0].w; - r10.z = icb[r9.y + 0].w; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0180617999 + 2.78077793; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.y = exp2(r0.w); - r0.w = cmp(0 >= r2.w); - r1.w = log2(r2.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = r0.w * 0.90309 + 7.54498291; - } else { - r2.w = cmp(-12.7838678 < r0.w); - r3.w = cmp(r0.w < 2.26303458); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + 3.84832764; - r3.w = 1.54540098 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 1.54540098 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 0].z; - r10.y = icb[r9.x + 0].z; - r10.z = icb[r9.y + 0].z; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r2.w = cmp(r0.w >= 2.26303458); - r3.w = cmp(r0.w < 12.1373367); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + -0.681241274; - r3.w = 2.3549509 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 2.3549509 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 0].w; - r10.y = icb[r9.x + 0].w; - r10.z = icb[r9.y + 0].w; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0180617999 + 2.78077793; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.z = exp2(r0.w); - r7.xyz = float3(-3.50738446e-05, -3.50738446e-05, -3.50738446e-05) + r7.xyz; - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = float3(9.99999975e-05, 9.99999975e-05, 9.99999975e-05) * r8.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.159301758, 0.159301758, 0.159301758) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r8.xyz = r7.xyz * float3(18.8515625, 18.8515625, 18.8515625) + float3(0.8359375, 0.8359375, 0.8359375); - r7.xyz = r7.xyz * float3(18.6875, 18.6875, 18.6875) + float3(1, 1, 1); - r7.xyz = rcp(r7.xyz); - r7.xyz = r8.xyz * r7.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(78.84375, 78.84375, 78.84375) * r7.xyz; - r2.xyz = exp2(r7.xyz); - } else { - r7.xy = cmp(asint(cb0[65].zz) == int2(4, 6)); - r0.w = (int)r7.y | (int)r7.x; - if (r0.w != 0) { - r7.xyz = float3(1.5, 1.5, 1.5) * r1.xyz; - r8.y = dot(float3(0.439700812, 0.382978052, 0.1773348), r7.xyz); - r8.z = dot(float3(0.0897923037, 0.813423157, 0.096761629), r7.xyz); - r8.w = dot(float3(0.0175439864, 0.111544058, 0.870704114), r7.xyz); - r0.w = min(r8.y, r8.z); - r0.w = min(r0.w, r8.w); - r1.w = max(r8.y, r8.z); - r1.w = max(r1.w, r8.w); - r7.xy = max(float2(1.00000001e-10, 0.00999999978), r1.ww); - r0.w = max(1.00000001e-10, r0.w); - r0.w = r7.x + -r0.w; - r0.w = r0.w / r7.y; - r7.xyz = r8.wzy + -r8.zyw; - r7.xy = r8.wz * r7.xy; - r1.w = r7.x + r7.y; - r1.w = r8.y * r7.z + r1.w; - r1.w = sqrt(r1.w); - r2.w = r8.w + r8.z; - r2.w = r2.w + r8.y; - r1.w = r1.w * 1.75 + r2.w; - r2.w = 0.333333343 * r1.w; - r3.w = -0.400000006 + r0.w; - r4.w = 2.5 * r3.w; - r4.w = 1 + -abs(r4.w); - r4.w = max(0, r4.w); - r5.w = cmp(0 < r3.w); - r3.w = cmp(r3.w < 0); - r3.w = (int)-r5.w + (int)r3.w; - r3.w = (int)r3.w; - r4.w = -r4.w * r4.w + 1; - r3.w = r3.w * r4.w + 1; - r3.w = 0.0250000004 * r3.w; - r4.w = cmp(0.159999996 >= r1.w); - r1.w = cmp(r1.w >= 0.479999989); - r2.w = 0.0799999982 / r2.w; - r2.w = -0.5 + r2.w; - r2.w = r3.w * r2.w; - r1.w = r1.w ? 0 : r2.w; - r1.w = r4.w ? r3.w : r1.w; - r1.w = 1 + r1.w; - r7.yzw = r8.yzw * r1.www; - r9.xy = cmp(r7.zw == r7.yz); - r2.w = r9.y ? r9.x : 0; - r3.w = r8.z * r1.w + -r7.w; - r3.w = 1.73205078 * r3.w; - r4.w = r7.y * 2 + -r7.z; - r4.w = -r8.w * r1.w + r4.w; - r5.w = min(abs(r4.w), abs(r3.w)); - r6.w = max(abs(r4.w), abs(r3.w)); - r6.w = 1 / r6.w; - r5.w = r6.w * r5.w; - r6.w = r5.w * r5.w; - r8.x = r6.w * 0.0208350997 + -0.0851330012; - r8.x = r6.w * r8.x + 0.180141002; - r8.x = r6.w * r8.x + -0.330299497; - r6.w = r6.w * r8.x + 0.999866009; - r8.x = r6.w * r5.w; - r8.z = cmp(abs(r4.w) < abs(r3.w)); - r8.x = r8.x * -2 + 1.57079637; - r8.x = r8.z ? r8.x : 0; - r5.w = r5.w * r6.w + r8.x; - r6.w = cmp(r4.w < -r4.w); - r6.w = r6.w ? -3.141593 : 0; - r5.w = r6.w + r5.w; - r6.w = min(r4.w, r3.w); - r3.w = max(r4.w, r3.w); - r4.w = cmp(r6.w < -r6.w); - r3.w = cmp(r3.w >= -r3.w); - r3.w = r3.w ? r4.w : 0; - r3.w = r3.w ? -r5.w : r5.w; - r3.w = 57.2957802 * r3.w; - r2.w = r2.w ? 0 : r3.w; - r3.w = cmp(r2.w < 0); - r4.w = 360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r2.w = max(0, r2.w); - r2.w = min(360, r2.w); - r3.w = cmp(180 < r2.w); - r4.w = -360 + r2.w; - r2.w = r3.w ? r4.w : r2.w; - r3.w = cmp(-67.5 < r2.w); - r4.w = cmp(r2.w < 67.5); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r2.w = 67.5 + r2.w; - r3.w = 0.0296296291 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r2.w = r2.w * 0.0296296291 + -r3.w; - r3.w = r2.w * r2.w; - r5.w = r3.w * r2.w; - r8.xzw = float3(-0.166666672, -0.5, 0.166666672) * r5.www; - r8.xz = r3.ww * float2(0.5, 0.5) + r8.xz; - r8.xz = r2.ww * float2(-0.5, 0.5) + r8.xz; - r2.w = r5.w * 0.5 + -r3.w; - r2.w = 0.666666687 + r2.w; - r9.xyz = cmp((int3)r4.www == int3(3, 2, 1)); - r8.xz = float2(0.166666672, 0.166666672) + r8.xz; - r3.w = r4.w ? 0 : r8.w; - r3.w = r9.z ? r8.z : r3.w; - r2.w = r9.y ? r2.w : r3.w; - r2.w = r9.x ? r8.x : r2.w; - } else { - r2.w = 0; - } - r0.w = r2.w * r0.w; - r0.w = 1.5 * r0.w; - r1.w = -r8.y * r1.w + 0.0299999993; - r0.w = r1.w * r0.w; - r7.x = r0.w * 0.180000007 + r7.y; - r7.xyz = max(float3(0, 0, 0), r7.xzw); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r8.x = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r8.y = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r8.z = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r7.xyz = max(float3(0, 0, 0), r8.xyz); - r7.xyz = min(float3(65535, 65535, 65535), r7.xyz); - r0.w = dot(r7.xyz, float3(0.272228718, 0.674081743, 0.0536895171)); - r7.xyz = r7.xyz + -r0.www; - r7.xyz = r7.xyz * float3(0.959999979, 0.959999979, 0.959999979) + r0.www; - r8.xyz = cmp(float3(0, 0, 0) >= r7.xyz); - r7.xyz = log2(r7.xyz); - r7.xyz = r8.xyz ? float3(-14, -14, -14) : r7.xyz; - r8.xyz = cmp(float3(-17.4739323, -17.4739323, -17.4739323) >= r7.xyz); - if (r8.x != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.x); - r2.w = cmp(r7.x < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.664385557 + -r2.w; - r8.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r8.x + 0].x; - r10.z = icb[r8.w + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r1.w = cmp(r7.x >= -2.47393107); - r2.w = cmp(r7.x < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.x * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r9.y = r1.w * 0.553654671 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r9.x = r9.y * r9.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r7.x + 0].y; - r10.z = icb[r7.w + 0].y; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r9.z = 1; - r0.w = dot(r9.xyz, r11.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.x = exp2(r0.w); - if (r8.y != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.y); - r2.w = cmp(r7.y < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.664385557 + -r2.w; - r7.xw = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].x; - r11.y = icb[r7.x + 0].x; - r11.z = icb[r7.w + 0].x; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r1.w = cmp(r7.y >= -2.47393107); - r2.w = cmp(r7.y < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.y * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r10.y = r1.w * 0.553654671 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r10.x = r10.y * r10.y; - r11.x = icb[r3.w + 0].y; - r11.y = icb[r7.x + 0].y; - r11.z = icb[r7.y + 0].y; - r12.x = dot(r11.xzy, float3(0.5, 0.5, -1)); - r12.y = dot(r11.xy, float2(-1, 1)); - r12.z = dot(r11.xy, float2(0.5, 0.5)); - r10.z = 1; - r0.w = dot(r10.xyz, r12.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.y = exp2(r0.w); - if (r8.z != 0) { - r0.w = -4; - } else { - r1.w = cmp(-17.4739323 < r7.z); - r2.w = cmp(r7.z < -2.47393107); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 5.26017761; - r2.w = 0.664385557 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r8.y = r1.w * 0.664385557 + -r2.w; - r7.xy = (int2)r3.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r3.w + 0].x; - r10.y = icb[r7.x + 0].x; - r10.z = icb[r7.y + 0].x; - r11.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r11.y = dot(r10.xy, float2(-1, 1)); - r11.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r0.w = dot(r8.xyz, r11.xyz); - } else { - r1.w = cmp(r7.z >= -2.47393107); - r2.w = cmp(r7.z < 15.5260687); - r1.w = r1.w ? r2.w : 0; - if (r1.w != 0) { - r1.w = r7.z * 0.30103001 + 0.744727492; - r2.w = 0.553654671 * r1.w; - r3.w = (int)r2.w; - r2.w = trunc(r2.w); - r7.y = r1.w * 0.553654671 + -r2.w; - r8.xy = (int2)r3.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r10.x = icb[r3.w + 0].y; - r10.y = icb[r8.x + 0].y; - r10.z = icb[r8.y + 0].y; - r8.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r10.xy, float2(-1, 1)); - r8.z = dot(r10.xy, float2(0.5, 0.5)); - r7.z = 1; - r0.w = dot(r7.xyz, r8.xyz); - } else { - r0.w = 4; - } - } - } - r0.w = 3.32192802 * r0.w; - r9.z = exp2(r0.w); - r7.x = dot(float3(0.695452213, 0.140678704, 0.163869068), r9.xyz); - r7.y = dot(float3(0.0447945632, 0.859671116, 0.0955343172), r9.xyz); - r7.z = dot(float3(-0.00552588282, 0.00402521016, 1.00150073), r9.xyz); - r0.w = dot(float3(1.45143926, -0.236510754, -0.214928567), r7.xyz); - r1.w = dot(float3(-0.0765537769, 1.17622972, -0.0996759236), r7.xyz); - r2.w = dot(float3(0.00831614807, -0.00603244966, 0.997716308), r7.xyz); - r3.w = cmp(0 >= r0.w); - r0.w = log2(r0.w); - r0.w = r3.w ? -13.2877121 : r0.w; - r3.w = cmp(-12.7838678 >= r0.w); - if (r3.w != 0) { - r3.w = -2.30102992; - } else { - r4.w = cmp(-12.7838678 < r0.w); - r5.w = cmp(r0.w < 2.26303458); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + 3.84832764; - r5.w = 1.54540098 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 1.54540098 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 6].x; - r9.y = icb[r8.x + 6].x; - r9.z = icb[r8.y + 6].x; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r4.w = cmp(r0.w >= 2.26303458); - r5.w = cmp(r0.w < 12.4948215); - r4.w = r4.w ? r5.w : 0; - if (r4.w != 0) { - r4.w = r0.w * 0.30103001 + -0.681241274; - r5.w = 2.27267218 * r4.w; - r6.w = (int)r5.w; - r5.w = trunc(r5.w); - r7.y = r4.w * 2.27267218 + -r5.w; - r8.xy = (int2)r6.ww + int2(1, 2); - r7.x = r7.y * r7.y; - r9.x = icb[r6.w + 6].y; - r9.y = icb[r8.x + 6].y; - r9.z = icb[r8.y + 6].y; - r8.x = dot(r9.xzy, float3(0.5, 0.5, -1)); - r8.y = dot(r9.xy, float2(-1, 1)); - r8.z = dot(r9.xy, float2(0.5, 0.5)); - r7.z = 1; - r3.w = dot(r7.xyz, r8.xyz); - } else { - r3.w = r0.w * 0.0361235999 + 2.84967208; - } - } - } - r0.w = 3.32192802 * r3.w; - r7.x = exp2(r0.w); - r0.w = cmp(0 >= r1.w); - r1.w = log2(r1.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = -2.30102992; - } else { - r3.w = cmp(-12.7838678 < r0.w); - r4.w = cmp(r0.w < 2.26303458); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + 3.84832764; - r4.w = 1.54540098 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 1.54540098 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 6].x; - r10.y = icb[r9.x + 6].x; - r10.z = icb[r9.y + 6].x; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r3.w = cmp(r0.w >= 2.26303458); - r4.w = cmp(r0.w < 12.4948215); - r3.w = r3.w ? r4.w : 0; - if (r3.w != 0) { - r3.w = r0.w * 0.30103001 + -0.681241274; - r4.w = 2.27267218 * r3.w; - r5.w = (int)r4.w; - r4.w = trunc(r4.w); - r8.y = r3.w * 2.27267218 + -r4.w; - r9.xy = (int2)r5.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r5.w + 6].y; - r10.y = icb[r9.x + 6].y; - r10.z = icb[r9.y + 6].y; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0361235999 + 2.84967208; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.y = exp2(r0.w); - r0.w = cmp(0 >= r2.w); - r1.w = log2(r2.w); - r0.w = r0.w ? -13.2877121 : r1.w; - r1.w = cmp(-12.7838678 >= r0.w); - if (r1.w != 0) { - r1.w = -2.30102992; - } else { - r2.w = cmp(-12.7838678 < r0.w); - r3.w = cmp(r0.w < 2.26303458); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + 3.84832764; - r3.w = 1.54540098 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 1.54540098 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 6].x; - r10.y = icb[r9.x + 6].x; - r10.z = icb[r9.y + 6].x; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r2.w = cmp(r0.w >= 2.26303458); - r3.w = cmp(r0.w < 12.4948215); - r2.w = r2.w ? r3.w : 0; - if (r2.w != 0) { - r2.w = r0.w * 0.30103001 + -0.681241274; - r3.w = 2.27267218 * r2.w; - r4.w = (int)r3.w; - r3.w = trunc(r3.w); - r8.y = r2.w * 2.27267218 + -r3.w; - r9.xy = (int2)r4.ww + int2(1, 2); - r8.x = r8.y * r8.y; - r10.x = icb[r4.w + 6].y; - r10.y = icb[r9.x + 6].y; - r10.z = icb[r9.y + 6].y; - r9.x = dot(r10.xzy, float3(0.5, 0.5, -1)); - r9.y = dot(r10.xy, float2(-1, 1)); - r9.z = dot(r10.xy, float2(0.5, 0.5)); - r8.z = 1; - r1.w = dot(r8.xyz, r9.xyz); - } else { - r1.w = r0.w * 0.0361235999 + 2.84967208; - } - } - } - r0.w = 3.32192802 * r1.w; - r7.z = exp2(r0.w); - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = float3(9.99999975e-05, 9.99999975e-05, 9.99999975e-05) * r8.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.159301758, 0.159301758, 0.159301758) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r8.xyz = r7.xyz * float3(18.8515625, 18.8515625, 18.8515625) + float3(0.8359375, 0.8359375, 0.8359375); - r7.xyz = r7.xyz * float3(18.6875, 18.6875, 18.6875) + float3(1, 1, 1); - r7.xyz = rcp(r7.xyz); - r7.xyz = r8.xyz * r7.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(78.84375, 78.84375, 78.84375) * r7.xyz; - r2.xyz = exp2(r7.xyz); - } else { - r0.w = cmp(asint(cb0[65].z) == 7); - if (r0.w != 0) { - r7.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r1.xyz); - r7.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r1.xyz); - r7.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r1.xyz); - r8.x = dot(r5.xyz, r7.xyz); - r8.y = dot(r6.xyz, r7.xyz); - r8.z = dot(r4.xyz, r7.xyz); - r7.xyz = float3(9.99999975e-05, 9.99999975e-05, 9.99999975e-05) * r8.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(0.159301758, 0.159301758, 0.159301758) * r7.xyz; - r7.xyz = exp2(r7.xyz); - r8.xyz = r7.xyz * float3(18.8515625, 18.8515625, 18.8515625) + float3(0.8359375, 0.8359375, 0.8359375); - r7.xyz = r7.xyz * float3(18.6875, 18.6875, 18.6875) + float3(1, 1, 1); - r7.xyz = rcp(r7.xyz); - r7.xyz = r8.xyz * r7.xyz; - r7.xyz = log2(r7.xyz); - r7.xyz = float3(78.84375, 78.84375, 78.84375) * r7.xyz; - r2.xyz = exp2(r7.xyz); - } else { - r7.xy = cmp(asint(cb0[65].zz) == int2(8, 9)); - r8.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r0.xyz); - r8.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r0.xyz); - r8.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r0.xyz); - r0.x = dot(r5.xyz, r8.xyz); - r0.y = dot(r6.xyz, r8.xyz); - r0.z = dot(r4.xyz, r8.xyz); - r8.x = dot(float3(0.613191485, 0.33951208, 0.0473663323), r3.xyz); - r8.y = dot(float3(0.0702069029, 0.916335821, 0.0134500116), r3.xyz); - r8.z = dot(float3(0.0206188709, 0.109567292, 0.869606733), r3.xyz); - r0.w = dot(r5.xyz, r8.xyz); - r1.w = dot(r6.xyz, r8.xyz); - r2.w = dot(r4.xyz, r8.xyz); - r3.x = log2(r0.w); - r3.y = log2(r1.w); - r3.z = log2(r2.w); - r3.xyz = cb0[27].zzz * r3.xyz; - r3.xyz = exp2(r3.xyz); - r0.xyz = r7.yyy ? r0.xyz : r3.xyz; - r2.xyz = r7.xxx ? r1.xyz : r0.xyz; - } - } - } - } - } - o0.xyz = float3(0.952381015, 0.952381015, 0.952381015) * r2.xyz; - o0.w = 0; - return; -} diff --git a/src/games/visionsofmana/movies_0x82F9B4AC.ps_5_1.hlsl b/src/games/visionsofmana/movies_0x82F9B4AC.ps_5_1.hlsl deleted file mode 100644 index 9682b11f..00000000 --- a/src/games/visionsofmana/movies_0x82F9B4AC.ps_5_1.hlsl +++ /dev/null @@ -1,96 +0,0 @@ -// ---- Created with 3Dmigoto v1.3.16 on Sun Sep 29 03:09:50 2024 -// Movies 1 (Intro Movies) - -#include "./shared.h" - -Texture2D t0 : register(t0); - -SamplerState s0_s : register(s0); - -cbuffer cb1 : register(b1) -{ - float4 cb1[11]; -} - -cbuffer cb0 : register(b0) -{ - float4 cb0[39]; -} - - - - -// 3Dmigoto declarations -#define cmp - - - -void main( - float4 v0 : SV_POSITION0, - out float4 o0 : SV_Target0) -{ - float4 r0,r1,r2,r3,r4; - uint4 bitmask, uiDest; - float4 fDest; - - r0.xy = asuint(cb0[37].xy); - r0.xy = v0.xy + -r0.xy; - r0.z = cmp(0 >= cb1[7].y); - r0.w = log2(cb1[7].y); - r0.w = 0.45449999 * r0.w; - r0.w = exp2(r0.w); - r0.z = r0.z ? 0 : r0.w; - r1.xy = float2(-2,-1.10000002) + cb1[7].zw; - r0.zw = r0.zz * r1.xy + float2(2,1.10000002); - r1.xy = r0.xy * cb0[38].zw + float2(-0.5,-0.5); - r1.xy = cb1[1].xy * r1.xy; - r1.x = dot(r1.xy, r1.xy); - r1.x = sqrt(r1.x); - r1.x = r1.x + -r0.z; - r0.z = r0.w + -r0.z; - r0.z = saturate(r1.x / r0.z); - r0.w = r0.z * r0.z; - r0.z = -r0.z * 2 + 3; - r0.z = r0.w * r0.z; - r0.z = min(1, r0.z); - r1.xy = r0.xy * cb0[38].zw + -cb1[10].yz; - r0.w = -1 + cb1[10].x; - r2.xyz = float3(0,0,0); - r1.z = 0; - while (true) { - r1.w = (int)r1.z; - r2.w = cmp(r1.w >= cb1[10].x); - if (r2.w != 0) break; - r1.w = r1.w / r0.w; - r3.xyzw = cb1[4].zzww * r1.wwww + cb1[4].yyzz; - r1.w = cb1[5].y * r1.w + cb1[5].x; - r3.xyzw = r1.xyxy * r3.xyzw + cb1[10].yzyz; - r4.xyzw = r0.xyxy * cb0[38].zwzw + -r3.xyzw; - r3.xyzw = r0.zzzz * r4.xyzw + r3.xyzw; - r4.xy = r1.xy * r1.ww + cb1[10].yz; - r4.zw = r0.xy * cb0[38].zw + -r4.xy; - r4.xy = r0.zz * r4.zw + r4.xy; - r3.xyzw = r3.xyzw * cb0[5].xyxy + cb0[4].xyxy; - r1.w = t0.Sample(s0_s, r3.xy).x; - r2.x = r2.x + r1.w; - r1.w = t0.Sample(s0_s, r3.zw).y; - r2.y = r2.y + r1.w; - r3.xy = r4.xy * cb0[5].xy + cb0[4].xy; - r1.w = t0.Sample(s0_s, r3.xy).z; - r2.z = r2.z + r1.w; - r1.z = (int)r1.z + 1; - } - r0.xyz = r2.xyz / cb1[10].xxx; - r1.xyz = cb1[6].xyz + -r0.xyz; - r0.xyz = cb1[10].www * r1.xyz + r0.xyz; - if (injectedData.toneMapType == 0){ - o0.xyz = max(float3(0, 0, 0), r0.xyz); - } - else{ - o0.rgb = r0.xyz; //unclamp rec709 - } - o0.w = 1; - - // o0.rgb = renodx::math::SafePow(o0.rgb, 2.2f); //2.2 gamma correction - //o0.rgb *= injectedData.toneMapGameNits / 80.f; //Added ui slider - return; -} \ No newline at end of file diff --git a/src/games/visionsofmana/sample1_0xBBA0606A.ps_5_1.hlsl b/src/games/visionsofmana/sample1_0xBBA0606A.ps_5_1.hlsl deleted file mode 100644 index 903a2ab0..00000000 --- a/src/games/visionsofmana/sample1_0xBBA0606A.ps_5_1.hlsl +++ /dev/null @@ -1,127 +0,0 @@ -// ---- Created with 3Dmigoto v1.3.16 on Thu Sep 5 00:04:50 2024 -// Main output, used to be called the "709" shader in the older mod - -#include "./common.hlsl" -#include "./shared.h" - -Texture3D t3 : register(t3); - -Texture2D t2 : register(t2); - -Texture2D t1 : register(t1); - -Texture2D t0 : register(t0); - -SamplerState s3_s : register(s3); - -SamplerState s2_s : register(s2); - -SamplerState s1_s : register(s1); - -SamplerState s0_s : register(s0); - -cbuffer cb1 : register(b1) { - float4 cb1[136]; -} - -cbuffer cb0 : register(b0) { - float4 cb0[68]; -} - -// 3Dmigoto declarations -#define cmp - - -void main( - linear noperspective float2 v0 : TEXCOORD0, - linear noperspective float2 w0 : TEXCOORD3, - linear noperspective float3 v1 : TEXCOORD1, - linear noperspective float4 v2 : TEXCOORD2, - float2 v3 : TEXCOORD4, - float4 v4 : SV_POSITION0, - out float4 o0 : SV_Target0) { - float4 r0, r1, r2; - uint4 bitmask, uiDest; - float4 fDest; - - r0.x = v2.w * 543.309998 + v2.z; - r0.x = sin(r0.x); - r0.x = 493013 * r0.x; - r0.x = frac(r0.x); - r0.yzw = t0.Sample(s0_s, v0.xy).xyz; - r0.yzw = cb1[135].zzz * r0.yzw; - r1.xy = cb0[58].zw * v0.xy + cb0[59].xy; - r1.xy = max(cb0[50].zw, r1.xy); - r1.xy = min(cb0[51].xy, r1.xy); - r1.xyz = t1.Sample(s1_s, r1.xy).xyz; - r1.xyz = cb1[135].zzz * r1.xyz; - r2.xy = w0.xy * cb0[67].zw + cb0[67].xy; - r2.xy = r2.xy * float2(0.5, -0.5) + float2(0.5, 0.5); - r2.xyz = t2.Sample(s2_s, r2.xy).xyz; - r2.xyz = r2.xyz * cb0[66].xyz + cb0[61].xyz; - r1.xyz = r2.xyz * r1.xyz; - r0.yzw = r0.yzw * cb0[60].xyz + r1.xyz; - - r0.yzw = v1.xxx * r0.yzw; - r1.xy = cb0[62].xx * v1.yz; - r1.x = dot(r1.xy, r1.xy); - r1.x = 1 + r1.x; - r1.x = rcp(r1.x); - r1.x = r1.x * r1.x; - - // r0.yzw = r0.yzw * r1.xxx + float3(0.00266771927,0.00266771927,0.00266771927); - // r0.yzw = log2(r0.yzw); - // r0.yzw = saturate(r0.yzw * float3(0.0714285746,0.0714285746,0.0714285746) + float3(0.610726953,0.610726953,0.610726953)); - // r0.yzw = r0.yzw * float3(0.96875,0.96875,0.96875) + float3(0.015625,0.015625,0.015625); - // r0.yzw = t3.Sample(s3_s, r0.yzw).xyz; //sampling lutbuilder - // r1.xyz = float3(1.04999995,1.04999995,1.04999995) * r0.yzw; - - float3 untonemapped = r0.yzw * r1.x; - - float3 lut_input = renodx::color::pq::Encode(max(0, untonemapped), 100.f); - float3 sampled = renodx::lut::Sample(t3, s3_s, lut_input); - // float3 post_lut = renodx::color::bt2020::from::PQ(sampled, 100.f); - float3 post_lut = sampled; - - o0.w = saturate(dot(r1.xyz, float3(0.298999995, 0.587000012, 0.114))); - r0.x = r0.x * 0.00390625 + -0.001953125; - r0.xyz = r0.yzw * float3(1.04999995, 1.04999995, 1.04999995) + r0.xxx; - - if (cb0[65].x != 0) { - r1.xyz = log2(r0.xyz); - r1.xyz = float3(0.0126833133, 0.0126833133, 0.0126833133) * r1.xyz; - r1.xyz = exp2(r1.xyz); - r2.xyz = float3(-0.8359375, -0.8359375, -0.8359375) + r1.xyz; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r1.xyz = -r1.xyz * float3(18.6875, 18.6875, 18.6875) + float3(18.8515625, 18.8515625, 18.8515625); - r1.xyz = r2.xyz / r1.xyz; - r1.xyz = log2(r1.xyz); - r1.xyz = float3(6.27739477, 6.27739477, 6.27739477) * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = float3(10000, 10000, 10000) * r1.xyz; - r1.xyz = r1.xyz / cb0[64].www; - r1.xyz = max(float3(6.10351999e-05, 6.10351999e-05, 6.10351999e-05), r1.xyz); - r2.xyz = float3(12.9200001, 12.9200001, 12.9200001) * r1.xyz; - r1.xyz = max(float3(0.00313066994, 0.00313066994, 0.00313066994), r1.xyz); - r1.xyz = log2(r1.xyz); - r1.xyz = float3(0.416666657, 0.416666657, 0.416666657) * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = r1.xyz * float3(1.05499995, 1.05499995, 1.05499995) + float3(-0.0549999997, -0.0549999997, -0.0549999997); - o0.xyz = min(r2.xyz, r1.xyz); - } else { - o0.xyz = r0.xyz; - } - - // o0.rgb = post_lut; - // o0.rgb = renodx::color::bt2020::from::BT709(o0.rgb); - // o0.rgb *= 203.f; - // o0.rgb /= 10000.f; - // o0.rgb = renodx::color::pq::from::BT2020(o0.rgb); - - o0.rgb = post_lut.rgb; - - o0.w = 1.f; - - o0.rgb = scalePaperWhite(o0.rgb); - - return; -} \ No newline at end of file diff --git a/src/games/visionsofmana/sandSample_0x3FA88630.ps_5_1.hlsl b/src/games/visionsofmana/sandSample_0x3FA88630.ps_5_1.hlsl deleted file mode 100644 index 0ee21cae..00000000 --- a/src/games/visionsofmana/sandSample_0x3FA88630.ps_5_1.hlsl +++ /dev/null @@ -1,164 +0,0 @@ -// ---- Created with 3Dmigoto v1.3.16 on Sat Oct 12 04:28:27 2024 -// Sandland part 1 sample - -#include "./common.hlsl" -#include "./shared.h" - -Texture3D t3 : register(t3); - -Texture2D t2 : register(t2); - -Texture2D t1 : register(t1); - -Texture2D t0 : register(t0); - -SamplerState s3_s : register(s3); - -SamplerState s2_s : register(s2); - -SamplerState s1_s : register(s1); - -SamplerState s0_s : register(s0); - -cbuffer cb1 : register(b1) { - float4 cb1[136]; -} - -cbuffer cb0 : register(b0) { - float4 cb0[68]; -} - -// 3Dmigoto declarations -#define cmp - - -void main( - linear noperspective float2 v0 : TEXCOORD0, - linear noperspective float2 w0 : TEXCOORD3, - linear noperspective float3 v1 : TEXCOORD1, - linear noperspective float4 v2 : TEXCOORD2, - float2 v3 : TEXCOORD4, - float4 v4 : SV_POSITION0, - out float4 o0 : SV_Target0) { - float4 r0, r1, r2, r3, r4, r5, r6; - uint4 bitmask, uiDest; - float4 fDest; - - r0.x = v2.w * 543.309998 + v2.z; - r0.x = sin(r0.x); - r0.x = 493013 * r0.x; - r0.x = frac(r0.x); - r0.yzw = t0.Sample(s0_s, v0.xy).xyz; - r0.yzw = cb1[135].zzz * r0.yzw; - r1.x = dot(r0.yzw, float3(0.300000012, 0.589999974, 0.109999999)); - r1.yz = cb0[37].yz * v0.xy; - r1.yz = floor(r1.yz); - r1.yz = (uint2)r1.yz; - r1.yz = (int2)r1.yz & int2(1, 1); - r1.yz = (uint2)r1.yz; - r2.xy = r1.yz * float2(2, 2) + float2(-1, -1); - r3.x = cb0[38].x * r2.x; - r3.y = 0; - r1.yz = v0.xy + r3.xy; - r1.yzw = t0.Sample(s0_s, r1.yz).xyz; - r3.xyz = cb1[135].zzz * r1.yzw; - r2.z = 0; - r2.zw = r2.zy * cb0[38].xy + v0.xy; - r4.xyz = t0.Sample(s0_s, r2.zw).xyz; - r5.xyz = cb1[135].zzz * r4.xyz; - r3.x = dot(r3.xyz, float3(0.300000012, 0.589999974, 0.109999999)); - r3.y = dot(r5.xyz, float3(0.300000012, 0.589999974, 0.109999999)); - r5.xyz = ddx_fine(r0.yzw); - r5.xyz = -r5.xyz * r2.xxx + r0.yzw; - r6.xyz = ddy_fine(r0.yzw); - r6.xyz = -r6.xyz * r2.yyy + r0.yzw; - r2.z = ddx_fine(r1.x); - r3.z = -r2.z * r2.x + r1.x; - r2.x = ddy_fine(r1.x); - r3.w = -r2.x * r2.y + r1.x; - r2.xyzw = -r3.xyzw + r1.xxxx; - r2.xy = max(abs(r2.xz), abs(r2.yw)); - r1.x = max(r2.x, r2.y); - r1.x = saturate(-v1.x * r1.x + 1); - r1.x = cb0[62].y * -r1.x; - r1.yzw = r1.yzw * cb1[135].zzz + r5.xyz; - r1.yzw = r4.xyz * cb1[135].zzz + r1.yzw; - r1.yzw = r1.yzw + r6.xyz; - r1.yzw = -r0.yzw * float3(4, 4, 4) + r1.yzw; - r0.yzw = r1.yzw * r1.xxx + r0.yzw; - r1.xy = cb0[58].zw * v0.xy + cb0[59].xy; - r1.xy = max(cb0[50].zw, r1.xy); - r1.xy = min(cb0[51].xy, r1.xy); - r1.xyz = t1.Sample(s1_s, r1.xy).xyz; - r1.xyz = cb1[135].zzz * r1.xyz; - r2.xy = w0.xy * cb0[67].zw + cb0[67].xy; - r2.xy = r2.xy * float2(0.5, -0.5) + float2(0.5, 0.5); - r2.xyz = t2.Sample(s2_s, r2.xy).xyz; - r2.xyz = r2.xyz * cb0[66].xyz + cb0[61].xyz; - r1.xyz = r2.xyz * r1.xyz; - r0.yzw = r0.yzw * cb0[60].xyz + r1.xyz; - r0.yzw = v1.xxx * r0.yzw; - r1.xy = cb0[62].xx * v1.yz; - r1.x = dot(r1.xy, r1.xy); - r1.x = 1 + r1.x; - r1.x = rcp(r1.x); - r1.x = r1.x * r1.x; - - // r0.yzw = r0.yzw * r1.xxx + float3(0.00266771927, 0.00266771927, 0.00266771927); - // r0.yzw = log2(r0.yzw); - // r0.yzw = saturate(r0.yzw * float3(0.0714285746, 0.0714285746, 0.0714285746) + float3(0.610726953, 0.610726953, 0.610726953)); - // r0.yzw = r0.yzw * float3(0.96875, 0.96875, 0.96875) + float3(0.015625, 0.015625, 0.015625); - // r0.yzw = t3.Sample(s3_s, r0.yzw).xyz; - // r1.xyz = float3(1.04999995, 1.04999995, 1.04999995) * r0.yzw; - - float3 untonemapped = r0.yzw * r1.x; - // o0.rgb = untonemapped.rgb; - // o0.w = 1.f; - // return; - float3 lut_input = renodx::color::pq::Encode(max(0, untonemapped), 100.f); - float3 sampled = renodx::lut::Sample(t3, s3_s, lut_input); - // float3 post_lut = renodx::color::bt2020::from::PQ(sampled, 100.f); - float3 post_lut = sampled; - - // float3 lut_input = renodx::color::pq::Encode(max(0, untonemapped), 100.f); - // float3 sampled = renodx::lut::Sample(t3, s3_s, lut_input); - // float3 post_lut = renodx::color::pq::Decode(sampled, 100.f); - r0.yzw = post_lut; - - // float3 lut_input = renodx::color::pq::Encode(untonemapped, 100.f); - // float3 sampled = renodx::lut::Sample(t3, s3_s, lut_input); - // float3 post_lut = renodx::color::pq::Decode(sampled, 100.f); - - o0.w = saturate(dot(r1.xyz, float3(0.298999995, 0.587000012, 0.114))); - r0.x = r0.x * 0.00390625 + -0.001953125; - r0.xyz = r0.yzw * float3(1.04999995, 1.04999995, 1.04999995) + r0.xxx; - - if (cb0[65].x != 0) { - r1.xyz = log2(r0.xyz); - r1.xyz = float3(0.0126833133, 0.0126833133, 0.0126833133) * r1.xyz; - r1.xyz = exp2(r1.xyz); - r2.xyz = float3(-0.8359375, -0.8359375, -0.8359375) + r1.xyz; - r2.xyz = max(float3(0, 0, 0), r2.xyz); - r1.xyz = -r1.xyz * float3(18.6875, 18.6875, 18.6875) + float3(18.8515625, 18.8515625, 18.8515625); - r1.xyz = r2.xyz / r1.xyz; - r1.xyz = log2(r1.xyz); - r1.xyz = float3(6.27739477, 6.27739477, 6.27739477) * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = float3(10000, 10000, 10000) * r1.xyz; - r1.xyz = r1.xyz / cb0[64].www; - r1.xyz = max(float3(6.10351999e-05, 6.10351999e-05, 6.10351999e-05), r1.xyz); - r2.xyz = float3(12.9200001, 12.9200001, 12.9200001) * r1.xyz; - r1.xyz = max(float3(0.00313066994, 0.00313066994, 0.00313066994), r1.xyz); - r1.xyz = log2(r1.xyz); - r1.xyz = float3(0.416666657, 0.416666657, 0.416666657) * r1.xyz; - r1.xyz = exp2(r1.xyz); - r1.xyz = r1.xyz * float3(1.05499995, 1.05499995, 1.05499995) + float3(-0.0549999997, -0.0549999997, -0.0549999997); - o0.xyz = min(r2.xyz, r1.xyz); - } else { - o0.xyz = r0.xyz; - } - - o0.rgb = post_lut.rgb; - o0.w = 1.f; - - o0.rgb = scalePaperWhite(o0.rgb); -} diff --git a/src/games/visionsofmana/shared.h b/src/games/visionsofmana/shared.h deleted file mode 100644 index 0de6c3c8..00000000 --- a/src/games/visionsofmana/shared.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef SRC_MANA_SHARED_H_ -#define SRC_MANA_SHARED_H_ - -#ifndef __cplusplus -#include "../../shaders/renodx.hlsl" -#endif - -// Must be 32bit aligned -// Should be 4x32 -struct ShaderInjectData { - float toneMapType; - float toneMapPeakNits; - float toneMapGameNits; - float toneMapUINits; - float colorGradeExposure; - float colorGradeHighlights; - float colorGradeShadows; - float colorGradeContrast; - float colorGradeSaturation; - float colorGradeBlowout; - float colorGradeFlare; - float toneMapHueCorrection; - float toneMapPerChannel; - float ToneMapHueProcessor; - float toneMapHueCorrectionMethod; -}; - -#ifndef __cplusplus -cbuffer injectedBuffer : register(b0, space50) { - ShaderInjectData injectedData : packoffset(c0); -} -// cbuffer cb1 : register(b1) { -// ShaderInjectData injectedData : packoffset(c0); // -// } -#endif - -#endif // SRC_MANA_SHARED_H_ diff --git a/src/games/visionsofmana/swap_chain_proxy_pixel_shader.ps_5_1.hlsl b/src/games/visionsofmana/swap_chain_proxy_pixel_shader.ps_5_1.hlsl deleted file mode 100644 index 8b5d0cff..00000000 --- a/src/games/visionsofmana/swap_chain_proxy_pixel_shader.ps_5_1.hlsl +++ /dev/null @@ -1,17 +0,0 @@ -#include "./common.hlsl" -#include "./shared.h" - -Texture2D t0 : register(t0); -SamplerState s0 : register(s0); -float4 main(float4 vpos : SV_POSITION, float2 uv : TEXCOORD0) : SV_TARGET { - float4 color = t0.Sample(s0, uv); - - color.rgb = renodx::math::PowSafe(color.rgb, 2.2f); - color.rgb *= injectedData.toneMapUINits / 80.f; - - color.a = 1.f; - - color.rgb = renodx::color::bt709::clamp::BT2020(color.rgb); // Clamp to BT2020 to avoid negative colors - - return color; -} \ No newline at end of file diff --git a/src/games/visionsofmana/swap_chain_proxy_vertex_shader.vs_5_1.hlsl b/src/games/visionsofmana/swap_chain_proxy_vertex_shader.vs_5_1.hlsl deleted file mode 100644 index aaee1e17..00000000 --- a/src/games/visionsofmana/swap_chain_proxy_vertex_shader.vs_5_1.hlsl +++ /dev/null @@ -1,6 +0,0 @@ -void main(uint id : SV_VERTEXID, out float4 pos : SV_POSITION, - out float2 uv : TEXCOORD0) { - uv.x = (id == 1) ? 2.0 : 0.0; - uv.y = (id == 2) ? 2.0 : 0.0; - pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0); -} \ No newline at end of file