#include "pipe/p_state.h"
#include "util/u_blitter.h"
-#include "util/u_double_list.h"
+#include "util/list.h"
#include "tgsi/tgsi_scan.h"
+#include "svga_screen.h"
#include "svga_state.h"
#include "svga_tgsi.h"
+#include "svga_winsys.h"
#include "svga_hw_reg.h"
#include "svga3d_shaderdefs.h"
+/** Non-GPU queries for gallium HUD */
+#define SVGA_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0)
+#define SVGA_QUERY_FALLBACKS (PIPE_QUERY_DRIVER_SPECIFIC + 1)
+#define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 2)
+
+
struct draw_vertex_shader;
struct draw_fragment_shader;
-struct svga_shader_result;
+struct svga_shader_variant;
struct SVGACmdMemory;
struct util_bitmask;
-struct u_upload_mgr;
struct svga_shader
struct tgsi_shader_info info;
- struct svga_shader_result *results;
+ /** Head of linked list of variants */
+ struct svga_shader_variant *variants;
unsigned id; /**< for debugging only */
};
+
struct svga_fragment_shader
{
struct svga_shader base;
int8_t generic_remap_table[MAX_GENERIC_VARYING];
};
+
struct svga_vertex_shader
{
struct svga_shader base;
float slopescaledepthbias;
float depthbias;
float pointsize;
+ float linewidth;
unsigned hw_unfilled:16; /* PIPE_POLYGON_MODE_x */
struct svga_velems_state {
unsigned count;
struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
+ SVGA3dDeclType decl_type[PIPE_MAX_ATTRIBS]; /**< vertex attrib formats */
+ unsigned adjust_attrib_range; /* bitmask of attrs needing range adjustment */
+ unsigned adjust_attrib_w_1; /* bitmask of attrs needing w = 1 */
+ boolean need_swvfetch;
};
/* Use to calculate differences between state emitted to hardware and
struct pipe_vertex_buffer vb[PIPE_MAX_ATTRIBS];
struct pipe_index_buffer ib;
- struct pipe_resource *cb[PIPE_SHADER_TYPES];
+ struct pipe_constant_buffer cbufs[PIPE_SHADER_TYPES];
struct pipe_framebuffer_state framebuffer;
float depthscale;
unsigned flag_1d;
unsigned flag_srgb;
} tex_flags;
-
- boolean any_user_vertex_buffers;
};
struct svga_prescale {
unsigned ts[SVGA3D_PIXEL_SAMPLERREG_MAX][SVGA3D_TS_MAX];
float cb[PIPE_SHADER_TYPES][SVGA3D_CONSTREG_MAX][4];
- struct svga_shader_result *fs;
- struct svga_shader_result *vs;
+ /**
+ * For guest backed shader constants only.
+ */
+ struct svga_winsys_surface *hw_cb[PIPE_SHADER_TYPES];
+
+ struct svga_shader_variant *fs;
+ struct svga_shader_variant *vs;
struct svga_hw_view_state views[PIPE_MAX_SAMPLERS];
unsigned num_views;
*/
struct svga_sw_state
{
- unsigned ve_format[PIPE_MAX_ATTRIBS]; /* NEW_VELEMENT */
-
/* which parts we need */
boolean need_swvfetch;
boolean need_pipeline;
} swtnl;
/* Bitmask of used shader IDs */
- struct util_bitmask *fs_bm;
- struct util_bitmask *vs_bm;
+ struct util_bitmask *shader_id_bm;
struct {
unsigned dirty[SVGA_STATE_MAX];
struct {
unsigned rendertargets:1;
unsigned texture_samplers:1;
+ unsigned vs:1;
+ unsigned fs:1;
} rebind;
- struct u_upload_mgr *upload_ib;
- struct u_upload_mgr *upload_vb;
struct svga_hwtnl *hwtnl;
/** The occlusion query currently in progress */
/** List of buffers with queued transfers */
struct list_head dirty_buffers;
+
+ /** performance / info queries */
+ uint64_t num_draw_calls; /**< SVGA_QUERY_DRAW_CALLS */
+ uint64_t num_fallbacks; /**< SVGA_QUERY_FALLBACKS */
};
/* A flag for each state_tracker state object:
#define SVGA_NEW_NEED_PIPELINE 0x100000
#define SVGA_NEW_NEED_SWVFETCH 0x200000
#define SVGA_NEW_NEED_SWTNL 0x400000
-#define SVGA_NEW_FS_RESULT 0x800000
-#define SVGA_NEW_VS_RESULT 0x1000000
+#define SVGA_NEW_FS_VARIANT 0x800000
+#define SVGA_NEW_VS_VARIANT 0x1000000
#define SVGA_NEW_TEXTURE_FLAGS 0x4000000
#define SVGA_NEW_STENCIL_REF 0x8000000
struct pipe_context *
svga_context_create(struct pipe_screen *screen,
- void *priv);
+ void *priv, unsigned flags);
/***********************************************************************
* Inline conversion functions. These are better-typed than the
* macros used previously:
*/
-static INLINE struct svga_context *
+static inline struct svga_context *
svga_context( struct pipe_context *pipe )
{
return (struct svga_context *)pipe;
}
+static inline boolean
+svga_have_gb_objects(const struct svga_context *svga)
+{
+ return svga_screen(svga->pipe.screen)->sws->have_gb_objects;
+}
+
+static inline boolean
+svga_have_gb_dma(const struct svga_context *svga)
+{
+ return svga_screen(svga->pipe.screen)->sws->have_gb_dma;
+}
+
#endif