From 64463b81dfb2a2c8fcfd3388d588983c77513294 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Fri, 24 Apr 2015 22:25:41 +0200 Subject: [PATCH] wined3d: Rename struct wined3d_shader_buffer to wined3d_string_buffer. Also rename the shader_buffer_(clear|init|free) functions. --- dlls/wined3d/arb_program_shader.c | 168 +++++++++++++++++++------------------- dlls/wined3d/glsl_shader.c | 102 +++++++++++------------ dlls/wined3d/shader.c | 14 ++-- dlls/wined3d/wined3d_private.h | 17 ++-- 4 files changed, 150 insertions(+), 151 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 7a497d245bd..a45d25f30d4 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -743,7 +743,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]; @@ -756,7 +756,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) { @@ -975,7 +975,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; @@ -1271,7 +1271,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; @@ -1369,7 +1369,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; @@ -1488,7 +1488,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); @@ -1569,7 +1569,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]; @@ -1618,7 +1618,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, @@ -1651,7 +1651,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]; @@ -1671,7 +1671,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; @@ -1724,7 +1724,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; @@ -1786,7 +1786,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) @@ -1869,7 +1869,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, @@ -2001,7 +2001,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]; @@ -2023,7 +2023,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; @@ -2046,7 +2046,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]; @@ -2076,7 +2076,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; @@ -2130,7 +2130,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; @@ -2149,7 +2149,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]; @@ -2169,7 +2169,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; @@ -2193,7 +2193,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; @@ -2215,7 +2215,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]; @@ -2256,7 +2256,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]; @@ -2294,7 +2294,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); @@ -2326,7 +2326,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]; @@ -2346,7 +2346,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); @@ -2359,7 +2359,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; @@ -2378,7 +2378,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; @@ -2482,7 +2482,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; @@ -2538,7 +2538,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; @@ -2587,7 +2587,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]; @@ -2613,7 +2613,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]; @@ -2716,7 +2716,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; @@ -2759,7 +2759,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]; @@ -2775,7 +2775,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; @@ -2817,7 +2817,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); @@ -2844,7 +2844,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); @@ -2871,7 +2871,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) @@ -2894,7 +2894,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) @@ -2929,7 +2929,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); @@ -2977,7 +2977,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]; @@ -3004,7 +3004,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); @@ -3033,7 +3033,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); @@ -3053,7 +3053,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); @@ -3113,7 +3113,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; @@ -3128,7 +3128,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; @@ -3235,7 +3235,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); @@ -3253,7 +3253,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); } @@ -3403,7 +3403,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 */ @@ -3544,7 +3544,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); @@ -3554,7 +3554,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; @@ -4149,7 +4149,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) { @@ -4296,7 +4296,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; @@ -4357,7 +4357,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; @@ -4365,7 +4365,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++]; @@ -4391,7 +4391,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; @@ -4454,7 +4454,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; @@ -4463,7 +4463,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++]; @@ -5126,7 +5126,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; @@ -5467,7 +5467,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) @@ -5998,7 +5998,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; @@ -6070,7 +6070,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; @@ -6224,7 +6224,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}; @@ -6239,7 +6239,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; @@ -6512,7 +6512,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; } @@ -6910,7 +6910,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; @@ -6998,7 +6998,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; @@ -7147,7 +7147,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; @@ -7288,7 +7288,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 @@ -7297,7 +7297,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; @@ -7307,7 +7307,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; } @@ -7329,7 +7329,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; } @@ -7377,14 +7377,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; @@ -7396,7 +7396,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; } @@ -7451,7 +7451,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; @@ -7459,7 +7459,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; @@ -7467,14 +7467,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; } @@ -7492,7 +7492,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; } @@ -7502,11 +7502,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; @@ -7515,7 +7515,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)); @@ -7543,7 +7543,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 4c0266f76c7..2e0be379cdf 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]; @@ -1297,7 +1297,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; @@ -2159,7 +2159,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) { @@ -2196,7 +2196,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); } @@ -2535,7 +2535,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; @@ -2664,7 +2664,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; @@ -2697,7 +2697,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; @@ -2751,7 +2751,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; @@ -2774,7 +2774,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; @@ -2820,7 +2820,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; @@ -2872,7 +2872,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; @@ -2925,7 +2925,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; @@ -2952,7 +2952,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; @@ -2997,7 +2997,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; @@ -3025,7 +3025,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; @@ -3107,7 +3107,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; @@ -3124,7 +3124,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; @@ -3509,7 +3509,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; @@ -3598,7 +3598,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; @@ -4013,7 +4013,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)) @@ -4169,7 +4169,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); @@ -4181,7 +4181,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; @@ -4194,7 +4194,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; @@ -4255,7 +4255,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; @@ -4285,7 +4285,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; @@ -4492,7 +4492,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) @@ -4608,7 +4608,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, @@ -4704,7 +4704,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) { @@ -4715,7 +4715,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)); @@ -4819,7 +4819,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"); @@ -4829,7 +4829,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) { @@ -4860,7 +4860,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; @@ -4924,7 +4924,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; @@ -5000,7 +5000,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; @@ -5033,7 +5033,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; @@ -5100,7 +5100,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; @@ -5115,7 +5115,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; @@ -5173,7 +5173,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; @@ -5181,7 +5181,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; @@ -5211,7 +5211,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; @@ -5234,7 +5234,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; @@ -5341,13 +5341,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"); @@ -5464,7 +5464,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; @@ -5560,7 +5560,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; @@ -5712,7 +5712,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; @@ -5723,7 +5723,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) @@ -6941,7 +6941,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; @@ -6988,7 +6988,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); @@ -7018,7 +7018,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 7d0c47bb46a..612b0551bb5 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -245,13 +245,13 @@ 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; } -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))) @@ -260,16 +260,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) { unsigned int rem; int rc; @@ -297,7 +297,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; @@ -1533,7 +1533,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 1529c6b93de..c840c102a0d 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; @@ -663,7 +663,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; -- 2.11.4.GIT