summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv30/nv30_state.h
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2012-01-11 12:42:07 +0100
committerBen Skeggs <[email protected]>2012-04-14 02:56:34 +1000
commita2fc42b899de22273c1df96091bfb5c636075cb0 (patch)
treed3c4981bf8b611e1cea9876e9235b142f7fd39d0 /src/gallium/drivers/nv30/nv30_state.h
parent6d1cdec3ba151168bfc3aef222fba6265dfb41fb (diff)
nv30: import new driver for GeForce FX/6/7 chipsets, and Quadro variants
The primary motivation for this rewrite was to have a maintainable driver going forward, as nvfx was quite horrible in a lot of ways. The driver is heavily based on the design of the nv50/nvc0 3d drivers we already have, and uses the same common buffer/fence code. It also passes a HEAP more piglit tests than nvfx did, supports a couple more features, and a few more to come still probably. The CPU footprint of this driver is far far less than nvfx, and translates into far greater framerates in a lot of applications (unless you're using a CPU that's way way newer than the GPUs of these generations....) Basically, we once again have a maintained driver for these chipsets \o/ Feel free to report bugs now!
Diffstat (limited to 'src/gallium/drivers/nv30/nv30_state.h')
-rw-r--r--src/gallium/drivers/nv30/nv30_state.h144
1 files changed, 144 insertions, 0 deletions
diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h
new file mode 100644
index 00000000000..a219bf20951
--- /dev/null
+++ b/src/gallium/drivers/nv30/nv30_state.h
@@ -0,0 +1,144 @@
+#ifndef __NV30_STATE_H__
+#define __NV30_STATE_H__
+
+#include "pipe/p_state.h"
+#include "tgsi/tgsi_scan.h"
+#include "util/u_dynarray.h"
+
+#define NV30_QUERY_ZCULL_0 (PIPE_QUERY_TYPES + 0)
+#define NV30_QUERY_ZCULL_1 (PIPE_QUERY_TYPES + 1)
+#define NV30_QUERY_ZCULL_2 (PIPE_QUERY_TYPES + 2)
+#define NV30_QUERY_ZCULL_3 (PIPE_QUERY_TYPES + 3)
+
+#define SB_DATA(so, u) (so)->data[(so)->size++] = (u)
+#define SB_MTHD30(so, mthd, size) \
+ SB_DATA((so), ((size) << 18) | (7 << 13) | NV30_3D_##mthd)
+#define SB_MTHD40(so, mthd, size) \
+ SB_DATA((so), ((size) << 18) | (7 << 13) | NV40_3D_##mthd)
+
+struct nv30_blend_stateobj {
+ struct pipe_blend_state pipe;
+ unsigned data[16];
+ unsigned size;
+};
+
+struct nv30_rasterizer_stateobj {
+ struct pipe_rasterizer_state pipe;
+ unsigned data[32];
+ unsigned size;
+};
+
+struct nv30_zsa_stateobj {
+ struct pipe_depth_stencil_alpha_state pipe;
+ unsigned data[32];
+ unsigned size;
+};
+
+struct nv30_sampler_state {
+ struct pipe_sampler_state pipe;
+ unsigned fmt;
+ unsigned wrap;
+ unsigned en;
+ unsigned filt;
+ unsigned bcol;
+ /* 4.8 */
+ unsigned min_lod;
+ unsigned max_lod;
+};
+
+struct nv30_sampler_view {
+ struct pipe_sampler_view pipe;
+ unsigned fmt;
+ unsigned swz;
+ unsigned filt;
+ unsigned filt_mask;
+ unsigned wrap;
+ unsigned wrap_mask;
+ unsigned npot_size0;
+ unsigned npot_size1;
+ /* 4.8 */
+ unsigned base_lod;
+ unsigned high_lod;
+};
+
+struct nv30_shader_reloc {
+ unsigned location;
+ unsigned target;
+};
+
+struct nv30_vertprog_exec {
+ uint32_t data[4];
+};
+
+struct nv30_vertprog_data {
+ int index; /* immediates == -1 */
+ float value[4];
+};
+
+struct nv30_vertprog {
+ struct pipe_shader_state pipe;
+ struct tgsi_shader_info info;
+
+ struct draw_vertex_shader *draw;
+ boolean translated;
+ unsigned enabled_ucps;
+ uint16_t texcoord[10];
+
+ struct util_dynarray branch_relocs;
+ struct nv30_vertprog_exec *insns;
+ unsigned nr_insns;
+
+ struct util_dynarray const_relocs;
+ struct nv30_vertprog_data *consts;
+ unsigned nr_consts;
+
+ struct nouveau_heap *exec;
+ struct nouveau_heap *data;
+ uint32_t ir;
+ uint32_t or;
+ void *nvfx;
+};
+
+struct nv30_fragprog_data {
+ unsigned offset;
+ unsigned index;
+};
+
+struct nv30_fragprog {
+ struct pipe_shader_state pipe;
+ struct tgsi_shader_info info;
+
+ struct draw_fragment_shader *draw;
+ boolean translated;
+
+ uint32_t *insn;
+ unsigned insn_len;
+
+ uint16_t texcoord[10];
+ struct nv30_fragprog_data *consts;
+ unsigned nr_consts;
+
+ struct pipe_resource *buffer;
+ uint32_t vp_or; /* appended to VP_RESULT_EN */
+ uint32_t fp_control;
+ uint32_t point_sprite_control;
+ uint32_t coord_conventions;
+ uint32_t samplers;
+ uint32_t rt_enable;
+};
+
+struct nv30_vertex_element {
+ unsigned state;
+};
+
+struct nv30_vertex_stateobj {
+ struct pipe_vertex_element pipe[PIPE_MAX_ATTRIBS];
+ struct translate *translate;
+ bool need_conversion;
+ unsigned num_elements;
+ unsigned vtx_size;
+ unsigned vtx_per_packet_max;
+ struct nv30_vertex_element element[];
+};
+
+#endif