#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
-
+#include "util/u_inlines.h"
+#include "svga_screen_cache.h"
struct pipe_context;
struct pipe_screen;
enum SVGA3dSurfaceFormat;
-#define SVGA_MAX_TEXTURE_LEVELS 12 /* 2048x2048 */
+#define SVGA_MAX_TEXTURE_LEVELS 16
/**
{
struct pipe_reference reference;
- struct svga_texture *texture;
+ struct pipe_texture *texture;
int min_lod;
int max_lod;
unsigned age;
+ struct svga_host_surface_cache_key key;
struct svga_winsys_surface *handle;
};
{
struct pipe_texture base;
- struct svga_winsys_surface *handle;
-
- boolean defined[6][PIPE_MAX_TEXTURE_LEVELS];
+ boolean defined[6][SVGA_MAX_TEXTURE_LEVELS];
struct svga_sampler_view *cached_view;
unsigned age;
boolean views_modified;
+
+ /**
+ * Creation key for the host surface handle.
+ *
+ * This structure describes all the host surface characteristics so that it
+ * can be looked up in cache, since creating a host surface is often a slow
+ * operation.
+ */
+ struct svga_host_surface_cache_key key;
+
+ /**
+ * Handle for the host side surface.
+ *
+ * This handle is owned by this texture. Views should hold on to a reference
+ * to this texture and never destroy this handle directly.
+ */
+ struct svga_winsys_surface *handle;
};
{
struct pipe_surface base;
+ struct svga_host_surface_cache_key key;
struct svga_winsys_surface *handle;
unsigned real_face;
{
struct svga_sampler_view *old = *ptr;
- if (pipe_reference((struct pipe_reference **)ptr, &v->reference))
+ if (pipe_reference(&(*ptr)->reference, &v->reference))
svga_destroy_sampler_view_priv(old);
+ *ptr = v;
}
extern void
extern void
svga_screen_init_texture_functions(struct pipe_screen *screen);
+void
+svga_init_texture_functions(struct pipe_context *pipe);
+
enum SVGA3dSurfaceFormat
svga_translate_format(enum pipe_format format);