Add metal config to tools

Bug: skia:
Change-Id: I84dbd56c17d4856496af4491f340ec560e29c8a6
Reviewed-on: https://skia-review.googlesource.com/23200
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Greg Daniel 2017-07-13 15:34:56 -04:00 committed by Skia Commit-Bot
parent f99a1739be
commit 2811aa25f1
4 changed files with 33 additions and 10 deletions

View File

@ -78,7 +78,8 @@ public:
kGL_ContextType = 0,
kGLES_ContextType = 0,
kNullGL_ContextType = 0,
kVulkan_ContextType = 0;
kVulkan_ContextType = 0,
kMetal_ContextType = 0;
static const int kContextTypeCnt = 1;
enum class ContextOverrides {};
void destroyContexts() {}

View File

@ -118,7 +118,8 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
"glwide",
"glnarrow",
"glnostencils",
"mock"
"mock",
"mtl"
});
SkCommandLineConfigArray configs;
@ -259,6 +260,7 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
"gpu[api=gles]",
"gpu[api=gl]",
"gpu[api=vulkan]",
"gpu[api=metal]",
"gpu[api=mock]",
});
@ -305,7 +307,14 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0);
#endif
#ifdef SK_METAL
REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getContextType() ==
GrContextFactory::kMetal_ContextType);
REPORTER_ASSERT(reporter, !configs[8]->asConfigGpu()->getUseNVPR());
REPORTER_ASSERT(reporter, !configs[8]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getSamples() == 0);
#endif
REPORTER_ASSERT(reporter, configs[9]->asConfigGpu()->getContextType() ==
GrContextFactory::kMock_ContextType);
#endif
}

View File

@ -93,6 +93,13 @@ static const struct {
,{ "vkmsaa4", "gpu", "api=vulkan,samples=4" }
,{ "vkmsaa8", "gpu", "api=vulkan,samples=8" }
#endif
#ifdef SK_METAL
,{ "mtl", "gpu", "api=metal" }
,{ "mtlsrgb", "gpu", "api=metal,color=srgb" }
,{ "mtlwide", "gpu", "api=metal,color=f16_wide" }
,{ "mtlmsaa4", "gpu", "api=metal,samples=4" }
,{ "mtlmsaa8", "gpu", "api=metal,samples=8" }
#endif
#else
{ "", "", "" }
#endif
@ -136,6 +143,9 @@ static const char configExtendedHelp[] =
#endif
#ifdef SK_VULKAN
"\t\tvulkan\t\t\tUse Vulkan.\n"
#endif
#ifdef SK_METAL
"\t\tmetal\t\t\tUse Metal.\n"
#endif
"\tcolor\ttype: string\tdefault: 8888.\n"
"\t Select framebuffer color format.\n"
@ -299,6 +309,12 @@ static bool parse_option_gpu_api(const SkString& value,
*outContextType = GrContextFactory::kVulkan_ContextType;
return true;
}
#endif
#ifdef SK_METAL
if (value.equals("metal")) {
*outContextType = GrContextFactory::kMetal_ContextType;
return true;
}
#endif
return false;
}

View File

@ -12,7 +12,6 @@
#include "GrContextOptions.h"
#include "gl/GLTestContext.h"
#include "vk/VkTestContext.h"
#include "SkTArray.h"
struct GrVkBackendContext;
@ -44,6 +43,7 @@ public:
kNullGL_ContextType, //! Non-rendering OpenGL mock context.
kDebugGL_ContextType, //! Non-rendering, state verifying OpenGL context.
kVulkan_ContextType, //! Vulkan
kMetal_ContextType, //! Metal
kMock_ContextType, //! Mock context that does not draw.
kLastContextType = kMock_ContextType
};
@ -80,6 +80,8 @@ public:
switch (type) {
case kVulkan_ContextType:
return kVulkan_GrBackend;
case kMetal_ContextType:
return kMetal_GrBackend;
case kMock_ContextType:
return kMock_GrBackend;
default:
@ -113,6 +115,8 @@ public:
return "Debug GL";
case kVulkan_ContextType:
return "Vulkan";
case kMetal_ContextType:
return "Metal";
case kMock_ContextType:
return "Mock";
}
@ -185,13 +189,6 @@ public:
return static_cast<GLTestContext*>(fTestContext);
}
#ifdef SK_VULKAN
VkTestContext* vkContext() const {
SkASSERT(kVulkan_GrBackend == this->backend());
return static_cast<VkTestContext*>(fTestContext);
}
#endif
private:
ContextInfo(GrContextFactory::ContextType type,
TestContext* testContext,