Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build (part 2) #63

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/Mocha.Engine/DebugOverlay.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Mocha;
namespace Mocha;

public struct DebugOverlayText
{
Expand Down
6 changes: 3 additions & 3 deletions Source/Mocha.Engine/Render/Assets/Material.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public Material( string path )
var shaderFileBytes = FileSystem.Mounted.ReadAllBytes( "shaders/pbr.mshdr" );
var shaderFormat = Serializer.Deserialize<MochaFile<ShaderInfo>>( shaderFileBytes );

NativeMaterial.SetShaderData(
shaderFormat.Data.VertexShaderData.ToInterop(),
shaderFormat.Data.FragmentShaderData.ToInterop()
NativeMaterial.SetShaderData(
shaderFormat.Data.VertexShaderData.ToInterop(),
shaderFormat.Data.FragmentShaderData.ToInterop()
);

NativeMaterial.Reload();
Expand Down
8 changes: 4 additions & 4 deletions Source/Mocha.Hotload/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public static void Run( IntPtr args )

// TODO: Is there a better way to register these cvars?
// Register cvars for assemblies that will never hotload
ConsoleSystem.Internal.RegisterAssembly( typeof( Main ).Assembly ); // Hotload
ConsoleSystem.Internal.RegisterAssembly( typeof( IGame ).Assembly ); // Common
ConsoleSystem.Internal.RegisterAssembly( typeof( BaseGame ).Assembly ); // Engine
ConsoleSystem.Internal.RegisterAssembly( typeof( Main ).Assembly ); // Hotload
ConsoleSystem.Internal.RegisterAssembly( typeof( IGame ).Assembly ); // Common
ConsoleSystem.Internal.RegisterAssembly( typeof( BaseGame ).Assembly ); // Engine

// Initialize upgrader, we do this as early as possible to prevent
// slowdowns while the engine is running.
Expand Down Expand Up @@ -142,7 +142,7 @@ public static void Run( IntPtr args )
else
{
SetServerContext( false );

s_editor = new ProjectAssembly<IGame>( editorAssemblyInfo );
// The editor should never fail to compile.
Debug.Assert( s_editor.EntryPoint is not null );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private static byte[] BlockCompression( byte[] data, uint width, uint height, ui
byte[] resizedData = new byte[4 * targetWidth * targetWidth];

Rgba32[] pixels = new Rgba32[width * height];
for ( int i = 0; i < pixels.Length; i ++ )
for ( int i = 0; i < pixels.Length; i++ )
{
pixels[i] = new Rgba32(
data[(i * 4) + 0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<Platforms>AnyCPU;x64;x86</Platforms>
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<StartupObject>MochaTool.AssetCompiler.CommandLine</StartupObject>
<OutputPath>$(SolutionDir)..\build</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Source/MochaTool.InteropGen/ThreadDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ internal ThreadDispatcher( AsyncThreadCallback threadStart, List<T> queue )

private void Setup( List<T> queue, Action<List<T>> threadStart )
{
var batchSize = queue.Count / _threadCount - 1;
var batchSize = queue.Count / (_threadCount - 1);

if ( batchSize == 0 )
return; // Bail to avoid division by zero
throw new InvalidOperationException( "There are no items to batch for threads" );

var batched = queue
.Select( ( Value, Index ) => new { Value, Index } )
Expand Down
Loading