mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -12,8 +12,7 @@
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
|
||||
ImguiRenderer::ImguiRenderer()
|
||||
: m_state(df::CreateRenderState(gpu::Program::ImGui, df::DepthLayer::GuiLayer))
|
||||
ImguiRenderer::ImguiRenderer() : m_state(df::CreateRenderState(gpu::Program::ImGui, df::DepthLayer::GuiLayer))
|
||||
{
|
||||
m_state.SetDepthTestEnabled(false);
|
||||
m_state.SetBlending(dp::Blending(true));
|
||||
@@ -91,21 +90,20 @@ void ImguiRenderer::Render(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::Tex
|
||||
|
||||
gpu::ImGuiProgramParams const params{.m_projection = m_projection};
|
||||
context->PushDebugLabel("ImGui Rendering");
|
||||
m_mesh->Render(context, gpuProgram, m_state, programManager->GetParamsSetter(), params,
|
||||
[&, this]()
|
||||
{
|
||||
context->SetCullingEnabled(false);
|
||||
for (auto const & drawCall : dataBuffer.m_drawCalls)
|
||||
{
|
||||
uint32_t y = drawCall.clipRect.y;
|
||||
if (context->GetApiVersion() == dp::ApiVersion::OpenGLES3)
|
||||
y = dataBuffer.m_height - y - drawCall.clipRect.w;
|
||||
context->SetScissor(drawCall.clipRect.x, y, drawCall.clipRect.z, drawCall.clipRect.w);
|
||||
m_mesh->DrawPrimitivesSubsetIndexed(context, drawCall.indexCount, drawCall.startIndex);
|
||||
}
|
||||
context->SetCullingEnabled(true);
|
||||
context->SetScissor(0, 0, dataBuffer.m_width, dataBuffer.m_height);
|
||||
});
|
||||
m_mesh->Render(context, gpuProgram, m_state, programManager->GetParamsSetter(), params, [&, this]()
|
||||
{
|
||||
context->SetCullingEnabled(false);
|
||||
for (auto const & drawCall : dataBuffer.m_drawCalls)
|
||||
{
|
||||
uint32_t y = drawCall.clipRect.y;
|
||||
if (context->GetApiVersion() == dp::ApiVersion::OpenGLES3)
|
||||
y = dataBuffer.m_height - y - drawCall.clipRect.w;
|
||||
context->SetScissor(drawCall.clipRect.x, y, drawCall.clipRect.z, drawCall.clipRect.w);
|
||||
m_mesh->DrawPrimitivesSubsetIndexed(context, drawCall.indexCount, drawCall.startIndex);
|
||||
}
|
||||
context->SetCullingEnabled(true);
|
||||
context->SetScissor(0, 0, dataBuffer.m_width, dataBuffer.m_height);
|
||||
});
|
||||
context->PopDebugLabel();
|
||||
}
|
||||
|
||||
@@ -209,7 +207,7 @@ void ImguiRenderer::UpdateBuffers()
|
||||
|
||||
for (int cmdIndex = 0; cmdIndex < cmdList->CmdBuffer.Size; ++cmdIndex)
|
||||
{
|
||||
const ImDrawCmd cmd = cmdList->CmdBuffer[cmdIndex];
|
||||
ImDrawCmd const cmd = cmdList->CmdBuffer[cmdIndex];
|
||||
ImVec2 clipMin((cmd.ClipRect.x - clipOff.x) * clipScale.x, (cmd.ClipRect.y - clipOff.y) * clipScale.y);
|
||||
ImVec2 clipMax((cmd.ClipRect.z - clipOff.x) * clipScale.x, (cmd.ClipRect.w - clipOff.y) * clipScale.y);
|
||||
if (clipMin.x < 0.0f)
|
||||
|
||||
@@ -18,8 +18,7 @@ class ImguiRenderer
|
||||
{
|
||||
public:
|
||||
ImguiRenderer();
|
||||
void Render(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::TextureManager> textureManager,
|
||||
void Render(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> textureManager,
|
||||
ref_ptr<gpu::ProgramManager> programManager);
|
||||
void Update(std::function<void()> const & uiCallback);
|
||||
void Reset();
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
#include "coding/reader.hpp"
|
||||
|
||||
#include "base/math.hpp"
|
||||
#include "base/logging.hpp"
|
||||
#include "base/macros.hpp"
|
||||
#include "base/math.hpp"
|
||||
|
||||
#include "std/target_os.hpp"
|
||||
|
||||
@@ -81,7 +81,10 @@ bool ValidateLogAbortLevel(char const * flagname, std::string const & value)
|
||||
|
||||
bool const g_logAbortLevelDummy = gflags::RegisterFlagValidator(&FLAGS_log_abort_level, &ValidateLogAbortLevel);
|
||||
|
||||
void errorCallback(int error, char const * description) { LOG(LERROR, ("GLFW (", error, "):", description)); }
|
||||
void errorCallback(int error, char const * description)
|
||||
{
|
||||
LOG(LERROR, ("GLFW (", error, "):", description));
|
||||
}
|
||||
|
||||
struct WindowHandlers
|
||||
{
|
||||
@@ -143,7 +146,7 @@ void FormatMapSize(uint64_t sizeInBytes, std::string & units, size_t & sizeToDow
|
||||
|
||||
std::string_view GetMyPoisitionText(location::EMyPositionMode mode)
|
||||
{
|
||||
switch(mode)
|
||||
switch (mode)
|
||||
{
|
||||
case location::EMyPositionMode::PendingPosition: return "Pending";
|
||||
case location::EMyPositionMode::NotFollowNoPosition: return "No position";
|
||||
@@ -157,9 +160,12 @@ std::string_view GetMyPoisitionText(location::EMyPositionMode mode)
|
||||
dp::ApiVersion GetApiVersion(char const * apiLabel)
|
||||
{
|
||||
std::string_view v(apiLabel);
|
||||
if (v == "Metal") return dp::ApiVersion::Metal;
|
||||
if (v == "Vulkan") return dp::ApiVersion::Vulkan;
|
||||
if (v == "OpenGL") return dp::ApiVersion::OpenGLES3;
|
||||
if (v == "Metal")
|
||||
return dp::ApiVersion::Metal;
|
||||
if (v == "Vulkan")
|
||||
return dp::ApiVersion::Vulkan;
|
||||
if (v == "OpenGL")
|
||||
return dp::ApiVersion::OpenGLES3;
|
||||
return dp::ApiVersion::Invalid;
|
||||
}
|
||||
|
||||
@@ -231,17 +237,14 @@ int main(int argc, char * argv[])
|
||||
// Init GLFW.
|
||||
glfwSetErrorCallback(errorCallback);
|
||||
if (!glfwInit())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
#if defined(OMIM_OS_WINDOWS)
|
||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||
#endif
|
||||
auto monitor = glfwGetPrimaryMonitor();
|
||||
auto mode = glfwGetVideoMode(monitor);
|
||||
GLFWwindow * window =
|
||||
glfwCreateWindow(mode->width, mode->height, "Developer Render Sandbox", nullptr, nullptr);
|
||||
GLFWwindow * window = glfwCreateWindow(mode->width, mode->height, "Developer Render Sandbox", nullptr, nullptr);
|
||||
int fbWidth = 0, fbHeight = 0;
|
||||
glfwGetFramebufferSize(window, &fbWidth, &fbHeight);
|
||||
float xs = 1.0f, ys = 1.0f;
|
||||
@@ -277,16 +280,14 @@ int main(int argc, char * argv[])
|
||||
.m_visualScale = visualScale,
|
||||
.m_surfaceWidth = fbWidth,
|
||||
.m_surfaceHeight = fbHeight,
|
||||
.m_renderInjectionHandler = [&](ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::TextureManager> textureManager,
|
||||
ref_ptr<gpu::ProgramManager> programManager,
|
||||
bool shutdown)
|
||||
{
|
||||
if (shutdown)
|
||||
imguiRenderer.Reset();
|
||||
else
|
||||
imguiRenderer.Render(context, textureManager, programManager);
|
||||
}};
|
||||
.m_renderInjectionHandler = [&](ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> textureManager,
|
||||
ref_ptr<gpu::ProgramManager> programManager, bool shutdown)
|
||||
{
|
||||
if (shutdown)
|
||||
imguiRenderer.Reset();
|
||||
else
|
||||
imguiRenderer.Render(context, textureManager, programManager);
|
||||
}};
|
||||
gui::Skin guiSkin(gui::ResolveGuiSkinFile("default"), visualScale);
|
||||
guiSkin.Resize(fbWidth, fbHeight);
|
||||
guiSkin.ForEach([&](gui::EWidget widget, gui::Position const & pos) { drapeParams.m_widgetsInitInfo[widget] = pos; });
|
||||
@@ -301,7 +302,7 @@ int main(int argc, char * argv[])
|
||||
drapeParams.m_surfaceHeight = fbHeight;
|
||||
contextFactory = CreateContextFactory(window, drapeParams.m_apiVersion,
|
||||
m2::PointU(static_cast<uint32_t>(drapeParams.m_surfaceWidth),
|
||||
static_cast<uint32_t>(drapeParams.m_surfaceHeight)));
|
||||
static_cast<uint32_t>(drapeParams.m_surfaceHeight)));
|
||||
auto params = drapeParams;
|
||||
framework.CreateDrapeEngine(make_ref(contextFactory), std::move(params));
|
||||
OnCreateDrapeEngine(window, version, make_ref(contextFactory));
|
||||
@@ -360,10 +361,8 @@ int main(int argc, char * argv[])
|
||||
framework.OnSize(fbWidth, fbHeight);
|
||||
}
|
||||
};
|
||||
glfwSetWindowContentScaleCallback(window, [](GLFWwindow *, float xscale, float yscale)
|
||||
{
|
||||
handlers.onContentScale(xscale, yscale);
|
||||
});
|
||||
glfwSetWindowContentScaleCallback(
|
||||
window, [](GLFWwindow *, float xscale, float yscale) { handlers.onContentScale(xscale, yscale); });
|
||||
|
||||
// Location handler
|
||||
std::optional<ms::LatLon> lastLatLon;
|
||||
@@ -384,9 +383,7 @@ int main(int argc, char * argv[])
|
||||
.m_horizontalAccuracy = 10,
|
||||
.m_bearing = bearingEnabled ? bearing : -1.0f});
|
||||
if (bearingEnabled)
|
||||
{
|
||||
framework.OnCompassUpdate(location::CompassInfo{.m_bearing = math::DegToRad(bearing)});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -436,19 +433,17 @@ int main(int argc, char * argv[])
|
||||
|
||||
framework.GetStorage().Subscribe(
|
||||
[&](storage::CountryId const & countryId)
|
||||
{
|
||||
// Storage also calls notifications for parents, but we are interested in leafs only.
|
||||
if (framework.GetStorage().IsLeaf(countryId))
|
||||
onCountryChanged(countryId);
|
||||
},
|
||||
[&](storage::CountryId const & countryId, downloader::Progress const & progress)
|
||||
{
|
||||
std::stringstream str;
|
||||
str << "Downloading (" << countryId << ") " << (progress.m_bytesDownloaded * 100 / progress.m_bytesTotal)
|
||||
<< "%";
|
||||
downloadStatusLabel = str.str();
|
||||
framework.MakeFrameActive();
|
||||
});
|
||||
{
|
||||
// Storage also calls notifications for parents, but we are interested in leafs only.
|
||||
if (framework.GetStorage().IsLeaf(countryId))
|
||||
onCountryChanged(countryId);
|
||||
}, [&](storage::CountryId const & countryId, downloader::Progress const & progress)
|
||||
{
|
||||
std::stringstream str;
|
||||
str << "Downloading (" << countryId << ") " << (progress.m_bytesDownloaded * 100 / progress.m_bytesTotal) << "%";
|
||||
downloadStatusLabel = str.str();
|
||||
framework.MakeFrameActive();
|
||||
});
|
||||
|
||||
// Handle mouse buttons.
|
||||
bool touchActive = false;
|
||||
@@ -491,13 +486,12 @@ int main(int argc, char * argv[])
|
||||
touchMods = 0;
|
||||
}
|
||||
};
|
||||
glfwSetMouseButtonCallback(window,
|
||||
[](GLFWwindow * wnd, int button, int action, int mods)
|
||||
{
|
||||
double x, y;
|
||||
glfwGetCursorPos(wnd, &x, &y);
|
||||
handlers.onMouseButton(x, y, button, action, mods);
|
||||
});
|
||||
glfwSetMouseButtonCallback(window, [](GLFWwindow * wnd, int button, int action, int mods)
|
||||
{
|
||||
double x, y;
|
||||
glfwGetCursorPos(wnd, &x, &y);
|
||||
handlers.onMouseButton(x, y, button, action, mods);
|
||||
});
|
||||
|
||||
// Handle mouse moving.
|
||||
handlers.onMouseMove = [&](double x, double y)
|
||||
@@ -509,19 +503,13 @@ int main(int argc, char * argv[])
|
||||
framework.MakeFrameActive();
|
||||
|
||||
if (touchActive)
|
||||
{
|
||||
#if defined(OMIM_OS_MAC)
|
||||
x *= visualScale;
|
||||
y *= visualScale;
|
||||
y *= visualScale;
|
||||
#endif
|
||||
framework.TouchEvent(
|
||||
GetTouchEvent(framework, x, y, touchMods, df::TouchEvent::TOUCH_MOVE));
|
||||
}
|
||||
framework.TouchEvent(GetTouchEvent(framework, x, y, touchMods, df::TouchEvent::TOUCH_MOVE));
|
||||
};
|
||||
glfwSetCursorPosCallback(window, [](GLFWwindow *, double x, double y)
|
||||
{
|
||||
handlers.onMouseMove(x, y);
|
||||
});
|
||||
glfwSetCursorPosCallback(window, [](GLFWwindow *, double x, double y) { handlers.onMouseMove(x, y); });
|
||||
|
||||
// Handle scroll.
|
||||
handlers.onScroll = [&](double x, double y, double xOffset, double yOffset)
|
||||
@@ -543,20 +531,17 @@ int main(int argc, char * argv[])
|
||||
double const factor = yOffset * kSensitivity;
|
||||
framework.Scale(exp(factor), m2::PointD(x, y), false);
|
||||
};
|
||||
glfwSetScrollCallback(window,
|
||||
[](GLFWwindow * wnd, double xoffset, double yoffset)
|
||||
{
|
||||
double x, y;
|
||||
glfwGetCursorPos(wnd, &x, &y);
|
||||
handlers.onScroll(x, y, xoffset, yoffset);
|
||||
});
|
||||
glfwSetScrollCallback(window, [](GLFWwindow * wnd, double xoffset, double yoffset)
|
||||
{
|
||||
double x, y;
|
||||
glfwGetCursorPos(wnd, &x, &y);
|
||||
handlers.onScroll(x, y, xoffset, yoffset);
|
||||
});
|
||||
|
||||
// Keys.
|
||||
handlers.onKeyboardButton = [&](int key, int scancode, int action, int mods) {};
|
||||
glfwSetKeyCallback(window, [](GLFWwindow *, int key, int scancode, int action, int mods)
|
||||
{
|
||||
handlers.onKeyboardButton(key, scancode, action, mods);
|
||||
});
|
||||
{ handlers.onKeyboardButton(key, scancode, action, mods); });
|
||||
|
||||
// imGui UI
|
||||
bool enableDebugRectRendering = false;
|
||||
@@ -569,12 +554,9 @@ int main(int argc, char * argv[])
|
||||
// Drape controls
|
||||
char const * apiLabels[] = {
|
||||
#if defined(OMIM_OS_MAC)
|
||||
"Metal",
|
||||
"Vulkan",
|
||||
"OpenGL"
|
||||
"Metal", "Vulkan", "OpenGL"
|
||||
#elif defined(OMIM_OS_LINUX)
|
||||
"Vulkan",
|
||||
"OpenGL"
|
||||
"Vulkan", "OpenGL"
|
||||
#endif
|
||||
};
|
||||
static int currentAPI = 0;
|
||||
@@ -656,7 +638,7 @@ int main(int argc, char * argv[])
|
||||
|
||||
// Render imGui UI
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiIO & io = ImGui::GetIO();
|
||||
#if defined(OMIM_OS_LINUX)
|
||||
// Apply correct visual scale on Linux
|
||||
// In glfw for Linux, window size and framebuffer size are the same,
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#define GLFW_EXPOSE_NATIVE_X11
|
||||
#include <GLFW/glfw3native.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <X11/X.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <vulkan_wrapper.h>
|
||||
// Workaround for TestFunction::Always compilation issue:
|
||||
@@ -80,23 +80,23 @@ public:
|
||||
|
||||
// Based on: https://github.com/glfw/glfw/blob/master/src/glx_context.c
|
||||
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define GLX_PBUFFER_HEIGHT 0x8040
|
||||
#define GLX_PBUFFER_WIDTH 0x8041
|
||||
#define GLX_DOUBLEBUFFER 5
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_PBUFFER_BIT 0x00000004
|
||||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_RED_SIZE 8
|
||||
#define GLX_GREEN_SIZE 9
|
||||
#define GLX_BLUE_SIZE 10
|
||||
#define GLX_ALPHA_SIZE 11
|
||||
#define GLX_DEPTH_SIZE 12
|
||||
#define GLX_STENCIL_SIZE 13
|
||||
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define GLX_PBUFFER_HEIGHT 0x8040
|
||||
#define GLX_PBUFFER_WIDTH 0x8041
|
||||
#define GLX_DOUBLEBUFFER 5
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_PBUFFER_BIT 0x00000004
|
||||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_RED_SIZE 8
|
||||
#define GLX_GREEN_SIZE 9
|
||||
#define GLX_BLUE_SIZE 10
|
||||
#define GLX_ALPHA_SIZE 11
|
||||
#define GLX_DEPTH_SIZE 12
|
||||
#define GLX_STENCIL_SIZE 13
|
||||
|
||||
typedef XID GLXDrawable;
|
||||
typedef struct __GLXcontext * GLXContext;
|
||||
@@ -104,13 +104,13 @@ typedef XID GLXPbuffer;
|
||||
typedef struct __GLXFBConfig * GLXFBConfig;
|
||||
typedef void (*__GLXextproc)(void);
|
||||
|
||||
typedef __GLXextproc (*PFNGLXGETPROCADDRESSPROC)(const GLubyte * procName);
|
||||
typedef __GLXextproc (*PFNGLXGETPROCADDRESSPROC)(GLubyte const * procName);
|
||||
|
||||
typedef int (*PFNXFREE)(void *);
|
||||
typedef GLXFBConfig * (*PFNGLXCHOOSEFBCONFIGPROC)(Display *, int, const int *, int *);
|
||||
typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARB)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
|
||||
typedef GLXFBConfig * (*PFNGLXCHOOSEFBCONFIGPROC)(Display *, int, int const *, int *);
|
||||
typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARB)(Display *, GLXFBConfig, GLXContext, Bool, int const *);
|
||||
typedef void (*PFNGLXDESTROYCONTEXT)(Display *, GLXContext);
|
||||
typedef GLXPbuffer (*PFNGLXCREATEPBUFFERPROC)(Display *, GLXFBConfig, const int *);
|
||||
typedef GLXPbuffer (*PFNGLXCREATEPBUFFERPROC)(Display *, GLXFBConfig, int const *);
|
||||
typedef void (*PFNGLXDESTROYPBUFFER)(Display *, GLXPbuffer);
|
||||
typedef Bool (*PFNGLXMAKECURRENTPROC)(Display *, GLXDrawable, GLXContext);
|
||||
typedef void (*PFNGLXSWAPBUFFERSPROC)(Display *, GLXDrawable);
|
||||
@@ -129,9 +129,7 @@ struct GLXFunctions
|
||||
{
|
||||
m_module = dlopen(lib, RTLD_LAZY | RTLD_LOCAL);
|
||||
if (m_module)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(m_module != nullptr, ("Failed to initialize GLX"));
|
||||
@@ -154,9 +152,7 @@ struct GLXFunctions
|
||||
~GLXFunctions()
|
||||
{
|
||||
if (m_module)
|
||||
{
|
||||
dlclose(m_module);
|
||||
}
|
||||
}
|
||||
|
||||
PFNXFREE XFree = nullptr;
|
||||
@@ -201,30 +197,41 @@ class LinuxGLContext : public dp::OGLContext
|
||||
public:
|
||||
LinuxGLContext(GLXFunctions const & glx, Display * display, Window window, LinuxGLContext * contextToShareWith,
|
||||
bool usePixelBuffer)
|
||||
: m_glx(glx), m_display(display), m_window(window)
|
||||
: m_glx(glx)
|
||||
, m_display(display)
|
||||
, m_window(window)
|
||||
{
|
||||
int visualAttribs[] = {
|
||||
GLX_DOUBLEBUFFER, True,
|
||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||
GLX_DRAWABLE_TYPE, (usePixelBuffer ? GLX_PBUFFER_BIT : GLX_WINDOW_BIT),
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_ALPHA_SIZE, 8,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
GLX_STENCIL_SIZE, 8,
|
||||
None
|
||||
};
|
||||
int contextAttribs[] = {
|
||||
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||
None};
|
||||
int visualAttribs[] = {GLX_DOUBLEBUFFER,
|
||||
True,
|
||||
GLX_RENDER_TYPE,
|
||||
GLX_RGBA_BIT,
|
||||
GLX_DRAWABLE_TYPE,
|
||||
(usePixelBuffer ? GLX_PBUFFER_BIT : GLX_WINDOW_BIT),
|
||||
GLX_RED_SIZE,
|
||||
8,
|
||||
GLX_GREEN_SIZE,
|
||||
8,
|
||||
GLX_BLUE_SIZE,
|
||||
8,
|
||||
GLX_ALPHA_SIZE,
|
||||
8,
|
||||
GLX_DEPTH_SIZE,
|
||||
24,
|
||||
GLX_STENCIL_SIZE,
|
||||
8,
|
||||
None};
|
||||
int contextAttribs[] = {GLX_CONTEXT_PROFILE_MASK_ARB,
|
||||
GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB,
|
||||
4,
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB,
|
||||
1,
|
||||
None};
|
||||
int fbcount = 0;
|
||||
if (GLXFBConfig * config = m_glx.glXChooseFBConfig(display, DefaultScreen(display), visualAttribs, &fbcount))
|
||||
{
|
||||
m_context =
|
||||
m_glx.glXCreateContextAttribsARB(display, config[0], contextToShareWith ? contextToShareWith->m_context : 0, True, contextAttribs);
|
||||
m_context = m_glx.glXCreateContextAttribsARB(
|
||||
display, config[0], contextToShareWith ? contextToShareWith->m_context : 0, True, contextAttribs);
|
||||
CHECK(m_context != nullptr, ("Failed to create GLX context"));
|
||||
|
||||
if (usePixelBuffer)
|
||||
@@ -368,9 +375,7 @@ drape_ptr<dp::GraphicsContextFactory> CreateContextFactory(GLFWwindow * window,
|
||||
}
|
||||
|
||||
if (api == dp::ApiVersion::OpenGLES3)
|
||||
{
|
||||
return make_unique_dp<LinuxContextFactory>(glfwGetX11Display(), glfwGetX11Window(window));
|
||||
}
|
||||
|
||||
ASSERT(false, ("API is not available yet"));
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user