summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-10 12:13:48 -0600
committerBrian <[email protected]>2007-08-10 12:14:25 -0600
commit9ac1a8d416c2bd50ca10186ca09f5e86f6fa4ce6 (patch)
tree39ac2f23794da71ec1aaf4e1629bdd889baf1b91 /src/mesa/pipe
parent519aacef031e3271e16693308ca462346a8a160c (diff)
pipe->region_alloc() now takes width instead of pitch, plus a flags param
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/i915simple/i915_regions.c11
-rw-r--r--src/mesa/pipe/p_context.h3
-rw-r--r--src/mesa/pipe/p_defines.h19
-rw-r--r--src/mesa/pipe/p_state.h10
-rw-r--r--src/mesa/pipe/softpipe/sp_region.c2
5 files changed, 27 insertions, 18 deletions
diff --git a/src/mesa/pipe/i915simple/i915_regions.c b/src/mesa/pipe/i915simple/i915_regions.c
index e2b807f959a..b3bcae547d1 100644
--- a/src/mesa/pipe/i915simple/i915_regions.c
+++ b/src/mesa/pipe/i915simple/i915_regions.c
@@ -31,6 +31,7 @@
* - refcounting of buffer mappings.
*/
+#include "pipe/p_defines.h"
#include "i915_context.h"
#include "i915_winsys.h"
#include "i915_blit.h"
@@ -70,7 +71,7 @@ i915_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
static struct pipe_region *
i915_region_alloc(struct pipe_context *pipe,
- GLuint cpp, GLuint width, GLuint height)
+ GLuint cpp, GLuint width, GLuint height, GLbitfield flags)
{
struct i915_context *i915 = i915_context( pipe );
struct pipe_region *region = calloc(sizeof(*region), 1);
@@ -82,7 +83,13 @@ i915_region_alloc(struct pipe_context *pipe,
* clearly want to be able to render to textures under some
* circumstances, but maybe not always a requirement.
*/
- unsigned pitch = ((cpp * width + 63) & ~63) / cpp;
+ unsigned pitch;
+
+ /* XXX is the pitch different for textures vs. drawables? */
+ if (flags & PIPE_SURFACE_FLAG_TEXTURE) /* or PIPE_SURFACE_FLAG_RENDER? */
+ pitch = ((cpp * width + 63) & ~63) / cpp;
+ else
+ pitch = ((cpp * width + 63) & ~63) / cpp;
region->cpp = cpp;
region->pitch = pitch;
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index b5dd149603c..7eb492816b4 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -140,7 +140,8 @@ struct pipe_context {
* Some of these may go away...
*/
struct pipe_region *(*region_alloc)(struct pipe_context *pipe,
- GLuint cpp, GLuint pitch, GLuint height);
+ GLuint cpp, GLuint width, GLuint height,
+ GLbitfield flags);
void (*region_release)(struct pipe_context *pipe, struct pipe_region **r);
diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h
index efbb3239a2e..52ecd5b1190 100644
--- a/src/mesa/pipe/p_defines.h
+++ b/src/mesa/pipe/p_defines.h
@@ -176,11 +176,22 @@
/**
- * Buffer mapping access modes
+ * Surface flags
*/
-#define PIPE_MAP_READ 1
-#define PIPE_MAP_WRITE 2
-#define PIPE_MAP_READ_WRITE 3
+#define PIPE_SURFACE_FLAG_TEXTURE 0x1
+#define PIPE_SURFACE_FLAG_RENDER 0x2
+
+
+/**
+ * Buffer flags
+ */
+#define PIPE_BUFFER_FLAG_READ 0x1
+#define PIPE_BUFFER_FLAG_WRITE 0x2
+
+#define PIPE_BUFFER_USE_TEXTURE 0x1
+#define PIPE_BUFFER_USE_VERTEX_BUFFER 0x2
+#define PIPE_BUFFER_USE_INDEX_BUFFER 0x4
+#define PIPE_BUFFER_USE_RENDER_TARGET 0x8
/**
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index 64a475ba00d..df456cc2edd 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -329,15 +329,5 @@ struct pipe_mipmap_tree
struct pipe_buffer_handle;
-#define PIPE_BUFFER_FLAG_READ 0x1
-#define PIPE_BUFFER_FLAG_WRITE 0x2
-
-#define PIPE_BUFFER_USE_TEXTURE 0x1
-#define PIPE_BUFFER_USE_VERTEX_BUFFER 0x2
-#define PIPE_BUFFER_USE_INDEX_BUFFER 0x4
-#define PIPE_BUFFER_USE_RENDER_TARGET 0x8
-
-
-
#endif
diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c
index 58749492ec1..1db508f028f 100644
--- a/src/mesa/pipe/softpipe/sp_region.c
+++ b/src/mesa/pipe/softpipe/sp_region.c
@@ -70,7 +70,7 @@ sp_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
static struct pipe_region *
sp_region_alloc(struct pipe_context *pipe,
- GLuint cpp, GLuint pitch, GLuint height)
+ GLuint cpp, GLuint pitch, GLuint height, GLbitfield flags)
{
struct softpipe_context *sp = softpipe_context( pipe );
struct pipe_region *region = calloc(sizeof(*region), 1);