diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 1dc6647..b94f6df 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -89,9 +89,6 @@ struct global_error_state { }; struct global_renderer_state { - bool inited; - - bool use_core_profile; int gl_major_ver; int gl_minor_ver; @@ -100,6 +97,9 @@ struct global_renderer_state { struct vrend_context *current_hw_ctx; struct list_head waiting_query_list; + bool inited; + bool use_core_profile; + bool have_mesa_invert; bool have_samplers; bool have_robustness; @@ -158,13 +158,13 @@ struct vrend_shader { struct vrend_shader_selector { struct pipe_reference reference; - struct vrend_shader *current; - struct tgsi_token *tokens; - - struct vrend_shader_info sinfo; unsigned num_shaders; unsigned type; + struct vrend_shader_info sinfo; + + struct vrend_shader *current; + struct tgsi_token *tokens; }; struct vrend_buffer { @@ -210,18 +210,18 @@ struct vrend_sampler_view { GLuint res_handle; GLuint format; GLuint val0, val1; - GLuint swizzle_r:3; - GLuint swizzle_g:3; - GLuint swizzle_b:3; - GLuint swizzle_a:3; GLuint gl_swizzle_r; GLuint gl_swizzle_g; GLuint gl_swizzle_b; GLuint gl_swizzle_a; GLuint cur_base, cur_max; - struct vrend_resource *texture; GLenum depth_texture_mode; GLuint srgb_decode; + GLuint swizzle_r:3; + GLuint swizzle_g:3; + GLuint swizzle_b:3; + GLuint swizzle_a:3; + struct vrend_resource *texture; }; struct vrend_vertex_element { @@ -280,28 +280,31 @@ struct vrend_sub_context { GLuint vaoid; uint32_t enabled_attribs_bitmask; - struct util_hash_table *object_hash; struct list_head programs; + struct util_hash_table *object_hash; struct vrend_vertex_element_array *ve; int num_vbos; int old_num_vbos; /* for cleaning up */ struct pipe_vertex_buffer vbo[PIPE_MAX_ATTRIBS]; uint32_t vbo_res_ids[PIPE_MAX_ATTRIBS]; + + struct pipe_index_buffer ib; + uint32_t index_buffer_res_id; + bool vbo_dirty; + bool shader_dirty; + bool sampler_state_dirty; + bool stencil_state_dirty; struct vrend_shader_selector *vs; struct vrend_shader_selector *gs; struct vrend_shader_selector *fs; - bool shader_dirty; struct vrend_linked_shader_program *prog; struct vrend_shader_view views[PIPE_SHADER_TYPES]; - struct pipe_index_buffer ib; - uint32_t index_buffer_res_id; - struct vrend_constants consts[PIPE_SHADER_TYPES]; bool const_dirty[PIPE_SHADER_TYPES]; struct vrend_sampler_state *sampler_state[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; @@ -310,7 +313,6 @@ struct vrend_sub_context { uint32_t const_bufs_used_mask[PIPE_SHADER_TYPES]; int num_sampler_states[PIPE_SHADER_TYPES]; - bool sampler_state_dirty; uint32_t fb_id; int nr_cbufs, old_nr_cbufs; @@ -320,13 +322,9 @@ struct vrend_sub_context { struct vrend_viewport vps[PIPE_MAX_VIEWPORTS]; float depth_transform, depth_scale; /* viewport is negative */ - bool viewport_is_negative; - /* this is set if the contents of the FBO look upside down when viewed - with 0,0 as the bottom corner */ - bool inverted_fbo_content; uint32_t scissor_state_dirty; uint32_t viewport_state_dirty; - bool stencil_state_dirty; + uint32_t fb_height; struct pipe_scissor_state ss[PIPE_MAX_VIEWPORTS]; @@ -336,6 +334,10 @@ struct vrend_sub_context { struct pipe_rasterizer_state rs_state; uint8_t stencil_refs[2]; + bool viewport_is_negative; + /* this is set if the contents of the FBO look upside down when viewed + with 0,0 as the bottom corner */ + bool inverted_fbo_content; GLuint blit_fb_ids[2]; @@ -353,8 +355,8 @@ struct vrend_sub_context { struct pipe_rasterizer_state hw_rs_state; struct pipe_blend_state hw_blend_state; - struct vrend_streamout_object *current_so; struct list_head streamout_list; + struct vrend_streamout_object *current_so; }; struct vrend_context { @@ -366,24 +368,22 @@ struct vrend_context { struct vrend_sub_context *sub0; int ctx_id; - - /* resource bounds to this context */ - struct util_hash_table *res_hash; - - struct list_head active_nontimer_query_list; - /* has this ctx gotten an error? */ bool in_error; - enum virgl_ctx_errors last_error; - bool ctx_switch_pending; - bool pstip_inited; + GLuint pstipple_tex_id; - struct vrend_shader_cfg shader_cfg; + enum virgl_ctx_errors last_error; + + /* resource bounds to this context */ + struct util_hash_table *res_hash; + struct list_head active_nontimer_query_list; struct list_head ctx_entry; + + struct vrend_shader_cfg shader_cfg; }; static void vrend_destroy_program(struct vrend_linked_shader_program *ent); diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index 2b53e4a..dc0122e 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -35,9 +35,9 @@ typedef void *virgl_gl_context; typedef void *virgl_gl_drawable; struct virgl_gl_ctx_param { - bool shared; int major_ver; int minor_ver; + bool shared; }; extern int vrend_dump_shaders; @@ -51,14 +51,15 @@ struct vrend_resource { GLuint readback_fb_id; GLuint readback_fb_level; GLuint readback_fb_z; - void *ptr; + + GLuint tbo_tex_id;/* tbos have two ids to track */ + bool y_0_top; + GLuint handle; + void *ptr; struct iovec *iov; uint32_t num_iovs; - bool y_0_top; - - GLuint tbo_tex_id;/* tbos have two ids to track */ }; /* assume every format is sampler friendly */ @@ -84,10 +85,10 @@ struct vrend_transfer_info { int level; uint32_t stride; uint32_t layer_stride; - struct pipe_box *box; - uint64_t offset; - struct iovec *iovec; unsigned int iovec_cnt; + struct iovec *iovec; + uint64_t offset; + struct pipe_box *box; }; struct vrend_if_cbs { diff --git a/src/vrend_shader.c b/src/vrend_shader.c index bdddd31..e2682d2 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -42,8 +42,8 @@ struct vrend_shader_io { unsigned done; int sid; unsigned interpolate; - bool centroid; unsigned first; + bool centroid; bool glsl_predefined_no_emit; bool glsl_no_index; bool glsl_gl_in; @@ -70,8 +70,8 @@ struct dump_ctx { struct tgsi_iterate_context iter; struct vrend_shader_cfg *cfg; int prog_type; - char *glsl_main; int size; + char *glsl_main; uint instno; int num_interps; @@ -106,24 +106,24 @@ struct dump_ctx { bool uses_lodq; bool uses_txq_levels; bool uses_tg4; - /* create a shader with lower left if upper left is primary variant - or vice versa */ - uint32_t shadow_samp_mask; bool write_all_cbufs; + + uint32_t shadow_samp_mask; + int fs_coord_origin, fs_pixel_center; int gs_in_prim, gs_out_prim, gs_max_out_verts; struct vrend_shader_key *key; - bool has_ints; - bool has_instanceid; int indent_level; int num_in_clip_dist; int num_clip_dist; - int glsl_ver_required; - bool front_face_emitted; int color_in_mask; + bool front_face_emitted; + bool has_ints; + bool has_instanceid; + bool has_clipvertex; bool has_clipvertex_so; bool has_viewport_idx; diff --git a/src/vrend_shader.h b/src/vrend_shader.h index 7dfed35..4ccb9a3 100644 --- a/src/vrend_shader.h +++ b/src/vrend_shader.h @@ -44,10 +44,11 @@ struct vrend_shader_info { int num_ucp; int glsl_ver; uint32_t shadow_samp_mask; + int gs_out_prim; + struct pipe_stream_output_info so_info; struct vrend_interp_info *interpinfo; - int gs_out_prim; char **so_names; }; @@ -59,9 +60,9 @@ struct vrend_shader_key { bool color_two_side; uint8_t alpha_test; uint8_t clip_plane_enable; - float alpha_ref_val; bool gs_present; bool flatshade; + float alpha_ref_val; }; struct vrend_shader_cfg {