Skip to content

Commit

Permalink
IGL: Use preferred build rules for libraries and tests
Browse files Browse the repository at this point in the history
Reviewed By: kraisler, nlutsenko, rameshviswanathan

Differential Revision: D67116232

fbshipit-source-id: c4def49fdd63882fd8fc0485828b6de077be8509
  • Loading branch information
Eric Griffith authored and facebook-github-bot committed Dec 15, 2024
1 parent 8d7dc97 commit 50a676f
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion shell/renderSessions/GPUStressSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static uint32_t arc4random(void) {
}
#endif // _MSC_VER || IGL_PLATFORM_LINUX

#if ANDROID
#if IGL_PLATFORM_ANDROID

#include <sys/syscall.h>
#include <unistd.h>
Expand Down
7 changes: 6 additions & 1 deletion shell/shared/renderSession/DefaultRenderSessionFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@

#pragma once

#include <igl/Config.h>
#include <memory>
#include <shell/shared/renderSession/IRenderSessionFactory.h>

namespace igl::shell {

std::unique_ptr<IRenderSessionFactory> createDefaultRenderSessionFactory();
#if IGL_PLATFORM_LINUX
__attribute__((weak))
#endif // IGL_PLATFORM_LINUX
std::unique_ptr<IRenderSessionFactory>
createDefaultRenderSessionFactory();

} // namespace igl::shell
6 changes: 4 additions & 2 deletions shell/windows/opengl/AutoContextReleaseDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

#pragma once

#include <igl/Config.h>

// clang-format off
#if defined(_WIN32)
#if IGL_PLATFORM_WINDOWS
#include <igl/opengl/wgl/Context.h>
#include <igl/opengl/wgl/Device.h>
#elif IGL_PLATFORM_LINUX
Expand All @@ -19,7 +21,7 @@

namespace igl::shell::util {

#if defined(_WIN32)
#if IGL_PLATFORM_WINDOWS
struct WGLDevice final : public igl::opengl::Device {
explicit WGLDevice(std::unique_ptr<igl::opengl::IContext> context) :
Device(std::move(context)), platformDevice_(*this) {}
Expand Down
6 changes: 6 additions & 0 deletions src/igl/metal/RenderPipelineReflection.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#include <map>
#include <vector>

// Suppress warnings about use of MTLArgumentType
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

namespace igl::metal {

class RenderPipelineReflection final : public IRenderPipelineReflection {
Expand Down Expand Up @@ -47,3 +51,5 @@ class RenderPipelineReflection final : public IRenderPipelineReflection {
};

} // namespace igl::metal

#pragma GCC diagnostic pop
1 change: 0 additions & 1 deletion src/igl/metal/RenderPipelineState.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <igl/Common.h>
#include <igl/RenderPipelineState.h>
#include <igl/metal/RenderPipelineReflection.h>

namespace igl::metal {

class RenderPipelineState final : public IRenderPipelineState {
Expand Down
4 changes: 1 addition & 3 deletions src/igl/opengl/glx/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace {

int GetLastError() {
[[maybe_unused]] int GetLastError() {
return 0; // TODO: implement error handling
}

Expand Down Expand Up @@ -148,8 +148,6 @@ Context::Context(std::shared_ptr<GLXSharedModule> module,
static int visualAttribs[] = {None};
int contextAttribs[] = {GLX_CONTEXT_MAJOR_VERSION_ARB, 4, GLX_CONTEXT_MINOR_VERSION_ARB, 6, None};

GLXPbuffer pbuf;

if (display_ = module_->XOpenDisplay(0); display_ != nullptr) {
int fbcount = 0;
if (GLXFBConfig* fbc = module_->glXChooseFBConfig(
Expand Down
4 changes: 3 additions & 1 deletion src/igl/opengl/wgl/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

#include <igl/opengl/Texture.h>

#if !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
#if !defined(NOMINMAX)
#define NOMINMAX
#endif // NOMINMAX
#endif // !defined(NOMINMAX)
#include <windows.h>
#ifdef DISABLE_WGL_VSYNC
#include <GL/wglext.h>
Expand Down
4 changes: 4 additions & 0 deletions src/igl/tests/metal/RenderPipelineReflection.mm
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,15 @@ void SetUp() override {
MTLRenderPipelineReflection* reflection = nil;
auto device_ = MTLCreateSystemDefaultDevice();

// Suppress warnings about MTLPipelineOptionArgumentInfo being deprecated
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Create reflection for use later in binding, etc.
[device_ newRenderPipelineStateWithDescriptor:metalDesc
options:MTLPipelineOptionArgumentInfo
reflection:&reflection
error:&error];
#pragma GCC diagnostic pop

pipeRef_ = std::make_shared<metal::RenderPipelineReflection>(reflection);
ASSERT_NE(pipeRef_, nullptr);
Expand Down
4 changes: 4 additions & 0 deletions src/igl/tests/metal/RenderPipelineState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ void SetUp() override {
pipelineDesc_.frontFaceWinding = igl::WindingMode::CounterClockwise;
pipelineDesc_.polygonFillMode = PolygonFillMode::Fill;

// Suppress warnings about MTLPipelineOptionArgumentInfo being deprecated
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Create reflection for use later in binding, etc.
id<MTLRenderPipelineState> metalObject =
[device_ newRenderPipelineStateWithDescriptor:metalDesc
Expand All @@ -107,6 +110,7 @@ void SetUp() override {
options:MTLPipelineOptionArgumentInfo
reflection:nullptr
error:&error];
#pragma GCC diagnostic pop

pipeStateWithNoRefl_ = std::make_shared<metal::RenderPipelineState>(
metalObjectWithoutRefl, nullptr, pipelineDesc_);
Expand Down

0 comments on commit 50a676f

Please sign in to comment.