summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/nv50
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2007-12-18 11:27:44 +1100
committerBen Skeggs <skeggsb@gmail.com>2007-12-18 11:27:44 +1100
commit3af35c6dfa4db1cbf830731882e61d57741f2898 (patch)
treeea5d794b006f2e644d8529ae4f5ef27ecc8be309 /src/mesa/pipe/nv50
parent015871a0753cb984f8a93232a7e8334a24b08406 (diff)
nouveau: match latest gallium changes
Diffstat (limited to 'src/mesa/pipe/nv50')
-rw-r--r--src/mesa/pipe/nv50/nv50_state.c38
-rw-r--r--src/mesa/pipe/nv50/nv50_surface.c158
2 files changed, 15 insertions, 181 deletions
diff --git a/src/mesa/pipe/nv50/nv50_state.c b/src/mesa/pipe/nv50/nv50_state.c
index 0a27a4676e..25eac41c2f 100644
--- a/src/mesa/pipe/nv50/nv50_state.c
+++ b/src/mesa/pipe/nv50/nv50_state.c
@@ -7,23 +7,6 @@
#include "nv50_state.h"
static void *
-nv50_alpha_test_state_create(struct pipe_context *pipe,
- const struct pipe_alpha_test_state *cso)
-{
- return NULL;
-}
-
-static void
-nv50_alpha_test_state_bind(struct pipe_context *pipe, void *hwcso)
-{
-}
-
-static void
-nv50_alpha_test_state_delete(struct pipe_context *pipe, void *hwcso)
-{
-}
-
-static void *
nv50_blend_state_create(struct pipe_context *pipe,
const struct pipe_blend_state *cso)
{
@@ -82,19 +65,19 @@ nv50_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso)
}
static void *
-nv50_depth_stencil_state_create(struct pipe_context *pipe,
- const struct pipe_depth_stencil_state *cso)
+nv50_depth_stencil_alpha_state_create(struct pipe_context *pipe,
+ const struct pipe_depth_stencil_alpha_state *cso)
{
return NULL;
}
static void
-nv50_depth_stencil_state_bind(struct pipe_context *pipe, void *hwcso)
+nv50_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso)
{
}
static void
-nv50_depth_stencil_state_delete(struct pipe_context *pipe, void *hwcso)
+nv50_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso)
{
}
@@ -187,10 +170,6 @@ nv50_set_vertex_element(struct pipe_context *pipe, unsigned index,
void
nv50_init_state_functions(struct nv50_context *nv50)
{
- nv50->pipe.create_alpha_test_state = nv50_alpha_test_state_create;
- nv50->pipe.bind_alpha_test_state = nv50_alpha_test_state_bind;
- nv50->pipe.delete_alpha_test_state = nv50_alpha_test_state_delete;
-
nv50->pipe.create_blend_state = nv50_blend_state_create;
nv50->pipe.bind_blend_state = nv50_blend_state_bind;
nv50->pipe.delete_blend_state = nv50_blend_state_delete;
@@ -204,9 +183,12 @@ nv50_init_state_functions(struct nv50_context *nv50)
nv50->pipe.bind_rasterizer_state = nv50_rasterizer_state_bind;
nv50->pipe.delete_rasterizer_state = nv50_rasterizer_state_delete;
- nv50->pipe.create_depth_stencil_state = nv50_depth_stencil_state_create;
- nv50->pipe.bind_depth_stencil_state = nv50_depth_stencil_state_bind;
- nv50->pipe.delete_depth_stencil_state = nv50_depth_stencil_state_delete;
+ nv50->pipe.create_depth_stencil_alpha_state =
+ nv50_depth_stencil_alpha_state_create;
+ nv50->pipe.bind_depth_stencil_alpha_state =
+ nv50_depth_stencil_alpha_state_bind;
+ nv50->pipe.delete_depth_stencil_alpha_state =
+ nv50_depth_stencil_alpha_state_delete;
nv50->pipe.create_vs_state = nv50_vp_state_create;
nv50->pipe.bind_vs_state = nv50_vp_state_bind;
diff --git a/src/mesa/pipe/nv50/nv50_surface.c b/src/mesa/pipe/nv50/nv50_surface.c
index 7e294cdfdf..44e6728b26 100644
--- a/src/mesa/pipe/nv50/nv50_surface.c
+++ b/src/mesa/pipe/nv50/nv50_surface.c
@@ -31,155 +31,7 @@
#include "pipe/p_util.h"
#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
-
-
-#define CLIP_TILE \
- do { \
- if (x >= ps->width) \
- return; \
- if (y >= ps->height) \
- return; \
- if (x + w > ps->width) \
- w = ps->width - x; \
- if (y + h > ps->height) \
- h = ps->height -y; \
- } while(0)
-
-
-/**
- * Note: this is exactly like a8r8g8b8_get_tile() in sp_surface.c
- * Share it someday.
- */
-static void
-nv50_get_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h, float *p)
-{
- const unsigned *src
- = ((const unsigned *) (ps->map + ps->offset))
- + y * ps->pitch + x;
- unsigned i, j;
- unsigned w0 = w;
-
- CLIP_TILE;
-
- switch (ps->format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++) {
- const unsigned pixel = src[j];
- pRow[0] = UBYTE_TO_FLOAT((pixel >> 16) & 0xff);
- pRow[1] = UBYTE_TO_FLOAT((pixel >> 8) & 0xff);
- pRow[2] = UBYTE_TO_FLOAT((pixel >> 0) & 0xff);
- pRow[3] = UBYTE_TO_FLOAT((pixel >> 24) & 0xff);
- pRow += 4;
- }
- src += ps->pitch;
- p += w0 * 4;
- }
- break;
- case PIPE_FORMAT_Z24S8_UNORM:
- {
- const float scale = 1.0 / (float) 0xffffff;
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++) {
- const unsigned pixel = src[j];
- pRow[0] =
- pRow[1] =
- pRow[2] =
- pRow[3] = ((pixel & 0xffffff) >> 8) * scale;
- pRow += 4;
- }
- src += ps->pitch;
- p += w0 * 4;
- }
- }
- break;
- default:
- assert(0);
- }
-}
-
-
-static void
-nv50_put_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h, const float *p)
-{
- /* TODO */
- assert(0);
-}
-
-
-/*
- * XXX note: same as code in sp_surface.c
- */
-static void
-nv50_get_tile(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- void *p, int dst_stride)
-{
- const uint cpp = ps->cpp;
- const uint w0 = w;
- const ubyte *pSrc;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- CLIP_TILE;
-
- if (dst_stride == 0) {
- dst_stride = w0 * cpp;
- }
-
- pSrc = ps->map + ps->offset + (y * ps->pitch + x) * cpp;
- pDest = (ubyte *) p;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w0 * cpp);
- pDest += dst_stride;
- pSrc += ps->pitch * cpp;
- }
-}
-
-
-/*
- * XXX note: same as code in sp_surface.c
- */
-static void
-nv50_put_tile(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- const void *p, int src_stride)
-{
- const uint cpp = ps->cpp;
- const uint w0 = w;
- const ubyte *pSrc;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- CLIP_TILE;
-
- if (src_stride == 0) {
- src_stride = w0 * cpp;
- }
-
- pSrc = (const ubyte *) p;
- pDest = ps->map + ps->offset + (y * ps->pitch + x) * cpp;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w0 * cpp);
- pDest += ps->pitch * cpp;
- pSrc += src_stride;
- }
-}
-
+#include "pipe/util/p_tile.h"
static struct pipe_surface *
nv50_get_tex_surface(struct pipe_context *pipe,
@@ -230,10 +82,10 @@ void
nv50_init_surface_functions(struct nv50_context *nv50)
{
nv50->pipe.get_tex_surface = nv50_get_tex_surface;
- nv50->pipe.get_tile = nv50_get_tile;
- nv50->pipe.put_tile = nv50_put_tile;
- nv50->pipe.get_tile_rgba = nv50_get_tile_rgba;
- nv50->pipe.put_tile_rgba = nv50_put_tile_rgba;
+ nv50->pipe.get_tile = pipe_get_tile_raw;
+ nv50->pipe.put_tile = pipe_put_tile_raw;
+ nv50->pipe.get_tile_rgba = pipe_get_tile_rgba;
+ nv50->pipe.put_tile_rgba = pipe_put_tile_rgba;
nv50->pipe.surface_data = nv50_surface_data;
nv50->pipe.surface_copy = nv50_surface_copy;
nv50->pipe.surface_fill = nv50_surface_fill;