Merge remote-tracking branch 'origin/master' into navigation-features

This commit is contained in:
Wojtek Figat
2021-01-12 12:04:20 +01:00
19 changed files with 125 additions and 29 deletions

19
.github/workflows/build_linux.todo vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Build Linux
on: [push, pull_request]
jobs:
# Game
game-linux:
name: Game (Linux, Release x64)
runs-on: "ubuntu-20.04"
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Checkout LFS
run: |
git lfs version
git lfs pull
- name: Build
run: |
./Development/Scripts/Linux/CallBuildTool.sh -build -log -arch=x64 -platform=Linux -configuration=Release -buildtargets=FlaxGame

34
.github/workflows/build_windows.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Build Windows
on: [push, pull_request]
jobs:
# Editor
editor-windows:
name: Editor (Windows, Development x64)
runs-on: "windows-latest"
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Checkout LFS
run: |
git lfs version
git lfs pull
- name: Build
run: |
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxEditor
# Game
game-windows:
name: Game (Windows, Release x64)
runs-on: "windows-latest"
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Checkout LFS
run: |
git lfs version
git lfs pull
- name: Build
run: |
.\Development\Scripts\Windows\CallBuildTool.bat -build -log -arch=x64 -platform=Windows -configuration=Release -buildtargets=FlaxGame

0
Development/Scripts/Linux/CallBuildTool.sh Normal file → Executable file
View File

0
GenerateProjectFiles.sh Normal file → Executable file
View File

0
PackagePlatforms.sh Normal file → Executable file
View File

View File

