32
32
#include "swrast/swrast.h"
35
struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface; \
39
#define LOCAL_DEPTH_VARS LOCAL_VARS
44
#define HW_CLIPLOOP() { \
47
int maxx = rb->Width; \
48
int maxy = rb->Height;
50
#define HW_ENDCLIPLOOP() }
52
#define Y_FLIP(y) (rb->Name ? (y) : rb->Height - 1 - (y))
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)
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)
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)
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
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
102
37
renderbuffer_map_unmap(struct gl_renderbuffer *rb, GLboolean map)
104
39
struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface;
107
switch (rb->Format) {
108
case MESA_FORMAT_RGB565:
109
nouveau_InitPointers_rgb565(rb);
111
case MESA_FORMAT_XRGB8888:
112
nouveau_InitPointers_rgb888(rb);
114
case MESA_FORMAT_ARGB8888:
115
nouveau_InitPointers_argb8888(rb);
117
case MESA_FORMAT_Z16:
118
nouveau_InitDepthPointers_z16(rb);
120
case MESA_FORMAT_Z24_S8:
121
nouveau_InitDepthPointers_z24s8(rb);
127
42
nouveau_bo_map(s->bo, NOUVEAU_BO_RDWR);
129
44
nouveau_bo_unmap(s->bo);
134
texture_unit_map_unmap(struct gl_context *ctx, struct gl_texture_unit *u, GLboolean map)
136
if (!u->_ReallyEnabled)
140
ctx->Driver.MapTexture(ctx, u->_Current);
142
ctx->Driver.UnmapTexture(ctx, u->_Current);
146
49
framebuffer_map_unmap(struct gl_framebuffer *fb, GLboolean map)
167
70
framebuffer_map_unmap(ctx->ReadBuffer, map);
169
72
for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
170
texture_unit_map_unmap(ctx, &ctx->Texture.Unit[i], map);
74
_swrast_map_texture(ctx, ctx->Texture.Unit[i]._Current);
76
_swrast_unmap_texture(ctx, ctx->Texture.Unit[i]._Current);