Remove AttachmentInfo from VulkanViewer setup
It's not necessary to pass this information back up to the client; we can store it in the TestContext if needed for Surface creation. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1920163004 Review-Url: https://codereview.chromium.org/1920163004
This commit is contained in:
parent
c355bc8dd1
commit
a4b0fed3b7
@ -189,7 +189,7 @@ bool stencil_format_supported(const GrVkInterface* interface,
|
||||
void GrVkCaps::initStencilFormat(const GrVkInterface* interface, VkPhysicalDevice physDev) {
|
||||
// List of legal stencil formats (though perhaps not supported on
|
||||
// the particular gpu/driver) from most preferred to least. We are guaranteed to have either
|
||||
// VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D24_SFLOAT_S8_UINT. VK_FORMAT_D32_SFLOAT_S8_UINT
|
||||
// VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D32_SFLOAT_S8_UINT. VK_FORMAT_D32_SFLOAT_S8_UINT
|
||||
// can optionally have 24 unused bits at the end so we assume the total bits is 64.
|
||||
static const StencilFormat
|
||||
// internal Format stencil bits total bits packed?
|
||||
|
@ -63,21 +63,6 @@ void VulkanTestContext::initializeContext(void* platformData) {
|
||||
return;
|
||||
}
|
||||
|
||||
// query to get the initial queue props size
|
||||
uint32_t queueCount;
|
||||
GR_VK_CALL(fBackendContext->fInterface,
|
||||
GetPhysicalDeviceQueueFamilyProperties(fBackendContext->fPhysicalDevice, &queueCount,
|
||||
nullptr));
|
||||
SkASSERT(queueCount >= 1);
|
||||
|
||||
SkAutoMalloc queuePropsAlloc(queueCount * sizeof(VkQueueFamilyProperties));
|
||||
// now get the actual queue props
|
||||
VkQueueFamilyProperties* queueProps = (VkQueueFamilyProperties*)queuePropsAlloc.get();
|
||||
|
||||
GR_VK_CALL(fBackendContext->fInterface,
|
||||
GetPhysicalDeviceQueueFamilyProperties(fBackendContext->fPhysicalDevice, &queueCount,
|
||||
queueProps));
|
||||
|
||||
VkBool32 supported;
|
||||
VkResult res = fGetPhysicalDeviceSurfaceSupportKHR(fBackendContext->fPhysicalDevice,
|
||||
fPresentQueueIndex, fSurface,
|
||||
@ -176,6 +161,10 @@ bool VulkanTestContext::createSwapchain(uint32_t width, uint32_t height)
|
||||
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR :
|
||||
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||
|
||||
// Pick our surface format -- for now, the first one
|
||||
VkFormat surfaceFormat = surfaceFormats[0].format;
|
||||
VkColorSpaceKHR colorSpace = surfaceFormats[0].colorSpace;
|
||||
|
||||
// If mailbox mode is available, use it, as it is the lowest-latency non-
|
||||
// tearing mode. If not, fall back to FIFO which is always available.
|
||||
VkPresentModeKHR mode = VK_PRESENT_MODE_FIFO_KHR;
|
||||
@ -192,8 +181,8 @@ bool VulkanTestContext::createSwapchain(uint32_t width, uint32_t height)
|
||||
swapchainCreateInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||
swapchainCreateInfo.surface = fSurface;
|
||||
swapchainCreateInfo.minImageCount = imageCount;
|
||||
swapchainCreateInfo.imageFormat = surfaceFormats[0].format; // for now, use the first one
|
||||
swapchainCreateInfo.imageColorSpace = surfaceFormats[0].colorSpace;
|
||||
swapchainCreateInfo.imageFormat = surfaceFormat;
|
||||
swapchainCreateInfo.imageColorSpace = colorSpace;
|
||||
swapchainCreateInfo.imageExtent = extent;
|
||||
swapchainCreateInfo.imageArrayLayers = 1;
|
||||
swapchainCreateInfo.imageUsage = usageFlags;
|
||||
|
@ -37,8 +37,6 @@ public:
|
||||
void swapBuffers();
|
||||
|
||||
bool makeCurrent() { return true; }
|
||||
int getStencilBits() { return 0; }
|
||||
int getSampleCount() { return 0; }
|
||||
|
||||
bool isValid() { return SkToBool(fBackendContext.get()); }
|
||||
|
||||
|
@ -28,17 +28,12 @@ public:
|
||||
virtual bool supportsContentRect() const { return false; }
|
||||
virtual SkRect getContentRect() { return SkRect::MakeEmpty(); }
|
||||
|
||||
struct AttachmentInfo {
|
||||
int fSampleCount;
|
||||
int fStencilBits;
|
||||
};
|
||||
|
||||
enum BackEndType {
|
||||
kNativeGL_BackendType,
|
||||
kVulkan_BackendType
|
||||
};
|
||||
|
||||
virtual bool attach(BackEndType attachType, int msaaSampleCount, AttachmentInfo*) = 0;
|
||||
virtual bool attach(BackEndType attachType, int msaaSampleCount) = 0;
|
||||
void detach();
|
||||
|
||||
// input handling
|
||||
|
@ -71,7 +71,7 @@ VulkanViewer::VulkanViewer(int argc, char** argv, void* platformData)
|
||||
SkCommandLineFlags::Parse(argc, argv);
|
||||
|
||||
fWindow = Window::CreateNativeWindow(platformData);
|
||||
fWindow->attach(Window::kVulkan_BackendType, 0, nullptr);
|
||||
fWindow->attach(Window::kVulkan_BackendType, 0);
|
||||
|
||||
// register callbacks
|
||||
fWindow->registerKeyFunc(on_key_handler, this);
|
||||
|
@ -262,7 +262,7 @@ void Window_win::show() {
|
||||
}
|
||||
|
||||
|
||||
bool Window_win::attach(BackEndType attachType, int msaaSampleCount, AttachmentInfo*) {
|
||||
bool Window_win::attach(BackEndType attachType, int msaaSampleCount) {
|
||||
if (kVulkan_BackendType != attachType) {
|
||||
return false;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
void setTitle(const char*) override;
|
||||
void show() override;
|
||||
|
||||
bool attach(BackEndType attachType, int msaaSampleCount, AttachmentInfo*) override;
|
||||
bool attach(BackEndType attachType, int msaaSampleCount) override;
|
||||
|
||||
void inval() override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user