Various fixes in VulkanWindowContext

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4066

Change-Id: Ib42dbe70e868c83bdf06e370388e0cc7639a0992
Reviewed-on: https://skia-review.googlesource.com/4066
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2016-10-27 16:37:17 -04:00 committed by Skia Commit-Bot
parent 5011f8547c
commit 1f05f44e8f
5 changed files with 9 additions and 15 deletions

View File

@ -173,9 +173,6 @@
'link_settings': {
'libraries': [ '<(vulkan_lib_name)', ],
},
'dependencies': [
'shaderc.gyp:shaderc_combined',
],
'conditions': [
[ 'skia_os == "win"', {
'variables': {
@ -233,9 +230,6 @@
'../tools/viewer/sk_app/android',
],
},
'dependencies!': [
'shaderc.gyp:shaderc_combined',
],
'sources': [
# the gyp -> android.mk generator doesn't seem to like cpp files
# in directories outside of src, bench, or dm. Until this gets fixed

View File

@ -310,7 +310,7 @@ void VulkanWindowContext::createBuffers(VkFormat format) {
fenceInfo.pNext = nullptr;
fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
// we create one additional backbuffer structure here, because we want to
// we create one additional backbuffer structure here, because we want to
// give the command buffers they contain a chance to finish before we cycle back
fBackbuffers = new BackbufferInfo[fImageCount + 1];
for (uint32_t i = 0; i < fImageCount + 1; ++i) {
@ -417,7 +417,6 @@ VulkanWindowContext::BackbufferInfo* VulkanWindowContext::getAvailableBackbuffer
}
BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;
GR_VK_CALL_ERRCHECK(fBackendContext->fInterface,
WaitForFences(fBackendContext->fDevice, 2, backbuffer->fUsageFences,
true, UINT64_MAX));
@ -444,7 +443,7 @@ sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() {
}
if (VK_ERROR_OUT_OF_DATE_KHR == res) {
// tear swapchain down and try again
if (!this->createSwapchain(0, 0, fDisplayParams)) {
if (!this->createSwapchain(-1, -1, fDisplayParams)) {
return nullptr;
}

View File

@ -36,8 +36,8 @@ public:
this->createSwapchain(fWidth, fHeight, params);
}
GrBackendContext getBackendContext() override {
return (GrBackendContext) fBackendContext.get();
GrBackendContext getBackendContext() override {
return (GrBackendContext) fBackendContext.get();
}
/** Platform specific function that creates a VkSurfaceKHR for a window */

View File

@ -25,12 +25,13 @@ sk_sp<SkSurface> WindowContext::createOffscreenSurface(bool forceSRGB) {
return createSurface(nullptr, 0, true, forceSRGB);
}
sk_sp<SkSurface> WindowContext::createRenderSurface(GrBackendRenderTargetDesc desc, int colorBits) {
sk_sp<SkSurface> WindowContext::createRenderSurface(const GrBackendRenderTargetDesc& desc,
int colorBits) {
return createSurface(&desc, colorBits, false, false);
}
sk_sp<SkSurface> WindowContext::createSurface(
GrBackendRenderTargetDesc* rtDesc, int colorBits, bool offscreen, bool forceSRGB) {
const GrBackendRenderTargetDesc* rtDesc, int colorBits, bool offscreen, bool forceSRGB) {
if (!this->isGpuContext() || colorBits > 24 || offscreen ||
kRGBA_F16_SkColorType == fDisplayParams.fColorType) {
// If we're rendering to F16, we need an off-screen surface - the current render

View File

@ -49,7 +49,7 @@ public:
protected:
virtual bool isGpuContext() { return true; }
sk_sp<SkSurface> createRenderSurface(GrBackendRenderTargetDesc, int colorBits);
sk_sp<SkSurface> createRenderSurface(const GrBackendRenderTargetDesc&, int colorBits);
GrContext* fContext;
@ -61,7 +61,7 @@ protected:
private:
sk_sp<SkSurface> createSurface(
GrBackendRenderTargetDesc*, int colorBits, bool offscreen, bool forceSRGB);
const GrBackendRenderTargetDesc*, int colorBits, bool offscreen, bool forceSRGB);
};
} // namespace sk_app