Merge branch '7.8'
[mesa.git] / src / gallium / drivers / nvfx / nvfx_state_blend.c
1 #include "nvfx_context.h"
2
3 static boolean
4 nvfx_state_blend_validate(struct nvfx_context *nvfx)
5 {
6 so_ref(nvfx->blend->so, &nvfx->state.hw[NVFX_STATE_BLEND]);
7 return TRUE;
8 }
9
10 struct nvfx_state_entry nvfx_state_blend = {
11 .validate = nvfx_state_blend_validate,
12 .dirty = {
13 .pipe = NVFX_NEW_BLEND,
14 .hw = NVFX_STATE_BLEND
15 }
16 };
17
18 static boolean
19 nvfx_state_blend_colour_validate(struct nvfx_context *nvfx)
20 {
21 struct nouveau_stateobj *so = so_new(1, 1, 0);
22 struct pipe_blend_color *bcol = &nvfx->blend_colour;
23
24 so_method(so, nvfx->screen->eng3d, NV34TCL_BLEND_COLOR, 1);
25 so_data (so, ((float_to_ubyte(bcol->color[3]) << 24) |
26 (float_to_ubyte(bcol->color[0]) << 16) |
27 (float_to_ubyte(bcol->color[1]) << 8) |
28 (float_to_ubyte(bcol->color[2]) << 0)));
29
30 so_ref(so, &nvfx->state.hw[NVFX_STATE_BCOL]);
31 so_ref(NULL, &so);
32 return TRUE;
33 }
34
35 struct nvfx_state_entry nvfx_state_blend_colour = {
36 .validate = nvfx_state_blend_colour_validate,
37 .dirty = {
38 .pipe = NVFX_NEW_BCOL,
39 .hw = NVFX_STATE_BCOL
40 }
41 };