@@ -109,8 +109,7 @@ namespace FlaxEditor.CustomEditors.Editors
// Use int value editor with limit
var element = layout.SignedIntegerValue();
element.LongValue.SetLimits((LimitAttribute)limit);
element.LongValue.MinValue = Mathf.Max(element.LongValue.MinValue, min);
element.LongValue.MaxValue = Mathf.Min(element.LongValue.MaxValue, max);
element.LongValue.SetLimits(Mathf.Max(element.LongValue.MinValue, min), Mathf.Min(element.LongValue.MaxValue, max));
element.LongValue.ValueChanged += OnValueChanged;
element.LongValue.SlidingEnd += ClearToken;
_element = element;
@@ -121,8 +120,7 @@ namespace FlaxEditor.CustomEditors.Editors
{
// Use int value editor
var element = layout.SignedIntegerValue();
element.LongValue.MinValue = Mathf.Max(element.LongValue.MinValue, min);
element.LongValue.MaxValue = Mathf.Min(element.LongValue.MaxValue, max);
element.LongValue.SetLimits(Mathf.Max(element.LongValue.MinValue, min), Mathf.Min(element.LongValue.MaxValue, max));
element.LongValue.ValueChanged += OnValueChanged;
element.LongValue.SlidingEnd += ClearToken;
_element = element;
@@ -278,8 +276,7 @@ namespace FlaxEditor.CustomEditors.Editors
// Use int value editor with limit
var element = layout.UnsignedIntegerValue();
element.ULongValue.SetLimits((LimitAttribute)limit);
element.ULongValue.MinValue = Mathf.Max(element.ULongValue.MinValue, min);
element.ULongValue.MaxValue = Mathf.Min(element.ULongValue.MaxValue, max);
element.ULongValue.SetLimits(Mathf.Max(element.ULongValue.MinValue, min), Mathf.Min(element.ULongValue.MaxValue, max));
element.ULongValue.ValueChanged += OnValueChanged;
element.ULongValue.SlidingEnd += ClearToken;
_element = element;
@@ -290,8 +287,7 @@ namespace FlaxEditor.CustomEditors.Editors
{
// Use int value editor
var element = layout.UnsignedIntegerValue();
element.ULongValue.MinValue = Mathf.Max(element.ULongValue.MinValue, min);
element.ULongValue.MaxValue = Mathf.Min(element.ULongValue.MaxValue, max);
element.ULongValue.SetLimits(Mathf.Max(element.ULongValue.MinValue, min), Mathf.Min(element.ULongValue.MaxValue, max));
element.ULongValue.ValueChanged += OnValueChanged;
element.ULongValue.SlidingEnd += ClearToken;
_element = element;

View File

@@ -93,6 +93,18 @@ namespace FlaxEditor.GUI.Input
Value = Value;
}
/// <summary>
/// Sets the limits at once.
/// </summary>
/// <param name="min">The minimum value.</param>
/// <param name="max">The minimum value.</param>
public void SetLimits(long min, long max)
{
_min = Math.Min(min, max);
_max = Math.Max(min, max);
Value = Value;
}
/// <inheritdoc />
protected sealed override void UpdateText()
{

View File

@@ -88,12 +88,24 @@ namespace FlaxEditor.GUI.Input
/// <param name="limits">The limits.</param>
public void SetLimits(LimitAttribute limits)
{
_min = limits.Min == int.MinValue ? ulong.MinValue : (ulong)limits.Min;
_max = Math.Max(_min, limits.Max == int.MaxValue ? ulong.MaxValue : (ulong)limits.Max);
_min = limits.Min < 0.0f ? 0 : (ulong)limits.Min;
_max = Math.Max(_min, limits.Max == float.MaxValue ? ulong.MaxValue : (ulong)limits.Max);
_slideSpeed = limits.SliderSpeed;
Value = Value;
}
/// <summary>
/// Sets the limits at once.
/// </summary>
/// <param name="min">The minimum value.</param>
/// <param name="max">The minimum value.</param>
public void SetLimits(ulong min, ulong max)
{
_min = Math.Min(min, max);
_max = Math.Max(min, max);
Value = Value;
}
/// <inheritdoc />
protected sealed override void UpdateText()
{

View File

@@ -332,7 +332,10 @@ namespace FlaxEditor.Surface
/// <seealso cref="FlaxEditor.CustomEditors.CustomEditor" />
public class ParametersEditor : CustomEditor
{
private static readonly Attribute[] DefaultAttributes = { new LimitAttribute(float.MinValue, float.MaxValue, 0.1f) };
private static readonly Attribute[] DefaultAttributes =
{
//new LimitAttribute(float.MinValue, float.MaxValue, 0.1f),
};
/// <inheritdoc />
public override DisplayStyle Style => DisplayStyle.InlineIntoParent;

View File

@@ -41,13 +41,6 @@ private:
Array<SemaphoreVulkan*> _waitSemaphores;
Array<SemaphoreVulkan*> _submittedWaitSemaphores;
void MarkSemaphoresAsSubmitted()
{
_waitFlags.Clear();
_submittedWaitSemaphores = _waitSemaphores;
_waitSemaphores.Clear();
}
FenceVulkan* _fence;
#if GPU_ALLOW_PROFILE_EVENTS
int32 _eventsBegin = 0;

View File

@@ -47,7 +47,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(
extern PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR;
extern PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR vkGetPhysicalDeviceXlibPresentationSupportKHR;
void LinuxVulkanPlatform::GetInstanceExtensions(Array<const char*>& outExextensionstensions)
void LinuxVulkanPlatform::GetInstanceExtensions(Array<const char*>& extensions)
{
// Include X11 surface extension
extensions.Add(VK_KHR_SURFACE_EXTENSION_NAME);

View File

@@ -50,8 +50,11 @@ void QueueVulkan::Submit(CmdBufferVulkan* cmdBuffer, uint32 numSignalSemaphores,
VALIDATE_VULKAN_RESULT(vkQueueSubmit(_queue, 1, &submitInfo, fence->GetHandle()));
// Mark semaphores as submitted
cmdBuffer->_state = CmdBufferVulkan::State::Submitted;
cmdBuffer->MarkSemaphoresAsSubmitted();
cmdBuffer->_waitFlags.Clear();
cmdBuffer->_submittedWaitSemaphores = cmdBuffer->_waitSemaphores;
cmdBuffer->_waitSemaphores.Clear();
cmdBuffer->_submittedFenceCounter = cmdBuffer->_fenceSignaledCounter;
#if 0

View File

@@ -2,6 +2,9 @@
#pragma once
// Hide warning from old headers
#define register
namespace X11
{
#include <X11/Xlib.h>

View File

@@ -60,7 +60,7 @@ public:
ShadersCompilationService ShadersCompilationServiceInstance;
bool ShadersCompilation::Compile(const ShaderCompilationOptions& options)
bool ShadersCompilation::Compile(ShaderCompilationOptions& options)
{
PROFILE_CPU_NAMED("Shader.Compile");
@@ -86,6 +86,10 @@ bool ShadersCompilation::Compile(const ShaderCompilationOptions& options)
return true;
}
// Adjust input source length if it ends with null
while (options.SourceLength > 2 && options.Source[options.SourceLength - 1] == 0)
options.SourceLength--;
const DateTime startTime = DateTime::NowUTC();
const FeatureLevel featureLevel = RenderTools::GetFeatureLevel(options.Profile);

View File

@@ -20,7 +20,7 @@ public:
/// </summary>
/// <param name="options">Compilation options</param>
/// <returns>True if failed, otherwise false</returns>
static bool Compile(const ShaderCompilationOptions& options);
static bool Compile(ShaderCompilationOptions& options);
/// <summary>
/// Registers shader asset for the automated reloads on source includes changes.

View File

@@ -11,7 +11,7 @@ namespace FlaxEngine.GUI
/// <summary>
/// Gets or sets the blur strength. Defines how blurry the background is. Larger numbers increase blur, resulting in a larger runtime cost on the GPU.
/// </summary>
[EditorOrder(0), Limit(0, 100, 0.1f), Tooltip("Blur strength defines how blurry the background is. Larger numbers increase blur, resulting in a larger runtime cost on the GPU.")]
[EditorOrder(0), Limit(0, 100, 0.0f), Tooltip("Blur strength defines how blurry the background is. Larger numbers increase blur, resulting in a larger runtime cost on the GPU.")]
public float BlurStrength { get; set; }
/// <summary>

View File

@@ -11,6 +11,7 @@ namespace Flax.Build.Bindings
{
partial class BindingsGenerator
{
private static readonly bool[] CppParamsThatNeedLocalVariable = new bool[64];
private static readonly bool[] CppParamsThatNeedConvertion = new bool[64];
private static readonly string[] CppParamsThatNeedConvertionWrappers = new string[64];
private static readonly string[] CppParamsWrappersCache = new string[64];
@@ -391,8 +392,10 @@ namespace Flax.Build.Bindings
}
}
private static string GenerateCppWrapperManagedToNative(BuildData buildData, TypeInfo typeInfo, ApiTypeInfo caller, out string type, FunctionInfo functionInfo)
private static string GenerateCppWrapperManagedToNative(BuildData buildData, TypeInfo typeInfo, ApiTypeInfo caller, out string type, FunctionInfo functionInfo, out bool needLocalVariable)
{
needLocalVariable = false;
// Register any API types usage
var apiType = FindApiTypeInfo(buildData, typeInfo, caller);
CppReferencesFiles.Add(apiType?.File);
@@ -410,7 +413,7 @@ namespace Flax.Build.Bindings
{
typeInfo.IsArray = false;
var arrayType = new TypeInfo { Type = "Array", GenericArgs = new List<TypeInfo> { typeInfo, }, };
var result = GenerateCppWrapperManagedToNative(buildData, arrayType, caller, out type, functionInfo);
var result = GenerateCppWrapperManagedToNative(buildData, arrayType, caller, out type, functionInfo, out needLocalVariable);
typeInfo.IsArray = true;
return result + ".Get()";
}
@@ -515,6 +518,7 @@ namespace Flax.Build.Bindings
// BytesContainer
if (typeInfo.Type == "BytesContainer" && typeInfo.GenericArgs == null)
{
needLocalVariable = true;
type = "MonoArray*";
return "MUtils::LinkArray({0})";
}
@@ -616,7 +620,7 @@ namespace Flax.Build.Bindings
separator = true;
CppParamsThatNeedConvertion[i] = false;
CppParamsWrappersCache[i] = GenerateCppWrapperManagedToNative(buildData, parameterInfo.Type, caller, out var managedType, functionInfo);
CppParamsWrappersCache[i] = GenerateCppWrapperManagedToNative(buildData, parameterInfo.Type, caller, out var managedType, functionInfo, out CppParamsThatNeedLocalVariable[i]);
contents.Append(managedType);
if (parameterInfo.IsRef || parameterInfo.IsOut || UsePassByReference(buildData, parameterInfo.Type, caller))
contents.Append('*');
@@ -662,7 +666,7 @@ namespace Flax.Build.Bindings
contents.Append(", ");
separator = true;
GenerateCppWrapperManagedToNative(buildData, parameterInfo.Type, caller, out var managedType, functionInfo);
GenerateCppWrapperManagedToNative(buildData, parameterInfo.Type, caller, out var managedType, functionInfo, out _);
contents.Append(managedType);
if (parameterInfo.IsRef || parameterInfo.IsOut)
contents.Append('*');
@@ -750,6 +754,15 @@ namespace Flax.Build.Bindings
callParams += "Temp";
}
}
// Special case for parameter that cannot be passed directly to the function from the wrapper method input parameter (eg. MonoArray* converted into BytesContainer uses as BytesContainer&)
else if (CppParamsThatNeedLocalVariable[i])
{
contents.AppendFormat(" auto {0}Temp = {1};", parameterInfo.Name, param).AppendLine();
if (parameterInfo.Type.IsPtr)
callParams += "&";
callParams += parameterInfo.Name;
callParams += "Temp";
}
else
{
callParams += param;
@@ -1888,7 +1901,7 @@ namespace Flax.Build.Bindings
continue;
CppNonPodTypesConvertingGeneration = true;
var wrapper = GenerateCppWrapperManagedToNative(buildData, fieldInfo.Type, structureInfo, out _, null);
var wrapper = GenerateCppWrapperManagedToNative(buildData, fieldInfo.Type, structureInfo, out _, null, out _);
CppNonPodTypesConvertingGeneration = false;
if (fieldInfo.Type.IsArray)

View File

@@ -79,7 +79,7 @@ namespace Flax.Build.Platforms
{
switch (platform)
{
case TargetPlatform.Linux: return true;
case TargetPlatform.Linux: return HasRequiredSDKsInstalled;
case TargetPlatform.Android: return AndroidSdk.Instance.IsValid && AndroidNdk.Instance.IsValid;
default: return false;
}

View File

@@ -314,6 +314,10 @@ namespace Flax.Build.Platforms
return _sdks;
_sdks = new Dictionary<WindowsPlatformSDK, string>();
// Skip if running on non-Windows system
if (BuildTargetPlatform != TargetPlatform.Windows)
return _sdks;
// Check Windows 8.1 SDK
if (TryReadInstallDirRegistryKey32("Microsoft\\Microsoft SDKs\\Windows\\v8.1", "InstallationFolder", out var sdk81))
{