#include "pipe/p_defines.h"
#include "util/u_bitmask.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_helpers.h"
#include "util/u_inlines.h"
#include "util/u_math.h"
#include "svga_screen.h"
-static void svga_set_vertex_buffers(struct pipe_context *pipe,
- unsigned start_slot, unsigned count,
- const struct pipe_vertex_buffer *buffers)
+static void
+svga_set_vertex_buffers(struct pipe_context *pipe,
+ unsigned start_slot, unsigned count,
+ const struct pipe_vertex_buffer *buffers)
{
struct svga_context *svga = svga_context(pipe);
}
-static void svga_set_index_buffer(struct pipe_context *pipe,
- const struct pipe_index_buffer *ib)
-{
- struct svga_context *svga = svga_context(pipe);
-
- util_set_index_buffer(&svga->curr.ib, ib);
-}
-
-
/**
* Does the given vertex attrib format need range adjustment in the VS?
* Range adjustment scales and biases values from [0,1] to [-1,1].
struct svga_velems_state *velems)
{
SVGA3dInputElementDesc elements[PIPE_MAX_ATTRIBS];
- enum pipe_error ret;
unsigned i;
assert(velems->count <= PIPE_MAX_ATTRIBS);
velems->id = util_bitmask_add(svga->input_element_object_id_bm);
- ret = SVGA3D_vgpu10_DefineElementLayout(svga->swc, velems->count,
- velems->id, elements);
- if (ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = SVGA3D_vgpu10_DefineElementLayout(svga->swc, velems->count,
- velems->id, elements);
- assert(ret == PIPE_OK);
- }
+ SVGA_RETRY(svga, SVGA3D_vgpu10_DefineElementLayout(svga->swc, velems->count,
+ velems->id, elements));
}
}
svga->hud.num_vertexelement_objects++;
+ SVGA_STATS_COUNT_INC(svga_screen(svga->pipe.screen)->sws,
+ SVGA_STATS_COUNT_VERTEXELEMENT);
return velems;
}
struct svga_velems_state *velems = (struct svga_velems_state *) state;
if (svga_have_vgpu10(svga)) {
- enum pipe_error ret;
-
svga_hwtnl_flush_retry(svga);
- ret = SVGA3D_vgpu10_DestroyElementLayout(svga->swc, velems->id);
- if (ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = SVGA3D_vgpu10_DestroyElementLayout(svga->swc, velems->id);
- assert(ret == PIPE_OK);
- }
+ SVGA_RETRY(svga, SVGA3D_vgpu10_DestroyElementLayout(svga->swc,
+ velems->id));
if (velems->id == svga->state.hw_draw.layout_id)
svga->state.hw_draw.layout_id = SVGA3D_INVALID_ID;
svga->hud.num_vertexelement_objects--;
}
-void svga_cleanup_vertex_state( struct svga_context *svga )
+
+void
+svga_cleanup_vertex_state(struct svga_context *svga)
{
unsigned i;
-
+
for (i = 0 ; i < svga->curr.num_vertex_buffers; i++)
- pipe_resource_reference(&svga->curr.vb[i].buffer, NULL);
+ pipe_vertex_buffer_unreference(&svga->curr.vb[i]);
pipe_resource_reference(&svga->state.hw_draw.ib, NULL);
}
-void svga_init_vertex_functions( struct svga_context *svga )
+void
+svga_init_vertex_functions(struct svga_context *svga)
{
svga->pipe.set_vertex_buffers = svga_set_vertex_buffers;
- svga->pipe.set_index_buffer = svga_set_index_buffer;
svga->pipe.create_vertex_elements_state = svga_create_vertex_elements_state;
svga->pipe.bind_vertex_elements_state = svga_bind_vertex_elements_state;
svga->pipe.delete_vertex_elements_state = svga_delete_vertex_elements_state;