"Fix" warnings

This commit is contained in:
Simon Lübeß
2026-08-16 20:11:36 +02:00
parent 39d78ab4c1
commit 2a90374b5b
25 changed files with 53 additions and 45 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ class AssetCache
Try!(compressedStream.TryRead(compressedData)); Try!(compressedStream.TryRead(compressedData));
MemoryStream ms = new MemoryStream(asset.UncompressedByteCount); MemoryStream ms = new MemoryStream(asset.UncompressedByteCount);
ms.Memory.GrowUnitialized(asset.UncompressedByteCount); ms.Memory.GrowUninitialized(asset.UncompressedByteCount);
LZ4.LZ4F_dctx* context; LZ4.LZ4F_dctx* context;
LZ4.LZ4F_CreateDecompressionContext(out context); LZ4.LZ4F_CreateDecompressionContext(out context);
@@ -630,7 +630,7 @@ static class DdsImporter
surfaces.Reserve(surfaceCount); surfaces.Reserve(surfaceCount);
uint32 scanLineSize = 0; uint32 scanLineSize = 0;
uint32 slicePitch = 0; //uint32 slicePitch = 0;
uint64 numBytes = 0; uint64 numBytes = 0;
uint32 blockSize = 0; // Block size in bytes. uint32 blockSize = 0; // Block size in bytes.
@@ -97,7 +97,7 @@ class MaterialVariable
Result<int, Int.ParseError> rowsResult = int.Parse(rowsString); Result<int, Int.ParseError> rowsResult = int.Parse(rowsString);
if (rowsResult case .Err(let error)) if (rowsResult case .Err(var error))
{ {
switch (error) switch (error)
{ {
@@ -114,7 +114,7 @@ class MaterialVariable
Result<int, Int.ParseError> columnsResult = int.Parse(columnsString); Result<int, Int.ParseError> columnsResult = int.Parse(columnsString);
if (columnsResult case .Err(let error)) if (columnsResult case .Err(out error))
{ {
switch (error) switch (error)
{ {
@@ -226,7 +226,7 @@ extension ShaderCompiler
Try!(ShaderCodePreprocessor.ProcessFileContent(shaderCode, context.VsName, context.PsName, context.Variables, context.BufferNames, context.EngineBuffers)); Try!(ShaderCodePreprocessor.ProcessFileContent(shaderCode, context.VsName, context.PsName, context.Variables, context.BufferNames, context.EngineBuffers));
using (let includer = PreprocessingIncluder(directory, context)) using (var includer = PreprocessingIncluder(directory, context))
{ {
var result = D3DCompiler.D3DCompile(code.Ptr, (.)code.Length, fileName.FullIdentifier.ToScopeCStr!(), nativeMacros, &includer, entryPoint.ToScopeCStr!(), var result = D3DCompiler.D3DCompile(code.Ptr, (.)code.Length, fileName.FullIdentifier.ToScopeCStr!(), nativeMacros, &includer, entryPoint.ToScopeCStr!(),
compileTarget.ToScopeCStr!(), DefaultCompileFlags /* Pass down compile flags? */, .None, &outShader._shaderBlob, &errorBlob); compileTarget.ToScopeCStr!(), DefaultCompileFlags /* Pass down compile flags? */, .None, &outShader._shaderBlob, &errorBlob);
@@ -205,14 +205,14 @@ class ShaderProcessor : IAssetProcessor
ProcessedShader.ConstantBufferEntry constantBufferEntry = .Default; ProcessedShader.ConstantBufferEntry constantBufferEntry = .Default;
if (vsBufferResult case .Ok(let vsBuffer) && psBufferResult case .Ok(let psBuffer)) if (vsBufferResult case .Ok(var vsBuffer) && psBufferResult case .Ok(let psBuffer))
{ {
// Choose larger buffer // Choose larger buffer
constantBufferEntry.ConstantBuffer = (vsBuffer.Size >= psBuffer.Size) ? vsBuffer : psBuffer; constantBufferEntry.ConstantBuffer = (vsBuffer.Size >= psBuffer.Size) ? vsBuffer : psBuffer;
constantBufferEntry.VertexShaderBindPoint = (.)vsBuffer.BindPoint; constantBufferEntry.VertexShaderBindPoint = (.)vsBuffer.BindPoint;
constantBufferEntry.PixelShaderBindPoint = (.)psBuffer.BindPoint; constantBufferEntry.PixelShaderBindPoint = (.)psBuffer.BindPoint;
} }
else if (vsBufferResult case .Ok(let vsBuffer)) else if (vsBufferResult case .Ok(out vsBuffer))
{ {
constantBufferEntry.ConstantBuffer = vsBuffer; constantBufferEntry.ConstantBuffer = vsBuffer;
constantBufferEntry.VertexShaderBindPoint = (.)vsBuffer.BindPoint; constantBufferEntry.VertexShaderBindPoint = (.)vsBuffer.BindPoint;
@@ -465,7 +465,7 @@ namespace GlitchyEditor.EditWindows
_selectedFiles.ClearAndDeleteItems(); _selectedFiles.ClearAndDeleteItems();
} }
if (currentDirectoryNode case .Ok(TreeNode<AssetNode> currentDirectory)) if (currentDirectoryNode case .Ok(out currentDirectory))
{ {
FileDropTarget(currentDirectory, .External); FileDropTarget(currentDirectory, .External);
} }
@@ -168,7 +168,7 @@ namespace GlitchyEditor.EditWindows
let mousePos = (float2)ImGui.GetMousePos(); let mousePos = (float2)ImGui.GetMousePos();
let globalToImGuiMouse = (float2)globalMousePosition - mousePos; //let globalToImGuiMouse = (float2)globalMousePosition - mousePos;
let winPos = (float2)ImGui.GetWindowPos(); let winPos = (float2)ImGui.GetWindowPos();
let regionMin = winPos + (float2)ImGui.GetWindowContentRegionMin(); let regionMin = winPos + (float2)ImGui.GetWindowContentRegionMin();
@@ -119,11 +119,11 @@ class InspectorWindow : EditorWindow
{ {
ShowAssetProperties(assetHandle, editor); ShowAssetProperties(assetHandle, editor);
} }
else if (object case .Entity(let entityId)) else if (object case .Entity(var entityId))
{ {
ShowEntityProperties(entityId, editor); ShowEntityProperties(entityId, editor);
} }
else if (object case .Component(let entityId, let componentType)) else if (object case .Component(out entityId, let componentType))
{ {
ShowEntityProperties(entityId, editor, componentType); ShowEntityProperties(entityId, editor, componentType);
} }
@@ -156,7 +156,7 @@ class InspectorWindow : EditorWindow
if (assetFile.LoadedAsset != null) if (assetFile.LoadedAsset != null)
{ {
// TODO: Where do we get the asset editor from? // TODO: Where do we get the asset editor from?
if (let mat = assetFile.LoadedAsset as Material) if (assetFile.LoadedAsset is Material)
{ {
MaterialEditor.ShowEditor(assetFile); MaterialEditor.ShowEditor(assetFile);
//ImGui.TextUnformatted(assetFile.LoadedAsset.Identifier); //ImGui.TextUnformatted(assetFile.LoadedAsset.Identifier);
+2 -2
View File
@@ -972,14 +972,14 @@ class EditorContentManager : IContentManager
{ {
Runtime.NotImplemented(); Runtime.NotImplemented();
if (oldIdentifier == newIdentifier) /*if (oldIdentifier == newIdentifier)
return; return;
Log.EngineLogger.Assert(_identiferToHandle.ContainsKey(newIdentifier), "An asset with the same identifier is already managed by this content manager."); Log.EngineLogger.Assert(_identiferToHandle.ContainsKey(newIdentifier), "An asset with the same identifier is already managed by this content manager.");
// Since all we do in order to track assets is add them to a dictionary we can simply unmanage and manage it again. // Since all we do in order to track assets is add them to a dictionary we can simply unmanage and manage it again.
//UnmanageAsset(asset); //UnmanageAsset(asset);
//ManageAsset(asset); //ManageAsset(asset);*/
} }
// TODO: obviously use a map or something... // TODO: obviously use a map or something...
+3 -3
View File
@@ -589,7 +589,7 @@ namespace GlitchyEditor
/// @remarks If the creation fails at any point the entire directory will be deleted. /// @remarks If the creation fails at any point the entire directory will be deleted.
private Result<void> CreateNewProject(StringView workspaceDirectory, StringView projectName) private Result<void> CreateNewProject(StringView workspaceDirectory, StringView projectName)
{ {
if (Directory.CreateDirectory(workspaceDirectory) case .Err(let error)) if (Directory.CreateDirectory(workspaceDirectory) case .Err(var error))
{ {
Log.ClientLogger.Error($"Failed to create directory \"{workspaceDirectory}\". ({error})"); Log.ClientLogger.Error($"Failed to create directory \"{workspaceDirectory}\". ({error})");
return .Err; return .Err;
@@ -610,9 +610,9 @@ namespace GlitchyEditor
// If the project couldn't be created or initialization failed, we delete the workspace directory. // If the project couldn't be created or initialization failed, we delete the workspace directory.
if (newProjectResult == .Err) if (newProjectResult == .Err)
{ {
if (Directory.DelTree(workspaceDirectory) case .Err(let error)) if (Directory.DelTree(workspaceDirectory) case .Err(out error))
{ {
Log.EngineLogger.Error($"Failed to delete workspace ({workspaceDirectory})."); Log.EngineLogger.Error($"Failed to delete workspace ({workspaceDirectory}). ({error})");
} }
return .Err; return .Err;
+2 -2
View File
@@ -276,10 +276,10 @@ namespace ImGui
const String[?] componentNames = .("X", "Y", "Z", "W"); const String[?] componentNames = .("X", "Y", "Z", "W");
const String[?] componentIds = .("##X", "##Y", "##Z", "##W"); const String[?] componentIds = .("##X", "##Y", "##Z", "##W");
static int mouseLockId = 0; //static int mouseLockId = 0;
bool changed = false; bool changed = false;
bool deactivated = false; //bool deactivated = false;
if (!label.IsEmpty) if (!label.IsEmpty)
{ {
+1 -1
View File
@@ -311,7 +311,7 @@ namespace GlitchyEditor
switch (fieldType) switch (fieldType)
{ {
case typeof(bool): case typeof(bool):
let value = GetSettingValue!<bool>(); bool value = GetSettingValue!<bool>();
if (!ImGui.Checkbox(scope $"##{setting.Name}", &value)) if (!ImGui.Checkbox(scope $"##{setting.Name}", &value))
break; break;
+2 -2
View File
@@ -98,7 +98,7 @@ namespace GlitchyEngine.Content
for (var mesh in modelData.Meshes) for (var mesh in modelData.Meshes)
{ {
var name = StringView(mesh.Name); //var name = StringView(mesh.Name);
//if (name == meshName) //if (name == meshName)
{ {
@@ -616,7 +616,7 @@ namespace GlitchyEngine.Content
CGLTF.AccessorReadFloat(accessor, (uint)index, (float*)&result, 16); CGLTF.AccessorReadFloat(accessor, (uint)index, (float*)&result, 16);
case typeof(uint16): case typeof(uint16):
CGLTF.AccessorReadUint(accessor, (uint)index, (uint32*)&result, 2); CGLTF.AccessorReadUint(accessor, (uint)index, (uint32*)&result, 2);
case default: default:
uint8* data = (uint8*)accessor.BufferView.Buffer.Data; uint8* data = (uint8*)accessor.BufferView.Buffer.Data;
data += accessor.BufferView.Offset; data += accessor.BufferView.Offset;
+5 -1
View File
@@ -15,7 +15,11 @@ class TextureLoader : IProcessedAssetLoader
Format pixelFormat = Try!(dataStream.Read<Format>()); Format pixelFormat = Try!(dataStream.Read<Format>());
uint32 width = Try!(dataStream.Read<uint32>()); uint32 width = Try!(dataStream.Read<uint32>());
uint32 height = Try!(dataStream.Read<uint32>()); uint32 height = Try!(dataStream.Read<uint32>());
uint32 depth = Try!(dataStream.Read<uint32>());
// TODO: We don't need the depth-value?
//uint32 depth =
Try!(dataStream.Read<uint32>());
uint32 arraySize = Try!(dataStream.Read<uint32>()); uint32 arraySize = Try!(dataStream.Read<uint32>());
uint32 mipMapCount = Try!(dataStream.Read<uint32>()); uint32 mipMapCount = Try!(dataStream.Read<uint32>());
bool isCubemap = Try!(dataStream.Read<bool>()); bool isCubemap = Try!(dataStream.Read<bool>());
@@ -0,0 +1,10 @@
using System;
using GlitchyEngine.Math;
namespace Box2D;
extension b2Color
{
[Inline]
#unwarn
public static explicit operator ColorRGBA(b2Color color) => ColorRGBA(color.r, color.g, color.b, color.a);
}
-5
View File
@@ -929,10 +929,5 @@ static
return (int64)gcd((uint64)Math.Abs(u), (uint64)Math.Abs(v)); return (int64)gcd((uint64)Math.Abs(u), (uint64)Math.Abs(v));
} }
public static this()
{
int64 i = (int64)gcd(38, 123);
}
#endregion #endregion
} }
+1 -1
View File
@@ -476,7 +476,7 @@ public struct Matrix
float3 right = normalize(cross(up, forward)); float3 right = normalize(cross(up, forward));
float3 newUp = normalize(cross(forward, right)); //float3 newUp = normalize(cross(forward, right));
Matrix result = .Identity; Matrix result = .Identity;
@@ -68,7 +68,7 @@ namespace GlitchyEngine.Renderer
uint32 backBufferCount = 2; uint32 backBufferCount = 2;
Format backBufferFormat = .R8G8B8A8_UNorm; Format backBufferFormat = .R8G8B8A8_UNorm;
Format backBufferViewFormat = .R8G8B8A8_UNorm; // _SRGB //Format backBufferViewFormat = .R8G8B8A8_UNorm; // _SRGB
if(nativeSwapChain != null) if(nativeSwapChain != null)
{ {
@@ -335,7 +335,7 @@ namespace GlitchyEngine.Renderer
{ {
Debug.Profiler.ProfileResourceFunction!(); Debug.Profiler.ProfileResourceFunction!();
SubresourceData resData = .(data, linePitch, slicePitch); //SubresourceData resData = .(data, linePitch, slicePitch);
// If data is null, set subresourceData null // If data is null, set subresourceData null
SubresourceData* resDataPtr = null;//data == null ? null : &resData; SubresourceData* resDataPtr = null;//data == null ? null : &resData;
@@ -131,7 +131,7 @@ namespace GlitchyEngine
keycode = VK_XBUTTON1; keycode = VK_XBUTTON1;
case .XButton2: case .XButton2:
keycode = VK_XBUTTON2; keycode = VK_XBUTTON2;
case default: default:
return false; return false;
} }
+2 -2
View File
@@ -1205,12 +1205,12 @@ namespace GlitchyEngine.Renderer
#endif #endif
Runtime.FatalError("Circle renderer currently broken, do we need it?"); Runtime.FatalError("Circle renderer currently broken, do we need it?");
QueueCircleInstance(transform, color, texture, null, transform.Translation.Z, uvTransform, innerRadius, entityId); /*QueueCircleInstance(transform, color, texture, null, transform.Translation.Z, uvTransform, innerRadius, entityId);
if(s_drawOrder == .Immediate) if(s_drawOrder == .Immediate)
{ {
DrawDeferred(); DrawDeferred();
} }*/
} }
public struct Statistics public struct Statistics
@@ -242,7 +242,7 @@ namespace GlitchyEngine.Renderer.Text
StyleStack<bool> richTextStack = scope .(true); StyleStack<bool> richTextStack = scope .(true);
// TODO: color stack not used?! // TODO: color stack not used?!
StyleStack<ColorRGBA> fontColorStack = scope .(textRenderer.Color); //StyleStack<ColorRGBA> fontColorStack = scope .(textRenderer.Color);
StyleStack<float> fontSizeStack = scope .(textRenderer.FontSize); StyleStack<float> fontSizeStack = scope .(textRenderer.FontSize);
@@ -117,8 +117,6 @@ struct EngineFunctionsGeneratorAttribute : Attribute, IComptimeTypeApply
{ {
String parameters = new String(); String parameters = new String();
StringView str = method.Name;
for (int i < method.ParamCount) for (int i < method.ParamCount)
{ {
if (i != 0) if (i != 0)
@@ -247,6 +247,7 @@ class SerializedObject
static T GetFieldDataAs<T>(FieldData fieldData) static T GetFieldDataAs<T>(FieldData fieldData)
{ {
#unwarn
return *(T*)&fieldData.RawData; return *(T*)&fieldData.RawData;
} }
@@ -323,7 +324,7 @@ class SerializedObject
Serialize.Value(writer, ValueView(typeof(StringView), &dataView), environment); Serialize.Value(writer, ValueView(typeof(StringView), &dataView), environment);
case .EngineObjectReference: case .EngineObjectReference:
writer.Type("EngineObject"); writer.Type("EngineObject");
if (field.Data.EngineObject.FullTypeName != null) if (field.Data.EngineObject.FullTypeName.IsEmpty)
writer.Type((StringView)field.Data.ListEngineObject.FullTypeName); writer.Type((StringView)field.Data.ListEngineObject.FullTypeName);
Serialize.Value(writer, field.Data.EngineObject.ID, environment); Serialize.Value(writer, field.Data.EngineObject.ID, environment);
case .ObjectReference: case .ObjectReference:
+7 -7
View File
@@ -322,12 +322,12 @@ namespace GlitchyEngine.World
let start = vertices[i - 1]; let start = vertices[i - 1];
let end = vertices[i]; let end = vertices[i];
Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), *(ColorRGBA*)&color); Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), (ColorRGBA)color);
} }
let start = vertices[vertexCount - 1]; let start = vertices[vertexCount - 1];
let end = vertices[0]; let end = vertices[0];
Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), *(ColorRGBA*)&color); Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f),(ColorRGBA)color);
}; };
draw.drawSolidPolygonCallback = (vertices, vertexCount, color, userData) => draw.drawSolidPolygonCallback = (vertices, vertexCount, color, userData) =>
{ {
@@ -336,20 +336,20 @@ namespace GlitchyEngine.World
let start = vertices[i - 1]; let start = vertices[i - 1];
let end = vertices[i]; let end = vertices[i];
Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), *(ColorRGBA*)&color); Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f),(ColorRGBA)color);
} }
let start = vertices[vertexCount - 1]; let start = vertices[vertexCount - 1];
let end = vertices[0]; let end = vertices[0];
Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), *(ColorRGBA*)&color); Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f),(ColorRGBA)color);
}; };
draw.drawCircleCallback = (center, radius, color, userData) => draw.drawCircleCallback = (center, radius, color, userData) =>
{ {
Renderer2D.DrawCircle(center, radius.XX, *(ColorRGBA*)&color, 0.1f); Renderer2D.DrawCircle(center, radius.XX, (ColorRGBA)color, 0.1f);
}; };
draw.drawSolidCircleCallback = (center, radius, axis, color, userData) => draw.drawSolidCircleCallback = (center, radius, axis, color, userData) =>
{ {
Renderer2D.DrawCircle(center, radius.XX, *(ColorRGBA*)&color); Renderer2D.DrawCircle(center, radius.XX, (ColorRGBA)color);
}; };
draw.drawSegmentCallback = (p1, p2, color, userData) => draw.drawSegmentCallback = (p1, p2, color, userData) =>
{ {
@@ -723,7 +723,7 @@ namespace GlitchyEngine.World
b2Body* body = rigidbody.RuntimeBody; b2Body* body = rigidbody.RuntimeBody;
b2Vec2 position = Box2D.Body.GetPosition(body); b2Vec2 position = Box2D.Body.GetPosition(body);
float angle = Box2D.Body.GetAngle(body); //float angle = Box2D.Body.GetAngle(body);
b2Transform bodyTransform = Box2D.Body.GetTransform(body); b2Transform bodyTransform = Box2D.Body.GetTransform(body);
float cos = sqrt((1 + bodyTransform.q.c) / 2); float cos = sqrt((1 + bodyTransform.q.c) / 2);