~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/nouveau/nouveau_span.c

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
#include "swrast/swrast.h"
33
33
 
34
 
#define LOCAL_VARS                                                      \
35
 
        struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface; \
36
 
        GLuint p;                                                       \
37
 
        (void)p;
38
 
 
39
 
#define LOCAL_DEPTH_VARS LOCAL_VARS
40
 
 
41
 
#define HW_LOCK()
42
 
#define HW_UNLOCK()
43
 
 
44
 
#define HW_CLIPLOOP() {                                                 \
45
 
        int minx = 0;                                                   \
46
 
        int miny = 0;                                                   \
47
 
        int maxx = rb->Width;                                           \
48
 
        int maxy = rb->Height;
49
 
 
50
 
#define HW_ENDCLIPLOOP() }
51
 
 
52
 
#define Y_FLIP(y) (rb->Name ? (y) : rb->Height - 1 - (y))
53
 
 
54
 
/* RGB565 span functions */
55
 
#define SPANTMP_PIXEL_FMT GL_RGB
56
 
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
57
 
#define TAG(x) nouveau_##x##_rgb565
58
 
#define TAG2(x, y) nouveau_##x##_rgb565##y
59
 
#define GET_PTR(x, y) (s->bo->map + (y)*s->pitch + (x)*s->cpp)
60
 
 
61
 
#include "spantmp2.h"
62
 
 
63
 
/* RGB888 span functions */
64
 
#define SPANTMP_PIXEL_FMT GL_BGR
65
 
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
66
 
#define TAG(x) nouveau_##x##_rgb888
67
 
#define TAG2(x, y) nouveau_##x##_rgb888##y
68
 
#define GET_PTR(x, y) (s->bo->map + (y)*s->pitch + (x)*s->cpp)
69
 
 
70
 
#include "spantmp2.h"
71
 
 
72
 
/* ARGB8888 span functions */
73
 
#define SPANTMP_PIXEL_FMT GL_BGRA
74
 
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
75
 
#define TAG(x) nouveau_##x##_argb8888
76
 
#define TAG2(x, y) nouveau_##x##_argb8888##y
77
 
#define GET_PTR(x, y) (s->bo->map + (y)*s->pitch + (x)*s->cpp)
78
 
 
79
 
#include "spantmp2.h"
80
 
 
81
 
/* Z16 span functions */
82
 
#define VALUE_TYPE uint16_t
83
 
#define READ_DEPTH(v, x, y)                                             \
84
 
        v = *(uint16_t *)(s->bo->map + (y)*s->pitch + (x)*s->cpp);
85
 
#define WRITE_DEPTH(x, y, v)                                            \
86
 
        *(uint16_t *)(s->bo->map + (y)*s->pitch + (x)*s->cpp) = v
87
 
#define TAG(x) nouveau_##x##_z16
88
 
 
89
 
#include "depthtmp.h"
90
 
 
91
 
/* Z24S8 span functions */
92
 
#define VALUE_TYPE uint32_t
93
 
#define READ_DEPTH(v, x, y)                                             \
94
 
        v = *(uint32_t *)(s->bo->map + (y)*s->pitch + (x)*s->cpp);
95
 
#define WRITE_DEPTH(x, y, v)                                            \
96
 
        *(uint32_t *)(s->bo->map + (y)*s->pitch + (x)*s->cpp) = v
97
 
#define TAG(x) nouveau_##x##_z24s8
98
 
 
99
 
#include "depthtmp.h"
 
34
 
100
35
 
101
36
static void
102
37
renderbuffer_map_unmap(struct gl_renderbuffer *rb, GLboolean map)
104
39
        struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface;
105
40
 
106
41
        if (map) {
107
 
                switch (rb->Format) {
108
 
                case MESA_FORMAT_RGB565:
109
 
                        nouveau_InitPointers_rgb565(rb);
110
 
                        break;
111
 
                case MESA_FORMAT_XRGB8888:
112
 
                        nouveau_InitPointers_rgb888(rb);
113
 
                        break;
114
 
                case MESA_FORMAT_ARGB8888:
115
 
                        nouveau_InitPointers_argb8888(rb);
116
 
                        break;
117
 
                case MESA_FORMAT_Z16:
118
 
                        nouveau_InitDepthPointers_z16(rb);
119
 
                        break;
120
 
                case MESA_FORMAT_Z24_S8:
121
 
                        nouveau_InitDepthPointers_z24s8(rb);
122
 
                        break;
123
 
                default:
124
 
                        assert(0);
125
 
                }
126
 
 
127
42
                nouveau_bo_map(s->bo, NOUVEAU_BO_RDWR);
128
43
        } else {
129
44
                nouveau_bo_unmap(s->bo);
131
46
}
132
47
 
133
48
static void
134
 
texture_unit_map_unmap(struct gl_context *ctx, struct gl_texture_unit *u, GLboolean map)
135
 
{
136
 
        if (!u->_ReallyEnabled)
137
 
                return;
138
 
 
139
 
        if (map)
140
 
                ctx->Driver.MapTexture(ctx, u->_Current);
141
 
        else
142
 
                ctx->Driver.UnmapTexture(ctx, u->_Current);
143
 
}
144
 
 
145
 
static void
146
49
framebuffer_map_unmap(struct gl_framebuffer *fb, GLboolean map)
147
50
{
148
51
        int i;
152
55
 
153
56
        renderbuffer_map_unmap(fb->_ColorReadBuffer, map);
154
57
 
155
 
        if (fb->_DepthBuffer)
156
 
                renderbuffer_map_unmap(fb->_DepthBuffer->Wrapped, map);
 
58
        if (fb->Attachment[BUFFER_DEPTH].Renderbuffer)
 
59
                renderbuffer_map_unmap(fb->Attachment[BUFFER_DEPTH].Renderbuffer, map);
157
60
}
158
61
 
159
62
static void
167
70
                framebuffer_map_unmap(ctx->ReadBuffer, map);
168
71
 
169
72
        for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
170
 
                texture_unit_map_unmap(ctx, &ctx->Texture.Unit[i], map);
 
73
                if (map)
 
74
                        _swrast_map_texture(ctx, ctx->Texture.Unit[i]._Current);
 
75
                else
 
76
                        _swrast_unmap_texture(ctx, ctx->Texture.Unit[i]._Current);
171
77
}
172
78
 
173
79
static void