vk_object_base_init(&device->vk, &mem->base,
VK_OBJECT_TYPE_DEVICE_MEMORY);
- if (dedicate_info) {
- mem->image = libresoc_image_from_handle(dedicate_info->image);
- //mem->buffer = libresoc_buffer_from_handle(dedicate_info->buffer);
- } else {
- mem->image = NULL;
- //mem->buffer = NULL;
- }
+ // if (dedicate_info) {
+ // mem->image = libresoc_image_from_handle(dedicate_info->image);
+ // mem->buffer = libresoc_buffer_from_handle(dedicate_info->buffer);
+ // } else {
+ // mem->image = NULL;
+ // mem->buffer = NULL;
+ // }
// float priority_float = 0.5;
// const struct VkMemoryPriorityAllocateInfoEXT *priority_ext =
mtx_unlock(&device->overallocation_mutex);
}
+ mem->bytes = vk_zalloc2(&device->vk.alloc, pAllocator, alloc_size, 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
// mem->bo = device->ws->buffer_create(device->ws, alloc_size, device->physical_device->rad_info.max_alignment,
// domain, flags, priority);
LIBRESOC_FROM_HANDLE(libresoc_image, image, pBindInfos[i].image);
if (mem) {
- // image->bo = mem->bo;
+ image->bytes = mem->bytes;
// image->offset = pBindInfos[i].memoryOffset;
} else {
// image->bo = NULL;
if (mem->user_ptr)
*ppData = mem->user_ptr;
- // else
- // *ppData = device->ws->buffer_map(mem->bo);
+ else
+ *ppData = mem->bytes;
+ //*ppData = device->ws->buffer_map(mem->bo);
if (*ppData) {
*ppData += offset;
vk_object_base_init(&device->vk, &image->base, VK_OBJECT_TYPE_IMAGE);
image->type = pCreateInfo->imageType;
- // image->info.width = pCreateInfo->extent.width;
- // image->info.height = pCreateInfo->extent.height;
+ image->size = pCreateInfo->extent.width * pCreateInfo->extent.height * 4;
+ image->width = pCreateInfo->extent.width;
+ image->height = pCreateInfo->extent.height;
// image->info.depth = pCreateInfo->extent.depth;
// image->info.samples = pCreateInfo->samples;
// image->info.storage_samples = pCreateInfo->samples;
const VkImageSubresource* pSubresource,
VkSubresourceLayout* pLayout)
{
-//TODO: stub
+ LIBRESOC_FROM_HANDLE(libresoc_image, image, _image);
+
+ pLayout->size = image->size;
+ pLayout->rowPitch = image->width;
}
VkResult
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges)
{
-//TODO: stub
+
+ LIBRESOC_FROM_HANDLE(libresoc_image, image, image_h);
+ float r = pColor->float32[0];
+ float g = pColor->float32[1];
+ float b = pColor->float32[2];
+ float temp = 100.00 * ((r * 0.3 ) + (g * 0.3) + (b * 0.3));
+ for (int i=0; i < image->size; ++i) {
+ image->bytes[i] = temp;
+ }
}
#include "wsi_common.h"
#define LIBRESOC_MAX_QUEUE_FAMILIES 1
+typedef unsigned char byte;
+
static inline gl_shader_stage
vk_to_mesa_shader_stage(VkShaderStageFlagBits vk_stage)
{
VkDeviceSize size;
uint32_t alignment;
+ uint32_t height;
+ uint32_t width;
unsigned queue_family_mask;
bool exclusive;
bool shareable;
-
+ byte *bytes;
};
VkResult libresoc_image_create(VkDevice _device,
struct libresoc_device_memory {
struct vk_object_base base;
/* for dedicated allocations */
- struct libresoc_image *image;
+ //struct libresoc_image *image;
//struct libresoc_buffer *buffer;
uint32_t heap_index;
uint64_t alloc_size;
void * map;
void * user_ptr;
+ VkDeviceSize size;
+ byte *bytes;
};
void libresoc_free_memory(struct libresoc_device *device,