summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i915/i915_resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/i915/i915_resource.c')
-rw-r--r--src/gallium/drivers/i915/i915_resource.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/gallium/drivers/i915/i915_resource.c b/src/gallium/drivers/i915/i915_resource.c
new file mode 100644
index 0000000000..499233ceb9
--- /dev/null
+++ b/src/gallium/drivers/i915/i915_resource.c
@@ -0,0 +1,51 @@
+#include "util/u_debug.h"
+
+#include "i915_resource.h"
+#include "i915_context.h"
+#include "i915_screen.h"
+
+
+static struct pipe_resource *
+i915_resource_create(struct pipe_screen *screen,
+ const struct pipe_resource *template)
+{
+ if (template->target == PIPE_BUFFER)
+ return i915_buffer_create(screen, template);
+ else
+ return i915_texture_create(screen, template);
+
+}
+
+static struct pipe_resource *
+i915_resource_from_handle(struct pipe_screen * screen,
+ const struct pipe_resource *template,
+ struct winsys_handle *whandle)
+{
+ if (template->target == PIPE_BUFFER)
+ return NULL;
+ else
+ return i915_texture_from_handle(screen, template, whandle);
+}
+
+
+void
+i915_init_resource_functions(struct i915_context *i915 )
+{
+ i915->base.is_resource_referenced = u_default_is_resource_referenced;
+ i915->base.get_transfer = u_get_transfer_vtbl;
+ i915->base.transfer_map = u_transfer_map_vtbl;
+ i915->base.transfer_flush_region = u_transfer_flush_region_vtbl;
+ i915->base.transfer_unmap = u_transfer_unmap_vtbl;
+ i915->base.transfer_destroy = u_transfer_destroy_vtbl;
+ i915->base.transfer_inline_write = u_transfer_inline_write_vtbl;
+}
+
+void
+i915_init_screen_resource_functions(struct i915_screen *is)
+{
+ is->base.resource_create = i915_resource_create;
+ is->base.resource_from_handle = i915_resource_from_handle;
+ is->base.resource_get_handle = u_resource_get_handle_vtbl;
+ is->base.resource_destroy = u_resource_destroy_vtbl;
+ is->base.user_buffer_create = i915_user_buffer_create;
+}