OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrVkGpu.h" | 8 #include "GrVkGpu.h" |
9 | 9 |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 // Currently it is fine for us to always pass in 1 for the clear count even
if no attachment | 1881 // Currently it is fine for us to always pass in 1 for the clear count even
if no attachment |
1882 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the
color attachment | 1882 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the
color attachment |
1883 // which is always at the first attachment. | 1883 // which is always at the first attachment. |
1884 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target,
*pBounds, true); | 1884 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target,
*pBounds, true); |
1885 fCurrentCmdBuffer->executeCommands(this, buffer); | 1885 fCurrentCmdBuffer->executeCommands(this, buffer); |
1886 fCurrentCmdBuffer->endRenderPass(this); | 1886 fCurrentCmdBuffer->endRenderPass(this); |
1887 | 1887 |
1888 this->didWriteToSurface(target, &bounds); | 1888 this->didWriteToSurface(target, &bounds); |
1889 } | 1889 } |
1890 | 1890 |
| 1891 GrFence SK_WARN_UNUSED_RESULT GrVkGpu::insertFence() const { |
| 1892 VkFenceCreateInfo createInfo; |
| 1893 memset(&createInfo, 0, sizeof(VkFenceCreateInfo)); |
| 1894 createInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; |
| 1895 createInfo.pNext = nullptr; |
| 1896 createInfo.flags = 0; |
| 1897 VkFence fence = VK_NULL_HANDLE; |
| 1898 VkResult result = GR_VK_CALL(this->vkInterface(), CreateFence(this->device()
, &createInfo, |
| 1899 nullptr, &fenc
e)); |
| 1900 // TODO: verify that all QueueSubmits before this will finish before this fe
nce signals |
| 1901 if (VK_SUCCESS == result) { |
| 1902 GR_VK_CALL(this->vkInterface(), QueueSubmit(this->queue(), 0, nullptr, f
ence)); |
| 1903 } |
| 1904 return (GrFence)fence; |
| 1905 } |
| 1906 |
| 1907 bool GrVkGpu::waitFence(GrFence fence, uint64_t timeout) const { |
| 1908 VkResult result = GR_VK_CALL(this->vkInterface(), WaitForFences(this->device
(), 1, |
| 1909 (VkFence*)&f
ence, |
| 1910 VK_TRUE, |
| 1911 timeout)); |
| 1912 return (VK_SUCCESS == result); |
| 1913 } |
| 1914 |
| 1915 void GrVkGpu::deleteFence(GrFence fence) const { |
| 1916 GR_VK_CALL(this->vkInterface(), DestroyFence(this->device(), (VkFence)fence,
nullptr)); |
| 1917 } |
| 1918 |
OLD | NEW |