Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/drivers/nouveau/nv30/nv40_verttex.c
4574 views
1
/*
2
* Copyright 2012 Red Hat Inc.
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice shall be included in
12
* all copies or substantial portions of the Software.
13
*
14
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
* OTHER DEALINGS IN THE SOFTWARE.
21
*
22
* Authors: Ben Skeggs
23
*
24
*/
25
26
#include "util/u_inlines.h"
27
#include "nv30/nv30_context.h"
28
29
void
30
nv40_verttex_validate(struct nv30_context *nv30)
31
{
32
struct nouveau_pushbuf *push = nv30->base.pushbuf;
33
unsigned dirty = nv30->vertprog.dirty_samplers;
34
35
while (dirty) {
36
unsigned unit = ffs(dirty) - 1;
37
struct nv30_sampler_view *sv = (void *)nv30->fragprog.textures[unit];
38
struct nv30_sampler_state *ss = nv30->fragprog.samplers[unit];
39
40
if (ss && sv) {
41
} else {
42
BEGIN_NV04(push, NV40_3D(VTXTEX_ENABLE(unit)), 1);
43
PUSH_DATA (push, 0);
44
}
45
dirty &= ~(1 << unit);
46
}
47
48
nv30->vertprog.dirty_samplers = 0;
49
}
50
51
void
52
nv40_verttex_sampler_states_bind(struct pipe_context *pipe,
53
unsigned nr, void **hwcso)
54
{
55
struct nv30_context *nv30 = nv30_context(pipe);
56
unsigned i;
57
58
for (i = 0; i < nr; i++) {
59
nv30->vertprog.samplers[i] = hwcso[i];
60
nv30->vertprog.dirty_samplers |= (1 << i);
61
}
62
63
for (; i < nv30->vertprog.num_samplers; i++) {
64
nv30->vertprog.samplers[i] = NULL;
65
nv30->vertprog.dirty_samplers |= (1 << i);
66
}
67
68
nv30->vertprog.num_samplers = nr;
69
nv30->dirty |= NV30_NEW_VERTTEX;
70
}
71
72
73
void
74
nv40_verttex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
75
struct pipe_sampler_view **views)
76
{
77
struct nv30_context *nv30 = nv30_context(pipe);
78
unsigned i;
79
80
for (i = 0; i < nr; i++) {
81
nouveau_bufctx_reset(nv30->bufctx, BUFCTX_VERTTEX(i));
82
pipe_sampler_view_reference(&nv30->vertprog.textures[i], views[i]);
83
nv30->vertprog.dirty_samplers |= (1 << i);
84
}
85
86
for (; i < nv30->vertprog.num_textures; i++) {
87
nouveau_bufctx_reset(nv30->bufctx, BUFCTX_VERTTEX(i));
88
pipe_sampler_view_reference(&nv30->vertprog.textures[i], NULL);
89
nv30->vertprog.dirty_samplers |= (1 << i);
90
}
91
92
nv30->vertprog.num_textures = nr;
93
nv30->dirty |= NV30_NEW_VERTTEX;
94
}
95
96
void
97
nv40_verttex_init(struct pipe_context *pipe)
98
{
99
/* nothing */
100
}
101
102