-
Notifications
You must be signed in to change notification settings - Fork 0
Enable virutal GPU for tests #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,6 +10,8 @@ | |||||||||||||||||||
|
||||||||||||||||||||
#include <RenderingFramework/TestHelpers.h> | ||||||||||||||||||||
|
||||||||||||||||||||
#include <cstdlib> // For getenv | ||||||||||||||||||||
|
||||||||||||||||||||
#if TARGET_OS_IPHONE | ||||||||||||||||||||
#include <RenderingFramework/MetalTestContext.h> | ||||||||||||||||||||
#else | ||||||||||||||||||||
|
@@ -102,11 +104,28 @@ | |||||||||||||||||||
return camelCaseFilename; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
bool isSoftwareRenderingEnabled() | ||||||||||||||||||||
{ | ||||||||||||||||||||
// Check if software rendering is enabled via environment variable | ||||||||||||||||||||
// Note: In test environment, this is safe - worst case is wrong baseline selection | ||||||||||||||||||||
// NOLINTNEXTLINE(concurrency-mt-unsafe) - Test code, single-threaded usage | ||||||||||||||||||||
const char* softwareRendering = getenv("LIBGL_ALWAYS_SOFTWARE"); | ||||||||||||||||||||
Check warning on line 112 in test/RenderingFramework/TestHelpers.cpp
|
||||||||||||||||||||
if (softwareRendering != nullptr) { | ||||||||||||||||||||
// Validate the environment variable value for safety | ||||||||||||||||||||
std::string envValue(softwareRendering); | ||||||||||||||||||||
return (envValue == "1" || envValue == "true"); | ||||||||||||||||||||
Comment on lines
+112
to
+116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using getenv() can be unsafe in multi-threaded environments. Consider using a thread-safe alternative or ensuring this function is only called during single-threaded initialization phases.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||||
} | ||||||||||||||||||||
return false; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
std::string HydraRendererContext::getFilename( | ||||||||||||||||||||
const std::filesystem::path& filePath, const std::string& filename) | ||||||||||||||||||||
{ | ||||||||||||||||||||
std::string fullFilepath = filePath.string() + "/" + filename; | ||||||||||||||||||||
|
||||||||||||||||||||
// Use helper function to detect software rendering | ||||||||||||||||||||
bool isSoftwareRendering = isSoftwareRenderingEnabled(); | ||||||||||||||||||||
|
||||||||||||||||||||
#ifdef __ANDROID__ | ||||||||||||||||||||
fullFilepath += "_android"; | ||||||||||||||||||||
#elif defined(__APPLE__) | ||||||||||||||||||||
|
@@ -120,8 +139,15 @@ | |||||||||||||||||||
} | ||||||||||||||||||||
fullFilepath += "_ios"; | ||||||||||||||||||||
#else | ||||||||||||||||||||
// macOS hardware GPU uses _osx baselines | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an extra trailing space after 'baselines' in the comment.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||||
fullFilepath += "_osx"; | ||||||||||||||||||||
#endif // TARGET_OS_IPHONE | ||||||||||||||||||||
#elif defined(__linux__) | ||||||||||||||||||||
if (isSoftwareRendering) { | ||||||||||||||||||||
// Linux software rendering (CI environment) | ||||||||||||||||||||
fullFilepath += "_linux"; | ||||||||||||||||||||
} | ||||||||||||||||||||
// Linux hardware GPU uses main baselines | ||||||||||||||||||||
#endif // __ANDROID__ | ||||||||||||||||||||
fullFilepath += ".png"; | ||||||||||||||||||||
|
||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.