Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
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
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,10 @@
"cmake.buildDirectory": "${workspaceFolder}/build/targets/darwin",
"C_Cpp.default.cppStandard": "c++17",
"C_Cpp.default.cStandard": "c17",
"C_Cpp.errorSquiggles": "enabledIfIncludesResolve"
"C_Cpp.errorSquiggles": "enabledIfIncludesResolve",
"clangd.arguments": [
"--compile-commands-dir=${workspaceFolder}/build/targets/darwin",
"--background-index",
"--query-driver=/usr/bin/clang*;${env:ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/*"
]
}
3 changes: 1 addition & 2 deletions cmake/TransmuteCommon.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Set the common source files.
file(GLOB TR_COMMON_SOURCE
file(GLOB_RECURSE TR_COMMON_SOURCE
"src/common/*.cpp"
"src/common/**/*.cpp"
)

# Set the common include directories
Expand Down
2 changes: 1 addition & 1 deletion cmake/TransmuteCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if(NOT TR_ENABLE_INSPECTOR)
endif()

if(APPLE)
file(GLOB TR_CORE_SOURCE_MM "src/renderer/*.mm")
file(GLOB TR_CORE_SOURCE_MM "src/renderer/*.mm" "src/renderer/metal/*.mm")
list(APPEND TR_CORE_SOURCE ${TR_CORE_SOURCE_MM})
endif()

Expand Down
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/active_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ namespace endor
}

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/active_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ namespace endor
{
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/framebuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ namespace endor
// WebGLObject is a base class, typically not instantiated directly
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ namespace endor
}

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ namespace endor
WebGLProgram(v8::Isolate *isolate, const v8::FunctionCallbackInfo<v8::Value> &args);
};
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/renderbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ namespace endor
// WebGLRenderbuffer objects are created by WebGL context, not by user code
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/renderbuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ namespace endor
{
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/texture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/uniform_location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ namespace endor
}

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/uniform_location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/vertex_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ namespace endor
{
}
} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
2 changes: 1 addition & 1 deletion src/client/script_bindings/webgl/vertex_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ namespace endor
};

} // namespace webgl
} // namespace script_bindings
} // namespace script_bindings
} // namespace endor
57 changes: 57 additions & 0 deletions src/common/assert.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include <iostream>
#include <common/assert.hpp>
#include <common/compiler.hpp>
#include <common/platform.hpp>

namespace transmute::common
{
#if TR_COMPILER_IS(CLANG) || TR_COMPILER_IS(GCC)
void BreakPoint()
{
#if TR_PLATFORM_IS(X86)
__asm__ __volatile__("int $3\n\t");
#elif TR_PLATFORM_IS(ARM32)
__asm__ __volatile__("bkpt 0");
#elif TR_PLATFORM_IS(ARM64)
__asm__ __volatile__("brk 0xf000");
#elif TR_PLATFORM_IS(LOONGARCH)
__asm__ __volatile__("break 0");
#elif TR_PLATFORM_IS(RISCV)
__asm__ __volatile__("ebreak");
#elif TR_PLATFORM_IS(MIPS)
__asm__ __volatile__("break");
#elif TR_PLATFORM_IS(S390) || TR_PLATFORM_IS(S390X)
__asm__ __volatile__(".word 0x0001");
#elif TR_PLATFORM_IS(PPC) || TR_PLATFORM_IS(PPC64)
__asm__ __volatile__("twge 2,2");
#elif TR_PLATFORM_IS(WASM32) || TR_PLATFORM_IS(WASM64)
EM_ASM(debugger;);
#else
#error "Unsupported platform"
#endif
}

#elif TR_COMPILER_IS(MSVC)
void BreakPoint()
{
__debugbreak();
}

#else
#error "Unsupported compiler"
#endif

void HandleAssertionFailure(const char *file,
const char *function,
int line,
const char *condition)
{
std::cerr << "Assertion failure at " << file << ":" << line << " (" << function
<< "): " << condition;
#if defined(TR_ABORT_ON_ASSERT)
abort();
#else
BreakPoint();
#endif
}
}
10 changes: 10 additions & 0 deletions src/common/assert.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

namespace transmute::common
{
void BreakPoint();
void HandleAssertionFailure(const char *file,
const char *function,
int line,
const char *condition);
}
13 changes: 13 additions & 0 deletions src/common/command_buffers/gpu/attachment_set.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

namespace commandbuffers
{
class GPUDeviceBase;

namespace gpu
{
class AttachmentState
{
};
}
}
20 changes: 20 additions & 0 deletions src/common/command_buffers/gpu/backend_connection.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <common/command_buffers/gpu/backend_connection.hpp>

namespace commandbuffers::gpu
{
BackendConnection::BackendConnection(GPUInstance *instance, GPUBackendType type)
: instance_(instance)
, type_(type)
{
}

GPUBackendType BackendConnection::type() const
{
return type_;
}

GPUInstance *BackendConnection::getInstance() const
{
return instance_;
}
}
28 changes: 28 additions & 0 deletions src/common/command_buffers/gpu/backend_connection.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

#include <vector>
#include <common/utility.hpp>
#include <common/non_movable.hpp>
#include <common/command_buffers/gpu/gpu_base.hpp>
#include <common/command_buffers/gpu/gpu_instance.hpp>
#include <common/command_buffers/gpu/gpu_adapter.hpp>
#include <common/command_buffers/gpu/physical_device.hpp>

namespace commandbuffers::gpu
{
class BackendConnection : public NonMovable
{
public:
BackendConnection(GPUInstance *instance, GPUBackendType type);
virtual ~BackendConnection() = default;

GPUBackendType type() const;
GPUInstance *getInstance() const;

virtual std::vector<Ref<gpu::PhysicalDeviceBase>> discoverPhysicalDevices(const RequestAdapterOptions &) = 0;

private:
GPUInstance *instance_ = nullptr;
GPUBackendType type_;
};
}
Loading
Loading