Rename `float=64` SCons option to `precision=double`
This avoids confusion with the old `bits=64` option and building for 64-bit CPUs in general.
This commit is contained in:
parent
ae86d907e7
commit
063637ec77
|
@ -32,11 +32,11 @@ jobs:
|
|||
proj-conv: true
|
||||
artifact: true
|
||||
|
||||
- name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, float=64, use_asan=yes, use_ubsan=yes, linker=gold)
|
||||
- name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold)
|
||||
cache-name: linux-editor-double-sanitizers
|
||||
target: editor
|
||||
tests: true
|
||||
sconsflags: dev_build=yes float=64 use_asan=yes use_ubsan=yes linker=gold
|
||||
sconsflags: dev_build=yes precision=double use_asan=yes use_ubsan=yes linker=gold
|
||||
proj-test: true
|
||||
# Can be turned off for PRs that intentionally break compat with godot-cpp,
|
||||
# until both the upstream PR and the matching godot-cpp changes are merged.
|
||||
|
|
|
@ -179,7 +179,7 @@ opts.Add(BoolVariable("production", "Set defaults to build Godot for use in prod
|
|||
|
||||
# Components
|
||||
opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True))
|
||||
opts.Add(EnumVariable("float", "Floating-point precision", "32", ("32", "64")))
|
||||
opts.Add(EnumVariable("precision", "Set the floating-point precision level", "single", ("single", "double")))
|
||||
opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
|
||||
opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
|
||||
opts.Add(BoolVariable("vulkan", "Enable the vulkan rendering driver", True))
|
||||
|
@ -442,7 +442,7 @@ if env_base["no_editor_splash"]:
|
|||
if not env_base["deprecated"]:
|
||||
env_base.Append(CPPDEFINES=["DISABLE_DEPRECATED"])
|
||||
|
||||
if env_base["float"] == "64":
|
||||
if env_base["precision"] == "double":
|
||||
env_base.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
|
||||
|
||||
if selected_platform in platform_list:
|
||||
|
@ -747,7 +747,7 @@ if selected_platform in platform_list:
|
|||
if env.dev_build:
|
||||
suffix += ".dev"
|
||||
|
||||
if env_base["float"] == "64":
|
||||
if env_base["precision"] == "double":
|
||||
suffix += ".double"
|
||||
|
||||
suffix += "." + env["arch"]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
2-element structure that can be used to represent positions in 2D space or any other pair of numeric values.
|
||||
It uses floating-point coordinates. By default, these floating-point values use 32-bit precision, unlike [float] which is always 64-bit. If double precision is needed, compile the engine with the option [code]float=64[/code].
|
||||
It uses floating-point coordinates. By default, these floating-point values use 32-bit precision, unlike [float] which is always 64-bit. If double precision is needed, compile the engine with the option [code]precision=double[/code].
|
||||
See [Vector2i] for its integer counterpart.
|
||||
[b]Note:[/b] In a boolean context, a Vector2 will evaluate to [code]false[/code] if it's equal to [code]Vector2(0, 0)[/code]. Otherwise, a Vector2 will always evaluate to [code]true[/code].
|
||||
</description>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
3-element structure that can be used to represent positions in 3D space or any other triplet of numeric values.
|
||||
It uses floating-point coordinates. By default, these floating-point values use 32-bit precision, unlike [float] which is always 64-bit. If double precision is needed, compile the engine with the option [code]float=64[/code].
|
||||
It uses floating-point coordinates. By default, these floating-point values use 32-bit precision, unlike [float] which is always 64-bit. If double precision is needed, compile the engine with the option [code]precision=double[/code].
|
||||
See [Vector3i] for its integer counterpart.
|
||||
[b]Note:[/b] In a boolean context, a Vector3 will evaluate to [code]false[/code] if it's equal to [code]Vector3(0, 0, 0)[/code]. Otherwise, a Vector3 will always evaluate to [code]true[/code].
|
||||
</description>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
4-element structure that can be used to represent any quadruplet of numeric values.
|
||||
It uses floating-point coordinates. By default, these floating-point values use 32-bit precision, unlike [float] which is always 64-bit. If double precision is needed, compile the engine with the option [code]float=64[/code].
|
||||
It uses floating-point coordinates. By default, these floating-point values use 32-bit precision, unlike [float] which is always 64-bit. If double precision is needed, compile the engine with the option [code]precision=double[/code].
|
||||
See [Vector4i] for its integer counterpart.
|
||||
[b]Note:[/b] In a boolean context, a Vector4 will evaluate to [code]false[/code] if it's equal to [code]Vector4(0, 0, 0, 0)[/code]. Otherwise, a Vector4 will always evaluate to [code]true[/code].
|
||||
</description>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
The [float] built-in type is a 64-bit double-precision floating-point number, equivalent to [code]double[/code] in C++. This type has 14 reliable decimal digits of precision. The [float] type can be stored in [Variant], which is the generic type used by the engine. The maximum value of [float] is approximately [code]1.79769e308[/code], and the minimum is approximately [code]-1.79769e308[/code].
|
||||
Many methods and properties in the engine use 32-bit single-precision floating-point numbers instead, equivalent to [code]float[/code] in C++, which have 6 reliable decimal digits of precision. For data structures such as [Vector2] and [Vector3], Godot uses 32-bit floating-point numbers by default, but it can be changed to use 64-bit doubles if Godot is compiled with the [code]float=64[/code] option.
|
||||
Many methods and properties in the engine use 32-bit single-precision floating-point numbers instead, equivalent to [code]float[/code] in C++, which have 6 reliable decimal digits of precision. For data structures such as [Vector2] and [Vector3], Godot uses 32-bit floating-point numbers by default, but it can be changed to use 64-bit doubles if Godot is compiled with the [code]precision=double[/code] option.
|
||||
Math done using the [float] type is not guaranteed to be exact or deterministic, and will often result in small errors. You should usually use the [method @GlobalScope.is_equal_approx] and [method @GlobalScope.is_zero_approx] methods instead of [code]==[/code] to compare [float] values for equality.
|
||||
</description>
|
||||
<tutorials>
|
||||
|
|
|
@ -774,7 +774,7 @@ def generate_vs_project(env, num_jobs):
|
|||
for platform in ModuleConfigs.PLATFORMS
|
||||
]
|
||||
self.arg_dict["runfile"] += [
|
||||
f'bin\\godot.windows.{config}{ModuleConfigs.DEV_SUFFIX}{".double" if env["float"] == "64" else ""}.{plat_id}{f".{name}" if name else ""}.exe'
|
||||
f'bin\\godot.windows.{config}{ModuleConfigs.DEV_SUFFIX}{".double" if env["precision"] == "double" else ""}.{plat_id}{f".{name}" if name else ""}.exe'
|
||||
for config in ModuleConfigs.CONFIGURATIONS
|
||||
for plat_id in ModuleConfigs.PLATFORM_IDS
|
||||
]
|
||||
|
@ -820,8 +820,8 @@ def generate_vs_project(env, num_jobs):
|
|||
if env["custom_modules"]:
|
||||
common_build_postfix.append("custom_modules=%s" % env["custom_modules"])
|
||||
|
||||
if env["float"] == "64":
|
||||
common_build_postfix.append("float=64")
|
||||
if env["precision"] == "double":
|
||||
common_build_postfix.append("precision=double")
|
||||
|
||||
result = " ^& ".join(common_build_prefix + [" ".join([commands] + common_build_postfix)])
|
||||
return result
|
||||
|
|
|
@ -46,10 +46,10 @@ C# solutions during development to avoid mistakes.
|
|||
|
||||
# Double Precision Support (REAL_T_IS_DOUBLE)
|
||||
|
||||
Follow the above instructions but build Godot with the float=64 argument to scons
|
||||
Follow the above instructions but build Godot with the precision=double argument to scons
|
||||
|
||||
When building the NuGet packages, specify `--float=64` - for example:
|
||||
When building the NuGet packages, specify `--precision=double` - for example:
|
||||
```sh
|
||||
./modules/mono/build_scripts/build_assemblies.py --godot-output-dir ./bin \
|
||||
--push-nupkgs-local ~/MyLocalNugetSource --float=64
|
||||
--push-nupkgs-local ~/MyLocalNugetSource --precision=double
|
||||
```
|
||||
|
|
|
@ -193,7 +193,7 @@ def run_msbuild(tools: ToolsLocation, sln: str, msbuild_args: Optional[List[str]
|
|||
return subprocess.call(args, env=msbuild_env)
|
||||
|
||||
|
||||
def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, float_size):
|
||||
def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision):
|
||||
target_filenames = [
|
||||
"GodotSharp.dll",
|
||||
"GodotSharp.pdb",
|
||||
|
@ -214,7 +214,7 @@ def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, flo
|
|||
args = ["/restore", "/t:Build", "/p:Configuration=" + build_config, "/p:NoWarn=1591"]
|
||||
if push_nupkgs_local:
|
||||
args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local]
|
||||
if float_size == "64":
|
||||
if precision == "double":
|
||||
args += ["/p:GodotFloat64=true"]
|
||||
|
||||
sln = os.path.join(module_dir, "glue/GodotSharp/GodotSharp.sln")
|
||||
|
@ -303,12 +303,12 @@ def generate_sdk_package_versions():
|
|||
f.close()
|
||||
|
||||
|
||||
def build_all(msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, push_nupkgs_local, float_size):
|
||||
def build_all(msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, push_nupkgs_local, precision):
|
||||
# Generate SdkPackageVersions.props
|
||||
generate_sdk_package_versions()
|
||||
|
||||
# Godot API
|
||||
exit_code = build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, float_size)
|
||||
exit_code = build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision)
|
||||
if exit_code != 0:
|
||||
return exit_code
|
||||
|
||||
|
@ -319,7 +319,7 @@ def build_all(msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, p
|
|||
)
|
||||
if push_nupkgs_local:
|
||||
args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local]
|
||||
if float_size == "64":
|
||||
if precision == "double":
|
||||
args += ["/p:GodotFloat64=true"]
|
||||
exit_code = run_msbuild(msbuild_tool, sln=sln, msbuild_args=args)
|
||||
if exit_code != 0:
|
||||
|
@ -329,7 +329,7 @@ def build_all(msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, p
|
|||
args = ["/restore", "/t:Build", "/p:Configuration=Release"]
|
||||
if push_nupkgs_local:
|
||||
args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local]
|
||||
if float_size == "64":
|
||||
if precision == "double":
|
||||
args += ["/p:GodotFloat64=true"]
|
||||
sln = os.path.join(module_dir, "editor/Godot.NET.Sdk/Godot.NET.Sdk.sln")
|
||||
exit_code = run_msbuild(msbuild_tool, sln=sln, msbuild_args=args)
|
||||
|
@ -354,7 +354,9 @@ def main():
|
|||
parser.add_argument("--godot-platform", type=str, default="")
|
||||
parser.add_argument("--mono-prefix", type=str, default="")
|
||||
parser.add_argument("--push-nupkgs-local", type=str, default="")
|
||||
parser.add_argument("--float", type=str, default="32", choices=["32", "64"], help="Floating-point precision")
|
||||
parser.add_argument(
|
||||
"--precision", type=str, default="single", choices=["single", "double"], help="Floating-point precision level"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -378,7 +380,7 @@ def main():
|
|||
args.godot_platform,
|
||||
args.dev_debug,
|
||||
push_nupkgs_local,
|
||||
args.float,
|
||||
args.precision,
|
||||
)
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
|
Loading…
Reference in New Issue