Vulkan: detect vmem (#416)

This commit is contained in:
李通洲
2023-02-11 12:34:57 +08:00
parent b90d543afc
commit 662ddac050
9 changed files with 119 additions and 88 deletions
+10 -1
View File
@@ -88,7 +88,16 @@ bool ffPathExists(const char* path, FFPathType pathType);
#endif
// Not thread safe!
void ffSuppressIO(bool suppress);
bool ffSuppressIO(bool suppress);
static inline void ffUnsuppressIO(bool* suppressed)
{
if (!*suppressed) return;
ffSuppressIO(false);
*suppressed = false;
}
#define FF_SUPPRESS_IO() bool __attribute__((__cleanup__(ffUnsuppressIO), __unused__)) io_suppressed__ = ffSuppressIO(true)
void ffListFilesRecursively(const char* path);
+4 -3
View File
@@ -163,7 +163,7 @@ void ffGetTerminalResponse(const char* request, const char* format, ...)
va_end(args);
}
void ffSuppressIO(bool suppress)
bool ffSuppressIO(bool suppress)
{
static bool init = false;
static int origOut = -1;
@@ -173,7 +173,7 @@ void ffSuppressIO(bool suppress)
if(!init)
{
if(!suppress)
return;
return true;
origOut = dup(STDOUT_FILENO);
origErr = dup(STDERR_FILENO);
@@ -182,13 +182,14 @@ void ffSuppressIO(bool suppress)
}
if(nullFile == -1)
return;
return false;
fflush(stdout);
fflush(stderr);
dup2(suppress ? nullFile : origOut, STDOUT_FILENO);
dup2(suppress ? nullFile : origErr, STDERR_FILENO);
return true;
}
void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* folderName)
+2 -1
View File
@@ -111,9 +111,10 @@ bool ffPathExists(const char* path, FFPathType type)
return false;
}
void ffSuppressIO(bool suppress)
bool ffSuppressIO(bool suppress)
{
(void) suppress; //Not implemented.
return false;
}
void listFilesRecursively(FFstrbuf* folder, uint8_t indentation, const char* folderName)