Compare commits

...

5 commits

Author SHA1 Message Date
citrabot da9d2f6895 Canary #2754 2024-01-20 15:31:06 +00:00
citrabot ecae758082 Merge PR 7367 2024-01-20 15:31:05 +00:00
citrabot 8f883285b5 Merge PR 7366 2024-01-20 15:31:05 +00:00
citrabot 5b226d792e Merge PR 7355 2024-01-20 15:31:05 +00:00
citrabot 96f957a3e0 Merge PR 7345 2024-01-20 15:31:05 +00:00
21 changed files with 139 additions and 66 deletions

View file

@ -1,3 +1,15 @@
| Pull Request | Commit | Title | Author | Merged? |
|----|----|----|----|----|
| [7345](https://github.com/citra-emu/citra//pull/7345) | [`5250cf0bd`](https://github.com/citra-emu/citra//pull/7345/files) | frontend: Add setting for whether to use LLE applets. | [Steveice10](https://github.com/Steveice10/) | Yes |
| [7355](https://github.com/citra-emu/citra//pull/7355) | [`870625cb1`](https://github.com/citra-emu/citra//pull/7355/files) | glsl_shader_gen: Use epsilon for both ends of NDC range | [GPUCode](https://github.com/GPUCode/) | Yes |
| [7366](https://github.com/citra-emu/citra//pull/7366) | [`ab2c559a2`](https://github.com/citra-emu/citra//pull/7366/files) | shader_unit: Intialize temporaries on shader invocation | [GPUCode](https://github.com/GPUCode/) | Yes |
| [7367](https://github.com/citra-emu/citra//pull/7367) | [`008a0b294`](https://github.com/citra-emu/citra//pull/7367/files) | pica_core: Propagate vertex uniforms to geometry setup when not in exclusive mode | [GPUCode](https://github.com/GPUCode/) | Yes |
End of merge log. You can find the original README.md below the break.
-----
<h1 align="center">
<br>
<a href="https://citra-emu.org/"><img src="https://raw.githubusercontent.com/citra-emu/citra-assets/master/Main/citra_logo.svg" alt="Citra" width="200"></a>

View file

@ -25,6 +25,7 @@ enum class IntSetting(
SCREEN_LAYOUT("layout_option", Settings.SECTION_LAYOUT, 0),
AUDIO_INPUT_TYPE("output_type", Settings.SECTION_AUDIO, 0),
NEW_3DS("is_new_3ds", Settings.SECTION_SYSTEM, 1),
LLE_APPLETS("lle_applets", Settings.SECTION_SYSTEM, 0),
CPU_CLOCK_SPEED("cpu_clock_percentage", Settings.SECTION_CORE, 100),
LINEAR_FILTERING("filter_mode", Settings.SECTION_RENDERER, 1),
SHADERS_ACCURATE_MUL("shaders_accurate_mul", Settings.SECTION_RENDERER, 0),
@ -61,6 +62,7 @@ enum class IntSetting(
EMULATED_REGION,
INIT_CLOCK,
NEW_3DS,
LLE_APPLETS,
GRAPHICS_API,
VSYNC,
DEBUG_RENDERER,

View file

@ -907,6 +907,15 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
IntSetting.NEW_3DS.defaultValue
)
)
add(
SwitchSetting(
IntSetting.LLE_APPLETS,
R.string.lle_applets,
0,
IntSetting.LLE_APPLETS.key,
IntSetting.LLE_APPLETS.defaultValue
)
)
add(
SliderSetting(
IntSetting.CPU_CLOCK_SPEED,

View file

@ -206,6 +206,7 @@ void Config::ReadValues() {
// System
ReadSetting("System", Settings::values.is_new_3ds);
ReadSetting("System", Settings::values.lle_applets);
ReadSetting("System", Settings::values.region_value);
ReadSetting("System", Settings::values.init_clock);
{

View file

@ -270,6 +270,10 @@ use_virtual_sd =
# 0: Old 3DS (default), 1: New 3DS
is_new_3ds =
# Whether to use LLE system applets, if installed
# 0 (default): No, 1: Yes
lle_applets =
# The system region that Citra will use during emulation
# -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan
region_value =

View file

@ -171,6 +171,7 @@
<!-- System settings strings -->
<string name="username">Username</string>
<string name="new_3ds">New 3DS Mode</string>
<string name="lle_applets">Use LLE Applets (if installed)</string>
<string name="clock">Clock</string>
<string name="init_time">Offset Time</string>
<string name="init_time_description">If the clock is set to \"Simulated clock\", this changes the fixed date and time to start at.</string>

View file

@ -203,6 +203,7 @@ void Config::ReadValues() {
// System
ReadSetting("System", Settings::values.is_new_3ds);
ReadSetting("System", Settings::values.lle_applets);
ReadSetting("System", Settings::values.region_value);
ReadSetting("System", Settings::values.init_clock);
{

View file

@ -294,6 +294,10 @@ nand_directory =
# 0: Old 3DS, 1: New 3DS (default)
is_new_3ds =
# Whether to use LLE system applets, if installed
# 0 (default): No, 1: Yes
lle_applets =
# The system region that Citra will use during emulation
# -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan
region_value =

View file

@ -682,6 +682,7 @@ void Config::ReadSystemValues() {
qt_config->beginGroup(QStringLiteral("System"));
ReadGlobalSetting(Settings::values.is_new_3ds);
ReadGlobalSetting(Settings::values.lle_applets);
ReadGlobalSetting(Settings::values.region_value);
if (global) {
@ -1172,6 +1173,7 @@ void Config::SaveSystemValues() {
qt_config->beginGroup(QStringLiteral("System"));
WriteGlobalSetting(Settings::values.is_new_3ds);
WriteGlobalSetting(Settings::values.lle_applets);
WriteGlobalSetting(Settings::values.region_value);
if (global) {

View file

@ -309,6 +309,7 @@ void ConfigureSystem::SetConfiguration() {
}
ui->toggle_new_3ds->setChecked(Settings::values.is_new_3ds.GetValue());
ui->toggle_lle_applets->setChecked(Settings::values.lle_applets.GetValue());
ui->plugin_loader->setChecked(Settings::values.plugin_loader_enabled.GetValue());
ui->allow_plugin_loader->setChecked(Settings::values.allow_plugin_loader.GetValue());
}
@ -415,6 +416,8 @@ void ConfigureSystem::ApplyConfiguration() {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.is_new_3ds, ui->toggle_new_3ds,
is_new_3ds);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.lle_applets,
ui->toggle_lle_applets, lle_applets);
Settings::values.init_clock =
static_cast<Settings::InitClock>(ui->combo_init_clock->currentIndex());
@ -434,6 +437,7 @@ void ConfigureSystem::ApplyConfiguration() {
Settings::values.init_time_offset = time_offset_days + time_offset_time;
Settings::values.is_new_3ds = ui->toggle_new_3ds->isChecked();
Settings::values.lle_applets = ui->toggle_lle_applets->isChecked();
Settings::values.plugin_loader_enabled.SetValue(ui->plugin_loader->isChecked());
Settings::values.allow_plugin_loader.SetValue(ui->allow_plugin_loader->isChecked());
@ -526,6 +530,7 @@ void ConfigureSystem::SetupPerGameUI() {
// Block the global settings if a game is currently running that overrides them
if (Settings::IsConfiguringGlobal()) {
ui->toggle_new_3ds->setEnabled(Settings::values.is_new_3ds.UsingGlobal());
ui->toggle_lle_applets->setEnabled(Settings::values.lle_applets.UsingGlobal());
return;
}
@ -569,6 +574,8 @@ void ConfigureSystem::SetupPerGameUI() {
ConfigurationShared::SetColoredTristate(ui->toggle_new_3ds, Settings::values.is_new_3ds,
is_new_3ds);
ConfigurationShared::SetColoredTristate(ui->toggle_lle_applets, Settings::values.lle_applets,
lle_applets);
}
void ConfigureSystem::DownloadFromNUS() {

View file

@ -54,6 +54,7 @@ private:
std::unique_ptr<Ui::ConfigureSystem> ui;
Core::System& system;
ConfigurationShared::CheckState is_new_3ds;
ConfigurationShared::CheckState lle_applets;
bool enabled = false;
std::shared_ptr<Service::CFG::Module> cfg;

View file

@ -29,7 +29,14 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="2" column="0">
<widget class="QCheckBox" name="toggle_lle_applets">
<property name="text">
<string>Use LLE applets (if installed)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="edit_username">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -42,21 +49,21 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_username">
<property name="text">
<string>Username</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_birthday">
<property name="text">
<string>Birthday</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_birthday2">
<item>
<widget class="QComboBox" name="combo_birthmonth">
@ -127,14 +134,14 @@
</item>
</layout>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_language">
<property name="text">
<string>Language</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QComboBox" name="combo_language">
<property name="toolTip">
<string>Note: this can be overridden when region setting is auto-select</string>
@ -201,14 +208,14 @@
</item>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_sound">
<property name="text">
<string>Sound output mode</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QComboBox" name="combo_sound">
<item>
<property name="text">
@ -227,24 +234,24 @@
</item>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_country">
<property name="text">
<string>Country</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QComboBox" name="combo_country"/>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_init_clock">
<property name="text">
<string>Clock</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QComboBox" name="combo_init_clock">
<item>
<property name="text">
@ -258,28 +265,28 @@
</item>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_init_time">
<property name="text">
<string>Startup time</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QDateTimeEdit" name="edit_init_time">
<property name="displayFormat">
<string>yyyy-MM-ddTHH:mm:ss</string>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_init_time_offset">
<property name="text">
<string>Offset time</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<layout class="QGridLayout" name="edit_init_time_offset_grid">
<item row="0" column="0">
<widget class="QSpinBox" name="edit_init_time_offset_days">
@ -303,14 +310,14 @@
</item>
</layout>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="label_init_ticks_type">
<property name="text">
<string>Initial System Ticks</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="10" column="1">
<widget class="QComboBox" name="combo_init_ticks_type">
<item>
<property name="text">
@ -324,14 +331,14 @@
</item>
</widget>
</item>
<item row="10" column="0">
<item row="11" column="0">
<widget class="QLabel" name="label_init_ticks_value">
<property name="text">
<string>Initial System Ticks Override</string>
</property>
</widget>
</item>
<item row="10" column="1">
<item row="11" column="1">
<widget class="QLineEdit" name="edit_init_ticks_value">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -344,35 +351,35 @@
</property>
</widget>
</item>
<item row="11" column="0">
<item row="12" column="0">
<widget class="QLabel" name="label_play_coins">
<property name="text">
<string>Play Coins:</string>
</property>
</widget>
</item>
<item row="11" column="1">
<item row="12" column="1">
<widget class="QSpinBox" name="spinBox_play_coins">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="12" column="1">
<item row="13" column="1">
<widget class="QCheckBox" name="toggle_system_setup">
<property name="text">
<string>Run System Setup when Home Menu is launched</string>
</property>
</widget>
</item>
<item row="13" column="0">
<item row="14" column="0">
<widget class="QLabel" name="label_console_id">
<property name="text">
<string>Console ID:</string>
</property>
</widget>
</item>
<item row="13" column="1">
<item row="14" column="1">
<widget class="QPushButton" name="button_regenerate_console_id">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -388,35 +395,35 @@
</property>
</widget>
</item>
<item row="14" column="0">
<item row="15" column="0">
<widget class="QLabel" name="label_plugin_loader">
<property name="text">
<string>3GX Plugin Loader:</string>
</property>
</widget>
</item>
<item row="14" column="1">
<item row="15" column="1">
<widget class="QCheckBox" name="plugin_loader">
<property name="text">
<string>Enable 3GX plugin loader</string>
</property>
</widget>
</item>
<item row="15" column="1">
<item row="16" column="1">
<widget class="QCheckBox" name="allow_plugin_loader">
<property name="text">
<string>Allow games to change plugin loader state</string>
</property>
</widget>
</item>
<item row="16" column="0">
<item row="17" column="0">
<widget class="QLabel" name="label_nus_download">
<property name="text">
<string>Download System Files from Nitendo servers</string>
</property>
</widget>
</item>
<item row="16" column="1">
<item row="17" column="1">
<widget class="QWidget" name="body_nus_download">
<layout class="QHBoxLayout" name="horizontalLayout_nus_download">
<item>

View file

@ -138,6 +138,7 @@ void LogSettings() {
log_setting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir));
}
log_setting("System_IsNew3ds", values.is_new_3ds.GetValue());
log_setting("System_LLEApplets", values.lle_applets.GetValue());
log_setting("System_RegionValue", values.region_value.GetValue());
log_setting("System_PluginLoader", values.plugin_loader_enabled.GetValue());
log_setting("System_PluginLoaderAllowed", values.allow_plugin_loader.GetValue());
@ -175,6 +176,7 @@ void RestoreGlobalState(bool is_powered_on) {
// Core
values.cpu_clock_percentage.SetGlobal(true);
values.is_new_3ds.SetGlobal(true);
values.lle_applets.SetGlobal(true);
// Renderer
values.graphics_api.SetGlobal(true);

View file

@ -432,6 +432,7 @@ struct Values {
Setting<bool> use_cpu_jit{true, "use_cpu_jit"};
SwitchableSetting<s32, true> cpu_clock_percentage{100, 5, 400, "cpu_clock_percentage"};
SwitchableSetting<bool> is_new_3ds{true, "is_new_3ds"};
SwitchableSetting<bool> lle_applets{false, "lle_applets"};
// Data Storage
Setting<bool> use_virtual_sd{true, "use_virtual_sd"};

View file

@ -568,11 +568,13 @@ Result AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
capture_buffer_info.reset();
auto cfg = Service::CFG::GetModule(system);
auto process =
NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
if (process) {
return ResultSuccess;
if (Settings::values.lle_applets) {
auto cfg = Service::CFG::GetModule(system);
auto process = NS::LaunchTitle(FS::MediaType::NAND,
GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
if (process) {
return ResultSuccess;
}
}
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.
@ -595,11 +597,13 @@ Result AppletManager::PreloadLibraryApplet(AppletId applet_id) {
last_library_launcher_slot = active_slot;
last_prepared_library_applet = applet_id;
auto cfg = Service::CFG::GetModule(system);
auto process =
NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
if (process) {
return ResultSuccess;
if (Settings::values.lle_applets) {
auto cfg = Service::CFG::GetModule(system);
auto process = NS::LaunchTitle(FS::MediaType::NAND,
GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
if (process) {
return ResultSuccess;
}
}
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.

View file

@ -155,6 +155,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) {
static_cast<int>(Settings::values.mono_render_option.GetValue()));
AddField(Telemetry::FieldType::UserConfig, "System_IsNew3ds",
Settings::values.is_new_3ds.GetValue());
AddField(Telemetry::FieldType::UserConfig, "System_LLEApplets",
Settings::values.lle_applets.GetValue());
AddField(Telemetry::FieldType::UserConfig, "System_RegionValue",
Settings::values.region_value.GetValue());
}

View file

@ -256,6 +256,9 @@ void PicaCore::WriteInternalReg(u32 id, u32 value, u32 mask) {
case PICA_REG_INDEX(vs.bool_uniforms):
vs_setup.WriteUniformBoolReg(regs.internal.vs.bool_uniforms.Value());
if (!regs.internal.pipeline.gs_unit_exclusive_configuration) {
gs_setup.WriteUniformBoolReg(regs.internal.vs.bool_uniforms.Value());
}
break;
case PICA_REG_INDEX(vs.int_uniforms[0]):
@ -264,6 +267,9 @@ void PicaCore::WriteInternalReg(u32 id, u32 value, u32 mask) {
case PICA_REG_INDEX(vs.int_uniforms[3]): {
const u32 index = (id - PICA_REG_INDEX(vs.int_uniforms[0]));
vs_setup.WriteUniformIntReg(index, regs.internal.vs.GetIntUniform(index));
if (!regs.internal.pipeline.gs_unit_exclusive_configuration) {
gs_setup.WriteUniformIntReg(index, regs.internal.vs.GetIntUniform(index));
}
break;
}
@ -275,7 +281,10 @@ void PicaCore::WriteInternalReg(u32 id, u32 value, u32 mask) {
case PICA_REG_INDEX(vs.uniform_setup.set_value[5]):
case PICA_REG_INDEX(vs.uniform_setup.set_value[6]):
case PICA_REG_INDEX(vs.uniform_setup.set_value[7]): {
vs_setup.WriteUniformFloatReg(regs.internal.vs, value);
const auto index = vs_setup.WriteUniformFloatReg(regs.internal.vs, value);
if (!regs.internal.pipeline.gs_unit_exclusive_configuration && index) {
gs_setup.uniforms.f[index.value()] = vs_setup.uniforms.f[index.value()];
}
break;
}

View file

@ -27,21 +27,23 @@ void ShaderSetup::WriteUniformIntReg(u32 index, const Common::Vec4<u8> values) {
uniforms.i[index] = values;
}
void ShaderSetup::WriteUniformFloatReg(ShaderRegs& config, u32 value) {
std::optional<u32> ShaderSetup::WriteUniformFloatReg(ShaderRegs& config, u32 value) {
auto& uniform_setup = config.uniform_setup;
const bool is_float32 = uniform_setup.IsFloat32();
if (!uniform_queue.Push(value, is_float32)) {
return;
return std::nullopt;
}
const auto uniform = uniform_queue.Get(is_float32);
if (uniform_setup.index >= uniforms.f.size()) {
LOG_ERROR(HW_GPU, "Invalid float uniform index {}", uniform_setup.index.Value());
return;
return std::nullopt;
}
uniforms.f[uniform_setup.index] = uniform;
uniform_setup.index.Assign(uniform_setup.index + 1);
const u32 index = uniform_setup.index.Value();
uniforms.f[index] = uniform;
uniform_setup.index.Assign(index + 1);
return index;
}
u64 ShaderSetup::GetProgramCodeHash() {

View file

@ -4,6 +4,7 @@
#pragma once
#include <optional>
#include "common/vector_math.h"
#include "video_core/pica/packed_attribute.h"
#include "video_core/pica_types.h"
@ -58,7 +59,7 @@ public:
void WriteUniformIntReg(u32 index, const Common::Vec4<u8> values);
void WriteUniformFloatReg(ShaderRegs& config, u32 value);
std::optional<u32> WriteUniformFloatReg(ShaderRegs& config, u32 value);
u64 GetProgramCodeHash();

View file

@ -9,7 +9,10 @@
namespace Pica {
ShaderUnit::ShaderUnit(GeometryEmitter* emitter) : emitter_ptr{emitter} {}
ShaderUnit::ShaderUnit(GeometryEmitter* emitter) : emitter_ptr{emitter} {
const Common::Vec4<f24> temp_vec{f24::Zero(), f24::Zero(), f24::Zero(), f24::One()};
temporary.fill(temp_vec);
}
ShaderUnit::~ShaderUnit() = default;

View file

@ -39,6 +39,19 @@ layout (binding = 1, std140) uniform vs_data {
bool enable_clip1;
vec4 clip_coef;
};
const vec2 EPSILON_Z = vec2(0.00000001f, -1.00001f);
vec4 SanitizeVertex(vec4 vtx_pos) {
float ndc_z = vtx_pos.z / vtx_pos.w;
if (ndc_z > 0.f && ndc_z < EPSILON_Z[0]) {
vtx_pos.z = 0.f;
}
if (ndc_z < -1.f && ndc_z > EPSILON_Z[1]) {
vtx_pos.z = -vtx_pos.w;
}
return vtx_pos;
}
)";
static std::string GetVertexInterfaceDeclaration(bool is_output, bool use_clip_planes,
@ -94,13 +107,7 @@ std::string GenerateTrivialVertexShader(bool use_clip_planes, bool separable_sha
out += GetVertexInterfaceDeclaration(true, use_clip_planes, separable_shader);
out += VSUniformBlockDef;
// Certain games render 2D elements very close to clip plane 0 resulting in very tiny
// negative/positive z values when computing with f32 precision,
// causing some vertices to get erroneously clipped. To workaround this problem,
// we can use a very small epsilon value for clip plane comparison.
out += R"(
const float EPSILON_Z = 0.00000001f;
void main() {
primary_color = vert_color;
texcoord0 = vert_texcoord0;
@ -109,10 +116,7 @@ void main() {
texcoord0_w = vert_texcoord0_w;
normquat = vert_normquat;
view = vert_view;
vec4 vtx_pos = vert_position;
if (abs(vtx_pos.z) < EPSILON_Z) {
vtx_pos.z = 0.f;
}
vec4 vtx_pos = SanitizeVertex(vert_position);
gl_Position = vec4(vtx_pos.x, vtx_pos.y, -vtx_pos.z, vtx_pos.w);
)";
if (use_clip_planes) {
@ -215,7 +219,6 @@ std::string GenerateVertexShader(const ShaderSetup& setup, const PicaVSConfig& c
return "1.0";
};
out += "const float EPSILON_Z = 0.00000001f;\n\n";
out += "vec4 GetVertexQuaternion() {\n";
out += " return vec4(" + semantic(VSOutputAttributes::QUATERNION_X) + ", " +
semantic(VSOutputAttributes::QUATERNION_Y) + ", " +
@ -228,9 +231,7 @@ std::string GenerateVertexShader(const ShaderSetup& setup, const PicaVSConfig& c
semantic(VSOutputAttributes::POSITION_Y) + ", " +
semantic(VSOutputAttributes::POSITION_Z) + ", " +
semantic(VSOutputAttributes::POSITION_W) + ");\n";
out += " if (abs(vtx_pos.z) < EPSILON_Z) {\n";
out += " vtx_pos.z = 0.f;\n";
out += " }\n";
out += " vtx_pos = SanitizeVertex(vtx_pos);\n";
out += " gl_Position = vec4(vtx_pos.x, vtx_pos.y, -vtx_pos.z, vtx_pos.w);\n";
if (config.state.use_clip_planes) {
out += " gl_ClipDistance[0] = -vtx_pos.z;\n"; // fixed PICA clipping plane z <= 0
@ -312,7 +313,6 @@ struct Vertex {
return "1.0";
};
out += "const float EPSILON_Z = 0.00000001f;\n\n";
out += "vec4 GetVertexQuaternion(Vertex vtx) {\n";
out += " return vec4(" + semantic(VSOutputAttributes::QUATERNION_X) + ", " +
semantic(VSOutputAttributes::QUATERNION_Y) + ", " +
@ -325,9 +325,7 @@ struct Vertex {
semantic(VSOutputAttributes::POSITION_Y) + ", " +
semantic(VSOutputAttributes::POSITION_Z) + ", " +
semantic(VSOutputAttributes::POSITION_W) + ");\n";
out += " if (abs(vtx_pos.z) < EPSILON_Z) {\n";
out += " vtx_pos.z = 0.f;\n";
out += " }\n";
out += " vtx_pos = SanitizeVertex(vtx_pos);\n";
out += " gl_Position = vec4(vtx_pos.x, vtx_pos.y, -vtx_pos.z, vtx_pos.w);\n";
if (state.use_clip_planes) {
out += " gl_ClipDistance[0] = -vtx_pos.z;\n"; // fixed PICA clipping plane z <= 0