summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_resource.h
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-05-13 15:19:55 +0800
committerChia-I Wu <[email protected]>2013-05-14 16:07:22 +0800
commit176ad54c04f5b945e47b61a3cad4b6c87d883a41 (patch)
treef0016c8ab39b4d5bf24676fa6c0fa45f2871ae9c /src/gallium/drivers/ilo/ilo_resource.h
parent768296dd05fce98b7ad5219c647ded087b287742 (diff)
ilo: rework ilo_texture
Use ilo_buffer for buffer resources and ilo_texture for texture resources. A major cleanup is necessitated by the separation.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_resource.h')
-rw-r--r--src/gallium/drivers/ilo/ilo_resource.h36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/gallium/drivers/ilo/ilo_resource.h b/src/gallium/drivers/ilo/ilo_resource.h
index cf54dc83bcd..124603c3523 100644
--- a/src/gallium/drivers/ilo/ilo_resource.h
+++ b/src/gallium/drivers/ilo/ilo_resource.h
@@ -33,19 +33,20 @@
#include "ilo_common.h"
struct ilo_screen;
-struct winsys_handle;
-/*
- * TODO we should have
- *
- * ilo_resource, inherited by
- * - ilo_buffer
- * - ilo_texture
- * - ilo_global_binding
- */
+struct ilo_buffer {
+ struct pipe_resource base;
+
+ struct intel_bo *bo;
+ unsigned bo_size;
+ unsigned bo_flags;
+};
+
struct ilo_texture {
struct pipe_resource base;
- struct winsys_handle *handle;
+
+ bool imported;
+ unsigned bo_flags;
enum pipe_format bo_format;
struct intel_bo *bo;
@@ -73,22 +74,33 @@ struct ilo_texture {
bool interleaved;
/* 2D offsets into a layer/slice/face */
- struct {
+ struct ilo_texture_slice {
unsigned x;
unsigned y;
} *slice_offsets[PIPE_MAX_TEXTURE_LEVELS];
};
+static inline struct ilo_buffer *
+ilo_buffer(struct pipe_resource *res)
+{
+ return (struct ilo_buffer *)
+ ((res && res->target == PIPE_BUFFER) ? res : NULL);
+}
+
static inline struct ilo_texture *
ilo_texture(struct pipe_resource *res)
{
- return (struct ilo_texture *) res;
+ return (struct ilo_texture *)
+ ((res && res->target != PIPE_BUFFER) ? res : NULL);
}
void
ilo_init_resource_functions(struct ilo_screen *is);
bool
+ilo_buffer_alloc_bo(struct ilo_buffer *buf);
+
+bool
ilo_texture_alloc_bo(struct ilo_texture *tex);
unsigned