aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/nine_shader.h
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-09-19 19:00:23 +0200
committerAxel Davy <[email protected]>2016-10-10 23:43:50 +0200
commitb9639c661fb6b52c8abb96c06263f85ca4bd78c1 (patch)
tree639d0534ff10c8f80789d206f40b2a9cc90cdbe0 /src/gallium/state_trackers/nine/nine_shader.h
parent3bf02d383fe94a69dfec3ff54ede3e3b2e9dff6b (diff)
st/nine: Initial ProcessVertices support
For now only VS 3 support is implemented. This enables The Sims 2 to work. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/nine_shader.h')
-rw-r--r--src/gallium/state_trackers/nine/nine_shader.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/nine/nine_shader.h b/src/gallium/state_trackers/nine/nine_shader.h
index 092ae634d7d..72a28b8055f 100644
--- a/src/gallium/state_trackers/nine/nine_shader.h
+++ b/src/gallium/state_trackers/nine/nine_shader.h
@@ -26,10 +26,12 @@
#include "d3d9types.h"
#include "d3d9caps.h"
#include "nine_defines.h"
+#include "nine_helpers.h"
#include "pipe/p_state.h" /* PIPE_MAX_ATTRIBS */
#include "util/u_memory.h"
struct NineDevice9;
+struct NineVertexDeclaration9;
struct nine_lconstf /* NOTE: both pointers should be FREE'd by the user */
{
@@ -78,6 +80,18 @@ struct nine_shader_info
uint8_t bumpenvmat_needed;
boolean swvp_on;
+
+ boolean process_vertices;
+ struct NineVertexDeclaration9 *vdecl_out;
+ struct pipe_stream_output_info so;
+};
+
+struct nine_vs_output_info
+{
+ BYTE output_semantic;
+ int output_semantic_index;
+ int mask;
+ int output_index;
};
static inline void
@@ -147,4 +161,65 @@ nine_shader_variants_free(struct nine_shader_variant *list)
}
}
+struct nine_shader_variant_so
+{
+ struct nine_shader_variant_so *next;
+ struct NineVertexDeclaration9 *vdecl;
+ struct pipe_stream_output_info so;
+ void *cso;
+};
+
+static inline void *
+nine_shader_variant_so_get(struct nine_shader_variant_so *list,
+ struct NineVertexDeclaration9 *vdecl,
+ struct pipe_stream_output_info *so)
+{
+ while (list->vdecl != vdecl && list->next)
+ list = list->next;
+ if (list->vdecl == vdecl) {
+ *so = list->so;
+ return list->cso;
+ }
+ return NULL;
+}
+
+static inline boolean
+nine_shader_variant_so_add(struct nine_shader_variant_so *list,
+ struct NineVertexDeclaration9 *vdecl,
+ struct pipe_stream_output_info *so, void *cso)
+{
+ if (list->vdecl == NULL) { /* first shader */
+ list->next = NULL;
+ nine_bind(&list->vdecl, vdecl);
+ list->so = *so;
+ list->cso = cso;
+ return TRUE;
+ }
+ while (list->next) {
+ assert(list->vdecl != vdecl);
+ list = list->next;
+ }
+ list->next = MALLOC_STRUCT(nine_shader_variant_so);
+ if (!list->next)
+ return FALSE;
+ list->next->next = NULL;
+ nine_bind(&list->vdecl, vdecl);
+ list->next->so = *so;
+ list->next->cso = cso;
+ return TRUE;
+}
+
+static inline void
+nine_shader_variants_so_free(struct nine_shader_variant_so *list)
+{
+ while (list->next) {
+ struct nine_shader_variant_so *ptr = list->next;
+ list->next = ptr->next;
+ nine_bind(&ptr->vdecl, NULL);
+ FREE(ptr);
+ }
+ if (list->vdecl)
+ nine_bind(&list->vdecl, NULL);
+}
+
#endif /* _NINE_SHADER_H_ */