Rename mjrFilamentConfig to mjrfContextConfig.

PiperOrigin-RevId: 932996526
Change-Id: Ia81ee074471ab4ff41e0829fa5ba70203599fdb6
This commit is contained in:
Haroon Qureshi
2026-06-16 03:35:42 -07:00
committed by Copybara-Service
parent ecee1e0c53
commit c0fa33f97f
9 changed files with 21 additions and 21 deletions
+5 -5
View File
@@ -35,7 +35,7 @@ namespace {
class CompatContext {
public:
CompatContext(const mjrFilamentConfig* config, const mjModel* model);
CompatContext(const mjrfContextConfig* config, const mjModel* model);
void Render(const mjrRect& viewport, const mjvScene* scene);
@@ -66,7 +66,7 @@ class CompatContext {
UniquePtr<mjrfRenderTarget> depth_target_{nullptr, nullptr};
};
CompatContext::CompatContext(const mjrFilamentConfig* config,
CompatContext::CompatContext(const mjrfContextConfig* config,
const mjModel* model)
: context_(CreateContext(*config)) {
scene_bridge_ = std::make_unique<SceneBridge>(context_.get(), model);
@@ -186,7 +186,7 @@ void mjr_defaultContext(mjrContext* con) {
memset(con, 0, sizeof(mjrContext));
}
void mjr_makeFilamentContext(const mjModel* m, const mjrFilamentConfig* cfg,
void mjr_makeFilamentContext(const mjModel* m, const mjrfContextConfig* cfg,
mjrContext* con) {
if (g_context != nullptr) {
mju_error("Context already exists!");
@@ -197,8 +197,8 @@ void mjr_makeFilamentContext(const mjModel* m, const mjrFilamentConfig* cfg,
void mjr_makeContext(const mjModel* m, mjrContext* con, int fontscale) {
mjr_freeContext(con);
mjrFilamentConfig cfg;
mjrf_defaultFilamentConfig(&cfg);
mjrfContextConfig cfg;
mjrf_defaultContextConfig(&cfg);
mjr_makeFilamentContext(m, &cfg, con);
}
+2 -2
View File
@@ -94,8 +94,8 @@ void Renderer::Init(const mjModel* model) {
mjr_makeContext(model, &render_context_, mjFONTSCALE_150);
} else {
mjrFilamentConfig cfg;
mjrf_defaultFilamentConfig(&cfg);
mjrfContextConfig cfg;
mjrf_defaultContextConfig(&cfg);
cfg.native_window = native_window_;
cfg.force_software_rendering = IsSoftware(gfx_);
cfg.graphics_api = IsOpenGl(gfx_) || IsWebGl(gfx_)
+1 -1
View File
@@ -46,7 +46,7 @@
namespace mujoco {
FilamentContext::FilamentContext(const mjrFilamentConfig* config)
FilamentContext::FilamentContext(const mjrfContextConfig* config)
: config_(*config) {
FilamentPlatformSetup setup = CreateFilamentPlatform(config_);
platform_ = std::move(setup.platform);
+2 -2
View File
@@ -33,7 +33,7 @@ namespace mujoco {
// Manages the filament::Renderer and provides APIs for rendering scenes.
class FilamentContext : public mjrfContext {
public:
explicit FilamentContext(const mjrFilamentConfig* config);
explicit FilamentContext(const mjrfContextConfig* config);
~FilamentContext();
FilamentContext(const FilamentContext&) = delete;
@@ -75,7 +75,7 @@ class FilamentContext : public mjrfContext {
private:
void ValidateSwapChains(std::span<const mjrfRenderRequest> render_requests);
mjrFilamentConfig config_;
mjrfContextConfig config_;
filament::Engine* engine_ = nullptr;
filament::Renderer* renderer_ = nullptr;
filament::SwapChain* window_swap_chain_ = nullptr;
@@ -46,7 +46,7 @@ static filament::Engine::Backend ResolveBackend(int graphics_api) {
return backend;
}
FilamentPlatformSetup CreateFilamentPlatform(const mjrFilamentConfig& config) {
FilamentPlatformSetup CreateFilamentPlatform(const mjrfContextConfig& config) {
FilamentPlatformSetup setup;
setup.backend = ResolveBackend(config.graphics_api);
return setup;
@@ -38,7 +38,7 @@ struct FilamentPlatformSetup {
// Creates a filament::Platform based on the given config and defines the
// filament::Engine::Backend to use. Also returns additional information for
// setting up the filament::Engine for use with the provided Platform.
FilamentPlatformSetup CreateFilamentPlatform(const mjrFilamentConfig& config);
FilamentPlatformSetup CreateFilamentPlatform(const mjrfContextConfig& config);
} // namespace mujoco
+3 -3
View File
@@ -39,8 +39,8 @@ static void setf(float (&arr)[N], const std::array<float, N>& values) {
extern "C" {
void mjrf_defaultFilamentConfig(mjrFilamentConfig* config) {
memset(config, 0, sizeof(mjrFilamentConfig));
void mjrf_defaultContextConfig(mjrfContextConfig* config) {
memset(config, 0, sizeof(mjrfContextConfig));
}
void mjrf_defaultTextureData(mjrfTextureData* data) {
@@ -116,7 +116,7 @@ void mjrf_defaultFrameStats(mjrfFrameStats* stats) {
memset(stats, 0, sizeof(mjrfFrameStats));
}
mjrfContext* mjrf_createContext(const mjrFilamentConfig* config) {
mjrfContext* mjrf_createContext(const mjrfContextConfig* config) {
return new mujoco::FilamentContext(config);
}
+5 -5
View File
@@ -89,18 +89,18 @@ typedef enum mjrGraphicsApi_ { // underlying graphics API to use for rendering
mjGRAPHICS_API_VULKAN, // vulkan
} mjrGraphicsApi;
struct mjrFilamentConfig_ { // parameters for creating filament context (mjrfContext)
struct mjrfContextConfig_ { // parameters for creating filament context (mjrfContext)
int graphics_api; // mjrGraphicsApi; rendering graphics API
mjtBool force_software_rendering; // force backend to use software rendering
void* native_window; // platform-dependent window handle (or nullptr for windowless)
};
typedef struct mjrFilamentConfig_ mjrFilamentConfig;
typedef struct mjrfContextConfig_ mjrfContextConfig;
// Initializes the mjrFilamentConfig to default values.
void mjrf_defaultFilamentConfig(mjrFilamentConfig* config);
// Initializes the mjrfContextConfig to default values.
void mjrf_defaultContextConfig(mjrfContextConfig* config);
// Creates a filament rendering context.
mjrfContext* mjrf_createContext(const mjrFilamentConfig* config);
mjrfContext* mjrf_createContext(const mjrfContextConfig* config);
// Destroys the filament rendering context.
void mjrf_destroyContext(mjrfContext* ctx);
+1 -1
View File
@@ -26,7 +26,7 @@ namespace mujoco {
template <typename T>
using UniquePtr = std::unique_ptr<T, void (*)(T*)>;
inline UniquePtr<mjrfContext> CreateContext(const mjrFilamentConfig& config) {
inline UniquePtr<mjrfContext> CreateContext(const mjrfContextConfig& config) {
mjrfContext* context = mjrf_createContext(&config);
return UniquePtr<mjrfContext>(context, mjrf_destroyContext);
}