Initialize TextureOp and BufferOp structs

Fixes Coverity warnings, and avoids hard-to-debug errors, at minimal
overhead.

Change-Id: I3ff530a9263693d1123932458b3e186e79a14b7e
Coverity-Id: 263692
Coverity-Id: 263693
Coverity-Id: 263699
Coverity-Id: 263700
Coverity-Id: 263702
Coverity-Id: 263705
Pick-to: 5.15
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-05-14 08:56:02 +02:00
parent 7bee4e9cb3
commit 6f34c0c650

View File

@ -292,7 +292,7 @@ public:
static BufferOp dynamicUpdate(QRhiBuffer *buf, int offset, int size, const void *data)
{
BufferOp op;
BufferOp op = {};
op.type = DynamicUpdate;
op.buf = buf;
op.offset = offset;
@ -302,7 +302,7 @@ public:
static BufferOp staticUpload(QRhiBuffer *buf, int offset, int size, const void *data)
{
BufferOp op;
BufferOp op = {};
op.type = StaticUpload;
op.buf = buf;
op.offset = offset;
@ -312,7 +312,7 @@ public:
static BufferOp read(QRhiBuffer *buf, int offset, int size, QRhiBufferReadbackResult *result)
{
BufferOp op;
BufferOp op = {};
op.type = Read;
op.buf = buf;
op.offset = offset;
@ -344,7 +344,7 @@ public:
static TextureOp upload(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
{
TextureOp op;
TextureOp op = {};
op.type = Upload;
op.dst = tex;
for (auto it = desc.cbeginEntries(), itEnd = desc.cendEntries(); it != itEnd; ++it)
@ -354,7 +354,7 @@ public:
static TextureOp copy(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc)
{
TextureOp op;
TextureOp op = {};
op.type = Copy;
op.dst = dst;
op.src = src;
@ -364,7 +364,7 @@ public:
static TextureOp read(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
{
TextureOp op;
TextureOp op = {};
op.type = Read;
op.rb = rb;
op.result = result;
@ -373,7 +373,7 @@ public:
static TextureOp genMips(QRhiTexture *tex, int layer)
{
TextureOp op;
TextureOp op = {};
op.type = GenMips;
op.dst = tex;
op.layer = layer;