1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#include "glheader.h"
#include "macros.h"
#include "enums.h"
#include "program.h"
#include "nouveau_context.h"
#include "nouveau_shader.h"
static struct program *
nv40NewProgram(GLcontext *ctx, GLenum target, GLuint id)
{
}
static void
nv40BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
{
}
static void
nv40DeleteProgram(GLcontext *ctx, struct program *prog)
{
}
static void
nv40ProgramStringNotify(GLcontext *ctx, GLenum target,
struct program *prog)
{
}
static GLboolean
nv40IsProgramNative(GLcontext *ctx, GLenum target, struct program *prog)
{
}
void
nouveauInitShaderFuncs(GLcontext *ctx)
{
struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx);
if (nmesa->screen->card_type == NV_40) {
ctx->Driver.NewProgram = nv40NewProgram;
ctx->Driver.BindProgram = nv40BindProgram;
ctx->Driver.DeleteProgram = nv40DeleteProgram;
ctx->Driver.ProgramStringNotify = nv40ProgramStringNotify;
ctx->Driver.IsProgramNative = nv40IsProgramNative;
}
}
#define LONGBITS (sizeof(long) * 8)
void
nvsBitSet(long *rec, int bit)
{
int ri = bit / LONGBITS;
int rb = bit % LONGBITS;
rec[ri] |= (1 << rb);
}
void
nvsBitClear(long *rec, int bit)
{
int ri = bit / LONGBITS;
int rb = bit % LONGBITS;
rec[ri] &= ~(1 << rb);
}
void
nvsRecInit(long **rec, int max)
{
int c = (max / LONGBITS) + ((max % LONGBITS) ? 1 : 0);
*rec = calloc(c, sizeof(long));
}
int
nvsAllocIndex(long *rec, int max)
{
int c = (max / LONGBITS) + ((max % LONGBITS) ? 1 : 0);
int i, idx = 0;
for (i=0;i<c;i++) {
idx = ffsl(~rec[i]);
if (idx) {
nvsBitSet(rec, (idx - 1));
break;
}
}
return (idx - 1);
}
|