Skip to content

Commit 5251bc2

Browse files
committed
gfxwrapper: clang-tidy
1 parent 377777c commit 5251bc2

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/common/gfxwrapper_opengl.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ static bool ksGpuContext_CreateForSurface(ksGpuContext *context, const ksGpuDevi
15951595

15961596
#endif
15971597

1598-
bool ksGpuContext_CreateShared(ksGpuContext *context, const ksGpuContext *other, const int queueIndex) {
1598+
bool ksGpuContext_CreateShared(ksGpuContext *context, const ksGpuContext *other, int queueIndex) {
15991599
UNUSED_PARM(queueIndex);
16001600

16011601
memset(context, 0, sizeof(ksGpuContext));
@@ -1966,9 +1966,9 @@ void ksGpuWindow_Destroy(ksGpuWindow *window) {
19661966
}
19671967
}
19681968

1969-
bool ksGpuWindow_Create(ksGpuWindow *window, ksDriverInstance *instance, const ksGpuQueueInfo *queueInfo, const int queueIndex,
1970-
const ksGpuSurfaceColorFormat colorFormat, const ksGpuSurfaceDepthFormat depthFormat,
1971-
const ksGpuSampleCount sampleCount, const int width, const int height, const bool fullscreen) {
1969+
bool ksGpuWindow_Create(ksGpuWindow *window, ksDriverInstance *instance, const ksGpuQueueInfo *queueInfo, int queueIndex,
1970+
ksGpuSurfaceColorFormat colorFormat, ksGpuSurfaceDepthFormat depthFormat, ksGpuSampleCount sampleCount,
1971+
int width, int height, bool fullscreen) {
19721972
memset(window, 0, sizeof(ksGpuWindow));
19731973

19741974
window->colorFormat = colorFormat;
@@ -2194,7 +2194,7 @@ typedef enum { MOUSE_LEFT = Button1, MOUSE_RIGHT = Button2 } ksMouseButton;
21942194
this still appears to be the most reliable way to change video modes for a single
21952195
monitor configuration.
21962196
*/
2197-
static bool ChangeVideoMode_XF86VidMode(Display *xDisplay, int xScreen, Window xWindow, int *currentWidth, int *currentHeight,
2197+
static bool ChangeVideoMode_XF86VidMode(Display *xDisplay, int xScreen, int *currentWidth, int *currentHeight,
21982198
float *currentRefreshRate, int *desiredWidth, int *desiredHeight,
21992199
float *desiredRefreshRate) {
22002200
int videoModeCount;
@@ -2225,7 +2225,7 @@ static bool ChangeVideoMode_XF86VidMode(Display *xDisplay, int xScreen, Window x
22252225
const int dw = modeWidth - *desiredWidth;
22262226
const int dh = modeHeight - *desiredHeight;
22272227
const int sizeError = dw * dw + dh * dh;
2228-
const float refreshRateError = fabs(modeRefreshRate - *desiredRefreshRate);
2228+
const float refreshRateError = fabsf(modeRefreshRate - *desiredRefreshRate);
22292229
if (sizeError < bestSizeError || (sizeError == bestSizeError && refreshRateError < bestRefreshRateError)) {
22302230
bestSizeError = sizeError;
22312231
bestRefreshRateError = refreshRateError;
@@ -2267,7 +2267,7 @@ static bool ChangeVideoMode_XF86VidMode(Display *xDisplay, int xScreen, Window x
22672267
then NV-CONTROL clients, such as nvidia-settings, will not be able to dynamically manipulate
22682268
the X screen's MetaModes.
22692269
*/
2270-
static bool ChangeVideoMode_XRandR_1_1(Display *xDisplay, int xScreen, Window xWindow, int *currentWidth, int *currentHeight,
2270+
static bool ChangeVideoMode_XRandR_1_1(Display *xDisplay, Window xWindow, int *currentWidth, int *currentHeight,
22712271
float *currentRefreshRate, int *desiredWidth, int *desiredHeight,
22722272
float *desiredRefreshRate) {
22732273
int major_version;
@@ -2321,7 +2321,7 @@ static bool ChangeVideoMode_XRandR_1_1(Display *xDisplay, int xScreen, Window xW
23212321
int rate_index = -1;
23222322
float bestRateError = 1e6f;
23232323
for (int i = 0; i < nrates; i++) {
2324-
const float error = fabs(rates[i] - *desiredRefreshRate);
2324+
const float error = fabsf(rates[i] - *desiredRefreshRate);
23252325
if (error < bestRateError) {
23262326
bestRateError = error;
23272327
rate_index = i;
@@ -2398,7 +2398,7 @@ static bool ChangeVideoMode_XRandR_1_1(Display *xDisplay, int xScreen, Window xW
23982398
However, this requires calculating all the timing information in code
23992399
because there is no standard library that implements the GTF or CVT.
24002400
*/
2401-
static bool ChangeVideoMode_XRandR_1_2(Display *xDisplay, int xScreen, Window xWindow, int *currentWidth, int *currentHeight,
2401+
static bool ChangeVideoMode_XRandR_1_2(Display *xDisplay, Window xWindow, int *currentWidth, int *currentHeight,
24022402
float *currentRefreshRate, int *desiredWidth, int *desiredHeight,
24032403
float *desiredRefreshRate) {
24042404
int major_version;
@@ -2464,7 +2464,7 @@ static bool ChangeVideoMode_XRandR_1_2(Display *xDisplay, int xScreen, Window xW
24642464
const int dw = modeWidth - *desiredWidth;
24652465
const int dh = modeHeight - *desiredHeight;
24662466
const int sizeError = dw * dw + dh * dh;
2467-
const float refreshRateError = fabs(modeRefreshRate - *desiredRefreshRate);
2467+
const float refreshRateError = fabsf(modeRefreshRate - *desiredRefreshRate);
24682468
if (sizeError < bestSizeError || (sizeError == bestSizeError && refreshRateError < bestRefreshRateError)) {
24692469
bestSizeError = sizeError;
24702470
bestRefreshRateError = refreshRateError;
@@ -2495,7 +2495,7 @@ void ksGpuWindow_Destroy(ksGpuWindow *window) {
24952495
ksGpuDevice_Destroy(&window->device);
24962496

24972497
if (window->windowFullscreen) {
2498-
ChangeVideoMode_XF86VidMode(window->xDisplay, window->xScreen, window->xRoot, NULL, NULL, NULL, &window->desktopWidth,
2498+
ChangeVideoMode_XF86VidMode(window->xDisplay, window->xScreen, NULL, NULL, NULL, &window->desktopWidth,
24992499
&window->desktopHeight, &window->desktopRefreshRate);
25002500

25012501
XUngrabPointer(window->xDisplay, CurrentTime);
@@ -2551,11 +2551,11 @@ bool ksGpuWindow_Create(ksGpuWindow *window, ksDriverInstance *instance, const k
25512551
window->xRoot = XRootWindow(window->xDisplay, window->xScreen);
25522552

25532553
if (window->windowFullscreen) {
2554-
ChangeVideoMode_XF86VidMode(window->xDisplay, window->xScreen, window->xRoot, &window->desktopWidth, &window->desktopHeight,
2554+
ChangeVideoMode_XF86VidMode(window->xDisplay, window->xScreen, &window->desktopWidth, &window->desktopHeight,
25552555
&window->desktopRefreshRate, &window->windowWidth, &window->windowHeight,
25562556
&window->windowRefreshRate);
25572557
} else {
2558-
ChangeVideoMode_XF86VidMode(window->xDisplay, window->xScreen, window->xRoot, &window->desktopWidth, &window->desktopHeight,
2558+
ChangeVideoMode_XF86VidMode(window->xDisplay, window->xScreen, &window->desktopWidth, &window->desktopHeight,
25592559
&window->desktopRefreshRate, NULL, NULL, NULL);
25602560
window->windowRefreshRate = window->desktopRefreshRate;
25612561
}
@@ -4303,7 +4303,7 @@ ksGpuWindowEvent ksGpuWindow_ProcessEvents(ksGpuWindow *window) {
43034303

43044304
#endif
43054305

4306-
void ksGpuWindow_SwapInterval(ksGpuWindow *window, const int swapInterval) {
4306+
void ksGpuWindow_SwapInterval(ksGpuWindow *window, int swapInterval) {
43074307
if (swapInterval != window->windowSwapInterval) {
43084308
#if defined(OS_WINDOWS)
43094309
wglSwapIntervalEXT(swapInterval);
@@ -4342,7 +4342,7 @@ void ksGpuWindow_SwapBuffers(ksGpuWindow *window) {
43424342
// Even with smoothing, this is not particularly accurate.
43434343
const float frameTimeNanoseconds = 1000.0f * 1000.0f * 1000.0f / window->windowRefreshRate;
43444344
const float deltaTimeNanoseconds = (float)newTimeNanoseconds - window->lastSwapTime - frameTimeNanoseconds;
4345-
if (fabs(deltaTimeNanoseconds) < frameTimeNanoseconds * 0.75f) {
4345+
if (fabsf(deltaTimeNanoseconds) < frameTimeNanoseconds * 0.75f) {
43464346
newTimeNanoseconds = (ksNanoseconds)(window->lastSwapTime + frameTimeNanoseconds + 0.025f * deltaTimeNanoseconds);
43474347
}
43484348
// const float smoothDeltaNanoseconds = (float)( newTimeNanoseconds - window->lastSwapTime );

src/common/gfxwrapper_opengl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ typedef struct {
863863
unsigned char depthBits;
864864
} ksGpuSurfaceBits;
865865

866-
bool ksGpuContext_CreateShared(ksGpuContext *context, const ksGpuContext *other, const int queueIndex);
866+
bool ksGpuContext_CreateShared(ksGpuContext *context, const ksGpuContext *other, int queueIndex);
867867
void ksGpuContext_Destroy(ksGpuContext *context);
868868
void ksGpuContext_WaitIdle(ksGpuContext *context);
869869
void ksGpuContext_SetCurrent(ksGpuContext *context);
@@ -992,13 +992,13 @@ typedef struct {
992992
#endif
993993
} ksGpuWindow;
994994

995-
bool ksGpuWindow_Create(ksGpuWindow *window, ksDriverInstance *instance, const ksGpuQueueInfo *queueInfo, const int queueIndex,
996-
const ksGpuSurfaceColorFormat colorFormat, const ksGpuSurfaceDepthFormat depthFormat,
997-
const ksGpuSampleCount sampleCount, const int width, const int height, const bool fullscreen);
995+
bool ksGpuWindow_Create(ksGpuWindow *window, ksDriverInstance *instance, const ksGpuQueueInfo *queueInfo, int queueIndex,
996+
ksGpuSurfaceColorFormat colorFormat, ksGpuSurfaceDepthFormat depthFormat, ksGpuSampleCount sampleCount,
997+
int width, int height, bool fullscreen);
998998
void ksGpuWindow_Destroy(ksGpuWindow *window);
999999
void ksGpuWindow_Exit(ksGpuWindow *window);
10001000
ksGpuWindowEvent ksGpuWindow_ProcessEvents(ksGpuWindow *window);
1001-
void ksGpuWindow_SwapInterval(ksGpuWindow *window, const int swapInterval);
1001+
void ksGpuWindow_SwapInterval(ksGpuWindow *window, int swapInterval);
10021002
void ksGpuWindow_SwapBuffers(ksGpuWindow *window);
10031003
ksNanoseconds ksGpuWindow_GetNextSwapTimeNanoseconds(ksGpuWindow *window);
10041004
ksNanoseconds ksGpuWindow_GetFrameTimeNanoseconds(ksGpuWindow *window);

0 commit comments

Comments
 (0)