Update failure calls in GrVkMemory and shader creation.

Bug: skia:9603
Change-Id: I8571150bb7efe2f127c00d1a06e77ec8fa905d8f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255526
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2019-11-20 11:29:50 -05:00 committed by Skia Commit-Bot
parent b4f8540803
commit b184e9654d
6 changed files with 24 additions and 24 deletions

View File

@ -19,7 +19,7 @@
#define VALIDATE() do {} while(false)
#endif
const GrVkBuffer::Resource* GrVkBuffer::Create(const GrVkGpu* gpu, const Desc& desc) {
const GrVkBuffer::Resource* GrVkBuffer::Create(GrVkGpu* gpu, const Desc& desc) {
SkASSERT(!gpu->protectedContext() || (gpu->protectedContext() == desc.fDynamic));
VkBuffer buffer;
GrVkAlloc alloc;

View File

@ -77,7 +77,7 @@ protected:
};
// convenience routine for raw buffer creation
static const Resource* Create(const GrVkGpu* gpu,
static const Resource* Create(GrVkGpu* gpu,
const Desc& descriptor);
GrVkBuffer(const Desc& desc, const GrVkBuffer::Resource* resource)

View File

@ -30,7 +30,7 @@ static BufferUsage get_buffer_usage(GrVkBuffer::Type type, bool dynamic) {
SK_ABORT("Invalid GrVkBuffer::Type");
}
bool GrVkMemory::AllocAndBindBufferMemory(const GrVkGpu* gpu,
bool GrVkMemory::AllocAndBindBufferMemory(GrVkGpu* gpu,
VkBuffer buffer,
GrVkBuffer::Type type,
bool dynamic,
@ -62,9 +62,9 @@ bool GrVkMemory::AllocAndBindBufferMemory(const GrVkGpu* gpu,
allocator->getAllocInfo(memory, alloc);
// Bind buffer
VkResult err = GR_VK_CALL(gpu->vkInterface(), BindBufferMemory(gpu->device(), buffer,
alloc->fMemory,
alloc->fOffset));
VkResult err;
GR_VK_CALL_RESULT(gpu, err, BindBufferMemory(gpu->device(), buffer, alloc->fMemory,
alloc->fOffset));
if (err) {
FreeBufferMemory(gpu, type, *alloc);
return false;
@ -85,7 +85,7 @@ void GrVkMemory::FreeBufferMemory(const GrVkGpu* gpu, GrVkBuffer::Type type,
const VkDeviceSize kMaxSmallImageSize = 256 * 1024;
bool GrVkMemory::AllocAndBindImageMemory(const GrVkGpu* gpu,
bool GrVkMemory::AllocAndBindImageMemory(GrVkGpu* gpu,
VkImage image,
bool linearTiling,
GrVkAlloc* alloc) {
@ -114,8 +114,9 @@ bool GrVkMemory::AllocAndBindImageMemory(const GrVkGpu* gpu,
allocator->getAllocInfo(memory, alloc);
// Bind buffer
VkResult err = GR_VK_CALL(gpu->vkInterface(), BindImageMemory(gpu->device(), image,
alloc->fMemory, alloc->fOffset));
VkResult err;
GR_VK_CALL_RESULT(gpu, err, BindImageMemory(gpu->device(), image, alloc->fMemory,
alloc->fOffset));
if (err) {
FreeImageMemory(gpu, linearTiling, *alloc);
return false;
@ -134,7 +135,7 @@ void GrVkMemory::FreeImageMemory(const GrVkGpu* gpu, bool linearTiling,
}
}
void* GrVkMemory::MapAlloc(const GrVkGpu* gpu, const GrVkAlloc& alloc) {
void* GrVkMemory::MapAlloc(GrVkGpu* gpu, const GrVkAlloc& alloc) {
SkASSERT(GrVkAlloc::kMappable_Flag & alloc.fFlags);
#ifdef SK_DEBUG
if (alloc.fFlags & GrVkAlloc::kNoncoherent_Flag) {
@ -149,9 +150,9 @@ void* GrVkMemory::MapAlloc(const GrVkGpu* gpu, const GrVkAlloc& alloc) {
}
void* mapPtr;
VkResult err = GR_VK_CALL(gpu->vkInterface(), MapMemory(gpu->device(), alloc.fMemory,
alloc.fOffset,
alloc.fSize, 0, &mapPtr));
VkResult err;
GR_VK_CALL_RESULT(gpu, err, MapMemory(gpu->device(), alloc.fMemory, alloc.fOffset, alloc.fSize,
0, &mapPtr));
if (err) {
mapPtr = nullptr;
}

View File

@ -19,14 +19,14 @@ namespace GrVkMemory {
* Allocates vulkan device memory and binds it to the gpu's device for the given object.
* Returns true if allocation succeeded.
*/
bool AllocAndBindBufferMemory(const GrVkGpu* gpu,
bool AllocAndBindBufferMemory(GrVkGpu* gpu,
VkBuffer buffer,
GrVkBuffer::Type type,
bool dynamic,
GrVkAlloc* alloc);
void FreeBufferMemory(const GrVkGpu* gpu, GrVkBuffer::Type type, const GrVkAlloc& alloc);
bool AllocAndBindImageMemory(const GrVkGpu* gpu,
bool AllocAndBindImageMemory(GrVkGpu* gpu,
VkImage image,
bool linearTiling,
GrVkAlloc* alloc);
@ -36,7 +36,7 @@ namespace GrVkMemory {
// the hood, we may map more than the range of the GrVkAlloc (e.g. the entire VkDeviceMemory),
// but the pointer returned will always be to the start of the GrVkAlloc. The caller should also
// never assume more than the GrVkAlloc block has been mapped.
void* MapAlloc(const GrVkGpu* gpu, const GrVkAlloc& alloc);
void* MapAlloc(GrVkGpu* gpu, const GrVkAlloc& alloc);
void UnmapAlloc(const GrVkGpu* gpu, const GrVkAlloc& alloc);
// For the Flush and Invalidate calls, the offset should be relative to the GrVkAlloc. Thus this

View File

@ -112,7 +112,7 @@ SkSL::Program::Kind vk_shader_stage_to_skiasl_kind(VkShaderStageFlagBits stage)
return SkSL::Program::kFragment_Kind;
}
bool GrCompileVkShaderModule(const GrVkGpu* gpu,
bool GrCompileVkShaderModule(GrVkGpu* gpu,
const SkSL::String& shaderString,
VkShaderStageFlagBits stage,
VkShaderModule* shaderModule,
@ -138,7 +138,7 @@ bool GrCompileVkShaderModule(const GrVkGpu* gpu,
return GrInstallVkShaderModule(gpu, *outSPIRV, stage, shaderModule, stageInfo);
}
bool GrInstallVkShaderModule(const GrVkGpu* gpu,
bool GrInstallVkShaderModule(GrVkGpu* gpu,
const SkSL::String& spirv,
VkShaderStageFlagBits stage,
VkShaderModule* shaderModule,
@ -151,10 +151,9 @@ bool GrInstallVkShaderModule(const GrVkGpu* gpu,
moduleCreateInfo.codeSize = spirv.size();
moduleCreateInfo.pCode = (const uint32_t*)spirv.c_str();
VkResult err = GR_VK_CALL(gpu->vkInterface(), CreateShaderModule(gpu->device(),
&moduleCreateInfo,
nullptr,
shaderModule));
VkResult err;
GR_VK_CALL_RESULT(gpu, err, CreateShaderModule(gpu->device(), &moduleCreateInfo, nullptr,
shaderModule));
if (err) {
return false;
}

View File

@ -50,7 +50,7 @@ bool GrVkFormatColorTypePairIsValid(VkFormat, GrColorType);
bool GrSampleCountToVkSampleCount(uint32_t samples, VkSampleCountFlagBits* vkSamples);
bool GrCompileVkShaderModule(const GrVkGpu* gpu,
bool GrCompileVkShaderModule(GrVkGpu* gpu,
const SkSL::String& shaderString,
VkShaderStageFlagBits stage,
VkShaderModule* shaderModule,
@ -59,7 +59,7 @@ bool GrCompileVkShaderModule(const GrVkGpu* gpu,
SkSL::String* outSPIRV,
SkSL::Program::Inputs* outInputs);
bool GrInstallVkShaderModule(const GrVkGpu* gpu,
bool GrInstallVkShaderModule(GrVkGpu* gpu,
const SkSL::String& spirv,
VkShaderStageFlagBits stage,
VkShaderModule* shaderModule,