* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
+#include <assert.h>
+#include <string.h>
#include "util/u_format.h"
#include "util/u_memory.h"
VIRGL_OBJ_RS_S0_LINE_STIPPLE_ENABLE(state->line_stipple_enable) |
VIRGL_OBJ_RS_S0_LINE_LAST_PIXEL(state->line_last_pixel) |
VIRGL_OBJ_RS_S0_HALF_PIXEL_CENTER(state->half_pixel_center) |
- VIRGL_OBJ_RS_S0_BOTTOM_EDGE_RULE(state->bottom_edge_rule);
+ VIRGL_OBJ_RS_S0_BOTTOM_EDGE_RULE(state->bottom_edge_rule) |
+ VIRGL_OBJ_RS_S0_FORCE_PERSAMPLE_INTERP(state->force_persample_interp);
virgl_encoder_write_dword(ctx->cbuf, tmp); /* S0 */
virgl_encoder_write_dword(ctx->cbuf, fui(state->point_size)); /* S1 */
double depth, unsigned stencil)
{
int i;
+ uint64_t qword;
+
+ STATIC_ASSERT(sizeof(qword) == sizeof(depth));
+ memcpy(&qword, &depth, sizeof(qword));
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_CLEAR, 0, VIRGL_OBJ_CLEAR_SIZE));
virgl_encoder_write_dword(ctx->cbuf, buffers);
for (i = 0; i < 4; i++)
virgl_encoder_write_dword(ctx->cbuf, color->ui[i]);
- virgl_encoder_write_qword(ctx->cbuf, *(uint64_t *)&depth);
+ virgl_encoder_write_qword(ctx->cbuf, qword);
virgl_encoder_write_dword(ctx->cbuf, stencil);
return 0;
}
int i;
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_VERTEX_BUFFERS, 0, VIRGL_SET_VERTEX_BUFFERS_SIZE(num_buffers)));
for (i = 0; i < num_buffers; i++) {
- struct virgl_resource *res = virgl_resource(buffers[i].buffer);
+ struct virgl_resource *res = virgl_resource(buffers[i].buffer.resource);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].stride);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_offset);
virgl_encoder_write_res(ctx, res);
}
int virgl_encoder_set_index_buffer(struct virgl_context *ctx,
- const struct pipe_index_buffer *ib)
+ const struct virgl_indexbuf *ib)
{
int length = VIRGL_SET_INDEX_BUFFER_SIZE(ib);
struct virgl_resource *res = NULL;
int virgl_encoder_draw_vbo(struct virgl_context *ctx,
const struct pipe_draw_info *info)
{
- virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_DRAW_VBO, 0, VIRGL_DRAW_VBO_SIZE));
+ uint32_t length = VIRGL_DRAW_VBO_SIZE;
+ if (info->indirect)
+ length = VIRGL_DRAW_VBO_SIZE_INDIRECT;
+ virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_DRAW_VBO, 0, length));
virgl_encoder_write_dword(ctx->cbuf, info->start);
virgl_encoder_write_dword(ctx->cbuf, info->count);
virgl_encoder_write_dword(ctx->cbuf, info->mode);
- virgl_encoder_write_dword(ctx->cbuf, info->indexed);
+ virgl_encoder_write_dword(ctx->cbuf, !!info->index_size);
virgl_encoder_write_dword(ctx->cbuf, info->instance_count);
virgl_encoder_write_dword(ctx->cbuf, info->index_bias);
virgl_encoder_write_dword(ctx->cbuf, info->start_instance);
virgl_encoder_write_dword(ctx->cbuf, info->count_from_stream_output->buffer_size);
else
virgl_encoder_write_dword(ctx->cbuf, 0);
+ if (length == VIRGL_DRAW_VBO_SIZE_INDIRECT) {
+ virgl_encoder_write_dword(ctx->cbuf, 0); /* vertices per patch */
+ virgl_encoder_write_dword(ctx->cbuf, 0); /* drawid */
+ virgl_encoder_write_res(ctx, virgl_resource(info->indirect->buffer));
+ virgl_encoder_write_dword(ctx->cbuf, info->indirect->offset);
+ virgl_encoder_write_dword(ctx->cbuf, 0); /* indirect stride */
+ virgl_encoder_write_dword(ctx->cbuf, 0); /* indirect draw count */
+ virgl_encoder_write_dword(ctx->cbuf, 0); /* indirect draw count offset */
+ virgl_encoder_write_dword(ctx->cbuf, 0); /* indirect draw count handle */
+ }
return 0;
}
int virgl_encoder_render_condition(struct virgl_context *ctx,
uint32_t handle, boolean condition,
- uint mode)
+ enum pipe_render_cond_flag mode)
{
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_RENDER_CONDITION, 0, VIRGL_RENDER_CONDITION_SIZE));
virgl_encoder_write_dword(ctx->cbuf, handle);