15#ifdef GPUCA_DISPLAY_GL3W
20#if __has_include(<GL/glu.h>)
23#define gluErrorString(err) ""
34#define OPENGL_EMULATE_MULTI_DRAW 0
38#define GPUCA_DISPLAY_SHADER_TYPE_OPENGL
39#include "GPUDisplayLoadShaders.h"
57#ifdef GPUCA_DISPLAY_GL3W
73 GLenum err = glGetError(); \
74 while (err != GL_NO_ERROR) { \
75 GPUError("OpenGL Error %d: %s (%s: %d)", (int32_t)err, (const char*)gluErrorString(err), __FILE__, __LINE__); \
76 throw std::runtime_error("OpenGL Failure"); \
85 GLint drawFboId = 0, readFboId = 0;
123 if (tex && fb.
msaa) {
132 GPUError(
"Error creating framebuffer (tex %d) - incomplete (%d)", (
int32_t)tex, status);
162 auto first = std::get<0>(
v);
163 auto count = std::get<1>(
v);
243 printf(
"failed to compile shader\n");
245 std::vector<char>
buf(loglen + 1);
248 printf(
"%s\n",
buf.data());
259 printf(
"failed to link program\n");
261 std::vector<char>
buf(loglen + 1);
264 printf(
"%s\n",
buf.data());
274 GPUInfo(
"Ignoring OpenGL error %d from before the backend initialization", (
int32_t)err);
279 GPUInfo(
"Renderer: %s", (
const char*)
renderer);
294 mVBOId.resize(GPUTPCGeometry::NSECTORS);
431 for (
uint32_t i = 0;
i < GPUTPCGeometry::NSECTORS;
i++) {
456 }
else if (toMixBuffer) {
473 const hmm_mat4 modelViewProj = proj * view;
495 CHKERR(
glBlitNamedFramebuffer(
mOffscreenBufferMSAA.
fb_id, dstId, 0, 0,
mRenderWidth,
mRenderHeight, 0, 0,
mRenderWidth,
mRenderHeight,
GL_COLOR_BUFFER_BIT,
GL_LINEAR));
497 if (includeMixImage > 0) {
502 CHKERR(
glBlitNamedFramebuffer(
mOffscreenBuffer.
fb_id, 0, 0, 0,
mRenderWidth,
mRenderHeight, 0, 0,
mScreenWidth,
mScreenHeight,
GL_COLOR_BUFFER_BIT,
GL_LINEAR));
507 if (doScreenshot && !toMixBuffer) {
524 CHKERR(
glBlitNamedFramebuffer(
mOffscreenBuffer.
fb_id, tmpBuffer.
fb_id, 0, 0,
mRenderWidth,
mRenderHeight, 0, 0,
width,
height,
GL_COLOR_BUFFER_BIT,
GL_LINEAR));
549 float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
627 throw std::runtime_error(
"Incorrect symbol ID");
631 std::vector<uint8_t> tmp;
633 tmp.resize(sizex * sizey);
636 tmp[
i] =
src[
i] > 128 ? 255 : 0;
641 if (sizex == 0 || sizey == 0) {
686 for (
const unsigned char*
c = (
const unsigned char*)
s; *
c && (nCharacters == 0 ||
c < (
const unsigned char*)
s + nCharacters);
c++) {
688 GPUError(
"Trying to draw unsupported symbol: %d", (
int32_t)*
c);
693 float xpos =
x + sym.
offset[0] * scale;
694 float ypos =
y - (sym.
size[1] - sym.
offset[1]) * scale;
695 float w = sym.
size[0] * scale;
696 float h = sym.
size[1] * scale;
697 float vertices[6][4] = {
698 {xpos, ypos +
h, 0.0f, 0.0f},
699 {xpos, ypos, 0.0f, 1.0f},
700 {xpos +
w, ypos, 1.0f, 1.0f},
701 {xpos, ypos +
h, 0.0f, 0.0f},
702 {xpos +
w, ypos, 1.0f, 1.0f},
703 {xpos +
w, ypos +
h, 1.0f, 0.0f}};
728 static constexpr int32_t order[6] = {0, 1, 2, 0, 2, 3};
729 float vertices[6][4];
731 vertices[
i][0] = corners[order[
i]][0];
732 vertices[
i][1] = corners[order[
i]][1];
733 vertices[
i][2] = vertices[
i][3] = 0.5f;
776 float vertices[6][4] = {
#define OPENGL_EMULATE_MULTI_DRAW
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h renderer
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by factor
configStandalone Reconstruction rec_tpc float
HMM_INLINE hmm_mat4 HMM_Orthographic(float Left, float Right, float Bottom, float Top, float Near, float Far)
Class for time synchronization of RawReader instances.
uint32_t mFragmentShaderDownsample
void lineWidthFactor(float factor) override
void clearScreen(bool alphaOnly=false)
static constexpr int32_t UNIFORM_LOCATION_LINE_WIDTH
void resizeScene(uint32_t width, uint32_t height) override
GPUDisplayBackendOpenGL()
void loadDataToGPU(size_t totalVertizes) override
void setQuality() override
GLfb mOffscreenBufferMSAA
uint32_t mVertexShaderSmoothLine
bool prepareDraw(const hmm_mat4 &proj, const hmm_mat4 &view, bool requestScreenshot, bool toMixBuffer, float includeMixImage) override
bool canLimitToVSync() const override
uint32_t mShaderProgramSmoothLine
void drawTextVertices(const float(&vertices)[6][4], uint32_t texId)
void setFrameBuffer(uint32_t newID=0)
void GLDrawQuad(const float(&corners)[4][2], const float *color) override
static uint32_t loadShader(uint32_t type, const char *spirv, size_t size)
void drawDownsample(uint32_t srcTexture, uint32_t dstFramebuffer, uint32_t width, uint32_t height, int32_t factor)
uint32_t mFragmentShaderSmoothPoint
uint32_t mShaderProgramDownsample
void finishDraw(bool doScreenshot, bool toMixBuffer, float includeMixImage) override
uint32_t mVertexShaderFullscreen
uint32_t mShaderProgramTexture
void GLPrintText(const char *s, float x, float y, float *color, float scale, uint32_t nCharacters) override
uint32_t drawVertices(const vboList &v, const drawType t) override
uint32_t mVertexShaderSmoothPoint
int32_t InitBackendA() override
uint32_t mFragmentShaderText
static int32_t checkProgramStatus(uint32_t program)
int32_t ExtInit() override
void createFB(GLfb &fb, bool tex, bool withDepth, bool msaa, uint32_t width, uint32_t height)
uint32_t mShaderProgramSmoothPoint
void pointSizeFactor(float factor) override
void prepareText() override
void clearFontSymbols() override
static int32_t checkShaderStatus(uint32_t shader)
void initializeTextDrawing() override
void ClearOffscreenBuffers()
void ExitMagFieldVisualization()
uint32_t mFragmentShaderSmoothLine
uint32_t mShaderProgramText
std::vector< uint32_t > mVBOId
uint32_t mVertexShaderTexture
static constexpr int32_t UNIFORM_LOCATION_POINT_SIZE
static constexpr int32_t UNIFORM_LOCATION_VIEWPORT
static constexpr int32_t UNIFORM_LOCATION_COLOR
void mixImages(float mixSlaveImage)
void updateRenderer(bool withScreenshot)
void finishText() override
std::vector< FontSymbolOpenGL > mFontSymbols
uint32_t mFragmentShaderTexture
uint32_t mFieldModelViewBuffer
void finishFrame(bool doScreenshot, bool toMixBuffer, float includeMixImage) override
void addFontSymbol(int32_t symbol, int32_t sizex, int32_t sizey, int32_t offsetx, int32_t offsety, int32_t advance, void *data) override
void ActivateColor(std::array< float, 4 > &color) override
static constexpr int32_t UNIFORM_LOCATION_MATRIX
void setDepthBuffer() override
void ExitBackendA() override
static constexpr int32_t SOLID_GLYPH
vecpod< DrawArraysIndirectCommand > mCmdBuffer
std::vector< int32_t > mIndirectSectorOffset
void fillIndirectCmdBuffer()
static constexpr float SMOOTH_LINE_EXTRA_WIDTH
bool mFreetypeInitialized
std::vector< char > mScreenshotPixels
static constexpr float SMOOTH_POINT_EXTRA_SIZE
backendTypes mBackendType
std::unique_ptr< GPUDisplayMagneticField > mMagneticFieldVisualization
const char * mBackendName
float getDownsampleFactor(bool screenshot=false)
int32_t mDownsampleFactor
std::tuple< uint32_t, uint32_t, int32_t > vboList
static constexpr int32_t GL_MIN_VERSION_MAJOR
virtual bool canSetVSync()
static constexpr int32_t GL_MIN_VERSION_MINOR
const GPUSettingsDisplayLight & cfgL() const
int32_t updateRenderPipeline() const
const GPUSettingsDisplayRenderer & cfgR() const
vecpod< vtx > * vertexBuffer()
GPUDisplayFrontend * frontend()
const vecpod< uint32_t > * vertexBufferCount() const
vecpod< int32_t > * vertexBufferStart()
const GPUSettingsProcessing & GetProcessingSettings() const
#define glNamedBufferData
#define glUniformMatrix4fv
#define glSpecializeShader
#define glCheckFramebufferStatus
#define glDeleteVertexArrays
#define glProgramUniform2f
#define glGetShaderInfoLog
#define glFramebufferTexture2D
#define glProgramUniform1f
#define glBindVertexArray
#define glRenderbufferStorageMultisample
#define glMultiDrawArrays
#define glEnableVertexAttribArray
#define glGenVertexArrays
#define glBindFramebuffer
#define glProgramUniformMatrix4fv
#define glVertexAttribPointer
#define glGenRenderbuffers
#define glBindRenderbuffer
#define glBlitNamedFramebuffer
#define glDeleteFramebuffers
#define glFramebufferRenderbuffer
#define glMultiDrawArraysIndirect
#define glTexImage2DMultisample
#define glNamedBufferSubData
#define glGetProgramInfoLog
#define glDeleteRenderbuffers
#define glRenderbufferStorage
#define glProgramUniform4fv
#define glGenFramebuffers
#define GL_MAX_RENDERBUFFER_SIZE
#define GL_MAX_TEXTURE_SIZE
#define GL_TEXTURE_MIN_FILTER
#define GL_FRAGMENT_SHADER
#define GL_TEXTURE_WRAP_S
#define GL_MAX_FRAMEBUFFER_WIDTH
#define GL_PACK_ALIGNMENT
GLsizei GLenum GLenum * types
#define GL_COLOR_ATTACHMENT0
GLbitfield GLuint program
GLint GLsizei GLsizei height
GLsizei const GLfloat * value
#define GL_SHADER_BINARY_FORMAT_SPIR_V
#define GL_FRAMEBUFFER_COMPLETE
GLint GLint GLsizei GLint GLenum GLenum type
#define GL_DRAW_FRAMEBUFFER
#define GL_COMPILE_STATUS
#define GL_UNPACK_ALIGNMENT
#define GL_COLOR_BUFFER_BIT
#define GL_ONE_MINUS_SRC_ALPHA
#define GL_TEXTURE_2D_MULTISAMPLE
#define GL_DRAW_FRAMEBUFFER_BINDING
#define GL_READ_FRAMEBUFFER
#define GL_TEXTURE_WRAP_T
#define GL_DEPTH_ATTACHMENT
#define GL_TEXTURE_MAG_FILTER
#define GL_DEPTH_COMPONENT24
GLenum GLuint GLenum GLsizei const GLchar * buf
GLubyte GLubyte GLubyte GLubyte w
#define GL_READ_FRAMEBUFFER_BINDING
#define GL_INFO_LOG_LENGTH
#define GL_MAX_FRAMEBUFFER_HEIGHT
#define GL_DEPTH_BUFFER_BIT
#define GL_DRAW_INDIRECT_BUFFER