i965g: wip on removing GL stuff, trying to get a few files compiling
[mesa.git] / src / gallium / drivers / i965 / brw_pipe_depth.c
1
2 static void *
3 brw_create_depth_stencil( struct pipe_context *pipe,
4 const struct pipe_depth_stencil_alpha_state *tmpl )
5 {
6 if (tmpl->stencil[0].enable) {
7 cc.cc0.stencil_enable = 1;
8 cc.cc0.stencil_func =
9 intel_translate_compare_func(key->stencil_func[0]);
10 cc.cc0.stencil_fail_op =
11 intel_translate_stencil_op(key->stencil_fail_op[0]);
12 cc.cc0.stencil_pass_depth_fail_op =
13 intel_translate_stencil_op(key->stencil_pass_depth_fail_op[0]);
14 cc.cc0.stencil_pass_depth_pass_op =
15 intel_translate_stencil_op(key->stencil_pass_depth_pass_op[0]);
16 cc.cc1.stencil_ref = key->stencil_ref[0];
17 cc.cc1.stencil_write_mask = key->stencil_write_mask[0];
18 cc.cc1.stencil_test_mask = key->stencil_test_mask[0];
19
20 if (tmpl->stencil[1].enable) {
21 cc.cc0.bf_stencil_enable = 1;
22 cc.cc0.bf_stencil_func =
23 intel_translate_compare_func(key->stencil_func[1]);
24 cc.cc0.bf_stencil_fail_op =
25 intel_translate_stencil_op(key->stencil_fail_op[1]);
26 cc.cc0.bf_stencil_pass_depth_fail_op =
27 intel_translate_stencil_op(key->stencil_pass_depth_fail_op[1]);
28 cc.cc0.bf_stencil_pass_depth_pass_op =
29 intel_translate_stencil_op(key->stencil_pass_depth_pass_op[1]);
30 cc.cc1.bf_stencil_ref = key->stencil_ref[1];
31 cc.cc2.bf_stencil_write_mask = key->stencil_write_mask[1];
32 cc.cc2.bf_stencil_test_mask = key->stencil_test_mask[1];
33 }
34
35 /* Not really sure about this:
36 */
37 cc.cc0.stencil_write_enable = (cc.cc1.stencil_write_mask ||
38 cc.cc2.bf_stencil_write_mask);
39 }
40
41
42 if (key->alpha_enabled) {
43 cc.cc3.alpha_test = 1;
44 cc.cc3.alpha_test_func = intel_translate_compare_func(key->alpha_func);
45 cc.cc3.alpha_test_format = BRW_ALPHATEST_FORMAT_UNORM8;
46
47 UNCLAMPED_FLOAT_TO_UBYTE(cc.cc7.alpha_ref.ub[0], key->alpha_ref);
48 }
49
50 /* _NEW_DEPTH */
51 if (key->depth_test) {
52 cc.cc2.depth_test = 1;
53 cc.cc2.depth_test_function = intel_translate_compare_func(key->depth_func);
54 cc.cc2.depth_write_enable = key->depth_write;
55 }
56
57
58 }