summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-03-20 15:18:27 +1000
committerDave Airlie <airlied@redhat.com>2015-03-20 15:23:29 +1000
commit16990471e7038b933d21fc96c51274d92bd290ae (patch)
tree384d74fa7439d006cef457f5ddb7ae2f5246ce0c
parent38f01a3dafe999452eb1157d1446188b1f1bf154 (diff)
renderer: misc cleanups
move some static decls around, drop useless struct
-rw-r--r--src/vrend_renderer.c59
-rw-r--r--src/vrend_renderer.h8
2 files changed, 19 insertions, 48 deletions
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index b94f6df..bc053b7 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -46,22 +46,8 @@
#include "vrend_renderer.h"
#include "virgl_hw.h"
-/* transfer boxes from the guest POV are in y = 0 = top orientation */
-/* blit/copy operations from the guest POV are in y = 0 = top orientation */
-
-/* since we are storing things in OpenGL FBOs we need to flip transfer operations by default */
-
-static struct vrend_resource *vrend_renderer_ctx_res_lookup(struct vrend_context *ctx, int res_handle);
-static void vrend_update_viewport_state(struct vrend_context *ctx);
-static void vrend_update_scissor_state(struct vrend_context *ctx);
-static void vrend_destroy_query_object(void *obj_ptr);
-static void vrend_finish_context_switch(struct vrend_context *ctx);
-static void vrend_patch_blend_func(struct vrend_context *ctx);
-static void vrend_update_frontface_state(struct vrend_context *ctx);
-static void vrender_get_glsl_version(int *glsl_version);
-static void vrend_destroy_resource_object(void *obj_ptr);
-static void vrend_renderer_detach_res_ctx_p(struct vrend_context *ctx, int res_handle);
+/* debugging aid to dump shaders */
int vrend_dump_shaders;
struct vrend_if_cbs *vrend_clicbs;
@@ -167,10 +153,6 @@ struct vrend_shader_selector {
struct tgsi_token *tokens;
};
-struct vrend_buffer {
- struct vrend_resource base;
-};
-
struct vrend_texture {
struct vrend_resource base;
struct pipe_sampler_state state;
@@ -386,6 +368,16 @@ struct vrend_context {
struct vrend_shader_cfg shader_cfg;
};
+static struct vrend_resource *vrend_renderer_ctx_res_lookup(struct vrend_context *ctx, int res_handle);
+static void vrend_update_viewport_state(struct vrend_context *ctx);
+static void vrend_update_scissor_state(struct vrend_context *ctx);
+static void vrend_destroy_query_object(void *obj_ptr);
+static void vrend_finish_context_switch(struct vrend_context *ctx);
+static void vrend_patch_blend_func(struct vrend_context *ctx);
+static void vrend_update_frontface_state(struct vrend_context *ctx);
+static void vrender_get_glsl_version(int *glsl_version);
+static void vrend_destroy_resource_object(void *obj_ptr);
+static void vrend_renderer_detach_res_ctx_p(struct vrend_context *ctx, int res_handle);
static void vrend_destroy_program(struct vrend_linked_shader_program *ent);
static void vrend_apply_sampler_state(struct vrend_context *ctx,
struct vrend_resource *res,
@@ -652,6 +644,7 @@ static void vrend_alpha_test_enable(struct vrend_context *ctx, bool alpha_test_e
glDisable(GL_ALPHA_TEST);
}
}
+
static void vrend_stencil_test_enable(struct vrend_context *ctx, bool stencil_test_enable)
{
if (ctx->sub->stencil_test_enabled != stencil_test_enable) {
@@ -1736,6 +1729,7 @@ void vrend_set_uniform_buffer(struct vrend_context *ctx,
ctx->sub->const_bufs_used_mask[shader] &= ~(1 << index);
}
}
+
void vrend_set_index_buffer(struct vrend_context *ctx,
uint32_t res_handle,
uint32_t index_size,
@@ -1906,9 +1900,6 @@ void vrend_set_num_sampler_views(struct vrend_context *ctx,
ctx->sub->views[shader_type].num_views = start_slot + num_sampler_views;
}
-
-
-
static void vrend_destroy_shader_object(void *obj_ptr)
{
struct vrend_shader_selector *state = obj_ptr;
@@ -2277,7 +2268,7 @@ static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx,
for (i = 0; i < va->count; i++) {
struct vrend_vertex_element *ve = &va->elements[i];
int vbo_index = ve->base.vertex_buffer_index;
- struct vrend_buffer *buf;
+ struct vrend_resource *res;
GLint loc;
if (i >= ctx->sub->prog->ss[PIPE_SHADER_VERTEX]->sel->sinfo.num_inputs) {
@@ -2285,9 +2276,9 @@ static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx,
num_enable = ctx->sub->prog->ss[PIPE_SHADER_VERTEX]->sel->sinfo.num_inputs;
break;
}
- buf = (struct vrend_buffer *)ctx->sub->vbo[vbo_index].buffer;
+ res = (struct vrend_resource *)ctx->sub->vbo[vbo_index].buffer;
- if (!buf) {
+ if (!res) {
fprintf(stderr,"cannot find vbo buf %d %d %d\n", i, va->count, ctx->sub->prog->ss[PIPE_SHADER_VERTEX]->sel->sinfo.num_inputs);
continue;
}
@@ -2315,7 +2306,7 @@ static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx,
return;
}
- glBindBuffer(GL_ARRAY_BUFFER, buf->base.id);
+ glBindBuffer(GL_ARRAY_BUFFER, res->id);
if (ctx->sub->vbo[vbo_index].stride == 0) {
void *data;
@@ -3276,8 +3267,6 @@ void vrend_bind_sampler_states(struct vrend_context *ctx,
ctx->sub->sampler_state_dirty = true;
}
-
-
static void vrend_apply_sampler_state(struct vrend_context *ctx,
struct vrend_resource *res,
uint32_t shader_type,
@@ -3345,15 +3334,6 @@ static void vrend_apply_sampler_state(struct vrend_context *ctx,
tex->state = *state;
}
-void vrend_flush(struct vrend_context *ctx)
-{
- glFlush();
-}
-
-void vrend_flush_frontbuffer(uint32_t res_handle)
-{
-}
-
static GLenum tgsitargettogltarget(const enum pipe_texture_target target, int nr_samples)
{
switch(target) {
@@ -4664,7 +4644,6 @@ void vrend_set_sample_mask(struct vrend_context *ctx, unsigned sample_mask)
glSampleMaski(0, sample_mask);
}
-
static void vrend_hw_emit_streamout_targets(struct vrend_context *ctx, struct vrend_streamout_object *so_obj)
{
int i;
@@ -5222,7 +5201,6 @@ static void vrend_finish_context_switch(struct vrend_context *ctx)
vrend_clicbs->make_current(0, ctx->sub->gl_context);
}
-
void
vrend_renderer_object_destroy(struct vrend_context *ctx, uint32_t handle)
{
@@ -5617,7 +5595,6 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
}
}
}
-
}
GLint64 vrend_renderer_get_timestamp(void)
@@ -5743,6 +5720,7 @@ void vrend_renderer_detach_res_ctx(int ctx_id, int res_handle)
return;
vrend_renderer_detach_res_ctx_p(ctx, res_handle);
}
+
static struct vrend_resource *vrend_renderer_ctx_res_lookup(struct vrend_context *ctx, int res_handle)
{
struct vrend_resource *res = vrend_object_lookup(ctx->res_hash, res_handle, 1);
@@ -5831,7 +5809,6 @@ void vrend_renderer_create_sub_ctx(struct vrend_context *ctx, int sub_ctx_id)
ctx->sub0 = sub;
}
-
void vrend_renderer_destroy_sub_ctx(struct vrend_context *ctx, int sub_ctx_id)
{
struct vrend_sub_context *sub, *tofree = NULL;
diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h
index dc0122e..0fca5c4 100644
--- a/src/vrend_renderer.h
+++ b/src/vrend_renderer.h
@@ -131,10 +131,6 @@ void vrend_set_framebuffer_state(struct vrend_context *ctx,
uint32_t nr_cbufs, uint32_t surf_handle[8],
uint32_t zsurf_handle);
-void vrend_flush(struct vrend_context *ctx);
-
-
-void vrend_flush_frontbuffer(uint32_t res_handle);
struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *debug_name);
bool vrend_destroy_context(struct vrend_context *ctx);
int vrend_renderer_context_create(uint32_t handle, uint32_t nlen, const char *name);
@@ -243,7 +239,6 @@ void vrend_set_index_buffer(struct vrend_context *ctx,
uint32_t index_size,
uint32_t offset);
-
#define VREND_TRANSFER_WRITE 1
#define VREND_TRANSFER_READ 2
int vrend_renderer_transfer_iov(const struct vrend_transfer_info *info, int transfer_mode);
@@ -328,7 +323,7 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
union virgl_caps *caps);
GLint64 vrend_renderer_get_timestamp(void);
-/* formats */
+
void vrend_build_format_list(void);
int vrend_renderer_resource_attach_iov(int res_handle, struct iovec *iov,
@@ -355,7 +350,6 @@ void vrend_renderer_get_rect(int resource_id, struct iovec *iov, unsigned int nu
void vrend_renderer_attach_res_ctx(int ctx_id, int resource_id);
void vrend_renderer_detach_res_ctx(int ctx_id, int resource_id);
-
struct vrend_renderer_resource_info {
uint32_t handle;
uint32_t format;