diff --git a/tests/common.c b/tests/common.c index 88d30f91..a3de3d75 100644 --- a/tests/common.c +++ b/tests/common.c @@ -90,6 +90,7 @@ void app_dev_init(struct app_dev *dev, struct app_gpu *gpu) ERR_EXIT(XGL_ERROR_OUT_OF_MEMORY); for (i = 0; i < dev->heap_count; i++) { + size = sizeof(dev->heap_props[0]); err = xglGetMemoryHeapInfo(dev->obj, i, XGL_INFO_TYPE_MEMORY_HEAP_PROPERTIES, &size, &dev->heap_props[i]); @@ -210,6 +211,7 @@ void app_gpu_init(struct app_gpu *gpu, XGL_UINT id, XGL_PHYSICAL_GPU obj) gpu->queue_reqs[i].queueCount = gpu->queue_props[i].queueCount; } + size = sizeof(gpu->memory_props); err = xglGetGpuInfo(gpu->obj, XGL_INFO_TYPE_PHYSICAL_GPU_MEMORY_PROPERTIES, &size, &gpu->memory_props); diff --git a/tests/displayengine.cpp b/tests/displayengine.cpp index 7874b503..84fdfbe3 100644 --- a/tests/displayengine.cpp +++ b/tests/displayengine.cpp @@ -73,7 +73,7 @@ void DisplayEngine::Display(XGL_IMAGE image, XGL_GPU_MEMORY image_mem) XGL_IMAGE_ASPECT_COLOR, 0, 0 }; XGL_SUBRESOURCE_LAYOUT sr_layout; - XGL_UINT data_size; + XGL_UINT data_size = sizeof(sr_layout); if (!m_enable) return; // Do nothing except save info if not enabled diff --git a/tests/image_tests.cpp b/tests/image_tests.cpp index d12ff9b6..834942f3 100644 --- a/tests/image_tests.cpp +++ b/tests/image_tests.cpp @@ -136,7 +136,7 @@ void XglImageTest::CreateImage(XGL_UINT w, XGL_UINT h) * amount of data may vary and that doesn't work well for using a * fixed structure. */ - + size = sizeof(image_fmt); err = xglGetFormatInfo(this->device(), fmt, XGL_INFO_TYPE_FORMAT_PROPERTIES, &size, &image_fmt); @@ -188,7 +188,7 @@ void XglImageTest::CreateImage(XGL_UINT w, XGL_UINT h) ASSERT_XGL_SUCCESS(err); XGL_MEMORY_REQUIREMENTS mem_req; - XGL_UINT data_size; + XGL_UINT data_size = sizeof(mem_req); err = xglGetObjectInfo(m_image, XGL_INFO_TYPE_MEMORY_REQUIREMENTS, &data_size, &mem_req); ASSERT_XGL_SUCCESS(err); diff --git a/tests/init.cpp b/tests/init.cpp index c6cf0d02..b5fa0dca 100644 --- a/tests/init.cpp +++ b/tests/init.cpp @@ -167,8 +167,8 @@ TEST_F(XglTest, AllocMemory) { TEST_F(XglTest, Event) { XGL_EVENT_CREATE_INFO event_info; XGL_EVENT event; - XGL_UINT data_size; XGL_MEMORY_REQUIREMENTS mem_req; + XGL_UINT data_size = sizeof(mem_req); XGL_RESULT err; // typedef struct _XGL_EVENT_CREATE_INFO @@ -315,6 +315,7 @@ TEST_F(XglTest, Query) { err = xglCreateQueryPool(device(), &query_info, &query_pool); ASSERT_XGL_SUCCESS(err); + data_size = sizeof(mem_req); err = xglGetObjectInfo(query_pool, XGL_INFO_TYPE_MEMORY_REQUIREMENTS, &data_size, &mem_req); ASSERT_XGL_SUCCESS(err); @@ -482,6 +483,7 @@ void XglTest::CreateImageTest() * fixed structure. */ + size = sizeof(image_fmt); err = xglGetFormatInfo(device(), fmt, XGL_INFO_TYPE_FORMAT_PROPERTIES, &size, &image_fmt); @@ -569,7 +571,7 @@ void XglTest::CreateImageTest() while( ( _w > 0 ) || ( _h > 0 ) ) { XGL_SUBRESOURCE_LAYOUT layout = {}; - + data_size = sizeof(layout); err = xglGetImageSubresourceInfo(image, &subresource, XGL_INFO_TYPE_SUBRESOURCE_LAYOUT, &data_size, &layout); ASSERT_XGL_SUCCESS(err); @@ -584,6 +586,7 @@ void XglTest::CreateImageTest() } XGL_MEMORY_REQUIREMENTS mem_req; + data_size = sizeof(mem_req); err = xglGetObjectInfo(image, XGL_INFO_TYPE_MEMORY_REQUIREMENTS, &data_size, &mem_req); ASSERT_XGL_SUCCESS(err); diff --git a/tests/render_tests.cpp b/tests/render_tests.cpp index 83bbbfdf..3093f3d5 100644 --- a/tests/render_tests.cpp +++ b/tests/render_tests.cpp @@ -270,7 +270,7 @@ void XglRenderTest::CreateQueryPool(XGL_QUERY_TYPE type, XGL_UINT slots, ASSERT_XGL_SUCCESS(err); XGL_MEMORY_REQUIREMENTS mem_req; - XGL_UINT data_size; + XGL_UINT data_size = sizeof(mem_req); err = xglGetObjectInfo(*pPool, XGL_INFO_TYPE_MEMORY_REQUIREMENTS, &data_size, &mem_req); ASSERT_XGL_SUCCESS(err); @@ -708,7 +708,7 @@ void XglRenderTest::DrawTriangleTest() xglDeviceWaitIdle(m_device->device()); XGL_PIPELINE_STATISTICS_DATA stats; - XGL_SIZE stats_size; + XGL_SIZE stats_size = sizeof(stats); err = xglGetQueryPoolResults(query, 0, 1, &stats_size, &stats); ASSERT_XGL_SUCCESS( err ); ASSERT_EQ(stats_size, sizeof(stats)); diff --git a/tests/xgldevice.cpp b/tests/xgldevice.cpp index 3a62832f..b42f3ba5 100644 --- a/tests/xgldevice.cpp +++ b/tests/xgldevice.cpp @@ -40,6 +40,7 @@ void XglDevice::init_device() this->heap_props = new XGL_MEMORY_HEAP_PROPERTIES [this->heap_count]; ASSERT_TRUE(NULL != this->heap_props) << "Out of memory"; + size = sizeof(this->heap_props[0]); for (i = 0; i < this->heap_count; i++) { err = xglGetMemoryHeapInfo(m_xgl_device_object, i, @@ -60,7 +61,7 @@ void XglDevice::init_formats() fmt.channelFormat = static_cast(chInt); fmt.numericFormat = static_cast(numInt); - + size = sizeof(this->format_props[chInt][numInt]); err = xglGetFormatInfo(m_xgl_device_object, fmt, XGL_INFO_TYPE_FORMAT_PROPERTIES, &size, &this->format_props[chInt][numInt]); @@ -88,7 +89,7 @@ XGL_RESULT XglDevice::AllocAndBindGpuMemory(XGL_OBJECT obj, const std::string &o { XGL_RESULT err; XGL_MEMORY_REQUIREMENTS mem_req; - XGL_UINT data_size; + XGL_UINT data_size = sizeof(mem_req); err = xglGetObjectInfo(obj, XGL_INFO_TYPE_MEMORY_REQUIREMENTS, &data_size, &mem_req); if (err != XGL_SUCCESS) return err; diff --git a/tests/xglgpu.cpp b/tests/xglgpu.cpp index b8446c5d..38e1675f 100644 --- a/tests/xglgpu.cpp +++ b/tests/xglgpu.cpp @@ -20,12 +20,14 @@ void XglGpu::init_gpu() XGL_RESULT err; XGL_SIZE size; + size = sizeof(this->props); err = xglGetGpuInfo(this->gpuObj, XGL_INFO_TYPE_PHYSICAL_GPU_PROPERTIES, &size, &this->props); ASSERT_XGL_SUCCESS(err); ASSERT_EQ(size, sizeof(this->props)); + size = sizeof(this->perf); err = xglGetGpuInfo(this->gpuObj, XGL_INFO_TYPE_PHYSICAL_GPU_PERFORMANCE, &size, &this->perf); @@ -43,6 +45,7 @@ void XglGpu::init_gpu() this->queue_props = new XGL_PHYSICAL_GPU_QUEUE_PROPERTIES [this->queue_count]; ASSERT_TRUE(NULL != this->queue_props) << "Out of memory"; + size = this->queue_count*sizeof(this->queue_props[0]); err = xglGetGpuInfo(this->gpuObj, XGL_INFO_TYPE_PHYSICAL_GPU_QUEUE_PROPERTIES, &size, this->queue_props); @@ -59,6 +62,7 @@ void XglGpu::init_gpu() this->queue_reqs[i].queueCount = this->queue_props[i].queueCount; } + size = sizeof(this->memory_props); err = xglGetGpuInfo(this->gpuObj, XGL_INFO_TYPE_PHYSICAL_GPU_MEMORY_PROPERTIES, &size, &this->memory_props); diff --git a/tests/xglimage.cpp b/tests/xglimage.cpp index e5d85e48..105616ce 100644 --- a/tests/xglimage.cpp +++ b/tests/xglimage.cpp @@ -59,7 +59,7 @@ void XglImage::init(XGL_UINT32 w, XGL_UINT32 h, { XGL_RESULT err; XGL_UINT mipCount; - XGL_SIZE size; + XGL_SIZE size = sizeof(XGL_FORMAT_PROPERTIES); XGL_FORMAT_PROPERTIES image_fmt; mipCount = 0; @@ -142,7 +142,7 @@ void XglImage::init(XGL_UINT32 w, XGL_UINT32 h, ASSERT_XGL_SUCCESS(err); XGL_MEMORY_REQUIREMENTS mem_req; - XGL_UINT data_size; + XGL_UINT data_size = sizeof(XGL_MEMORY_REQUIREMENTS); err = xglGetObjectInfo(m_image, XGL_INFO_TYPE_MEMORY_REQUIREMENTS, &data_size, &mem_req); ASSERT_XGL_SUCCESS(err); diff --git a/tests/xgltestframework.cpp b/tests/xgltestframework.cpp index 4ef5ccf2..311f1ecd 100644 --- a/tests/xgltestframework.cpp +++ b/tests/xgltestframework.cpp @@ -103,7 +103,7 @@ void XglTestFramework::WritePPM( const char *basename, XglImage *image ) XGL_IMAGE_ASPECT_COLOR, 0, 0 }; XGL_SUBRESOURCE_LAYOUT sr_layout; - XGL_UINT data_size; + XGL_UINT data_size = sizeof(sr_layout); err = xglGetImageSubresourceInfo( image->image(), &sr, XGL_INFO_TYPE_SUBRESOURCE_LAYOUT, @@ -167,7 +167,7 @@ void XglTestFramework::Show(const char *comment, XglImage *image) XGL_IMAGE_ASPECT_COLOR, 0, 0 }; XGL_SUBRESOURCE_LAYOUT sr_layout; - XGL_UINT data_size; + XGL_UINT data_size = sizeof(sr_layout); if (!m_show_images) return;