2 * Copyright © 2012 Intel Corporation
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:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 #include "main/blend.h"
25 #include "main/mtypes.h"
26 #include "main/samplerobj.h"
27 #include "main/texformat.h"
28 #include "main/teximage.h"
29 #include "program/prog_parameter.h"
30 #include "program/prog_instruction.h"
32 #include "intel_mipmap_tree.h"
33 #include "intel_batchbuffer.h"
34 #include "intel_tex.h"
35 #include "intel_fbo.h"
36 #include "intel_buffer_objects.h"
37 #include "intel_image.h"
39 #include "brw_context.h"
40 #include "brw_state.h"
41 #include "brw_defines.h"
46 gen8_allocate_surface_state(struct brw_context
*brw
,
47 uint32_t *out_offset
, int index
)
49 int dwords
= brw
->gen
>= 9 ? 16 : 13;
50 uint32_t *surf
= __brw_state_batch(brw
, AUB_TRACE_SURFACE_STATE
,
51 dwords
* 4, 64, index
, out_offset
);
52 memset(surf
, 0, dwords
* 4);
57 * Creates a null surface.
59 * This is used when the shader doesn't write to any color output. An FB
60 * write to target 0 will still be emitted, because that's how the thread is
61 * terminated (and computed depth is returned), so we need to have the
62 * hardware discard the target 0 color output..
65 gen8_emit_null_surface_state(struct brw_context
*brw
,
71 uint32_t *surf
= gen8_allocate_surface_state(brw
, out_offset
, -1);
73 surf
[0] = BRW_SURFACE_NULL
<< BRW_SURFACE_TYPE_SHIFT
|
74 BRW_SURFACEFORMAT_B8G8R8A8_UNORM
<< BRW_SURFACE_FORMAT_SHIFT
|
75 GEN8_SURFACE_TILING_Y
;
76 surf
[2] = SET_FIELD(width
- 1, GEN7_SURFACE_WIDTH
) |
77 SET_FIELD(height
- 1, GEN7_SURFACE_HEIGHT
);
81 gen8_init_vtable_surface_functions(struct brw_context
*brw
)
83 brw
->vtbl
.update_renderbuffer_surface
= brw_update_renderbuffer_surface
;
84 brw
->vtbl
.emit_null_surface_state
= gen8_emit_null_surface_state
;