commit 57eaa9217e175e392abf315800056dc40c62fee5 Author: Matteo Bruni Date: Thu Apr 23 18:56:03 2015 +0200 wined3d: Rename struct wined3d_shader_buffer into wined3d_string_buffer. Also rename the shader_buffer_(clear|init|free) functions. diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 96d2f74..7489805 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -766,7 +766,7 @@ static void shader_arb_update_float_pixel_constants(struct wined3d_device *devic priv->highest_dirty_ps_const = max(priv->highest_dirty_ps_const, start + count); } -static void shader_arb_append_imm_vec4(struct wined3d_shader_buffer *buffer, const float *values) +static void shader_arb_append_imm_vec4(struct wined3d_string_buffer *buffer, const float *values) { char str[4][17]; @@ -779,7 +779,7 @@ static void shader_arb_append_imm_vec4(struct wined3d_shader_buffer *buffer, con /* Generate the variable & register declarations for the ARB_vertex_program output target */ static void shader_generate_arb_declarations(const struct wined3d_shader *shader, - const struct wined3d_shader_reg_maps *reg_maps, struct wined3d_shader_buffer *buffer, + const struct wined3d_shader_reg_maps *reg_maps, struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info, DWORD *num_clipplanes, const struct shader_arb_ctx_priv *ctx) { @@ -998,7 +998,7 @@ static void shader_arb_get_swizzle(const struct wined3d_shader_src_param *param, static void shader_arb_request_a0(const struct wined3d_shader_instruction *ins, const char *src) { struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; if (!strcmp(priv->addr_reg, src)) return; @@ -1294,7 +1294,7 @@ static const char *shader_arb_get_fixup_swizzle(enum fixup_channel_source channe } } -static void gen_color_correction(struct wined3d_shader_buffer *buffer, const char *reg, +static void gen_color_correction(struct wined3d_string_buffer *buffer, const char *reg, DWORD dst_mask, const char *one, const char *two, struct color_fixup_desc fixup) { DWORD mask; @@ -1392,7 +1392,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD const char *dst_str, const char *coord_reg, WORD flags, const char *dsx, const char *dsy) { enum wined3d_shader_resource_type resource_type = ins->ctx->reg_maps->resource_info[sampler_idx].type; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; const char *tex_type; BOOL np2_fixup = FALSE; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; @@ -1511,7 +1511,7 @@ static void shader_arb_get_src_param(const struct wined3d_shader_instruction *in BOOL is_color = FALSE, insert_line; char regstr[256]; char swzstr[20]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct shader_arb_ctx_priv *ctx = ins->ctx->backend_data; const char *one = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_ONE); const char *two = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_TWO); @@ -1592,7 +1592,7 @@ static void shader_arb_get_src_param(const struct wined3d_shader_instruction *in static void pshader_hw_bem(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader_dst_param *dst = &ins->dst[0]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; DWORD sampler_code = dst->reg.idx[0].offset; char dst_name[50]; char src_name[2][50]; @@ -1641,7 +1641,7 @@ static DWORD negate_modifiers(DWORD mod, char *extra_char) static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader_dst_param *dst = &ins->dst[0]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_name[50]; char src_name[3][50]; DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major, @@ -1674,7 +1674,7 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins) static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader_dst_param *dst = &ins->dst[0]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_name[50]; char src_name[3][50]; @@ -1694,7 +1694,7 @@ static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins) static void pshader_hw_dp2add(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader_dst_param *dst = &ins->dst[0]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_name[50]; char src_name[3][50]; struct shader_arb_ctx_priv *ctx = ins->ctx->backend_data; @@ -1747,7 +1747,7 @@ static void pshader_hw_dp2add(const struct wined3d_shader_instruction *ins) /* Map the opcode 1-to-1 to the GL code */ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; const char *instruction; char arguments[256], dst_str[50]; unsigned int i; @@ -1809,7 +1809,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins) const char *one = arb_get_helper_value(reg_maps->shader_version.type, ARB_ONE); const char *two = arb_get_helper_value(reg_maps->shader_version.type, ARB_TWO); - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char src0_param[256]; if (ins->handler_idx == WINED3DSIH_MOVA) @@ -1892,7 +1892,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins) static void pshader_hw_texkill(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader_dst_param *dst = &ins->dst[0]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char reg_dest[40]; /* No swizzles are allowed in d3d's texkill. PS 1.x ignores the 4th component as documented, @@ -2024,7 +2024,7 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins) static void pshader_hw_texcoord(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader_dst_param *dst = &ins->dst[0]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major, ins->ctx->reg_maps->shader_version.minor); char dst_str[50]; @@ -2046,7 +2046,7 @@ static void pshader_hw_texcoord(const struct wined3d_shader_instruction *ins) static void pshader_hw_texreg2ar(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; DWORD flags = 0; DWORD reg1 = ins->dst[0].reg.idx[0].offset; @@ -2069,7 +2069,7 @@ static void pshader_hw_texreg2ar(const struct wined3d_shader_instruction *ins) static void pshader_hw_texreg2gb(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; DWORD reg1 = ins->dst[0].reg.idx[0].offset; char dst_str[50]; @@ -2099,7 +2099,7 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins) { struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; const struct wined3d_shader_dst_param *dst = &ins->dst[0]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char reg_coord[40], dst_reg[50], src_reg[50]; DWORD reg_dest_code; @@ -2153,7 +2153,7 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins) static void pshader_hw_texm3x2pad(const struct wined3d_shader_instruction *ins) { DWORD reg = ins->dst[0].reg.idx[0].offset; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char src0_name[50], dst_name[50]; BOOL is_color; struct wined3d_shader_register tmp_reg = ins->dst[0].reg; @@ -2172,7 +2172,7 @@ static void pshader_hw_texm3x2tex(const struct wined3d_shader_instruction *ins) struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; DWORD flags; DWORD reg = ins->dst[0].reg.idx[0].offset; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_str[50]; char src0_name[50]; char dst_reg[50]; @@ -2192,7 +2192,7 @@ static void pshader_hw_texm3x3pad(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD reg = ins->dst[0].reg.idx[0].offset; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char src0_name[50], dst_name[50]; struct wined3d_shader_register tmp_reg = ins->dst[0].reg; BOOL is_color; @@ -2216,7 +2216,7 @@ static void pshader_hw_texm3x3tex(const struct wined3d_shader_instruction *ins) struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD flags; DWORD reg = ins->dst[0].reg.idx[0].offset; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_str[50]; char src0_name[50], dst_name[50]; BOOL is_color; @@ -2238,7 +2238,7 @@ static void pshader_hw_texm3x3vspec(const struct wined3d_shader_instruction *ins struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD flags; DWORD reg = ins->dst[0].reg.idx[0].offset; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_str[50]; char src0_name[50]; char dst_reg[50]; @@ -2279,7 +2279,7 @@ static void pshader_hw_texm3x3spec(const struct wined3d_shader_instruction *ins) struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD flags; DWORD reg = ins->dst[0].reg.idx[0].offset; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_str[50]; char src0_name[50]; char src1_name[50]; @@ -2317,7 +2317,7 @@ static void pshader_hw_texm3x3spec(const struct wined3d_shader_instruction *ins) static void pshader_hw_texdepth(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader_dst_param *dst = &ins->dst[0]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_name[50]; const char *zero = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_ZERO); const char *one = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_ONE); @@ -2349,7 +2349,7 @@ static void pshader_hw_texdepth(const struct wined3d_shader_instruction *ins) * then perform a 1D texture lookup from stage dstregnum, place into dst. */ static void pshader_hw_texdp3tex(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; DWORD sampler_idx = ins->dst[0].reg.idx[0].offset; char src0[50]; char dst_str[50]; @@ -2369,7 +2369,7 @@ static void pshader_hw_texdp3(const struct wined3d_shader_instruction *ins) const struct wined3d_shader_dst_param *dst = &ins->dst[0]; char src0[50]; char dst_str[50]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; /* Handle output register */ shader_arb_get_dst_param(ins, dst, dst_str); @@ -2382,7 +2382,7 @@ static void pshader_hw_texdp3(const struct wined3d_shader_instruction *ins) static void pshader_hw_texm3x3(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader_dst_param *dst = &ins->dst[0]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_str[50], dst_name[50]; char src0[50]; BOOL is_color; @@ -2401,7 +2401,7 @@ static void pshader_hw_texm3x3(const struct wined3d_shader_instruction *ins) */ static void pshader_hw_texm3x2depth(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; const struct wined3d_shader_dst_param *dst = &ins->dst[0]; char src0[50], dst_name[50]; BOOL is_color; @@ -2505,7 +2505,7 @@ static DWORD abs_modifier(DWORD mod, BOOL *need_abs) static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; const char *instruction; struct wined3d_shader_src_param src0_copy = ins->src[0]; BOOL need_abs = FALSE; @@ -2561,7 +2561,7 @@ static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins) static void shader_hw_nrm(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_name[50]; char src_name[50]; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; @@ -2610,7 +2610,7 @@ static void shader_hw_nrm(const struct wined3d_shader_instruction *ins) static void shader_hw_lrp(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_name[50]; char src_name[3][50]; @@ -2636,7 +2636,7 @@ static void shader_hw_sincos(const struct wined3d_shader_instruction *ins) * must contain fixed constants. So we need a separate function to filter those constants and * can't use map2gl */ - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; const struct wined3d_shader_dst_param *dst = &ins->dst[0]; char dst_name[50]; @@ -2739,7 +2739,7 @@ static void shader_hw_sincos(const struct wined3d_shader_instruction *ins) static void shader_hw_sgn(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char dst_name[50]; char src_name[50]; struct shader_arb_ctx_priv *ctx = ins->ctx->backend_data; @@ -2782,7 +2782,7 @@ static void shader_hw_sgn(const struct wined3d_shader_instruction *ins) static void shader_hw_dsy(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char src[50]; char dst[50]; char dst_name[50]; @@ -2798,7 +2798,7 @@ static void shader_hw_dsy(const struct wined3d_shader_instruction *ins) static void shader_hw_pow(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char src0[50], src1[50], dst[50]; struct wined3d_shader_src_param src0_copy = ins->src[0]; BOOL need_abs = FALSE; @@ -2840,7 +2840,7 @@ static void shader_hw_pow(const struct wined3d_shader_instruction *ins) static void shader_hw_loop(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char src_name[50]; BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type); @@ -2867,7 +2867,7 @@ static void shader_hw_loop(const struct wined3d_shader_instruction *ins) static void shader_hw_rep(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; char src_name[50]; BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type); @@ -2894,7 +2894,7 @@ static void shader_hw_rep(const struct wined3d_shader_instruction *ins) static void shader_hw_endloop(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type); if(vshader) @@ -2917,7 +2917,7 @@ static void shader_hw_endloop(const struct wined3d_shader_instruction *ins) static void shader_hw_endrep(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type); if(vshader) @@ -2952,7 +2952,7 @@ static const struct control_frame *find_last_loop(const struct shader_arb_ctx_pr static void shader_hw_break(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; const struct control_frame *control_frame = find_last_loop(ins->ctx->backend_data); BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type); @@ -3000,7 +3000,7 @@ static enum wined3d_shader_rel_op invert_compare(enum wined3d_shader_rel_op op) static void shader_hw_breakc(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type); const struct control_frame *control_frame = find_last_loop(ins->ctx->backend_data); char src_name0[50]; @@ -3027,7 +3027,7 @@ static void shader_hw_breakc(const struct wined3d_shader_instruction *ins) static void shader_hw_ifc(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; struct list *e = list_head(&priv->control_frames); struct control_frame *control_frame = LIST_ENTRY(e, struct control_frame, entry); @@ -3056,7 +3056,7 @@ static void shader_hw_ifc(const struct wined3d_shader_instruction *ins) static void shader_hw_else(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; struct list *e = list_head(&priv->control_frames); struct control_frame *control_frame = LIST_ENTRY(e, struct control_frame, entry); @@ -3076,7 +3076,7 @@ static void shader_hw_else(const struct wined3d_shader_instruction *ins) static void shader_hw_endif(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; struct list *e = list_head(&priv->control_frames); struct control_frame *control_frame = LIST_ENTRY(e, struct control_frame, entry); @@ -3136,7 +3136,7 @@ static void shader_hw_texldl(const struct wined3d_shader_instruction *ins) static void shader_hw_label(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; priv->in_main_func = FALSE; @@ -3151,7 +3151,7 @@ static void shader_hw_label(const struct wined3d_shader_instruction *ins) static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx, const struct arb_vshader_private *shader_data, const struct arb_vs_compile_args *args, const struct wined3d_shader_reg_maps *reg_maps, const struct wined3d_gl_info *gl_info, - struct wined3d_shader_buffer *buffer) + struct wined3d_string_buffer *buffer) { unsigned int i; @@ -3258,7 +3258,7 @@ static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx, static void shader_hw_ret(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; const struct wined3d_shader *shader = ins->ctx->shader; BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type); @@ -3276,7 +3276,7 @@ static void shader_hw_ret(const struct wined3d_shader_instruction *ins) static void shader_hw_call(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; shader_addline(buffer, "CAL l%u;\n", ins->src[0].reg.idx[0].offset); } @@ -3416,7 +3416,7 @@ static GLuint create_arb_blt_fragment_program(const struct wined3d_gl_info *gl_i return program_id; } -static void arbfp_add_sRGB_correction(struct wined3d_shader_buffer *buffer, const char *fragcolor, +static void arbfp_add_sRGB_correction(struct wined3d_string_buffer *buffer, const char *fragcolor, const char *tmp1, const char *tmp2, const char *tmp3, const char *tmp4, BOOL condcode) { /* Perform sRGB write correction. See GLX_EXT_framebuffer_sRGB */ @@ -3557,7 +3557,7 @@ static void init_ps_input(const struct wined3d_shader *shader, } } -static void arbfp_add_linear_fog(struct wined3d_shader_buffer *buffer, +static void arbfp_add_linear_fog(struct wined3d_string_buffer *buffer, const char *fragcolor, const char *tmp) { shader_addline(buffer, "SUB %s.x, state.fog.params.z, fragment.fogcoord.x;\n", tmp); @@ -3567,7 +3567,7 @@ static void arbfp_add_linear_fog(struct wined3d_shader_buffer *buffer, /* Context activation is done by the caller. */ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader, - const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer, + const struct wined3d_gl_info *gl_info, struct wined3d_string_buffer *buffer, const struct arb_ps_compile_args *args, struct arb_ps_compiled_shader *compiled) { const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; @@ -4162,7 +4162,7 @@ static void init_output_registers(const struct wined3d_shader *shader, /* Context activation is done by the caller. */ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader, - const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer, + const struct wined3d_gl_info *gl_info, struct wined3d_string_buffer *buffer, const struct arb_vs_compile_args *args, struct arb_vs_compiled_shader *compiled, const struct wined3d_shader_signature *ps_input_sig) { @@ -4309,7 +4309,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_shader *sh UINT i; DWORD new_size; struct arb_ps_compiled_shader *new_array; - struct wined3d_shader_buffer buffer; + struct wined3d_string_buffer buffer; struct arb_pshader_private *shader_data; GLuint ret; @@ -4370,7 +4370,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_shader *sh pixelshader_update_resource_types(shader, args->super.tex_types); - if (!shader_buffer_init(&buffer)) + if (!string_buffer_init(&buffer)) { ERR("Failed to initialize shader buffer.\n"); return 0; @@ -4378,7 +4378,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_shader *sh ret = shader_arb_generate_pshader(shader, gl_info, &buffer, args, &shader_data->gl_shaders[shader_data->num_gl_shaders]); - shader_buffer_free(&buffer); + string_buffer_free(&buffer); shader_data->gl_shaders[shader_data->num_gl_shaders].prgId = ret; return &shader_data->gl_shaders[shader_data->num_gl_shaders++]; @@ -4404,7 +4404,7 @@ static struct arb_vs_compiled_shader *find_arb_vshader(struct wined3d_shader *sh UINT i; DWORD new_size; struct arb_vs_compiled_shader *new_array; - struct wined3d_shader_buffer buffer; + struct wined3d_string_buffer buffer; struct arb_vshader_private *shader_data; GLuint ret; @@ -4467,7 +4467,7 @@ static struct arb_vs_compiled_shader *find_arb_vshader(struct wined3d_shader *sh shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args; - if (!shader_buffer_init(&buffer)) + if (!string_buffer_init(&buffer)) { ERR("Failed to initialize shader buffer.\n"); return 0; @@ -4476,7 +4476,7 @@ static struct arb_vs_compiled_shader *find_arb_vshader(struct wined3d_shader *sh ret = shader_arb_generate_vshader(shader, gl_info, &buffer, args, &shader_data->gl_shaders[shader_data->num_gl_shaders], ps_input_sig); - shader_buffer_free(&buffer); + string_buffer_free(&buffer); shader_data->gl_shaders[shader_data->num_gl_shaders].prgId = ret; return &shader_data->gl_shaders[shader_data->num_gl_shaders++]; @@ -5139,7 +5139,7 @@ static BOOL shader_arb_color_fixup_supported(struct color_fixup_desc fixup) static void shader_arb_add_instruction_modifiers(const struct wined3d_shader_instruction *ins) { DWORD shift; char write_mask[20], regstr[50]; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; BOOL is_color = FALSE; const struct wined3d_shader_dst_param *dst; @@ -5480,7 +5480,7 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; const struct wined3d_shader *shader = ins->ctx->shader; struct control_frame *control_frame; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; BOOL bool_const; if(ins->handler_idx == WINED3DSIH_LOOP || ins->handler_idx == WINED3DSIH_REP) @@ -6011,7 +6011,7 @@ static void color_key_arbfp(struct wined3d_context *context, const struct wined3 checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_COLOR_KEY, &float_key.r)"); } -static const char *get_argreg(struct wined3d_shader_buffer *buffer, DWORD argnum, unsigned int stage, DWORD arg) +static const char *get_argreg(struct wined3d_string_buffer *buffer, DWORD argnum, unsigned int stage, DWORD arg) { const char *ret; @@ -6083,7 +6083,7 @@ static const char *get_argreg(struct wined3d_shader_buffer *buffer, DWORD argnum return ret; } -static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int stage, BOOL color, +static void gen_ffp_instr(struct wined3d_string_buffer *buffer, unsigned int stage, BOOL color, BOOL alpha, DWORD dst, DWORD op, DWORD dw_arg0, DWORD dw_arg1, DWORD dw_arg2) { const char *dstmask, *dstreg, *arg0, *arg1, *arg2; @@ -6237,7 +6237,7 @@ static const char *arbfp_texture_target(enum wined3d_gl_resource_type type) static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, const struct wined3d_gl_info *gl_info) { unsigned int stage; - struct wined3d_shader_buffer buffer; + struct wined3d_string_buffer buffer; BOOL tex_read[MAX_TEXTURES] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}; BOOL bump_used[MAX_TEXTURES] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}; BOOL luminance_used[MAX_TEXTURES] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}; @@ -6252,7 +6252,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con const char *final_combiner_src = "ret"; BOOL custom_linear_fog = FALSE; - if (!shader_buffer_init(&buffer)) + if (!string_buffer_init(&buffer)) { ERR("Failed to initialize shader buffer.\n"); return 0; @@ -6525,7 +6525,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ret)); shader_arb_compile(gl_info, GL_FRAGMENT_PROGRAM_ARB, buffer.buffer); - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return ret; } @@ -6923,7 +6923,7 @@ static void arbfp_blit_free(struct wined3d_device *device) device->blit_priv = NULL; } -static BOOL gen_planar_yuv_read(struct wined3d_shader_buffer *buffer, const struct arbfp_blit_type *type, +static BOOL gen_planar_yuv_read(struct wined3d_string_buffer *buffer, const struct arbfp_blit_type *type, char *luminance) { char chroma; @@ -7011,7 +7011,7 @@ static BOOL gen_planar_yuv_read(struct wined3d_shader_buffer *buffer, const stru return TRUE; } -static BOOL gen_yv12_read(struct wined3d_shader_buffer *buffer, const struct arbfp_blit_type *type, +static BOOL gen_yv12_read(struct wined3d_string_buffer *buffer, const struct arbfp_blit_type *type, char *luminance) { const char *tex; @@ -7160,7 +7160,7 @@ static BOOL gen_yv12_read(struct wined3d_shader_buffer *buffer, const struct arb return TRUE; } -static BOOL gen_nv12_read(struct wined3d_shader_buffer *buffer, const struct arbfp_blit_type *type, +static BOOL gen_nv12_read(struct wined3d_string_buffer *buffer, const struct arbfp_blit_type *type, char *luminance) { const char *tex; @@ -7301,7 +7301,7 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, const struct wined3d_gl_info *gl_info, const struct arbfp_blit_type *type) { GLenum shader; - struct wined3d_shader_buffer buffer; + struct wined3d_string_buffer buffer; const char *tex_target = arbfp_texture_target(type->res_type); /* This should not happen because we only use this conversion for @@ -7310,7 +7310,7 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, FIXME("Implement P8 color keying.\n"); /* Shader header */ - if (!shader_buffer_init(&buffer)) + if (!string_buffer_init(&buffer)) { ERR("Failed to initialize shader buffer.\n"); return 0; @@ -7320,7 +7320,7 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)); if (!shader) { - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return 0; } @@ -7342,7 +7342,7 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, shader_arb_compile(gl_info, GL_FRAGMENT_PROGRAM_ARB, buffer.buffer); - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return shader; } @@ -7390,14 +7390,14 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ const struct arbfp_blit_type *type) { GLenum shader; - struct wined3d_shader_buffer buffer; + struct wined3d_string_buffer buffer; char luminance_component; if (type->use_color_key) FIXME("Implement YUV color keying.\n"); /* Shader header */ - if (!shader_buffer_init(&buffer)) + if (!string_buffer_init(&buffer)) { ERR("Failed to initialize shader buffer.\n"); return 0; @@ -7409,7 +7409,7 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)"); if (!shader) { - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return 0; } @@ -7464,7 +7464,7 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ case COMPLEX_FIXUP_YUY2: if (!gen_planar_yuv_read(&buffer, type, &luminance_component)) { - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return 0; } break; @@ -7472,7 +7472,7 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ case COMPLEX_FIXUP_YV12: if (!gen_yv12_read(&buffer, type, &luminance_component)) { - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return 0; } break; @@ -7480,14 +7480,14 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ case COMPLEX_FIXUP_NV12: if (!gen_nv12_read(&buffer, type, &luminance_component)) { - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return 0; } break; default: FIXME("Unsupported YUV fixup %#x\n", type->fixup); - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return 0; } @@ -7505,7 +7505,7 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ shader_arb_compile(gl_info, GL_FRAGMENT_PROGRAM_ARB, buffer.buffer); - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return shader; } @@ -7515,11 +7515,11 @@ static GLuint arbfp_gen_plain_shader(struct arbfp_blit_priv *priv, const struct wined3d_gl_info *gl_info, const struct arbfp_blit_type *type) { GLenum shader; - struct wined3d_shader_buffer buffer; + struct wined3d_string_buffer buffer; const char *tex_target = arbfp_texture_target(type->res_type); /* Shader header */ - if (!shader_buffer_init(&buffer)) + if (!string_buffer_init(&buffer)) { ERR("Failed to initialize shader buffer.\n"); return 0; @@ -7528,7 +7528,7 @@ static GLuint arbfp_gen_plain_shader(struct arbfp_blit_priv *priv, GL_EXTCALL(glGenProgramsARB(1, &shader)); if (!shader) { - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return 0; } GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)); @@ -7556,7 +7556,7 @@ static GLuint arbfp_gen_plain_shader(struct arbfp_blit_priv *priv, shader_arb_compile(gl_info, GL_FRAGMENT_PROGRAM_ARB, buffer.buffer); - shader_buffer_free(&buffer); + string_buffer_free(&buffer); return shader; } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 901a6f5..250468b 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -91,7 +91,7 @@ struct constant_heap /* GLSL shader private data */ struct shader_glsl_priv { - struct wined3d_shader_buffer shader_buffer; + struct wined3d_string_buffer shader_buffer; struct wine_rb_tree program_lookup; struct constant_heap vconst_heap; struct constant_heap pconst_heap; @@ -268,7 +268,7 @@ static const char *shader_glsl_get_version(const struct wined3d_gl_info *gl_info return "#version 120"; } -static void shader_glsl_append_imm_vec4(struct wined3d_shader_buffer *buffer, const float *values) +static void shader_glsl_append_imm_vec4(struct wined3d_string_buffer *buffer, const float *values) { char str[4][17]; @@ -1288,7 +1288,7 @@ static unsigned int vec4_varyings(DWORD shader_major, const struct wined3d_gl_in /** Generate the variable & register declarations for the GLSL output target */ static void shader_generate_glsl_declarations(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader, + struct wined3d_string_buffer *buffer, const struct wined3d_shader *shader, const struct wined3d_shader_reg_maps *reg_maps, const struct shader_glsl_ctx_priv *ctx_priv) { const struct wined3d_shader_version *version = ®_maps->shader_version; @@ -2150,7 +2150,7 @@ static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction * } /* Append the destination part of the instruction to the buffer, return the effective write mask */ -static DWORD shader_glsl_append_dst_ext(struct wined3d_shader_buffer *buffer, +static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer, const struct wined3d_shader_instruction *ins, const struct wined3d_shader_dst_param *dst, enum wined3d_data_type data_type) { @@ -2187,7 +2187,7 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_shader_buffer *buffer, } /* Append the destination part of the instruction to the buffer, return the effective write mask */ -static DWORD shader_glsl_append_dst(struct wined3d_shader_buffer *buffer, const struct wined3d_shader_instruction *ins) +static DWORD shader_glsl_append_dst(struct wined3d_string_buffer *buffer, const struct wined3d_shader_instruction *ins) { return shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], ins->dst[0].reg.data_type); } @@ -2526,7 +2526,7 @@ static void shader_glsl_append_fixup_arg(char *arguments, const char *reg_name, if (sign_fixup) strcat(arguments, " * 2.0 - 1.0"); } -static void shader_glsl_color_correction_ext(struct wined3d_shader_buffer *buffer, +static void shader_glsl_color_correction_ext(struct wined3d_string_buffer *buffer, const char *reg_name, DWORD mask, struct color_fixup_desc fixup) { unsigned int mask_size, remaining; @@ -2655,7 +2655,7 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s static void shader_glsl_binop(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; struct glsl_src_param src1_param; DWORD write_mask; @@ -2688,7 +2688,7 @@ static void shader_glsl_binop(const struct wined3d_shader_instruction *ins) static void shader_glsl_relop(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; struct glsl_src_param src1_param; unsigned int mask_size; @@ -2742,7 +2742,7 @@ static void shader_glsl_relop(const struct wined3d_shader_instruction *ins) static void shader_glsl_imul(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; struct glsl_src_param src1_param; DWORD write_mask; @@ -2765,7 +2765,7 @@ static void shader_glsl_imul(const struct wined3d_shader_instruction *ins) static void shader_glsl_udiv(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param, src1_param; DWORD write_mask; @@ -2811,7 +2811,7 @@ static void shader_glsl_udiv(const struct wined3d_shader_instruction *ins) static void shader_glsl_mov(const struct wined3d_shader_instruction *ins) { const struct wined3d_gl_info *gl_info = ins->ctx->gl_info; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; DWORD write_mask; @@ -2863,7 +2863,7 @@ static void shader_glsl_mov(const struct wined3d_shader_instruction *ins) /* Process the dot product operators DP3 and DP4 in GLSL (dst = dot(src0, src1)) */ static void shader_glsl_dot(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; struct glsl_src_param src1_param; DWORD dst_write_mask, src_write_mask; @@ -2916,7 +2916,7 @@ static void shader_glsl_cut(const struct wined3d_shader_instruction *ins) * GLSL uses the value as-is. */ static void shader_glsl_pow(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; struct glsl_src_param src1_param; DWORD dst_write_mask; @@ -2943,7 +2943,7 @@ static void shader_glsl_pow(const struct wined3d_shader_instruction *ins) /* Map the opcode 1-to-1 to the GL code (arg->dst = instruction(src0, src1, ...) */ static void shader_glsl_map2gl(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src_param; const char *instruction; DWORD write_mask; @@ -2988,7 +2988,7 @@ static void shader_glsl_nop(const struct wined3d_shader_instruction *ins) {} static void shader_glsl_nrm(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src_param; unsigned int mask_size; DWORD write_mask; @@ -3016,7 +3016,7 @@ static void shader_glsl_nrm(const struct wined3d_shader_instruction *ins) static void shader_glsl_scalar_op(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; const char *prefix, *suffix; unsigned int dst_size; @@ -3098,7 +3098,7 @@ static void shader_glsl_expp(const struct wined3d_shader_instruction *ins) static void shader_glsl_to_int(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src_param; unsigned int mask_size; DWORD write_mask; @@ -3115,7 +3115,7 @@ static void shader_glsl_to_int(const struct wined3d_shader_instruction *ins) static void shader_glsl_to_float(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src_param; unsigned int mask_size; DWORD write_mask; @@ -3500,7 +3500,7 @@ static void shader_glsl_dst(const struct wined3d_shader_instruction *ins) */ static void shader_glsl_sincos(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; DWORD write_mask; @@ -3589,7 +3589,7 @@ static void shader_glsl_sgn(const struct wined3d_shader_instruction *ins) static void shader_glsl_loop(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_loop_state *loop_state = ins->ctx->loop_state; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; const struct wined3d_shader *shader = ins->ctx->shader; const struct wined3d_shader_lconst *constant; struct glsl_src_param src1_param; @@ -4004,7 +4004,7 @@ static void shader_glsl_sample(const struct wined3d_shader_instruction *ins) static void shader_glsl_texcoord(const struct wined3d_shader_instruction *ins) { /* FIXME: Make this work for more than just 2D textures */ - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; DWORD write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins); if (!(ins->ctx->reg_maps->shader_version.major == 1 && ins->ctx->reg_maps->shader_version.minor == 4)) @@ -4160,7 +4160,7 @@ static void shader_glsl_texm3x2pad(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD reg = ins->dst[0].reg.idx[0].offset; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param); @@ -4172,7 +4172,7 @@ static void shader_glsl_texm3x2pad(const struct wined3d_shader_instruction *ins) static void shader_glsl_texm3x3pad(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD reg = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param; @@ -4185,7 +4185,7 @@ static void shader_glsl_texm3x3pad(const struct wined3d_shader_instruction *ins) static void shader_glsl_texm3x2tex(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_sample_function sample_function; DWORD reg = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param; @@ -4246,7 +4246,7 @@ static void shader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins { struct glsl_src_param src0_param; struct glsl_src_param src1_param; - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; struct glsl_sample_function sample_function; @@ -4276,7 +4276,7 @@ static void shader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins * Perform the final texture lookup based on the previous 2 3x3 matrix multiplies */ static void shader_glsl_texm3x3vspec(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; struct glsl_sample_function sample_function; @@ -4483,7 +4483,7 @@ static void shader_glsl_dp2add(const struct wined3d_shader_instruction *ins) } } -static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, +static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_signature *input_signature, const struct wined3d_shader_reg_maps *reg_maps, enum vertexprocessing_mode vertexprocessing) @@ -4599,7 +4599,7 @@ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struc HeapFree(GetProcessHeap(), 0, entry); } -static void handle_ps3_input(struct wined3d_shader_buffer *buffer, +static void handle_ps3_input(struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info, const DWORD *map, const struct wined3d_shader_signature *input_signature, const struct wined3d_shader_reg_maps *reg_maps_in, @@ -4695,7 +4695,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer, } /* Context activation is done by the caller. */ -static GLuint generate_param_reorder_function(struct wined3d_shader_buffer *buffer, +static GLuint generate_param_reorder_function(struct wined3d_string_buffer *buffer, const struct wined3d_shader *vs, const struct wined3d_shader *ps, const struct wined3d_gl_info *gl_info) { @@ -4706,7 +4706,7 @@ static GLuint generate_param_reorder_function(struct wined3d_shader_buffer *buff UINT semantic_idx; char reg_mask[6]; - shader_buffer_clear(buffer); + string_buffer_clear(buffer); shader_addline(buffer, "%s\n", shader_glsl_get_version(gl_info, &vs->reg_maps.shader_version)); @@ -4810,7 +4810,7 @@ static GLuint generate_param_reorder_function(struct wined3d_shader_buffer *buff return ret; } -static void shader_glsl_generate_srgb_write_correction(struct wined3d_shader_buffer *buffer) +static void shader_glsl_generate_srgb_write_correction(struct wined3d_string_buffer *buffer) { shader_addline(buffer, "tmp0.xyz = pow(gl_FragData[0].xyz, vec3(srgb_const0.x));\n"); shader_addline(buffer, "tmp0.xyz = tmp0.xyz * vec3(srgb_const0.y) - vec3(srgb_const0.z);\n"); @@ -4820,7 +4820,7 @@ static void shader_glsl_generate_srgb_write_correction(struct wined3d_shader_buf shader_addline(buffer, "gl_FragData[0] = clamp(gl_FragData[0], 0.0, 1.0);\n"); } -static void shader_glsl_generate_fog_code(struct wined3d_shader_buffer *buffer, enum wined3d_ffp_ps_fog_mode mode) +static void shader_glsl_generate_fog_code(struct wined3d_string_buffer *buffer, enum wined3d_ffp_ps_fog_mode mode) { switch (mode) { @@ -4851,7 +4851,7 @@ static void shader_glsl_generate_fog_code(struct wined3d_shader_buffer *buffer, /* Context activation is done by the caller. */ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader, + struct wined3d_string_buffer *buffer, const struct wined3d_shader *shader, const struct ps_compile_args *args, struct ps_np2fixup_info *np2fixup_info) { const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; @@ -4915,7 +4915,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context /* Context activation is done by the caller. */ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader, + struct wined3d_string_buffer *buffer, const struct wined3d_shader *shader, const struct vs_compile_args *args) { const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; @@ -4991,7 +4991,7 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context /* Context activation is done by the caller. */ static GLuint shader_glsl_generate_geometry_shader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader) + struct wined3d_string_buffer *buffer, const struct wined3d_shader *shader) { const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; const struct wined3d_gl_info *gl_info = context->gl_info; @@ -5024,7 +5024,7 @@ static GLuint shader_glsl_generate_geometry_shader(const struct wined3d_context } static GLuint find_glsl_pshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, + struct wined3d_string_buffer *buffer, struct wined3d_shader *shader, const struct ps_compile_args *args, const struct ps_np2fixup_info **np2fixup_info) { struct glsl_ps_compiled_shader *gl_shaders, *new_array; @@ -5091,7 +5091,7 @@ static GLuint find_glsl_pshader(const struct wined3d_context *context, pixelshader_update_resource_types(shader, args->tex_types); - shader_buffer_clear(buffer); + string_buffer_clear(buffer); ret = shader_glsl_generate_pshader(context, buffer, shader, args, np2fixup); gl_shaders[shader_data->num_gl_shaders++].id = ret; @@ -5106,7 +5106,7 @@ static inline BOOL vs_args_equal(const struct vs_compile_args *stored, const str } static GLuint find_glsl_vshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, + struct wined3d_string_buffer *buffer, struct wined3d_shader *shader, const struct vs_compile_args *args) { UINT i; @@ -5164,7 +5164,7 @@ static GLuint find_glsl_vshader(const struct wined3d_context *context, gl_shaders[shader_data->num_gl_shaders].args = *args; - shader_buffer_clear(buffer); + string_buffer_clear(buffer); ret = shader_glsl_generate_vshader(context, buffer, shader, args); gl_shaders[shader_data->num_gl_shaders++].id = ret; @@ -5172,7 +5172,7 @@ static GLuint find_glsl_vshader(const struct wined3d_context *context, } static GLuint find_glsl_geometry_shader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader) + struct wined3d_string_buffer *buffer, struct wined3d_shader *shader) { struct glsl_gs_compiled_shader *gl_shaders; struct glsl_shader_private *shader_data; @@ -5202,7 +5202,7 @@ static GLuint find_glsl_geometry_shader(const struct wined3d_context *context, shader_data->shader_array_size = 1; gl_shaders = shader_data->gl_shaders.gs; - shader_buffer_clear(buffer); + string_buffer_clear(buffer); ret = shader_glsl_generate_geometry_shader(context, buffer, shader); gl_shaders[shader_data->num_gl_shaders++].id = ret; @@ -5225,7 +5225,7 @@ static const char *shader_glsl_ffp_mcs(enum wined3d_material_color_source mcs, c } } -static void shader_glsl_ffp_vertex_lighting(struct wined3d_shader_buffer *buffer, +static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer, const struct wined3d_ffp_vs_settings *settings, const struct wined3d_gl_info *gl_info) { const char *diffuse, *specular, *emission, *ambient; @@ -5332,13 +5332,13 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_shader_buffer *buffer } /* Context activation is done by the caller. */ -static GLuint shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_buffer *buffer, +static GLuint shader_glsl_generate_ffp_vertex_shader(struct wined3d_string_buffer *buffer, const struct wined3d_ffp_vs_settings *settings, const struct wined3d_gl_info *gl_info) { GLuint shader_obj; unsigned int i; - shader_buffer_clear(buffer); + string_buffer_clear(buffer); shader_addline(buffer, "#version 120\n"); shader_addline(buffer, "\n"); @@ -5455,7 +5455,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_buffe return shader_obj; } -static const char *shader_glsl_get_ffp_fragment_op_arg(struct wined3d_shader_buffer *buffer, +static const char *shader_glsl_get_ffp_fragment_op_arg(struct wined3d_string_buffer *buffer, DWORD argnum, unsigned int stage, DWORD arg) { const char *ret; @@ -5551,7 +5551,7 @@ static const char *shader_glsl_get_ffp_fragment_op_arg(struct wined3d_shader_buf return ret; } -static void shader_glsl_ffp_fragment_op(struct wined3d_shader_buffer *buffer, unsigned int stage, BOOL color, +static void shader_glsl_ffp_fragment_op(struct wined3d_string_buffer *buffer, unsigned int stage, BOOL color, BOOL alpha, DWORD dst, DWORD op, DWORD dw_arg0, DWORD dw_arg1, DWORD dw_arg2) { const char *dstmask, *dstreg, *arg0, *arg1, *arg2; @@ -5703,7 +5703,7 @@ static void shader_glsl_ffp_fragment_op(struct wined3d_shader_buffer *buffer, un } /* Context activation is done by the caller. */ -static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_shader_buffer *buffer, +static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_string_buffer *buffer, const struct ffp_frag_settings *settings, const struct wined3d_gl_info *gl_info) { BYTE lum_map = 0, bump_map = 0, tex_map = 0, tss_const_map = 0; @@ -5714,7 +5714,7 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_shader_buf DWORD arg0, arg1, arg2; unsigned int stage; - shader_buffer_clear(buffer); + string_buffer_clear(buffer); /* Find out which textures are read */ for (stage = 0; stage < MAX_TEXTURES; ++stage) @@ -6932,7 +6932,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win return E_FAIL; } - if (!shader_buffer_init(&priv->shader_buffer)) + if (!string_buffer_init(&priv->shader_buffer)) { ERR("Failed to initialize shader buffer.\n"); goto fail; @@ -6979,7 +6979,7 @@ fail: constant_heap_free(&priv->pconst_heap); constant_heap_free(&priv->vconst_heap); HeapFree(GetProcessHeap(), 0, priv->stack); - shader_buffer_free(&priv->shader_buffer); + string_buffer_free(&priv->shader_buffer); fragment_pipe->free_private(device); vertex_pipe->vp_free(device); HeapFree(GetProcessHeap(), 0, priv); @@ -7009,7 +7009,7 @@ static void shader_glsl_free(struct wined3d_device *device) constant_heap_free(&priv->pconst_heap); constant_heap_free(&priv->vconst_heap); HeapFree(GetProcessHeap(), 0, priv->stack); - shader_buffer_free(&priv->shader_buffer); + string_buffer_free(&priv->shader_buffer); priv->fragment_pipe->free_private(device); priv->vertex_pipe->vp_free(device); diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index c249c9a..1459911 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -245,7 +245,7 @@ static const struct wined3d_shader_frontend *shader_select_frontend(DWORD versio } } -void shader_buffer_clear(struct wined3d_shader_buffer *buffer) +void string_buffer_clear(struct wined3d_string_buffer *buffer) { buffer->buffer[0] = '\0'; buffer->content_size = 0; @@ -253,7 +253,7 @@ void shader_buffer_clear(struct wined3d_shader_buffer *buffer) buffer->newline = TRUE; } -BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer) +BOOL string_buffer_init(struct wined3d_string_buffer *buffer) { buffer->buffer_size = 16384; if (!(buffer->buffer = HeapAlloc(GetProcessHeap(), 0, buffer->buffer_size))) @@ -262,16 +262,16 @@ BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer) return FALSE; } - shader_buffer_clear(buffer); + string_buffer_clear(buffer); return TRUE; } -void shader_buffer_free(struct wined3d_shader_buffer *buffer) +void string_buffer_free(struct wined3d_string_buffer *buffer) { HeapFree(GetProcessHeap(), 0, buffer->buffer); } -int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *format, va_list args) +int shader_vaddline(struct wined3d_string_buffer *buffer, const char *format, va_list args) { char *base = buffer->buffer + buffer->content_size; int rc; @@ -319,7 +319,7 @@ int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *format, va return 0; } -int shader_addline(struct wined3d_shader_buffer *buffer, const char *format, ...) +int shader_addline(struct wined3d_string_buffer *buffer, const char *format, ...) { va_list args; int ret; @@ -1555,7 +1555,7 @@ void shader_dump_src_param(const struct wined3d_shader_src_param *param, /* Shared code in order to generate the bulk of the shader string. * NOTE: A description of how to parse tokens can be found on MSDN. */ -void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, +void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) { struct wined3d_device *device = shader->device; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index dd2a85a..8706650 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -435,7 +435,7 @@ enum wined3d_shader_rel_op * Shader model 3 according to msdn (and for software shaders) */ #define MAX_LABELS 16 -struct wined3d_shader_buffer +struct wined3d_string_buffer { char *buffer; unsigned int buffer_size; @@ -665,7 +665,7 @@ struct wined3d_shader_context const struct wined3d_shader *shader; const struct wined3d_gl_info *gl_info; const struct wined3d_shader_reg_maps *reg_maps; - struct wined3d_shader_buffer *buffer; + struct wined3d_string_buffer *buffer; struct wined3d_shader_tex_mx *tex_mx; struct wined3d_shader_loop_state *loop_state; void *backend_data; @@ -2894,9 +2894,8 @@ struct wined3d_shader_limits #define PRINTF_ATTR(fmt,args) #endif -/* Base Shader utility functions. */ -int shader_addline(struct wined3d_shader_buffer *buffer, const char *fmt, ...) PRINTF_ATTR(2,3) DECLSPEC_HIDDEN; -int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *fmt, va_list args) DECLSPEC_HIDDEN; +int shader_addline(struct wined3d_string_buffer *buffer, const char *fmt, ...) PRINTF_ATTR(2,3) DECLSPEC_HIDDEN; +int shader_vaddline(struct wined3d_string_buffer *buffer, const char *fmt, va_list args) DECLSPEC_HIDDEN; /* Vertex shader utility functions */ BOOL vshader_get_input(const struct wined3d_shader *shader, @@ -2974,16 +2973,16 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 void find_vs_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader, WORD swizzle_map, struct vs_compile_args *args) DECLSPEC_HIDDEN; -void shader_buffer_clear(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN; -BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN; -void shader_buffer_free(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN; +void string_buffer_clear(struct wined3d_string_buffer *buffer) DECLSPEC_HIDDEN; +BOOL string_buffer_init(struct wined3d_string_buffer *buffer) DECLSPEC_HIDDEN; +void string_buffer_free(struct wined3d_string_buffer *buffer) DECLSPEC_HIDDEN; void shader_dump_src_param(const struct wined3d_shader_src_param *param, const struct wined3d_shader_version *shader_version) DECLSPEC_HIDDEN; void shader_dump_dst_param(const struct wined3d_shader_dst_param *param, const struct wined3d_shader_version *shader_version) DECLSPEC_HIDDEN; unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_maps *reg_maps, unsigned int max) DECLSPEC_HIDDEN; -void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, +void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN;