ReactOS 0.4.15-dev-7906-g1b85a5f
glsl_shader.c File Reference
#include "config.h"
#include "wine/port.h"
#include <limits.h>
#include <stdio.h>
#include "wined3d_private.h"
Include dependency graph for glsl_shader.c:

Go to the source code of this file.

Classes

struct  glsl_dst_param
 
struct  glsl_src_param
 
struct  glsl_sample_function
 
struct  constant_entry
 
struct  constant_heap
 
struct  shader_glsl_priv
 
struct  glsl_vs_program
 
struct  glsl_hs_program
 
struct  glsl_ds_program
 
struct  glsl_gs_program
 
struct  glsl_ps_program
 
struct  glsl_cs_program
 
struct  glsl_shader_prog_link
 
struct  glsl_program_key
 
struct  shader_glsl_ctx_priv
 
struct  glsl_context_data
 
struct  glsl_ps_compiled_shader
 
struct  glsl_vs_compiled_shader
 
struct  glsl_hs_compiled_shader
 
struct  glsl_ds_compiled_shader
 
struct  glsl_gs_compiled_shader
 
struct  glsl_cs_compiled_shader
 
struct  glsl_shader_private
 
struct  glsl_ffp_vertex_shader
 
struct  glsl_ffp_fragment_shader
 
struct  glsl_ffp_destroy_ctx
 

Macros

#define WINED3D_GLSL_SAMPLE_PROJECTED   0x01
 
#define WINED3D_GLSL_SAMPLE_LOD   0x02
 
#define WINED3D_GLSL_SAMPLE_GRAD   0x04
 
#define WINED3D_GLSL_SAMPLE_LOAD   0x08
 
#define WINED3D_GLSL_SAMPLE_OFFSET   0x10
 
#define WINED3D_TO_STR(u)   case u: return #u
 

Enumerations

enum  heap_node_op { HEAP_NODE_TRAVERSE_LEFT , HEAP_NODE_TRAVERSE_RIGHT , HEAP_NODE_POP }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d_shader)
 
 WINE_DECLARE_DEBUG_CHANNEL (d3d)
 
 WINE_DECLARE_DEBUG_CHANNEL (winediag)
 
static void shader_glsl_generate_shader_epilogue (const struct wined3d_shader_context *ctx)
 
static const chardebug_gl_shader_type (GLenum type)
 
static const charshader_glsl_get_prefix (enum wined3d_shader_type type)
 
static unsigned int shader_glsl_get_version (const struct wined3d_gl_info *gl_info)
 
static void shader_glsl_add_version_declaration (struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info)
 
static void shader_glsl_append_imm_vec4 (struct wined3d_string_buffer *buffer, const float *values)
 
static void shader_glsl_append_imm_ivec (struct wined3d_string_buffer *buffer, const int *values, unsigned int size)
 
static const charget_info_log_line (const char **ptr)
 
void print_glsl_info_log (const struct wined3d_gl_info *gl_info, GLuint id, BOOL program)
 
static void shader_glsl_compile (const struct wined3d_gl_info *gl_info, GLuint shader, const char *src)
 
static void shader_glsl_dump_program_source (const struct wined3d_gl_info *gl_info, GLuint program)
 
void shader_glsl_validate_link (const struct wined3d_gl_info *gl_info, GLuint program)
 
static BOOL shader_glsl_use_layout_qualifier (const struct wined3d_gl_info *gl_info)
 
static BOOL shader_glsl_use_layout_binding_qualifier (const struct wined3d_gl_info *gl_info)
 
static void shader_glsl_init_uniform_block_bindings (const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps)
 
static void shader_glsl_load_samplers_range (const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, const char *prefix, unsigned int base, unsigned int count, const DWORD *tex_unit_map)
 
static unsigned int shader_glsl_map_tex_unit (const struct wined3d_context *context, const struct wined3d_shader_version *shader_version, unsigned int sampler_idx)
 
static void shader_glsl_append_sampler_binding_qualifier (struct wined3d_string_buffer *buffer, const struct wined3d_context *context, const struct wined3d_shader_version *shader_version, unsigned int sampler_idx)
 
static void shader_glsl_load_samplers (const struct wined3d_context *context, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps)
 
static void shader_glsl_load_icb (const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps)
 
static void shader_glsl_load_images (const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps)
 
static void shader_glsl_load_program_resources (const struct wined3d_context *context, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader *shader)
 
static void append_transform_feedback_varying (const char **varyings, unsigned int *varying_count, char **strings, unsigned int *strings_length, struct wined3d_string_buffer *buffer)
 
static void append_transform_feedback_skip_components (const char **varyings, unsigned int *varying_count, char **strings, unsigned int *strings_length, struct wined3d_string_buffer *buffer, unsigned int component_count)
 
static void shader_glsl_generate_transform_feedback_varyings (const struct wined3d_stream_output_desc *so_desc, struct wined3d_string_buffer *buffer, const char **varyings, unsigned int *varying_count, char *strings, unsigned int *strings_length, GLenum buffer_mode)
 
static void shader_glsl_init_transform_feedback (const struct wined3d_context *context, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader *shader)
 
static void walk_constant_heap (const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version)
 
static void apply_clamped_constant (const struct wined3d_gl_info *gl_info, GLint location, const struct wined3d_vec4 *data)
 
static void walk_constant_heap_clamped (const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version)
 
static void shader_glsl_load_constants_f (const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, unsigned int version)
 
static void shader_glsl_load_constants_i (const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, const struct wined3d_ivec4 *constants, const GLint locations[WINED3D_MAX_CONSTS_I], WORD constants_set)
 
static void shader_glsl_load_constantsB (const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, const GLint locations[WINED3D_MAX_CONSTS_B], const BOOL *constants, WORD constants_set)
 
static void reset_program_constant_version (struct wine_rb_entry *entry, void *context)
 
static void shader_glsl_load_np2fixup_constants (const struct glsl_ps_program *ps, const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
 
static void shader_glsl_ffp_vertex_texmatrix_uniform (const struct wined3d_context *context, const struct wined3d_state *state, unsigned int tex, struct glsl_shader_prog_link *prog)
 
static void shader_glsl_ffp_vertex_material_uniform (const struct wined3d_context *context, const struct wined3d_state *state, struct glsl_shader_prog_link *prog)
 
static void shader_glsl_ffp_vertex_lightambient_uniform (const struct wined3d_context *context, const struct wined3d_state *state, struct glsl_shader_prog_link *prog)
 
static void multiply_vector_matrix (struct wined3d_vec4 *dest, const struct wined3d_vec4 *src1, const struct wined3d_matrix *src2)
 
static void shader_glsl_ffp_vertex_light_uniform (const struct wined3d_context *context, const struct wined3d_state *state, unsigned int light, const struct wined3d_light_info *light_info, struct glsl_shader_prog_link *prog)
 
static void shader_glsl_pointsize_uniform (const struct wined3d_context *context, const struct wined3d_state *state, struct glsl_shader_prog_link *prog)
 
static void shader_glsl_load_fog_uniform (const struct wined3d_context *context, const struct wined3d_state *state, struct glsl_shader_prog_link *prog)
 
static void shader_glsl_clip_plane_uniform (const struct wined3d_context *context, const struct wined3d_state *state, unsigned int index, struct glsl_shader_prog_link *prog)
 
static void shader_glsl_load_color_key_constant (const struct glsl_ps_program *ps, const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
 
static void get_normal_matrix (struct wined3d_context *context, struct wined3d_matrix *mat, float *normal)
 
static void shader_glsl_load_constants (void *shader_priv, struct wined3d_context *context, const struct wined3d_state *state)
 
static void update_heap_entry (struct constant_heap *heap, unsigned int idx, DWORD new_version)
 
static void shader_glsl_update_float_vertex_constants (struct wined3d_device *device, UINT start, UINT count)
 
static void shader_glsl_update_float_pixel_constants (struct wined3d_device *device, UINT start, UINT count)
 
static unsigned int vec4_varyings (DWORD shader_major, const struct wined3d_gl_info *gl_info)
 
static BOOL needs_legacy_glsl_syntax (const struct wined3d_gl_info *gl_info)
 
static BOOL shader_glsl_use_explicit_attrib_location (const struct wined3d_gl_info *gl_info)
 
static BOOL shader_glsl_use_interface_blocks (const struct wined3d_gl_info *gl_info)
 
static const charget_attribute_keyword (const struct wined3d_gl_info *gl_info)
 
static void PRINTF_ATTR (4, 5)
 
static const charshader_glsl_shader_input_name (const struct wined3d_gl_info *gl_info)
 
static const charshader_glsl_shader_output_name (const struct wined3d_gl_info *gl_info)
 
static const charshader_glsl_interpolation_qualifiers (enum wined3d_shader_interpolation_mode mode)
 
static enum wined3d_shader_interpolation_mode wined3d_extract_interpolation_mode (const DWORD *packed_interpolation_mode, unsigned int register_idx)
 
static void shader_glsl_declare_shader_inputs (const struct wined3d_gl_info *gl_info, struct wined3d_string_buffer *buffer, unsigned int element_count, const DWORD *interpolation_mode, BOOL unroll)
 
static void shader_glsl_declare_shader_outputs (const struct wined3d_gl_info *gl_info, struct wined3d_string_buffer *buffer, unsigned int element_count, BOOL rasterizer_setup, const DWORD *interpolation_mode)
 
static const charglsl_primitive_type_from_d3d (enum wined3d_primitive_type primitive_type)
 
static BOOL glsl_is_color_reg_read (const struct wined3d_shader *shader, unsigned int idx)
 
static BOOL glsl_is_shadow_sampler (const struct wined3d_shader *shader, const struct ps_compile_args *ps_args, unsigned int resource_idx, unsigned int sampler_idx)
 
static void shader_glsl_declare_typed_vertex_attribute (struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info, const char *vector_type, const char *scalar_type, unsigned int index)
 
static void shader_glsl_declare_generic_vertex_attribute (struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info, const struct wined3d_shader_signature_element *e)
 
static void shader_generate_glsl_declarations (const struct wined3d_context *context, 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)
 
static void shader_glsl_add_src_param (const struct wined3d_shader_instruction *ins, const struct wined3d_shader_src_param *wined3d_src, DWORD mask, struct glsl_src_param *glsl_src)
 
static void shader_glsl_gen_modifier (enum wined3d_shader_src_modifier src_modifier, const char *in_reg, const char *in_regswizzle, char *out_str)
 
static void shader_glsl_fixup_scalar_register_variable (char *register_name, const char *glsl_variable, const struct wined3d_gl_info *gl_info)
 
static void shader_glsl_get_register_name (const struct wined3d_shader_register *reg, enum wined3d_data_type data_type, char *register_name, BOOL *is_color, const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_write_mask_to_str (DWORD write_mask, char *str)
 
static DWORD shader_glsl_get_write_mask (const struct wined3d_shader_dst_param *param, char *write_mask)
 
static unsigned int shader_glsl_get_write_mask_size (DWORD write_mask)
 
static unsigned int shader_glsl_swizzle_get_component (DWORD swizzle, unsigned int component_idx)
 
static void shader_glsl_swizzle_to_str (DWORD swizzle, BOOL fixup, DWORD mask, char *str)
 
static void shader_glsl_get_swizzle (const struct wined3d_shader_src_param *param, BOOL fixup, DWORD mask, char *swizzle_str)
 
static void shader_glsl_sprintf_cast (struct wined3d_string_buffer *dst_param, const char *src_param, enum wined3d_data_type dst_data_type, enum wined3d_data_type src_data_type)
 
static void shader_glsl_add_src_param_ext (const struct wined3d_shader_instruction *ins, const struct wined3d_shader_src_param *wined3d_src, DWORD mask, struct glsl_src_param *glsl_src, enum wined3d_data_type data_type)
 
static DWORD shader_glsl_add_dst_param (const struct wined3d_shader_instruction *ins, const struct wined3d_shader_dst_param *wined3d_dst, struct glsl_dst_param *glsl_dst)
 
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)
 
static DWORD shader_glsl_append_dst (struct wined3d_string_buffer *buffer, const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_add_instruction_modifiers (const struct wined3d_shader_instruction *ins)
 
static const charshader_glsl_get_rel_op (enum wined3d_shader_rel_op op)
 
static BOOL shader_glsl_has_core_grad (const struct wined3d_gl_info *gl_info)
 
static void shader_glsl_get_coord_size (enum wined3d_shader_resource_type resource_type, unsigned int *coord_size, unsigned int *deriv_size)
 
static void shader_glsl_get_sample_function (const struct wined3d_shader_context *ctx, DWORD resource_idx, DWORD sampler_idx, DWORD flags, struct glsl_sample_function *sample_function)
 
static void shader_glsl_release_sample_function (const struct wined3d_shader_context *ctx, struct glsl_sample_function *sample_function)
 
static void shader_glsl_append_fixup_arg (char *arguments, const char *reg_name, BOOL sign_fixup, enum fixup_channel_source channel_source)
 
static void shader_glsl_color_correction_ext (struct wined3d_string_buffer *buffer, const char *reg_name, DWORD mask, struct color_fixup_desc fixup)
 
static void shader_glsl_color_correction (const struct wined3d_shader_instruction *ins, struct color_fixup_desc fixup)
 
static void PRINTF_ATTR (9, 10)
 
static void shader_glsl_fixup_position (struct wined3d_string_buffer *buffer)
 
static void shader_glsl_binop (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_relop (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_unary_op (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_mul_extended (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_udiv (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_mov (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_dot (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_cross (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_cut (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_pow (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_map2gl (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_float16 (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_bitwise_op (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_nop (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_nrm (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_scalar_op (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_expp (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_cast (const struct wined3d_shader_instruction *ins, const char *vector_constructor, const char *scalar_constructor)
 
static void shader_glsl_to_int (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_to_uint (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_to_float (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_compare (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_swapc (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_conditional_move (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_cnd (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_mad (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_mnxn (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_lrp (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_lit (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_dst (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_sincos (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_sgn (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_loop (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_end (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_rep (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_switch (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_case (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_default (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_generate_conditional_op (const struct wined3d_shader_instruction *ins, const char *op)
 
static void shader_glsl_if (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_ifc (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_else (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_emit (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_break (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_breakc (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_conditional_op (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_continue (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_label (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_call (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_callnz (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_ret (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_tex (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texldd (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texldl (const struct wined3d_shader_instruction *ins)
 
static unsigned int shader_glsl_find_sampler (const struct wined3d_shader_sampler_map *sampler_map, unsigned int resource_idx, unsigned int sampler_idx)
 
static void shader_glsl_atomic (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_uav_counter (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_ld_uav (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_ld_raw_structured (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_store_uav (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_store_raw_structured (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_sync (const struct wined3d_shader_instruction *ins)
 
static const struct wined3d_shader_resource_infoshader_glsl_get_resource_info (const struct wined3d_shader_instruction *ins, const struct wined3d_shader_register *reg)
 
static void shader_glsl_bufinfo (const struct wined3d_shader_instruction *ins)
 
static BOOL is_multisampled (enum wined3d_shader_resource_type resource_type)
 
static BOOL is_mipmapped (enum wined3d_shader_resource_type resource_type)
 
static void shader_glsl_resinfo (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_ld (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_sample (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_gen_sample_c_lz (const struct wined3d_shader_instruction *ins, unsigned int sampler_bind_idx, const struct glsl_sample_function *sample_function, unsigned int coord_size, const char *coord_param, const char *ref_param)
 
static void shader_glsl_sample_c (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_gather4 (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texcoord (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texdp3tex (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texdp3 (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texdepth (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texm3x2depth (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texm3x2pad (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texm3x3pad (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texm3x2tex (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texm3x3tex (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texm3x3 (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texm3x3spec (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texm3x3vspec (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texbem (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_bem (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texreg2ar (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texreg2gb (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texreg2rgb (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_texkill (const struct wined3d_shader_instruction *ins)
 
static void shader_glsl_dp2add (const struct wined3d_shader_instruction *ins)
 
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, const struct ps_compile_args *args, const struct wined3d_gl_info *gl_info, BOOL unroll)
 
static void add_glsl_program_entry (struct shader_glsl_priv *priv, struct glsl_shader_prog_link *entry)
 
static struct glsl_shader_prog_linkget_glsl_program_entry (const struct shader_glsl_priv *priv, const struct glsl_program_key *key)
 
static void delete_glsl_program_entry (struct shader_glsl_priv *priv, const struct wined3d_gl_info *gl_info, struct glsl_shader_prog_link *entry)
 
static void shader_glsl_setup_vs3_output (struct shader_glsl_priv *priv, 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, const struct wined3d_shader_signature *output_signature, const struct wined3d_shader_reg_maps *reg_maps_out)
 
static void shader_glsl_setup_sm4_shader_output (struct shader_glsl_priv *priv, unsigned int input_count, const struct wined3d_shader_signature *output_signature, const struct wined3d_shader_reg_maps *reg_maps_out, const char *output_variable_name, BOOL rasterizer_setup)
 
static void shader_glsl_generate_clip_or_cull_distances (struct wined3d_string_buffer *buffer, const struct wined3d_shader_signature_element *element, DWORD clip_or_cull_distance_mask)
 
static void shader_glsl_setup_sm3_rasterizer_input (struct shader_glsl_priv *priv, 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, unsigned int input_count, const struct wined3d_shader_signature *output_signature, const struct wined3d_shader_reg_maps *reg_maps_out, BOOL per_vertex_point_size)
 
static GLuint shader_glsl_generate_vs3_rasterizer_input_setup (struct shader_glsl_priv *priv, const struct wined3d_shader *vs, const struct wined3d_shader *ps, BOOL per_vertex_point_size, BOOL flatshading, const struct wined3d_gl_info *gl_info)
 
static void shader_glsl_generate_stream_output_setup (struct shader_glsl_priv *priv, const struct wined3d_shader *shader, const struct wined3d_stream_output_desc *so_desc)
 
static void shader_glsl_generate_sm4_output_setup (struct shader_glsl_priv *priv, const struct wined3d_shader *shader, unsigned int input_count, const struct wined3d_gl_info *gl_info, BOOL rasterizer_setup, const DWORD *interpolation_mode)
 
static void shader_glsl_generate_patch_constant_name (struct wined3d_string_buffer *buffer, const struct wined3d_shader_signature_element *constant, unsigned int *user_constant_idx, const char *reg_mask)
 
static void shader_glsl_generate_patch_constant_setup (struct wined3d_string_buffer *buffer, const struct wined3d_shader_signature *signature, BOOL input_setup)
 
static void shader_glsl_generate_srgb_write_correction (struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info)
 
static void shader_glsl_generate_fog_code (struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info, enum wined3d_ffp_ps_fog_mode mode)
 
static void shader_glsl_generate_alpha_test (struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info, enum wined3d_cmp_func alpha_func)
 
static void shader_glsl_enable_extensions (struct wined3d_string_buffer *buffer, const struct wined3d_gl_info *gl_info)
 
static void shader_glsl_generate_ps_epilogue (const struct wined3d_gl_info *gl_info, struct wined3d_string_buffer *buffer, const struct wined3d_shader *shader, const struct ps_compile_args *args)
 
static GLuint shader_glsl_generate_pshader (const struct wined3d_context *context, struct wined3d_string_buffer *buffer, struct wined3d_string_buffer_list *string_buffers, const struct wined3d_shader *shader, const struct ps_compile_args *args, struct ps_np2fixup_info *np2fixup_info)
 
static void shader_glsl_generate_vs_epilogue (const struct wined3d_gl_info *gl_info, struct wined3d_string_buffer *buffer, const struct wined3d_shader *shader, const struct vs_compile_args *args)
 
static GLuint shader_glsl_generate_vshader (const struct wined3d_context *context, struct shader_glsl_priv *priv, const struct wined3d_shader *shader, const struct vs_compile_args *args)
 
static void shader_glsl_generate_default_control_point_phase (const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps)
 
static HRESULT shader_glsl_generate_shader_phase (const struct wined3d_shader *shader, struct wined3d_string_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, struct shader_glsl_ctx_priv *priv_ctx, const struct wined3d_shader_phase *phase, const char *phase_name, unsigned phase_idx)
 
static void shader_glsl_generate_shader_phase_invocation (struct wined3d_string_buffer *buffer, const struct wined3d_shader_phase *phase, const char *phase_name, unsigned int phase_idx)
 
static GLuint shader_glsl_generate_hull_shader (const struct wined3d_context *context, struct shader_glsl_priv *priv, const struct wined3d_shader *shader)
 
static void shader_glsl_generate_ds_epilogue (const struct wined3d_gl_info *gl_info, struct wined3d_string_buffer *buffer, const struct wined3d_shader *shader, const struct ds_compile_args *args)
 
static GLuint shader_glsl_generate_domain_shader (const struct wined3d_context *context, struct shader_glsl_priv *priv, const struct wined3d_shader *shader, const struct ds_compile_args *args)
 
static GLuint shader_glsl_generate_geometry_shader (const struct wined3d_context *context, struct shader_glsl_priv *priv, const struct wined3d_shader *shader, const struct gs_compile_args *args)
 
static GLuint shader_glsl_generate_compute_shader (const struct wined3d_context *context, struct wined3d_string_buffer *buffer, struct wined3d_string_buffer_list *string_buffers, const struct wined3d_shader *shader)
 
static GLuint find_glsl_pshader (const struct wined3d_context *context, struct wined3d_string_buffer *buffer, struct wined3d_string_buffer_list *string_buffers, struct wined3d_shader *shader, const struct ps_compile_args *args, const struct ps_np2fixup_info **np2fixup_info)
 
static BOOL vs_args_equal (const struct vs_compile_args *stored, const struct vs_compile_args *new, const DWORD use_map)
 
static GLuint find_glsl_vshader (const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader, const struct vs_compile_args *args)
 
static GLuint find_glsl_hull_shader (const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader)
 
static GLuint find_glsl_domain_shader (const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader, const struct ds_compile_args *args)
 
static GLuint find_glsl_geometry_shader (const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader, const struct gs_compile_args *args)
 
static const charshader_glsl_ffp_mcs (enum wined3d_material_color_source mcs, const char *material)
 
static void shader_glsl_ffp_vertex_lighting_footer (struct wined3d_string_buffer *buffer, const struct wined3d_ffp_vs_settings *settings, unsigned int idx)
 
static void shader_glsl_ffp_vertex_lighting (struct wined3d_string_buffer *buffer, const struct wined3d_ffp_vs_settings *settings, BOOL legacy_lighting)
 
static GLuint shader_glsl_generate_ffp_vertex_shader (struct shader_glsl_priv *priv, const struct wined3d_ffp_vs_settings *settings, const struct wined3d_gl_info *gl_info)
 
static const charshader_glsl_get_ffp_fragment_op_arg (struct wined3d_string_buffer *buffer, DWORD argnum, unsigned int stage, DWORD arg)
 
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)
 
static GLuint shader_glsl_generate_ffp_fragment_shader (struct shader_glsl_priv *priv, const struct ffp_frag_settings *settings, const struct wined3d_context *context)
 
static struct glsl_ffp_vertex_shadershader_glsl_find_ffp_vertex_shader (struct shader_glsl_priv *priv, const struct wined3d_gl_info *gl_info, const struct wined3d_ffp_vs_settings *settings)
 
static struct glsl_ffp_fragment_shadershader_glsl_find_ffp_fragment_shader (struct shader_glsl_priv *priv, const struct ffp_frag_settings *args, const struct wined3d_context *context)
 
static void shader_glsl_init_vs_uniform_locations (const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, struct glsl_vs_program *vs, unsigned int vs_c_count)
 
static void shader_glsl_init_ds_uniform_locations (const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, struct glsl_ds_program *ds)
 
static void shader_glsl_init_gs_uniform_locations (const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, struct glsl_gs_program *gs)
 
static void shader_glsl_init_ps_uniform_locations (const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, struct glsl_ps_program *ps, unsigned int ps_c_count)
 
static HRESULT shader_glsl_compile_compute_shader (struct shader_glsl_priv *priv, const struct wined3d_context *context, struct wined3d_shader *shader)
 
static GLuint find_glsl_compute_shader (const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader)
 
static void set_glsl_compute_shader_program (const struct wined3d_context *context, const struct wined3d_state *state, struct shader_glsl_priv *priv, struct glsl_context_data *ctx_data)
 
static void set_glsl_shader_program (const struct wined3d_context *context, const struct wined3d_state *state, struct shader_glsl_priv *priv, struct glsl_context_data *ctx_data)
 
static void shader_glsl_precompile (void *shader_priv, struct wined3d_shader *shader)
 
static void shader_glsl_select (void *shader_priv, struct wined3d_context *context, const struct wined3d_state *state)
 
static void shader_glsl_select_compute (void *shader_priv, struct wined3d_context *context, const struct wined3d_state *state)
 
static void shader_glsl_invalidate_current_program (struct wined3d_context *context)
 
static void shader_glsl_disable (void *shader_priv, struct wined3d_context *context)
 
static void shader_glsl_invalidate_contexts_program (struct wined3d_device *device, const struct glsl_shader_prog_link *program)
 
static void shader_glsl_destroy (struct wined3d_shader *shader)
 
static int glsl_program_key_compare (const void *key, const struct wine_rb_entry *entry)
 
static BOOL constant_heap_init (struct constant_heap *heap, unsigned int constant_count)
 
static void constant_heap_free (struct constant_heap *heap)
 
static HRESULT shader_glsl_alloc (struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe, const struct fragment_pipeline *fragment_pipe)
 
static void shader_glsl_free (struct wined3d_device *device)
 
static BOOL shader_glsl_allocate_context_data (struct wined3d_context *context)
 
static void shader_glsl_free_context_data (struct wined3d_context *context)
 
static void shader_glsl_init_context_state (struct wined3d_context *context)
 
static unsigned int shader_glsl_get_shader_model (const struct wined3d_gl_info *gl_info)
 
static void shader_glsl_get_caps (const struct wined3d_gl_info *gl_info, struct shader_caps *caps)
 
static BOOL shader_glsl_color_fixup_supported (struct color_fixup_desc fixup)
 
static void shader_glsl_handle_instruction (const struct wined3d_shader_instruction *ins)
 
static BOOL shader_glsl_has_ffp_proj_control (void *shader_priv)
 
static void glsl_vertex_pipe_vp_enable (const struct wined3d_gl_info *gl_info, BOOL enable)
 
static void glsl_vertex_pipe_vp_get_caps (const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps)
 
static DWORD glsl_vertex_pipe_vp_get_emul_mask (const struct wined3d_gl_info *gl_info)
 
static voidglsl_vertex_pipe_vp_alloc (const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
 
static void shader_glsl_free_ffp_vertex_shader (struct wine_rb_entry *entry, void *context)
 
static void glsl_vertex_pipe_vp_free (struct wined3d_device *device)
 
static void glsl_vertex_pipe_nop (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_shader (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_vdecl (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_vs (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_hs (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_geometry_shader (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_pixel_shader (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_world (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_vertexblend (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_view (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_projection (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_viewport (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_texmatrix (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_texmatrix_np2 (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_material (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_light (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_pointsize (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_pointscale (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pointsprite_core (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_shademode (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_vertex_pipe_clip_plane (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_enable (const struct wined3d_gl_info *gl_info, BOOL enable)
 
static void glsl_fragment_pipe_get_caps (const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
 
static DWORD glsl_fragment_pipe_get_emul_mask (const struct wined3d_gl_info *gl_info)
 
static voidglsl_fragment_pipe_alloc (const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
 
static void shader_glsl_free_ffp_fragment_shader (struct wine_rb_entry *entry, void *context)
 
static void glsl_fragment_pipe_free (struct wined3d_device *device)
 
static void glsl_fragment_pipe_shader (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_fogparams (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_fog (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_vdecl (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_vs (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_tex_transform (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_invalidate_constants (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_alpha_test_func (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_core_alpha_test (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_alpha_test (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_core_alpha_test_ref (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_color_key (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static void glsl_fragment_pipe_shademode (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
static BOOL glsl_fragment_pipe_alloc_context_data (struct wined3d_context *context)
 
static void glsl_fragment_pipe_free_context_data (struct wined3d_context *context)
 

Variables

struct {
   unsigned int   coord_size
 
   unsigned int   resinfo_size
 
   const char *   type_part
 
resource_type_info []
 
static const char *const shift_glsl_tab []
 
static const SHADER_HANDLER shader_glsl_instruction_handler_table [WINED3DSIH_TABLE_SIZE]
 
const struct wined3d_shader_backend_ops glsl_shader_backend
 
static const struct StateEntryTemplate glsl_vertex_pipe_vp_states []
 
const struct wined3d_vertex_pipe_ops glsl_vertex_pipe
 
static const struct StateEntryTemplate glsl_fragment_pipe_state_template []
 
const struct fragment_pipeline glsl_fragment_pipe
 

Macro Definition Documentation

◆ WINED3D_GLSL_SAMPLE_GRAD

#define WINED3D_GLSL_SAMPLE_GRAD   0x04

Definition at line 49 of file glsl_shader.c.

◆ WINED3D_GLSL_SAMPLE_LOAD

#define WINED3D_GLSL_SAMPLE_LOAD   0x08

Definition at line 50 of file glsl_shader.c.

◆ WINED3D_GLSL_SAMPLE_LOD

#define WINED3D_GLSL_SAMPLE_LOD   0x02

Definition at line 48 of file glsl_shader.c.

◆ WINED3D_GLSL_SAMPLE_OFFSET

#define WINED3D_GLSL_SAMPLE_OFFSET   0x10

Definition at line 51 of file glsl_shader.c.

◆ WINED3D_GLSL_SAMPLE_PROJECTED

#define WINED3D_GLSL_SAMPLE_PROJECTED   0x01

Definition at line 47 of file glsl_shader.c.

◆ WINED3D_TO_STR

#define WINED3D_TO_STR (   u)    case u: return #u

Enumeration Type Documentation

◆ heap_node_op

Enumerator
HEAP_NODE_TRAVERSE_LEFT 
HEAP_NODE_TRAVERSE_RIGHT 
HEAP_NODE_POP 

Definition at line 97 of file glsl_shader.c.

98{
102};
@ HEAP_NODE_POP
Definition: glsl_shader.c:101
@ HEAP_NODE_TRAVERSE_RIGHT
Definition: glsl_shader.c:100
@ HEAP_NODE_TRAVERSE_LEFT
Definition: glsl_shader.c:99

Function Documentation

◆ add_glsl_program_entry()

static void add_glsl_program_entry ( struct shader_glsl_priv priv,
struct glsl_shader_prog_link entry 
)
static

Definition at line 6569 of file glsl_shader.c.

6570{
6571 struct glsl_program_key key;
6572
6573 key.vs_id = entry->vs.id;
6574 key.hs_id = entry->hs.id;
6575 key.ds_id = entry->ds.id;
6576 key.gs_id = entry->gs.id;
6577 key.ps_id = entry->ps.id;
6578 key.cs_id = entry->cs.id;
6579
6580 if (wine_rb_put(&priv->program_lookup, &key, &entry->program_lookup_entry) == -1)
6581 {
6582 ERR("Failed to insert program entry.\n");
6583 }
6584}
#define ERR(fmt,...)
Definition: debug.h:110
uint32_t entry
Definition: isohybrid.c:63
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
Definition: rbtree.h:215
Definition: copy.c:22
struct wine_rb_tree program_lookup
Definition: glsl_shader.c:123

Referenced by set_glsl_shader_program(), and shader_glsl_compile_compute_shader().

◆ append_transform_feedback_skip_components()

static void append_transform_feedback_skip_components ( const char **  varyings,
unsigned int varying_count,
char **  strings,
unsigned int strings_length,
struct wined3d_string_buffer buffer,
unsigned int  component_count 
)
static

Definition at line 790 of file glsl_shader.c.

793{
794 unsigned int j;
795
796 for (j = 0; j < component_count / 4; ++j)
797 {
798 string_buffer_sprintf(buffer, "gl_SkipComponents4");
799 append_transform_feedback_varying(varyings, varying_count, strings, strings_length, buffer);
800 }
801 if (component_count % 4)
802 {
803 string_buffer_sprintf(buffer, "gl_SkipComponents%u", component_count % 4);
804 append_transform_feedback_varying(varyings, varying_count, strings, strings_length, buffer);
805 }
806}
unsigned int component_count
void string_buffer_sprintf(struct wined3d_string_buffer *buffer, const char *format,...)
Definition: shader.c:526
GLsizei const GLchar *const * varyings
Definition: glext.h:6214
GLsizei const GLchar *const * strings
Definition: glext.h:7622
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static void append_transform_feedback_varying(const char **varyings, unsigned int *varying_count, char **strings, unsigned int *strings_length, struct wined3d_string_buffer *buffer)
Definition: glsl_shader.c:771

Referenced by shader_glsl_generate_transform_feedback_varyings().

◆ append_transform_feedback_varying()

static void append_transform_feedback_varying ( const char **  varyings,
unsigned int varying_count,
char **  strings,
unsigned int strings_length,
struct wined3d_string_buffer buffer 
)
static

Definition at line 771 of file glsl_shader.c.

773{
774 if (varyings && *strings)
775 {
776 char *ptr = *strings;
777
778 varyings[*varying_count] = ptr;
779
780 memcpy(ptr, buffer->buffer, buffer->content_size + 1);
781 ptr += buffer->content_size + 1;
782
783 *strings = ptr;
784 }
785
786 *strings_length += buffer->content_size + 1;
787 ++(*varying_count);
788}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27

Referenced by append_transform_feedback_skip_components(), and shader_glsl_generate_transform_feedback_varyings().

◆ apply_clamped_constant()

static void apply_clamped_constant ( const struct wined3d_gl_info gl_info,
GLint  location,
const struct wined3d_vec4 data 
)
inlinestatic

Definition at line 1045 of file glsl_shader.c.

1047{
1048 GLfloat clamped_constant[4];
1049
1050 if (location == -1) return;
1051
1052 clamped_constant[0] = data->x < -1.0f ? -1.0f : data->x > 1.0f ? 1.0f : data->x;
1053 clamped_constant[1] = data->y < -1.0f ? -1.0f : data->y > 1.0f ? 1.0f : data->y;
1054 clamped_constant[2] = data->z < -1.0f ? -1.0f : data->z > 1.0f ? 1.0f : data->z;
1055 clamped_constant[3] = data->w < -1.0f ? -1.0f : data->w > 1.0f ? 1.0f : data->w;
1056
1057 GL_EXTCALL(glUniform4fv(location, 1, clamped_constant));
1058}
float GLfloat
Definition: gl.h:161
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define GL_EXTCALL(f)

Referenced by walk_constant_heap_clamped().

◆ constant_heap_free()

static void constant_heap_free ( struct constant_heap heap)
static

Definition at line 10634 of file glsl_shader.c.

10635{
10636 heap_free(heap->entries);
10637}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static HANDLE heap
Definition: heap.c:65

Referenced by shader_glsl_alloc(), and shader_glsl_free().

◆ constant_heap_init()

static BOOL constant_heap_init ( struct constant_heap heap,
unsigned int  constant_count 
)
static

Definition at line 10611 of file glsl_shader.c.

10612{
10613 SIZE_T size = (constant_count + 1) * sizeof(*heap->entries)
10614 + constant_count * sizeof(*heap->contained)
10615 + constant_count * sizeof(*heap->positions);
10616 void *mem;
10617
10618 if (!(mem = heap_alloc(size)))
10619 {
10620 ERR("Failed to allocate memory\n");
10621 return FALSE;
10622 }
10623
10624 heap->entries = mem;
10625 heap->entries[1].version = 0;
10626 heap->contained = (BOOL *)(heap->entries + constant_count + 1);
10627 memset(heap->contained, 0, constant_count * sizeof(*heap->contained));
10628 heap->positions = (unsigned int *)(heap->contained + constant_count);
10629 heap->size = 1;
10630
10631 return TRUE;
10632}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
UINT constant_count
Definition: shader.c:5673
#define memset(x, y, z)
Definition: compat.h:39
Definition: mem.c:156
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by shader_glsl_alloc().

◆ debug_gl_shader_type()

static const char * debug_gl_shader_type ( GLenum  type)
static

Definition at line 347 of file glsl_shader.c.

348{
349 switch (type)
350 {
351#define WINED3D_TO_STR(u) case u: return #u
358#undef WINED3D_TO_STR
359 default:
360 return wine_dbg_sprintf("UNKNOWN(%#x)", type);
361 }
362}
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define GL_FRAGMENT_SHADER
Definition: glext.h:419
#define GL_GEOMETRY_SHADER
Definition: glext.h:820
#define GL_TESS_CONTROL_SHADER
Definition: glext.h:2126
#define GL_TESS_EVALUATION_SHADER
Definition: glext.h:2125
#define GL_VERTEX_SHADER
Definition: glext.h:420
#define WINED3D_TO_STR(u)
#define GL_COMPUTE_SHADER
Definition: wgl.h:689

Referenced by shader_glsl_dump_program_source().

◆ delete_glsl_program_entry()

static void delete_glsl_program_entry ( struct shader_glsl_priv priv,
const struct wined3d_gl_info gl_info,
struct glsl_shader_prog_link entry 
)
static

Definition at line 6596 of file glsl_shader.c.

6598{
6599 wine_rb_remove(&priv->program_lookup, &entry->program_lookup_entry);
6600
6601 GL_EXTCALL(glDeleteProgram(entry->id));
6602 if (entry->vs.id)
6603 list_remove(&entry->vs.shader_entry);
6604 if (entry->hs.id)
6605 list_remove(&entry->hs.shader_entry);
6606 if (entry->ds.id)
6607 list_remove(&entry->ds.shader_entry);
6608 if (entry->gs.id)
6609 list_remove(&entry->gs.shader_entry);
6610 if (entry->ps.id)
6611 list_remove(&entry->ps.shader_entry);
6612 if (entry->cs.id)
6613 list_remove(&entry->cs.shader_entry);
6615}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void wine_rb_remove(struct wine_rb_tree *tree, struct wine_rb_entry *entry)
Definition: rbtree.h:283

Referenced by shader_glsl_destroy(), shader_glsl_free_ffp_fragment_shader(), and shader_glsl_free_ffp_vertex_shader().

◆ find_glsl_compute_shader()

static GLuint find_glsl_compute_shader ( const struct wined3d_context context,
struct shader_glsl_priv priv,
struct wined3d_shader shader 
)
static

Definition at line 9778 of file glsl_shader.c.

9780{
9781 struct glsl_shader_private *shader_data;
9782
9783 if (!shader->backend_data)
9784 {
9785 WARN("Failed to find GLSL program for compute shader %p.\n", shader);
9787 {
9788 ERR("Failed to compile compute shader %p.\n", shader);
9789 return 0;
9790 }
9791 }
9792 shader_data = shader->backend_data;
9793 return shader_data->gl_shaders.cs[0].id;
9794}
#define WARN(fmt,...)
Definition: debug.h:112
GLuint shader
Definition: glext.h:6030
static HRESULT shader_glsl_compile_compute_shader(struct shader_glsl_priv *priv, const struct wined3d_context *context, struct wined3d_shader *shader)
Definition: glsl_shader.c:9698
#define FAILED(hr)
Definition: intsafe.h:51
Definition: http.c:7252
union glsl_shader_private::@276 gl_shaders
struct glsl_cs_compiled_shader * cs
Definition: glsl_shader.c:320

Referenced by set_glsl_compute_shader_program().

◆ find_glsl_domain_shader()

static GLuint find_glsl_domain_shader ( const struct wined3d_context context,
struct shader_glsl_priv priv,
struct wined3d_shader shader,
const struct ds_compile_args args 
)
static

Definition at line 8264 of file glsl_shader.c.

8266{
8267 struct glsl_ds_compiled_shader *gl_shaders, *new_array;
8268 struct glsl_shader_private *shader_data;
8269 unsigned int i, new_size;
8270 GLuint ret;
8271
8272 if (!shader->backend_data)
8273 {
8274 if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
8275 {
8276 ERR("Failed to allocate backend data.\n");
8277 return 0;
8278 }
8279 }
8280 shader_data = shader->backend_data;
8281 gl_shaders = shader_data->gl_shaders.ds;
8282
8283 for (i = 0; i < shader_data->num_gl_shaders; ++i)
8284 {
8285 if (!memcmp(&gl_shaders[i].args, args, sizeof(*args)))
8286 return gl_shaders[i].id;
8287 }
8288
8289 TRACE("No matching GL shader found for shader %p, compiling a new shader.\n", shader);
8290
8291 if (shader_data->num_gl_shaders)
8292 {
8293 new_size = shader_data->shader_array_size + 1;
8294 new_array = heap_realloc(shader_data->gl_shaders.ds, new_size * sizeof(*new_array));
8295 }
8296 else
8297 {
8298 new_array = heap_alloc(sizeof(*new_array));
8299 new_size = 1;
8300 }
8301
8302 if (!new_array)
8303 {
8304 ERR("Failed to allocate GL shaders array.\n");
8305 return 0;
8306 }
8307 shader_data->gl_shaders.ds = new_array;
8308 shader_data->shader_array_size = new_size;
8309 gl_shaders = new_array;
8310
8313 gl_shaders[shader_data->num_gl_shaders].args = *args;
8314 gl_shaders[shader_data->num_gl_shaders++].id = ret;
8315
8316 return ret;
8317}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
void string_buffer_clear(struct wined3d_string_buffer *buffer)
Definition: shader.c:422
unsigned int GLuint
Definition: gl.h:159
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static GLuint shader_glsl_generate_domain_shader(const struct wined3d_context *context, struct shader_glsl_priv *priv, const struct wined3d_shader *shader, const struct ds_compile_args *args)
Definition: glsl_shader.c:7848
#define args
Definition: format.c:66
#define TRACE(s)
Definition: solgame.cpp:4
Definition: match.c:390
unsigned int num_gl_shaders
Definition: glsl_shader.c:322
struct glsl_ds_compiled_shader * ds
Definition: glsl_shader.c:317
unsigned int shader_array_size
Definition: glsl_shader.c:322
struct wined3d_string_buffer shader_buffer
Definition: glsl_shader.c:121
int ret

Referenced by set_glsl_shader_program().

◆ find_glsl_geometry_shader()

static GLuint find_glsl_geometry_shader ( const struct wined3d_context context,
struct shader_glsl_priv priv,
struct wined3d_shader shader,
const struct gs_compile_args args 
)
static

Definition at line 8319 of file glsl_shader.c.

8321{
8322 struct glsl_gs_compiled_shader *gl_shaders, *new_array;
8323 struct glsl_shader_private *shader_data;
8324 unsigned int i, new_size;
8325 GLuint ret;
8326
8327 if (!shader->backend_data)
8328 {
8329 if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
8330 {
8331 ERR("Failed to allocate backend data.\n");
8332 return 0;
8333 }
8334 }
8335 shader_data = shader->backend_data;
8336 gl_shaders = shader_data->gl_shaders.gs;
8337
8338 for (i = 0; i < shader_data->num_gl_shaders; ++i)
8339 {
8340 if (!memcmp(&gl_shaders[i].args, args, sizeof(*args)))
8341 return gl_shaders[i].id;
8342 }
8343
8344 TRACE("No matching GL shader found for shader %p, compiling a new shader.\n", shader);
8345
8346 if (shader_data->num_gl_shaders)
8347 {
8348 new_size = shader_data->shader_array_size + 1;
8349 new_array = heap_realloc(shader_data->gl_shaders.gs, new_size * sizeof(*new_array));
8350 }
8351 else
8352 {
8353 new_array = heap_alloc(sizeof(*new_array));
8354 new_size = 1;
8355 }
8356
8357 if (!new_array)
8358 {
8359 ERR("Failed to allocate GL shaders array.\n");
8360 return 0;
8361 }
8362 shader_data->gl_shaders.gs = new_array;
8363 shader_data->shader_array_size = new_size;
8364 gl_shaders = new_array;
8365
8368 gl_shaders[shader_data->num_gl_shaders].args = *args;
8369 gl_shaders[shader_data->num_gl_shaders++].id = ret;
8370
8371 return ret;
8372}
static GLuint shader_glsl_generate_geometry_shader(const struct wined3d_context *context, struct shader_glsl_priv *priv, const struct wined3d_shader *shader, const struct gs_compile_args *args)
Definition: glsl_shader.c:7942
struct glsl_gs_compiled_shader * gs
Definition: glsl_shader.c:318

Referenced by set_glsl_shader_program().

◆ find_glsl_hull_shader()

static GLuint find_glsl_hull_shader ( const struct wined3d_context context,
struct shader_glsl_priv priv,
struct wined3d_shader shader 
)
static

Definition at line 8219 of file glsl_shader.c.

8221{
8222 struct glsl_hs_compiled_shader *gl_shaders, *new_array;
8223 struct glsl_shader_private *shader_data;
8224 unsigned int new_size;
8225 GLuint ret;
8226
8227 if (!shader->backend_data)
8228 {
8229 if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
8230 {
8231 ERR("Failed to allocate backend data.\n");
8232 return 0;
8233 }
8234 }
8235 shader_data = shader->backend_data;
8236 gl_shaders = shader_data->gl_shaders.hs;
8237
8238 if (shader_data->num_gl_shaders > 0)
8239 {
8240 assert(shader_data->num_gl_shaders == 1);
8241 return gl_shaders[0].id;
8242 }
8243
8244 TRACE("No matching GL shader found for shader %p, compiling a new shader.\n", shader);
8245
8246 assert(!shader_data->gl_shaders.hs);
8247 new_size = 1;
8248 if (!(new_array = heap_alloc(sizeof(*new_array))))
8249 {
8250 ERR("Failed to allocate GL shaders array.\n");
8251 return 0;
8252 }
8253 shader_data->gl_shaders.hs = new_array;
8254 shader_data->shader_array_size = new_size;
8255 gl_shaders = new_array;
8256
8259 gl_shaders[shader_data->num_gl_shaders++].id = ret;
8260
8261 return ret;
8262}
#define assert(x)
Definition: debug.h:53
static GLuint shader_glsl_generate_hull_shader(const struct wined3d_context *context, struct shader_glsl_priv *priv, const struct wined3d_shader *shader)
Definition: glsl_shader.c:7752
struct glsl_hs_compiled_shader * hs
Definition: glsl_shader.c:316

Referenced by set_glsl_shader_program().

◆ find_glsl_pshader()

static GLuint find_glsl_pshader ( const struct wined3d_context context,
struct wined3d_string_buffer buffer,
struct wined3d_string_buffer_list string_buffers,
struct wined3d_shader shader,
const struct ps_compile_args args,
const struct ps_np2fixup_info **  np2fixup_info 
)
static

Definition at line 8062 of file glsl_shader.c.

8066{
8067 struct glsl_ps_compiled_shader *gl_shaders, *new_array;
8068 struct glsl_shader_private *shader_data;
8069 struct ps_np2fixup_info *np2fixup;
8070 UINT i;
8071 DWORD new_size;
8072 GLuint ret;
8073
8074 if (!shader->backend_data)
8075 {
8076 if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
8077 {
8078 ERR("Failed to allocate backend data.\n");
8079 return 0;
8080 }
8081 }
8082 shader_data = shader->backend_data;
8083 gl_shaders = shader_data->gl_shaders.ps;
8084
8085 /* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2),
8086 * so a linear search is more performant than a hashmap or a binary search
8087 * (cache coherency etc)
8088 */
8089 for (i = 0; i < shader_data->num_gl_shaders; ++i)
8090 {
8091 if (!memcmp(&gl_shaders[i].args, args, sizeof(*args)))
8092 {
8093 if (args->np2_fixup)
8094 *np2fixup_info = &gl_shaders[i].np2fixup;
8095 return gl_shaders[i].id;
8096 }
8097 }
8098
8099 TRACE("No matching GL shader found for shader %p, compiling a new shader.\n", shader);
8100 if (shader_data->shader_array_size == shader_data->num_gl_shaders)
8101 {
8102 if (shader_data->num_gl_shaders)
8103 {
8104 new_size = shader_data->shader_array_size + max(1, shader_data->shader_array_size / 2);
8105 new_array = heap_realloc(shader_data->gl_shaders.ps, new_size * sizeof(*gl_shaders));
8106 }
8107 else
8108 {
8109 new_array = heap_alloc(sizeof(*gl_shaders));
8110 new_size = 1;
8111 }
8112
8113 if(!new_array) {
8114 ERR("Out of memory\n");
8115 return 0;
8116 }
8117 shader_data->gl_shaders.ps = new_array;
8118 shader_data->shader_array_size = new_size;
8119 gl_shaders = new_array;
8120 }
8121
8122 gl_shaders[shader_data->num_gl_shaders].args = *args;
8123
8124 np2fixup = &gl_shaders[shader_data->num_gl_shaders].np2fixup;
8125 memset(np2fixup, 0, sizeof(*np2fixup));
8126 *np2fixup_info = args->np2_fixup ? np2fixup : NULL;
8127
8129
8131 ret = shader_glsl_generate_pshader(context, buffer, string_buffers, shader, args, np2fixup);
8132 gl_shaders[shader_data->num_gl_shaders++].id = ret;
8133
8134 return ret;
8135}
#define NULL
Definition: types.h:112
void pixelshader_update_resource_types(struct wined3d_shader *shader, WORD tex_types)
Definition: shader.c:4073
unsigned long DWORD
Definition: ntddk_ex.h:95
static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context, struct wined3d_string_buffer *buffer, struct wined3d_string_buffer_list *string_buffers, const struct wined3d_shader *shader, const struct ps_compile_args *args, struct ps_np2fixup_info *np2fixup_info)
Definition: glsl_shader.c:7280
unsigned int UINT
Definition: ndis.h:50
struct ps_compile_args args
Definition: glsl_shader.c:278
struct ps_np2fixup_info np2fixup
Definition: glsl_shader.c:279
struct glsl_ps_compiled_shader * ps
Definition: glsl_shader.c:319
#define max(a, b)
Definition: svc.c:63

Referenced by set_glsl_shader_program().

◆ find_glsl_vshader()

static GLuint find_glsl_vshader ( const struct wined3d_context context,
struct shader_glsl_priv priv,
struct wined3d_shader shader,
const struct vs_compile_args args 
)
static

Definition at line 8155 of file glsl_shader.c.

8157{
8158 UINT i;
8159 DWORD new_size;
8160 DWORD use_map = context->stream_info.use_map;
8161 struct glsl_vs_compiled_shader *gl_shaders, *new_array;
8162 struct glsl_shader_private *shader_data;
8163 GLuint ret;
8164
8165 if (!shader->backend_data)
8166 {
8167 if (!(shader->backend_data = heap_alloc_zero(sizeof(*shader_data))))
8168 {
8169 ERR("Failed to allocate backend data.\n");
8170 return 0;
8171 }
8172 }
8173 shader_data = shader->backend_data;
8174 gl_shaders = shader_data->gl_shaders.vs;
8175
8176 /* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2),
8177 * so a linear search is more performant than a hashmap or a binary search
8178 * (cache coherency etc)
8179 */
8180 for (i = 0; i < shader_data->num_gl_shaders; ++i)
8181 {
8182 if (vs_args_equal(&gl_shaders[i].args, args, use_map))
8183 return gl_shaders[i].id;
8184 }
8185
8186 TRACE("No matching GL shader found for shader %p, compiling a new shader.\n", shader);
8187
8188 if (shader_data->shader_array_size == shader_data->num_gl_shaders)
8189 {
8190 if (shader_data->num_gl_shaders)
8191 {
8192 new_size = shader_data->shader_array_size + max(1, shader_data->shader_array_size / 2);
8193 new_array = heap_realloc(shader_data->gl_shaders.vs, new_size * sizeof(*gl_shaders));
8194 }
8195 else
8196 {
8197 new_array = heap_alloc(sizeof(*gl_shaders));
8198 new_size = 1;
8199 }
8200
8201 if(!new_array) {
8202 ERR("Out of memory\n");
8203 return 0;
8204 }
8205 shader_data->gl_shaders.vs = new_array;
8206 shader_data->shader_array_size = new_size;
8207 gl_shaders = new_array;
8208 }
8209
8210 gl_shaders[shader_data->num_gl_shaders].args = *args;
8211
8214 gl_shaders[shader_data->num_gl_shaders++].id = ret;
8215
8216 return ret;
8217}
static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context, struct shader_glsl_priv *priv, const struct wined3d_shader *shader, const struct vs_compile_args *args)
Definition: glsl_shader.c:7611
static BOOL vs_args_equal(const struct vs_compile_args *stored, const struct vs_compile_args *new, const DWORD use_map)
Definition: glsl_shader.c:8137
struct glsl_vs_compiled_shader * vs
Definition: glsl_shader.c:315

Referenced by set_glsl_shader_program().

◆ get_attribute_keyword()

static const char * get_attribute_keyword ( const struct wined3d_gl_info gl_info)
static

Definition at line 1817 of file glsl_shader.c.

1818{
1819 return needs_legacy_glsl_syntax(gl_info) ? "attribute" : "in";
1820}
static BOOL needs_legacy_glsl_syntax(const struct wined3d_gl_info *gl_info)
Definition: glsl_shader.c:1801

Referenced by shader_glsl_declare_generic_vertex_attribute(), shader_glsl_declare_typed_vertex_attribute(), and shader_glsl_generate_ffp_vertex_shader().

◆ get_glsl_program_entry()

static struct glsl_shader_prog_link * get_glsl_program_entry ( const struct shader_glsl_priv priv,
const struct glsl_program_key key 
)
static

Definition at line 6586 of file glsl_shader.c.

6588{
6589 struct wine_rb_entry *entry;
6590
6592 return entry ? WINE_RB_ENTRY_VALUE(entry, struct glsl_shader_prog_link, program_lookup_entry) : NULL;
6593}
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
static struct wine_rb_entry * wine_rb_get(const struct wine_rb_tree *tree, const void *key)
Definition: rbtree.h:203
Definition: rbtree.h:36

Referenced by set_glsl_compute_shader_program(), and set_glsl_shader_program().

◆ get_info_log_line()

static const char * get_info_log_line ( const char **  ptr)
static

Definition at line 442 of file glsl_shader.c.

443{
444 const char *p, *q;
445
446 p = *ptr;
447 if (!(q = strstr(p, "\n")))
448 {
449 if (!*p) return NULL;
450 *ptr += strlen(p);
451 return p;
452 }
453 *ptr = q + 1;
454
455 return p;
456}
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by print_glsl_info_log(), shader_glsl_compile(), and shader_glsl_dump_program_source().

◆ get_normal_matrix()

static void get_normal_matrix ( struct wined3d_context context,
struct wined3d_matrix mat,
float normal 
)
static

Definition at line 1438 of file glsl_shader.c.

1439{
1440 int i, j;
1441
1442 if (context->d3d_info->wined3d_creation_flags & WINED3D_LEGACY_FFP_LIGHTING)
1444 else
1446 /* Tests show that singular modelview matrices are used unchanged as normal
1447 * matrices on D3D3 and older. There seems to be no clearly consistent
1448 * behavior on newer D3D versions so always follow older ddraw behavior. */
1449 for (i = 0; i < 3; ++i)
1450 for (j = 0; j < 3; ++j)
1451 normal[i * 3 + j] = (&mat->_11)[j * 4 + i];
1452}
BOOL invert_matrix(struct wined3d_matrix *out, const struct wined3d_matrix *m)
Definition: utils.c:5501
BOOL invert_matrix_3d(struct wined3d_matrix *out, const struct wined3d_matrix *in)
Definition: utils.c:5431
static const MAT2 mat
Definition: font.c:66
@ normal
Definition: optimize.h:166
#define WINED3D_LEGACY_FFP_LIGHTING
Definition: wined3d.h:1323

Referenced by shader_glsl_load_constants().

◆ glsl_fragment_pipe_alloc()

static void * glsl_fragment_pipe_alloc ( const struct wined3d_shader_backend_ops shader_backend,
void shader_priv 
)
static

Definition at line 11663 of file glsl_shader.c.

11664{
11665 struct shader_glsl_priv *priv;
11666
11667 if (shader_backend == &glsl_shader_backend)
11668 {
11669 priv = shader_priv;
11671 return priv;
11672 }
11673
11674 FIXME("GLSL fragment pipe without GLSL shader backend not implemented.\n");
11675
11676 return NULL;
11677}
#define FIXME(fmt,...)
Definition: debug.h:111
int wined3d_ffp_frag_program_key_compare(const void *key, const struct wine_rb_entry *entry)
Definition: utils.c:6230
const struct wined3d_shader_backend_ops glsl_shader_backend
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
Definition: rbtree.h:179
struct wine_rb_tree ffp_fragment_shaders
Definition: glsl_shader.c:132

◆ glsl_fragment_pipe_alloc_context_data()

static BOOL glsl_fragment_pipe_alloc_context_data ( struct wined3d_context context)
static

Definition at line 11960 of file glsl_shader.c.

11961{
11962 return TRUE;
11963}

◆ glsl_fragment_pipe_alpha_test()

static void glsl_fragment_pipe_alpha_test ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11805 of file glsl_shader.c.

11807{
11808 const struct wined3d_gl_info *gl_info = context->gl_info;
11809
11810 if (state->render_states[WINED3D_RS_ALPHATESTENABLE])
11811 {
11812 gl_info->gl_ops.gl.p_glEnable(GL_ALPHA_TEST);
11813 checkGLcall("glEnable(GL_ALPHA_TEST)");
11814 }
11815 else
11816 {
11817 gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
11818 checkGLcall("glDisable(GL_ALPHA_TEST)");
11819 }
11820}
static int state
Definition: maze.c:121
#define GL_ALPHA_TEST
Definition: gl.h:366
struct opengl_funcs gl_ops
@ WINED3D_RS_ALPHATESTENABLE
Definition: wined3d.h:277
#define checkGLcall(A)

◆ glsl_fragment_pipe_alpha_test_func()

static void glsl_fragment_pipe_alpha_test_func ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11785 of file glsl_shader.c.

11787{
11788 const struct wined3d_gl_info *gl_info = context->gl_info;
11790 float ref = state->render_states[WINED3D_RS_ALPHAREF] / 255.0f;
11791
11792 if (func)
11793 {
11794 gl_info->gl_ops.gl.p_glAlphaFunc(func, ref);
11795 checkGLcall("glAlphaFunc");
11796 }
11797}
GLenum wined3d_gl_compare_func(enum wined3d_cmp_func f)
Definition: state.c:348
int GLint
Definition: gl.h:156
GLenum func
Definition: glext.h:6028
Definition: send.c:48
@ WINED3D_RS_ALPHAREF
Definition: wined3d.h:283
@ WINED3D_RS_ALPHAFUNC
Definition: wined3d.h:284

◆ glsl_fragment_pipe_color_key()

static void glsl_fragment_pipe_color_key ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11828 of file glsl_shader.c.

11830{
11831 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_COLOR_KEY;
11832}
#define WINED3D_SHADER_CONST_FFP_COLOR_KEY

◆ glsl_fragment_pipe_core_alpha_test()

static void glsl_fragment_pipe_core_alpha_test ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11799 of file glsl_shader.c.

11801{
11802 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
11803}
@ WINED3D_SHADER_TYPE_PIXEL

◆ glsl_fragment_pipe_core_alpha_test_ref()

static void glsl_fragment_pipe_core_alpha_test_ref ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11822 of file glsl_shader.c.

11824{
11825 context->constant_update_mask |= WINED3D_SHADER_CONST_PS_ALPHA_TEST;
11826}
#define WINED3D_SHADER_CONST_PS_ALPHA_TEST

◆ glsl_fragment_pipe_enable()

static void glsl_fragment_pipe_enable ( const struct wined3d_gl_info gl_info,
BOOL  enable 
)
static

Definition at line 11615 of file glsl_shader.c.

11616{
11617 /* Nothing to do. */
11618}

◆ glsl_fragment_pipe_fog()

static void glsl_fragment_pipe_fog ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11720 of file glsl_shader.c.

11722{
11723 BOOL use_vshader = use_vs(state);
11724 enum fogsource new_source;
11725 DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART];
11726 DWORD fogend = state->render_states[WINED3D_RS_FOGEND];
11727
11728 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
11729
11730 if (!state->render_states[WINED3D_RS_FOGENABLE])
11731 return;
11732
11733 if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE)
11734 {
11735 if (use_vshader)
11736 new_source = FOGSOURCE_VS;
11737 else if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE || context->stream_info.position_transformed)
11738 new_source = FOGSOURCE_COORD;
11739 else
11740 new_source = FOGSOURCE_FFP;
11741 }
11742 else
11743 {
11744 new_source = FOGSOURCE_FFP;
11745 }
11746
11747 if (new_source != context->fog_source || fogstart == fogend)
11748 {
11749 context->fog_source = new_source;
11750 context->constant_update_mask |= WINED3D_SHADER_CONST_PS_FOG;
11751 }
11752}
@ WINED3D_FOG_NONE
Definition: wined3d.h:471
@ WINED3D_RS_FOGEND
Definition: wined3d.h:296
@ WINED3D_RS_FOGSTART
Definition: wined3d.h:295
@ WINED3D_RS_FOGTABLEMODE
Definition: wined3d.h:294
@ WINED3D_RS_FOGENABLE
Definition: wined3d.h:287
@ WINED3D_RS_FOGVERTEXMODE
Definition: wined3d.h:327
static BOOL use_vs(const struct wined3d_state *state)
fogsource
@ FOGSOURCE_VS
@ FOGSOURCE_COORD
@ FOGSOURCE_FFP
#define WINED3D_SHADER_CONST_PS_FOG

Referenced by glsl_fragment_pipe_vdecl().

◆ glsl_fragment_pipe_fogparams()

static void glsl_fragment_pipe_fogparams ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11714 of file glsl_shader.c.

11716{
11717 context->constant_update_mask |= WINED3D_SHADER_CONST_PS_FOG;
11718}

◆ glsl_fragment_pipe_free()

static void glsl_fragment_pipe_free ( struct wined3d_device device)
static

Definition at line 11696 of file glsl_shader.c.

11697{
11698 struct shader_glsl_priv *priv = device->fragment_priv;
11700
11701 ctx.priv = priv;
11702 ctx.gl_info = &device->adapter->gl_info;
11704}
static void shader_glsl_free_ffp_fragment_shader(struct wine_rb_entry *entry, void *context)
static void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
Definition: rbtree.h:198
Definition: devices.h:37
struct shader_glsl_priv * priv
Definition: glsl_shader.c:341

◆ glsl_fragment_pipe_free_context_data()

static void glsl_fragment_pipe_free_context_data ( struct wined3d_context context)
static

Definition at line 11965 of file glsl_shader.c.

11966{
11967}

◆ glsl_fragment_pipe_get_caps()

static void glsl_fragment_pipe_get_caps ( const struct wined3d_gl_info gl_info,
struct fragment_caps caps 
)
static

Definition at line 11620 of file glsl_shader.c.

11621{
11654}
#define min(a, b)
Definition: monoChain.cc:55
DWORD MaxSimultaneousTextures
DWORD MaxTextureBlendStages
struct wined3d_gl_limits limits
#define WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
Definition: wined3d.h:1162
#define WINED3DTEXOPCAPS_ADD
Definition: wined3d.h:1151
#define WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
Definition: wined3d.h:1163
#define WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA
Definition: wined3d.h:1156
#define WINED3DPMISCCAPS_PERSTAGECONSTANT
Definition: wined3d.h:1105
#define WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE
Definition: wined3d.h:1167
#define WINED3DTEXOPCAPS_BLENDTEXTUREALPHA
Definition: wined3d.h:1157
#define WINED3DTEXOPCAPS_MODULATE2X
Definition: wined3d.h:1149
#define WINED3DTEXOPCAPS_DISABLE
Definition: wined3d.h:1145
#define WINED3DTEXOPCAPS_SELECTARG1
Definition: wined3d.h:1146
#define WINED3DTEXOPCAPS_SUBTRACT
Definition: wined3d.h:1154
#define WINED3DTEXOPCAPS_BUMPENVMAP
Definition: wined3d.h:1166
#define WINED3DTEXOPCAPS_ADDSIGNED2X
Definition: wined3d.h:1153
#define WINED3DTEXOPCAPS_MODULATE4X
Definition: wined3d.h:1150
#define WINED3DTEXOPCAPS_ADDSMOOTH
Definition: wined3d.h:1155
#define WINED3DPMISCCAPS_TSSARGTEMP
Definition: wined3d.h:1101
#define WINED3DTEXOPCAPS_MULTIPLYADD
Definition: wined3d.h:1169
#define WINED3DTEXOPCAPS_BLENDFACTORALPHA
Definition: wined3d.h:1158
#define WINED3DTEXOPCAPS_ADDSIGNED
Definition: wined3d.h:1152
#define WINED3DTEXOPCAPS_DOTPRODUCT3
Definition: wined3d.h:1168
#define WINED3DTEXOPCAPS_LERP
Definition: wined3d.h:1170
#define WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM
Definition: wined3d.h:1159
#define WINED3DTEXOPCAPS_SELECTARG2
Definition: wined3d.h:1147
#define WINED3DTEXOPCAPS_MODULATE
Definition: wined3d.h:1148
#define WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA
Definition: wined3d.h:1165
#define WINED3DTEXOPCAPS_BLENDCURRENTALPHA
Definition: wined3d.h:1160
#define WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR
Definition: wined3d.h:1164
#define WINED3D_FRAGMENT_CAP_COLOR_KEY
#define MAX_TEXTURES
#define WINED3D_FRAGMENT_CAP_SRGB_WRITE
#define WINED3D_FRAGMENT_CAP_PROJ_CONTROL

◆ glsl_fragment_pipe_get_emul_mask()

static DWORD glsl_fragment_pipe_get_emul_mask ( const struct wined3d_gl_info gl_info)
static

Definition at line 11656 of file glsl_shader.c.

11657{
11660 return 0;
11661}
BOOL supported[WINED3D_GL_EXT_COUNT]
@ WINED3D_GL_LEGACY_CONTEXT
Definition: wined3d_gl.h:213
#define GL_EXT_EMUL_ARB_MULTITEXTURE

◆ glsl_fragment_pipe_invalidate_constants()

static void glsl_fragment_pipe_invalidate_constants ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11779 of file glsl_shader.c.

11781{
11782 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_PS;
11783}
#define WINED3D_SHADER_CONST_FFP_PS

◆ glsl_fragment_pipe_shademode()

static void glsl_fragment_pipe_shademode ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11834 of file glsl_shader.c.

11836{
11837 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
11838}

◆ glsl_fragment_pipe_shader()

static void glsl_fragment_pipe_shader ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11706 of file glsl_shader.c.

11708{
11709 context->last_was_pshader = use_ps(state);
11710
11711 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
11712}
static BOOL use_ps(const struct wined3d_state *state)

◆ glsl_fragment_pipe_tex_transform()

static void glsl_fragment_pipe_tex_transform ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11773 of file glsl_shader.c.

11775{
11776 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
11777}

◆ glsl_fragment_pipe_vdecl()

static void glsl_fragment_pipe_vdecl ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11754 of file glsl_shader.c.

11756{
11757 /* Because of settings->texcoords_initialized and args->texcoords_initialized. */
11758 if (context->gl_info->limits.glsl_varyings < wined3d_max_compat_varyings(context->gl_info))
11759 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
11760
11763}
unsigned int wined3d_max_compat_varyings(const struct wined3d_gl_info *gl_info)
Definition: utils.c:5744
static void glsl_fragment_pipe_fog(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
static BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
#define STATE_RENDER(a)

◆ glsl_fragment_pipe_vs()

static void glsl_fragment_pipe_vs ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11765 of file glsl_shader.c.

11767{
11768 /* Because of settings->texcoords_initialized and args->texcoords_initialized. */
11769 if (context->gl_info->limits.glsl_varyings < wined3d_max_compat_varyings(context->gl_info))
11770 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
11771}

◆ glsl_is_color_reg_read()

static BOOL glsl_is_color_reg_read ( const struct wined3d_shader shader,
unsigned int  idx 
)
static

Definition at line 1991 of file glsl_shader.c.

1992{
1993 const struct wined3d_shader_signature *input_signature = &shader->input_signature;
1994 const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
1995 DWORD input_reg_used = shader->u.ps.input_reg_used;
1996 unsigned int i;
1997
1998 if (reg_maps->shader_version.major < 3)
1999 return input_reg_used & (1u << idx);
2000
2001 for (i = 0; i < input_signature->element_count; ++i)
2002 {
2003 const struct wined3d_shader_signature_element *input = &input_signature->elements[i];
2004
2005 if (!(reg_maps->input_registers & (1u << input->register_idx)))
2006 continue;
2007
2009 && input->semantic_idx == idx)
2010 return input_reg_used & (1u << input->register_idx);
2011 }
2012 return FALSE;
2013}
BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage)
Definition: shader.c:377
unsigned int idx
Definition: utils.c:41
GLenum GLenum GLenum input
Definition: glext.h:9031
union wined3d_shader_reg_maps::@279 u
struct wined3d_shader_version shader_version
struct wined3d_shader_signature_element * elements
Definition: wined3d.h:2046
@ WINED3D_DECL_USAGE_COLOR
Definition: wined3d.h:796

Referenced by shader_glsl_generate_pshader().

◆ glsl_is_shadow_sampler()

static BOOL glsl_is_shadow_sampler ( const struct wined3d_shader shader,
const struct ps_compile_args ps_args,
unsigned int  resource_idx,
unsigned int  sampler_idx 
)
static

Definition at line 2015 of file glsl_shader.c.

2017{
2018 const struct wined3d_shader_version *version = &shader->reg_maps.shader_version;
2019
2020 if (version->major >= 4)
2021 return shader->reg_maps.sampler_comparison_mode & (1u << sampler_idx);
2022 else
2023 return version->type == WINED3D_SHADER_TYPE_PIXEL && (ps_args->shadow & (1u << resource_idx));
2024}
static const WCHAR version[]
Definition: asmname.c:66

Referenced by shader_generate_glsl_declarations(), and shader_glsl_get_sample_function().

◆ glsl_primitive_type_from_d3d()

static const char * glsl_primitive_type_from_d3d ( enum wined3d_primitive_type  primitive_type)
static

Definition at line 1960 of file glsl_shader.c.

1961{
1962 switch (primitive_type)
1963 {
1965 return "points";
1966
1968 return "lines";
1969
1971 return "line_strip";
1972
1974 return "triangles";
1975
1977 return "triangle_strip";
1978
1980 return "lines_adjacency";
1981
1983 return "triangles_adjacency";
1984
1985 default:
1986 FIXME("Unhandled primitive type %s.\n", debug_d3dprimitivetype(primitive_type));
1987 return "";
1988 }
1989}
const char * debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type)
Definition: utils.c:4346
@ WINED3D_PT_LINELIST
Definition: wined3d.h:73
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:72
@ WINED3D_PT_TRIANGLELIST_ADJ
Definition: wined3d.h:80
@ WINED3D_PT_LINELIST_ADJ
Definition: wined3d.h:78
@ WINED3D_PT_TRIANGLESTRIP
Definition: wined3d.h:76
@ WINED3D_PT_LINESTRIP
Definition: wined3d.h:74
@ WINED3D_PT_TRIANGLELIST
Definition: wined3d.h:75

Referenced by shader_glsl_generate_geometry_shader().

◆ glsl_program_key_compare()

static int glsl_program_key_compare ( const void key,
const struct wine_rb_entry entry 
)
static

Definition at line 10584 of file glsl_shader.c.

10585{
10586 const struct glsl_program_key *k = key;
10589
10590 if (k->vs_id > prog->vs.id) return 1;
10591 else if (k->vs_id < prog->vs.id) return -1;
10592
10593 if (k->gs_id > prog->gs.id) return 1;
10594 else if (k->gs_id < prog->gs.id) return -1;
10595
10596 if (k->ps_id > prog->ps.id) return 1;
10597 else if (k->ps_id < prog->ps.id) return -1;
10598
10599 if (k->hs_id > prog->hs.id) return 1;
10600 else if (k->hs_id < prog->hs.id) return -1;
10601
10602 if (k->ds_id > prog->ds.id) return 1;
10603 else if (k->ds_id < prog->ds.id) return -1;
10604
10605 if (k->cs_id > prog->cs.id) return 1;
10606 else if (k->cs_id < prog->cs.id) return -1;
10607
10608 return 0;
10609}
char * prog
Definition: isohybrid.c:47
int k
Definition: mpi.c:3369

Referenced by shader_glsl_alloc().

◆ glsl_vertex_pipe_clip_plane()

static void glsl_vertex_pipe_clip_plane ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11454 of file glsl_shader.c.

11456{
11457 const struct wined3d_gl_info *gl_info = context->gl_info;
11458 UINT index = state_id - STATE_CLIPPLANE(0);
11459
11460 if (index >= gl_info->limits.user_clip_distances)
11461 return;
11462
11463 context->constant_update_mask |= WINED3D_SHADER_CONST_VS_CLIP_PLANES;
11464}
GLuint index
Definition: glext.h:6031
#define STATE_CLIPPLANE(a)
#define WINED3D_SHADER_CONST_VS_CLIP_PLANES

◆ glsl_vertex_pipe_geometry_shader()

static void glsl_vertex_pipe_geometry_shader ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11296 of file glsl_shader.c.

11298{
11299 struct glsl_context_data *ctx_data = context->shader_backend_data;
11301
11304 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
11306
11307 if (state->shader[WINED3D_SHADER_TYPE_DOMAIN])
11308 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_DOMAIN;
11309 else if (state->shader[WINED3D_SHADER_TYPE_VERTEX]
11310 && state->shader[WINED3D_SHADER_TYPE_VERTEX]->reg_maps.shader_version.major >= 4)
11311 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
11312}
BOOL rasterization_disabled
Definition: glsl_shader.c:273
static BOOL is_rasterization_disabled(const struct wined3d_shader *geometry_shader)
@ WINED3D_SHADER_TYPE_GEOMETRY
@ WINED3D_SHADER_TYPE_DOMAIN
@ WINED3D_SHADER_TYPE_VERTEX

◆ glsl_vertex_pipe_hs()

static void glsl_vertex_pipe_hs ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11284 of file glsl_shader.c.

11286{
11287 /* In Direct3D tessellator options (e.g. output primitive type, primitive
11288 * winding) are defined in Hull Shaders, while in GLSL those are
11289 * specified in Tessellation Evaluation Shaders. */
11290 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_DOMAIN;
11291
11292 if (state->shader[WINED3D_SHADER_TYPE_VERTEX])
11293 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
11294}

◆ glsl_vertex_pipe_light()

static void glsl_vertex_pipe_light ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11420 of file glsl_shader.c.

11422{
11423 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_LIGHTS;
11424}
#define WINED3D_SHADER_CONST_FFP_LIGHTS

◆ glsl_vertex_pipe_material()

static void glsl_vertex_pipe_material ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11414 of file glsl_shader.c.

11416{
11417 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MATERIAL;
11418}
#define WINED3D_SHADER_CONST_FFP_MATERIAL

◆ glsl_vertex_pipe_nop()

static void glsl_vertex_pipe_nop ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11203 of file glsl_shader.c.

11204 {}

◆ glsl_vertex_pipe_pixel_shader()

static void glsl_vertex_pipe_pixel_shader ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11314 of file glsl_shader.c.

11316{
11318 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_GEOMETRY;
11319 else if (state->shader[WINED3D_SHADER_TYPE_DOMAIN])
11320 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_DOMAIN;
11321 else if (state->shader[WINED3D_SHADER_TYPE_VERTEX]
11322 && state->shader[WINED3D_SHADER_TYPE_VERTEX]->reg_maps.shader_version.major >= 4)
11323 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
11324}

◆ glsl_vertex_pipe_pointscale()

static void glsl_vertex_pipe_pointscale ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11432 of file glsl_shader.c.

11434{
11435 if (!use_vs(state))
11436 context->constant_update_mask |= WINED3D_SHADER_CONST_VS_POINTSIZE;
11437}
#define WINED3D_SHADER_CONST_VS_POINTSIZE

◆ glsl_vertex_pipe_pointsize()

static void glsl_vertex_pipe_pointsize ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11426 of file glsl_shader.c.

11428{
11429 context->constant_update_mask |= WINED3D_SHADER_CONST_VS_POINTSIZE;
11430}

◆ glsl_vertex_pipe_projection()

static void glsl_vertex_pipe_projection ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11362 of file glsl_shader.c.

11364{
11365 /* Table fog behavior depends on the projection matrix. */
11366 if (state->render_states[WINED3D_RS_FOGENABLE]
11367 && state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
11368 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
11369 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_PROJ;
11370}
#define WINED3D_SHADER_CONST_FFP_PROJ

Referenced by glsl_vertex_pipe_viewport().

◆ glsl_vertex_pipe_shademode()

static void glsl_vertex_pipe_shademode ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11448 of file glsl_shader.c.

11450{
11451 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
11452}

◆ glsl_vertex_pipe_shader()

static void glsl_vertex_pipe_shader ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11206 of file glsl_shader.c.

11208{
11209 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
11210}

◆ glsl_vertex_pipe_texmatrix()

static void glsl_vertex_pipe_texmatrix ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11383 of file glsl_shader.c.

11385{
11386 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_TEXMATRIX;
11387}
#define WINED3D_SHADER_CONST_FFP_TEXMATRIX

◆ glsl_vertex_pipe_texmatrix_np2()

static void glsl_vertex_pipe_texmatrix_np2 ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11389 of file glsl_shader.c.

11391{
11392 DWORD sampler = state_id - STATE_SAMPLER(0);
11393 const struct wined3d_texture *texture = state->textures[sampler];
11394 BOOL np2;
11395
11396 if (!texture)
11397 return;
11398
11399 if (sampler >= MAX_TEXTURES)
11400 return;
11401
11402 if ((np2 = !(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT))
11403 || context->lastWasPow2Texture & (1u << sampler))
11404 {
11405 if (np2)
11406 context->lastWasPow2Texture |= 1u << sampler;
11407 else
11408 context->lastWasPow2Texture &= ~(1u << sampler);
11409
11410 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_TEXMATRIX;
11411 }
11412}
GLenum GLuint texture
Definition: glext.h:6295
GLuint sampler
Definition: glext.h:7283
#define WINED3D_TEXTURE_POW2_MAT_IDENT
#define STATE_SAMPLER(num)

◆ glsl_vertex_pipe_vdecl()

static void glsl_vertex_pipe_vdecl ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11212 of file glsl_shader.c.

11214{
11215 const struct wined3d_gl_info *gl_info = context->gl_info;
11216 BOOL normal = !!(context->stream_info.use_map & (1u << WINED3D_FFP_NORMAL));
11217 const BOOL legacy_clip_planes = needs_legacy_glsl_syntax(gl_info);
11218 BOOL transformed = context->stream_info.position_transformed;
11219 BOOL wasrhw = context->last_was_rhw;
11220 unsigned int i;
11221
11222 context->last_was_rhw = transformed;
11223
11224 /* If the vertex declaration contains a transformed position attribute,
11225 * the draw uses the fixed function vertex pipeline regardless of any
11226 * vertex shader set by the application. */
11227 if (transformed != wasrhw
11228 || context->stream_info.swizzle_map != context->last_swizzle_map)
11229 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
11230
11231 context->last_swizzle_map = context->stream_info.swizzle_map;
11232
11233 if (!use_vs(state))
11234 {
11235 if (context->last_was_vshader)
11236 {
11237 if (legacy_clip_planes)
11238 for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
11240 else
11241 context->constant_update_mask |= WINED3D_SHADER_CONST_VS_CLIP_PLANES;
11242 }
11243
11244 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_TEXMATRIX;
11245
11246 /* Because of settings->texcoords, we have to regenerate the vertex
11247 * shader on a vdecl change if there aren't enough varyings to just
11248 * always output all the texture coordinates. */
11249 if (gl_info->limits.glsl_varyings < wined3d_max_compat_varyings(gl_info)
11250 || normal != context->last_was_normal)
11251 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
11252
11253 if (use_ps(state)
11254 && state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.shader_version.major == 1
11255 && state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.shader_version.minor <= 3)
11256 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
11257 }
11258 else
11259 {
11260 if (!context->last_was_vshader)
11261 {
11262 /* Vertex shader clipping ignores the view matrix. Update all clip planes. */
11263 if (legacy_clip_planes)
11264 for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
11266 else
11267 context->constant_update_mask |= WINED3D_SHADER_CONST_VS_CLIP_PLANES;
11268 }
11269 }
11270
11271 context->last_was_vshader = use_vs(state);
11272 context->last_was_normal = normal;
11273}
void clipplane(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: state.c:3836
@ WINED3D_FFP_NORMAL

◆ glsl_vertex_pipe_vertexblend()

static void glsl_vertex_pipe_vertexblend ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11332 of file glsl_shader.c.

11334{
11335 int i = state_id - STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0));
11336 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_VERTEXBLEND_INDEX(i);
11337}
#define WINED3D_TS_WORLD_MATRIX(index)
Definition: wined3d.h:664
#define STATE_TRANSFORM(a)
#define WINED3D_SHADER_CONST_FFP_VERTEXBLEND_INDEX(i)

◆ glsl_vertex_pipe_view()

static void glsl_vertex_pipe_view ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11339 of file glsl_shader.c.

11340{
11341 const struct wined3d_gl_info *gl_info = context->gl_info;
11342 unsigned int k;
11343
11344 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MODELVIEW
11347
11348 if (needs_legacy_glsl_syntax(gl_info))
11349 {
11350 for (k = 0; k < gl_info->limits.user_clip_distances; ++k)
11351 {
11354 }
11355 }
11356 else
11357 {
11358 context->constant_update_mask |= WINED3D_SHADER_CONST_VS_CLIP_PLANES;
11359 }
11360}
#define WINED3D_SHADER_CONST_FFP_VERTEXBLEND
#define WINED3D_SHADER_CONST_FFP_MODELVIEW

◆ glsl_vertex_pipe_viewport()

static void glsl_vertex_pipe_viewport ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11372 of file glsl_shader.c.

11374{
11378 && state->render_states[WINED3D_RS_POINTSCALEENABLE])
11379 context->constant_update_mask |= WINED3D_SHADER_CONST_VS_POINTSIZE;
11380 context->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP;
11381}
static void glsl_vertex_pipe_projection(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@ WINED3D_RS_POINTSCALEENABLE
Definition: wined3d.h:342
@ WINED3D_TS_PROJECTION
Definition: wined3d.h:649
#define WINED3D_SHADER_CONST_POS_FIXUP

◆ glsl_vertex_pipe_vp_alloc()

static void * glsl_vertex_pipe_vp_alloc ( const struct wined3d_shader_backend_ops shader_backend,
void shader_priv 
)
static

Definition at line 11160 of file glsl_shader.c.

11161{
11162 struct shader_glsl_priv *priv;
11163
11164 if (shader_backend == &glsl_shader_backend)
11165 {
11166 priv = shader_priv;
11168 return priv;
11169 }
11170
11171 FIXME("GLSL vertex pipe without GLSL shader backend not implemented.\n");
11172
11173 return NULL;
11174}
int wined3d_ffp_vertex_program_key_compare(const void *key, const struct wine_rb_entry *entry)
Definition: utils.c:6387
struct wine_rb_tree ffp_vertex_shaders
Definition: glsl_shader.c:131

◆ glsl_vertex_pipe_vp_enable()

static void glsl_vertex_pipe_vp_enable ( const struct wined3d_gl_info gl_info,
BOOL  enable 
)
static

Definition at line 11131 of file glsl_shader.c.

11131{}

◆ glsl_vertex_pipe_vp_free()

static void glsl_vertex_pipe_vp_free ( struct wined3d_device device)
static

Definition at line 11193 of file glsl_shader.c.

11194{
11195 struct shader_glsl_priv *priv = device->vertex_priv;
11197
11198 ctx.priv = priv;
11199 ctx.gl_info = &device->adapter->gl_info;
11201}
static void shader_glsl_free_ffp_vertex_shader(struct wine_rb_entry *entry, void *context)

◆ glsl_vertex_pipe_vp_get_caps()

static void glsl_vertex_pipe_vp_get_caps ( const struct wined3d_gl_info gl_info,
struct wined3d_vertex_caps caps 
)
static

Definition at line 11133 of file glsl_shader.c.

11134{
11135 caps->xyzrhw = TRUE;
11148 caps->fvf_caps = WINED3DFVFCAPS_PSIZE | 8; /* 8 texture coordinates. */
11149 caps->max_user_clip_planes = gl_info->limits.user_clip_distances;
11151}
#define WINED3DPRASTERCAPS_FOGRANGE
Definition: wined3d.h:1206
#define WINED3DVTXPCAPS_LOCALVIEWER
Definition: wined3d.h:1282
#define WINED3DVTXPCAPS_POSITIONALLIGHTS
Definition: wined3d.h:1281
#define WINED3DVTXPCAPS_TEXGEN
Definition: wined3d.h:1277
#define WINED3DVTXPCAPS_MATERIALSOURCE7
Definition: wined3d.h:1278
#define WINED3DVTXPCAPS_VERTEXFOG
Definition: wined3d.h:1279
#define WINED3DFVFCAPS_PSIZE
Definition: wined3d.h:1057
#define WINED3DVTXPCAPS_TEXGEN_SPHEREMAP
Definition: wined3d.h:1284
#define WINED3DVTXPCAPS_DIRECTIONALLIGHTS
Definition: wined3d.h:1280
#define MAX_VERTEX_INDEX_BLENDS
#define MAX_ACTIVE_LIGHTS
#define MAX_VERTEX_BLENDS

◆ glsl_vertex_pipe_vp_get_emul_mask()

static DWORD glsl_vertex_pipe_vp_get_emul_mask ( const struct wined3d_gl_info gl_info)
static

Definition at line 11153 of file glsl_shader.c.

11154{
11157 return 0;
11158}

◆ glsl_vertex_pipe_vs()

static void glsl_vertex_pipe_vs ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11275 of file glsl_shader.c.

11277{
11278 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
11279 /* Different vertex shaders potentially require a different vertex attributes setup. */
11282}
static void context_apply_state(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
#define STATE_VDECL

◆ glsl_vertex_pipe_world()

static void glsl_vertex_pipe_world ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11326 of file glsl_shader.c.

11328{
11329 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MODELVIEW;
11330}

◆ glsl_vertex_pointsprite_core()

static void glsl_vertex_pointsprite_core ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)
static

Definition at line 11439 of file glsl_shader.c.

11441{
11442 static unsigned int once;
11443
11444 if (state->gl_primitive_type == GL_POINTS && !state->render_states[WINED3D_RS_POINTSPRITEENABLE] && !once++)
11445 FIXME("Non-point sprite points not supported in core profile.\n");
11446}
#define GL_POINTS
Definition: gl.h:190
@ WINED3D_RS_POINTSPRITEENABLE
Definition: wined3d.h:341

◆ is_mipmapped()

static BOOL is_mipmapped ( enum wined3d_shader_resource_type  resource_type)
static

Definition at line 5665 of file glsl_shader.c.

5666{
5667 return resource_type != WINED3D_SHADER_RESOURCE_BUFFER && !is_multisampled(resource_type);
5668}
static BOOL is_multisampled(enum wined3d_shader_resource_type resource_type)
Definition: glsl_shader.c:5659
@ WINED3D_SHADER_RESOURCE_BUFFER

Referenced by shader_glsl_ld(), and shader_glsl_resinfo().

◆ is_multisampled()

static BOOL is_multisampled ( enum wined3d_shader_resource_type  resource_type)
static

Definition at line 5659 of file glsl_shader.c.

5660{
5661 return resource_type == WINED3D_SHADER_RESOURCE_TEXTURE_2DMS
5663}
@ WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY
@ WINED3D_SHADER_RESOURCE_TEXTURE_2DMS

Referenced by is_mipmapped(), and shader_glsl_ld().

◆ multiply_vector_matrix()

static void multiply_vector_matrix ( struct wined3d_vec4 dest,
const struct wined3d_vec4 src1,
const struct wined3d_matrix src2 
)
static

Definition at line 1289 of file glsl_shader.c.

1291{
1292 struct wined3d_vec4 temp;
1293
1294 temp.x = (src1->x * src2->_11) + (src1->y * src2->_21) + (src1->z * src2->_31) + (src1->w * src2->_41);
1295 temp.y = (src1->x * src2->_12) + (src1->y * src2->_22) + (src1->z * src2->_32) + (src1->w * src2->_42);
1296 temp.z = (src1->x * src2->_13) + (src1->y * src2->_23) + (src1->z * src2->_33) + (src1->w * src2->_43);
1297 temp.w = (src1->x * src2->_14) + (src1->y * src2->_24) + (src1->z * src2->_34) + (src1->w * src2->_44);
1298
1299 *dest = temp;
1300}
static char * dest
Definition: rtl.c:135
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by shader_glsl_clip_plane_uniform(), and shader_glsl_ffp_vertex_light_uniform().

◆ needs_legacy_glsl_syntax()

◆ print_glsl_info_log()

void print_glsl_info_log ( const struct wined3d_gl_info gl_info,
GLuint  id,
BOOL  program 
)

Definition at line 459 of file glsl_shader.c.

460{
461 int length = 0;
462 char *log;
463
464 if (!WARN_ON(d3d_shader) && !FIXME_ON(d3d_shader))
465 return;
466
467 if (program)
468 GL_EXTCALL(glGetProgramiv(id, GL_INFO_LOG_LENGTH, &length));
469 else
470 GL_EXTCALL(glGetShaderiv(id, GL_INFO_LOG_LENGTH, &length));
471
472 /* A size of 1 is just a null-terminated string, so the log should be bigger than
473 * that if there are errors. */
474 if (length > 1)
475 {
476 const char *ptr, *line;
477
479 /* The info log is supposed to be zero-terminated, but at least some
480 * versions of fglrx don't terminate the string properly. The reported
481 * length does include the terminator, so explicitly set it to zero
482 * here. */
483 log[length - 1] = 0;
484 if (program)
485 GL_EXTCALL(glGetProgramInfoLog(id, length, NULL, log));
486 else
487 GL_EXTCALL(glGetShaderInfoLog(id, length, NULL, log));
488
489 ptr = log;
490 if (gl_info->quirks & WINED3D_QUIRK_INFO_LOG_SPAM)
491 {
492 WARN("Info log received from GLSL shader #%u:\n", id);
493 while ((line = get_info_log_line(&ptr))) WARN(" %.*s", (int)(ptr - line), line);
494 }
495 else
496 {
497 FIXME("Info log received from GLSL shader #%u:\n", id);
498 while ((line = get_info_log_line(&ptr))) FIXME(" %.*s", (int)(ptr - line), line);
499 }
500 heap_free(log);
501 }
502}
GLuint program
Definition: glext.h:6723
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define GL_INFO_LOG_LENGTH
Definition: glext.h:450
static const char * get_info_log_line(const char **ptr)
Definition: glsl_shader.c:442
#define WARN_ON(c)
Definition: module.h:257
#define FIXME_ON(ch)
Definition: debug.h:407
#define log(outFile, fmt,...)
Definition: util.h:15
Definition: parser.c:49
#define WINED3D_QUIRK_INFO_LOG_SPAM

Referenced by draw_test_quad(), shader_glsl_compile(), and shader_glsl_validate_link().

◆ PRINTF_ATTR() [1/2]

static void PRINTF_ATTR ( ,
 
)
static

Definition at line 1822 of file glsl_shader.c.

1824{
1825 va_list args;
1826 int ret;
1827
1828 shader_addline(buffer, "%s%s ", flat ? "flat " : "",
1829 needs_legacy_glsl_syntax(gl_info) ? "varying" : "in");
1830 for (;;)
1831 {
1834 va_end(args);
1835 if (!ret)
1836 return;
1838 return;
1839 }
1840}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
int shader_addline(struct wined3d_string_buffer *buffer, const char *format,...)
Definition: shader.c:478
int shader_vaddline(struct wined3d_string_buffer *buffer, const char *format, va_list args)
Definition: shader.c:464
BOOL string_buffer_resize(struct wined3d_string_buffer *buffer, int rc)
Definition: shader.c:446
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546

◆ PRINTF_ATTR() [2/2]

static void PRINTF_ATTR ( ,
10   
)
static

Definition at line 3450 of file glsl_shader.c.

3454{
3455 static const struct wined3d_shader_texel_offset dummy_offset = {0, 0, 0};
3456 const struct wined3d_shader_version *version = &ins->ctx->reg_maps->shader_version;
3457 char dst_swizzle[6];
3458 struct color_fixup_desc fixup;
3459 BOOL np2_fixup = FALSE;
3460 va_list args;
3461 int ret;
3462
3463 shader_glsl_swizzle_to_str(swizzle, FALSE, ins->dst[0].write_mask, dst_swizzle);
3464
3465 /* If ARB_texture_swizzle is supported we don't need to do anything here.
3466 * We actually rely on it for vertex shaders and SM4+. */
3467 if (version->type == WINED3D_SHADER_TYPE_PIXEL && version->major < 4)
3468 {
3469 const struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data;
3470 fixup = priv->cur_ps_args->color_fixup[sampler_bind_idx];
3471
3472 if (priv->cur_ps_args->np2_fixup & (1u << sampler_bind_idx))
3473 np2_fixup = TRUE;
3474 }
3475 else
3476 {
3477 fixup = COLOR_FIXUP_IDENTITY;
3478 }
3479
3480 shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &ins->dst[0], sample_function->data_type);
3481
3482 if (sample_function->output_single_component)
3483 shader_addline(ins->ctx->buffer, "vec4(");
3484
3485 shader_addline(ins->ctx->buffer, "%s(%s_sampler%u, ",
3486 sample_function->name->buffer, shader_glsl_get_prefix(version->type), sampler_bind_idx);
3487
3488 for (;;)
3489 {
3490 va_start(args, coord_reg_fmt);
3491 ret = shader_vaddline(ins->ctx->buffer, coord_reg_fmt, args);
3492 va_end(args);
3493 if (!ret)
3494 break;
3495 if (!string_buffer_resize(ins->ctx->buffer, ret))
3496 break;
3497 }
3498
3499 if (np2_fixup)
3500 {
3501 const struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data;
3502 const unsigned char idx = priv->cur_np2fixup_info->idx[sampler_bind_idx];
3503
3504 switch (shader_glsl_get_write_mask_size(sample_function->coord_mask))
3505 {
3506 case 1:
3507 shader_addline(ins->ctx->buffer, " * ps_samplerNP2Fixup[%u].%s",
3508 idx >> 1, (idx % 2) ? "z" : "x");
3509 break;
3510 case 2:
3511 shader_addline(ins->ctx->buffer, " * ps_samplerNP2Fixup[%u].%s",
3512 idx >> 1, (idx % 2) ? "zw" : "xy");
3513 break;
3514 case 3:
3515 shader_addline(ins->ctx->buffer, " * vec3(ps_samplerNP2Fixup[%u].%s, 1.0)",
3516 idx >> 1, (idx % 2) ? "zw" : "xy");
3517 break;
3518 case 4:
3519 shader_addline(ins->ctx->buffer, " * vec4(ps_samplerNP2Fixup[%u].%s, 1.0, 1.0)",
3520 idx >> 1, (idx % 2) ? "zw" : "xy");
3521 break;
3522 }
3523 }
3524 if (sample_function->emulate_lod)
3525 {
3526 if (strcmp(bias, "0")) FIXME("Don't know how to emulate lod level %s\n", bias);
3527 switch (sample_function->emulate_lod)
3528 {
3530 if (!dx) dx = "vec2(0.0, 0.0)";
3531 if (!dy) dy = "vec2(0.0, 0.0)";
3532 break;
3533
3535 if (!dx) dx = "vec3(0.0, 0.0, 0.0)";
3536 if (!dy) dy = "vec3(0.0, 0.0, 0.0)";
3537 break;
3538
3539 default:
3540 break;
3541 }
3542 if (!offset) offset = &dummy_offset;
3543 }
3544 if (dx && dy)
3545 shader_addline(ins->ctx->buffer, ", %s, %s", dx, dy);
3546 else if (bias)
3547 shader_addline(ins->ctx->buffer, ", %s", bias);
3548 if (sample_function->offset_size)
3549 {
3550 int offset_immdata[4] = {offset->u, offset->v, offset->w};
3551 shader_addline(ins->ctx->buffer, ", ");
3552 shader_glsl_append_imm_ivec(ins->ctx->buffer, offset_immdata, sample_function->offset_size);
3553 }
3554 shader_addline(ins->ctx->buffer, ")");
3555
3556 if (sample_function->output_single_component)
3557 shader_addline(ins->ctx->buffer, ")");
3558
3559 shader_addline(ins->ctx->buffer, "%s);\n", dst_swizzle);
3560
3561 if (!is_identity_fixup(fixup))
3562 shader_glsl_color_correction(ins, fixup);
3563}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLuint GLenum swizzle
Definition: glext.h:9511
GLfloat bias
Definition: glext.h:7909
GLintptr offset
Definition: glext.h:5920
static const char * shader_glsl_get_prefix(enum wined3d_shader_type type)
Definition: glsl_shader.c:364
static void shader_glsl_color_correction(const struct wined3d_shader_instruction *ins, struct color_fixup_desc fixup)
Definition: glsl_shader.c:3441
static unsigned int shader_glsl_get_write_mask_size(DWORD write_mask)
Definition: glsl_shader.c:2977
static void shader_glsl_swizzle_to_str(DWORD swizzle, BOOL fixup, DWORD mask, char *str)
Definition: glsl_shader.c:2996
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)
Definition: glsl_shader.c:3134
static void shader_glsl_append_imm_ivec(struct wined3d_string_buffer *buffer, const int *values, unsigned int size)
Definition: glsl_shader.c:421
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
struct ps_np2fixup_info * cur_np2fixup_info
Definition: glsl_shader.c:265
const struct ps_compile_args * cur_ps_args
Definition: glsl_shader.c:264
@ WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY
@ WINED3D_SHADER_RESOURCE_TEXTURE_CUBE
static const struct color_fixup_desc COLOR_FIXUP_IDENTITY
static BOOL is_identity_fixup(struct color_fixup_desc fixup)

◆ reset_program_constant_version()

static void reset_program_constant_version ( struct wine_rb_entry entry,
void context 
)
static

Definition at line 1205 of file glsl_shader.c.

1206{
1207 WINE_RB_ENTRY_VALUE(entry, struct glsl_shader_prog_link, program_lookup_entry)->constant_version = 0;
1208}

Referenced by shader_glsl_load_constants().

◆ set_glsl_compute_shader_program()

static void set_glsl_compute_shader_program ( const struct wined3d_context context,
const struct wined3d_state state,
struct shader_glsl_priv priv,
struct glsl_context_data ctx_data 
)
static

Definition at line 9797 of file glsl_shader.c.

9799{
9801 struct wined3d_shader *shader;
9802 struct glsl_program_key key;
9803 GLuint cs_id;
9804
9805 if (!(context->shader_update_mask & (1u << WINED3D_SHADER_TYPE_COMPUTE)))
9806 return;
9807
9808 if (!(shader = state->shader[WINED3D_SHADER_TYPE_COMPUTE]))
9809 {
9810 WARN("Compute shader is NULL.\n");
9811 ctx_data->glsl_program = NULL;
9812 return;
9813 }
9814
9816 memset(&key, 0, sizeof(key));
9817 key.cs_id = cs_id;
9818 if (!(entry = get_glsl_program_entry(priv, &key)))
9819 ERR("Failed to find GLSL program for compute shader %p.\n", shader);
9820 ctx_data->glsl_program = entry;
9821}
static GLuint find_glsl_compute_shader(const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader)
Definition: glsl_shader.c:9778
static struct glsl_shader_prog_link * get_glsl_program_entry(const struct shader_glsl_priv *priv, const struct glsl_program_key *key)
Definition: glsl_shader.c:6586
struct glsl_shader_prog_link * glsl_program
Definition: glsl_shader.c:271
@ WINED3D_SHADER_TYPE_COMPUTE

Referenced by shader_glsl_select_compute().

◆ set_glsl_shader_program()

static void set_glsl_shader_program ( const struct wined3d_context context,
const struct wined3d_state state,
struct shader_glsl_priv priv,
struct glsl_context_data ctx_data 
)
static

Definition at line 9824 of file glsl_shader.c.

9826{
9827 const struct wined3d_d3d_info *d3d_info = context->d3d_info;
9828 const struct wined3d_gl_info *gl_info = context->gl_info;
9829 const struct wined3d_shader *pre_rasterization_shader;
9830 const struct ps_np2fixup_info *np2fixup_info = NULL;
9831 struct wined3d_shader *hshader, *dshader, *gshader;
9833 struct wined3d_shader *vshader = NULL;
9834 struct wined3d_shader *pshader = NULL;
9835 GLuint reorder_shader_id = 0;
9836 struct glsl_program_key key;
9837 GLuint program_id;
9838 unsigned int i;
9839 GLuint vs_id = 0;
9840 GLuint hs_id = 0;
9841 GLuint ds_id = 0;
9842 GLuint gs_id = 0;
9843 GLuint ps_id = 0;
9844 struct list *ps_list = NULL, *vs_list = NULL;
9845 WORD attribs_map;
9847
9848 if (!(context->shader_update_mask & (1u << WINED3D_SHADER_TYPE_VERTEX)) && ctx_data->glsl_program)
9849 {
9850 vs_id = ctx_data->glsl_program->vs.id;
9851 vs_list = &ctx_data->glsl_program->vs.shader_entry;
9852
9853 if (use_vs(state))
9854 vshader = state->shader[WINED3D_SHADER_TYPE_VERTEX];
9855 }
9856 else if (use_vs(state))
9857 {
9859
9860 vshader = state->shader[WINED3D_SHADER_TYPE_VERTEX];
9861
9862 find_vs_compile_args(state, vshader, context->stream_info.swizzle_map, &vs_compile_args, context);
9863 vs_id = find_glsl_vshader(context, priv, vshader, &vs_compile_args);
9864 vs_list = &vshader->linked_programs;
9865 }
9866 else if (priv->vertex_pipe == &glsl_vertex_pipe)
9867 {
9868 struct glsl_ffp_vertex_shader *ffp_shader;
9870
9872 ffp_shader = shader_glsl_find_ffp_vertex_shader(priv, gl_info, &settings);
9873 vs_id = ffp_shader->id;
9874 vs_list = &ffp_shader->linked_programs;
9875 }
9876
9877 hshader = state->shader[WINED3D_SHADER_TYPE_HULL];
9878 if (!(context->shader_update_mask & (1u << WINED3D_SHADER_TYPE_HULL)) && ctx_data->glsl_program)
9879 hs_id = ctx_data->glsl_program->hs.id;
9880 else if (hshader)
9881 hs_id = find_glsl_hull_shader(context, priv, hshader);
9882
9883 dshader = state->shader[WINED3D_SHADER_TYPE_DOMAIN];
9884 if (!(context->shader_update_mask & (1u << WINED3D_SHADER_TYPE_DOMAIN)) && ctx_data->glsl_program)
9885 {
9886 ds_id = ctx_data->glsl_program->ds.id;
9887 }
9888 else if (dshader)
9889 {
9890 struct ds_compile_args args;
9891
9893 ds_id = find_glsl_domain_shader(context, priv, dshader, &args);
9894 }
9895
9896 gshader = state->shader[WINED3D_SHADER_TYPE_GEOMETRY];
9897 if (!(context->shader_update_mask & (1u << WINED3D_SHADER_TYPE_GEOMETRY)) && ctx_data->glsl_program)
9898 {
9899 gs_id = ctx_data->glsl_program->gs.id;
9900 }
9901 else if (gshader)
9902 {
9903 struct gs_compile_args args;
9904
9906 gs_id = find_glsl_geometry_shader(context, priv, gshader, &args);
9907 }
9908
9909 /* A pixel shader is not used when rasterization is disabled. */
9910 if (is_rasterization_disabled(gshader))
9911 {
9912 ps_id = 0;
9913 ps_list = NULL;
9914 }
9915 else if (!(context->shader_update_mask & (1u << WINED3D_SHADER_TYPE_PIXEL)) && ctx_data->glsl_program)
9916 {
9917 ps_id = ctx_data->glsl_program->ps.id;
9918 ps_list = &ctx_data->glsl_program->ps.shader_entry;
9919
9920 if (use_ps(state))
9921 pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
9922 }
9923 else if (use_ps(state))
9924 {
9926 pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
9927 find_ps_compile_args(state, pshader, context->stream_info.position_transformed, &ps_compile_args, context);
9928 ps_id = find_glsl_pshader(context, &priv->shader_buffer, &priv->string_buffers,
9929 pshader, &ps_compile_args, &np2fixup_info);
9930 ps_list = &pshader->linked_programs;
9931 }
9932 else if (priv->fragment_pipe == &glsl_fragment_pipe
9933 && !(vshader && vshader->reg_maps.shader_version.major >= 4))
9934 {
9935 struct glsl_ffp_fragment_shader *ffp_shader;
9937
9940 ps_id = ffp_shader->id;
9941 ps_list = &ffp_shader->linked_programs;
9942 }
9943
9944 key.vs_id = vs_id;
9945 key.hs_id = hs_id;
9946 key.ds_id = ds_id;
9947 key.gs_id = gs_id;
9948 key.ps_id = ps_id;
9949 key.cs_id = 0;
9950 if ((!vs_id && !hs_id && !ds_id && !gs_id && !ps_id) || (entry = get_glsl_program_entry(priv, &key)))
9951 {
9952 ctx_data->glsl_program = entry;
9953 return;
9954 }
9955
9956 /* If we get to this point, then no matching program exists, so we create one */
9957 program_id = GL_EXTCALL(glCreateProgram());
9958 TRACE("Created new GLSL shader program %u.\n", program_id);
9959
9960 /* Create the entry */
9961 entry = heap_alloc(sizeof(*entry));
9962 entry->id = program_id;
9963 entry->vs.id = vs_id;
9964 entry->hs.id = hs_id;
9965 entry->ds.id = ds_id;
9966 entry->gs.id = gs_id;
9967 entry->ps.id = ps_id;
9968 entry->cs.id = 0;
9969 entry->constant_version = 0;
9970 entry->shader_controlled_clip_distances = 0;
9971 entry->ps.np2_fixup_info = np2fixup_info;
9972 /* Add the hash table entry */
9974
9975 /* Set the current program */
9976 ctx_data->glsl_program = entry;
9977
9978 /* Attach GLSL vshader */
9979 if (vs_id)
9980 {
9981 TRACE("Attaching GLSL shader object %u to program %u.\n", vs_id, program_id);
9982 GL_EXTCALL(glAttachShader(program_id, vs_id));
9983 checkGLcall("glAttachShader");
9984
9985 list_add_head(vs_list, &entry->vs.shader_entry);
9986 }
9987
9988 if (vshader)
9989 {
9990 attribs_map = vshader->reg_maps.input_registers;
9991 if (vshader->reg_maps.shader_version.major < 4)
9992 {
9993 reorder_shader_id = shader_glsl_generate_vs3_rasterizer_input_setup(priv, vshader, pshader,
9994 state->gl_primitive_type == GL_POINTS && vshader->reg_maps.point_size,
9995 d3d_info->emulated_flatshading
9996 && state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT, gl_info);
9997 TRACE("Attaching GLSL shader object %u to program %u.\n", reorder_shader_id, program_id);
9998 GL_EXTCALL(glAttachShader(program_id, reorder_shader_id));
9999 checkGLcall("glAttachShader");
10000 /* Flag the reorder function for deletion, it will be freed
10001 * automatically when the program is destroyed. */
10002 GL_EXTCALL(glDeleteShader(reorder_shader_id));
10003 }
10004 }
10005 else
10006 {
10007 attribs_map = (1u << WINED3D_FFP_ATTRIBS_COUNT) - 1;
10008 }
10009
10011 {
10012 /* Bind vertex attributes to a corresponding index number to match
10013 * the same index numbers as ARB_vertex_programs (makes loading
10014 * vertex attributes simpler). With this method, we can use the
10015 * exact same code to load the attributes later for both ARB and
10016 * GLSL shaders.
10017 *
10018 * We have to do this here because we need to know the Program ID
10019 * in order to make the bindings work, and it has to be done prior
10020 * to linking the GLSL program. */
10022 for (i = 0; attribs_map; attribs_map >>= 1, ++i)
10023 {
10024 if (!(attribs_map & 1))
10025 continue;
10026
10027 string_buffer_sprintf(tmp_name, "vs_in%u", i);
10028 GL_EXTCALL(glBindAttribLocation(program_id, i, tmp_name->buffer));
10029 if (vshader && vshader->reg_maps.shader_version.major >= 4)
10030 {
10031 string_buffer_sprintf(tmp_name, "vs_in_uint%u", i);
10032 GL_EXTCALL(glBindAttribLocation(program_id, i, tmp_name->buffer));
10033 string_buffer_sprintf(tmp_name, "vs_in_int%u", i);
10034 GL_EXTCALL(glBindAttribLocation(program_id, i, tmp_name->buffer));
10035 }
10036 }
10037 checkGLcall("glBindAttribLocation");
10039
10040 if (!needs_legacy_glsl_syntax(gl_info))
10041 {
10042 char var[12];
10043
10044 if (wined3d_dualblend_enabled(state, gl_info))
10045 {
10046 for (i = 0; i < gl_info->limits.dual_buffers * 2; i++)
10047 {
10048 sprintf(var, "ps_out%u", i);
10049 GL_EXTCALL(glBindFragDataLocationIndexed(program_id, i / 2, i % 2, var));
10050 checkGLcall("glBindFragDataLocationIndexed");
10051 }
10052 }
10053 else
10054 {
10055 for (i = 0; i < gl_info->limits.buffers; i++)
10056 {
10057 sprintf(var, "ps_out%u", i);
10058 GL_EXTCALL(glBindFragDataLocation(program_id, i, var));
10059 checkGLcall("glBindFragDataLocation");
10060 }
10061 }
10062 }
10063 }
10064
10065 if (hshader)
10066 {
10067 TRACE("Attaching GLSL tessellation control shader object %u to program %u.\n", hs_id, program_id);
10068 GL_EXTCALL(glAttachShader(program_id, hs_id));
10069 checkGLcall("glAttachShader");
10070
10071 list_add_head(&hshader->linked_programs, &entry->hs.shader_entry);
10072 }
10073
10074 if (dshader)
10075 {
10076 TRACE("Attaching GLSL tessellation evaluation shader object %u to program %u.\n", ds_id, program_id);
10077 GL_EXTCALL(glAttachShader(program_id, ds_id));
10078 checkGLcall("glAttachShader");
10079
10080 list_add_head(&dshader->linked_programs, &entry->ds.shader_entry);
10081 }
10082
10083 if (gshader)
10084 {
10085 TRACE("Attaching GLSL geometry shader object %u to program %u.\n", gs_id, program_id);
10086 GL_EXTCALL(glAttachShader(program_id, gs_id));
10087 checkGLcall("glAttachShader");
10088
10089 shader_glsl_init_transform_feedback(context, priv, program_id, gshader);
10090
10091 list_add_head(&gshader->linked_programs, &entry->gs.shader_entry);
10092 }
10093
10094 /* Attach GLSL pshader */
10095 if (ps_id)
10096 {
10097 TRACE("Attaching GLSL shader object %u to program %u.\n", ps_id, program_id);
10098 GL_EXTCALL(glAttachShader(program_id, ps_id));
10099 checkGLcall("glAttachShader");
10100
10101 list_add_head(ps_list, &entry->ps.shader_entry);
10102 }
10103
10104 /* Link the program */
10105 TRACE("Linking GLSL shader program %u.\n", program_id);
10106 GL_EXTCALL(glLinkProgram(program_id));
10107 shader_glsl_validate_link(gl_info, program_id);
10108
10109 shader_glsl_init_vs_uniform_locations(gl_info, priv, program_id, &entry->vs,
10110 vshader ? vshader->limits->constant_float : 0);
10111 shader_glsl_init_ds_uniform_locations(gl_info, priv, program_id, &entry->ds);
10112 shader_glsl_init_gs_uniform_locations(gl_info, priv, program_id, &entry->gs);
10113 shader_glsl_init_ps_uniform_locations(gl_info, priv, program_id, &entry->ps,
10114 pshader ? pshader->limits->constant_float : 0);
10115 checkGLcall("find glsl program uniform locations");
10116
10117 pre_rasterization_shader = gshader ? gshader : dshader ? dshader : vshader;
10118 if (pre_rasterization_shader && pre_rasterization_shader->reg_maps.shader_version.major >= 4)
10119 {
10120 unsigned int clip_distance_count = wined3d_popcount(pre_rasterization_shader->reg_maps.clip_distance_mask);
10121 entry->shader_controlled_clip_distances = 1;
10122 entry->clip_distance_mask = (1u << clip_distance_count) - 1;
10123 }
10124
10125 if (needs_legacy_glsl_syntax(gl_info))
10126 {
10127 if (pshader && pshader->reg_maps.shader_version.major >= 3
10128 && pshader->u.ps.declared_in_count > vec4_varyings(3, gl_info))
10129 {
10130 TRACE("Shader %d needs vertex color clamping disabled.\n", program_id);
10131 entry->vs.vertex_color_clamp = GL_FALSE;
10132 }
10133 else
10134 {
10135 entry->vs.vertex_color_clamp = GL_FIXED_ONLY_ARB;
10136 }
10137 }
10138 else
10139 {
10140 /* With core profile we never change vertex_color_clamp from
10141 * GL_FIXED_ONLY_MODE (which is also the initial value) so we never call
10142 * glClampColorARB(). */
10143 entry->vs.vertex_color_clamp = GL_FIXED_ONLY_ARB;
10144 }
10145
10146 /* Set the shader to allow uniform loading on it */
10147 GL_EXTCALL(glUseProgram(program_id));
10148 checkGLcall("glUseProgram");
10149
10150 entry->constant_update_mask = 0;
10151 if (vshader)
10152 {
10153 entry->constant_update_mask |= WINED3D_SHADER_CONST_VS_F;
10154 if (vshader->reg_maps.integer_constants)
10155 entry->constant_update_mask |= WINED3D_SHADER_CONST_VS_I;
10156 if (vshader->reg_maps.boolean_constants)
10157 entry->constant_update_mask |= WINED3D_SHADER_CONST_VS_B;
10158 if (entry->vs.pos_fixup_location != -1)
10159 entry->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP;
10160
10161 shader_glsl_load_program_resources(context, priv, program_id, vshader);
10162 }
10163 else
10164 {
10165 entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MODELVIEW
10167
10168 for (i = 1; i < MAX_VERTEX_INDEX_BLENDS; ++i)
10169 {
10170 if (entry->vs.modelview_matrix_location[i] != -1)
10171 {
10172 entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_VERTEXBLEND;
10173 break;
10174 }
10175 }
10176
10177 for (i = 0; i < MAX_TEXTURES; ++i)
10178 {
10179 if (entry->vs.texture_matrix_location[i] != -1)
10180 {
10181 entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_TEXMATRIX;
10182 break;
10183 }
10184 }
10185 if (entry->vs.material_ambient_location != -1 || entry->vs.material_diffuse_location != -1
10186 || entry->vs.material_specular_location != -1
10187 || entry->vs.material_emissive_location != -1
10188 || entry->vs.material_shininess_location != -1)
10189 entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MATERIAL;
10190 if (entry->vs.light_ambient_location != -1)
10191 entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_LIGHTS;
10192 }
10193 if (entry->vs.clip_planes_location != -1)
10194 entry->constant_update_mask |= WINED3D_SHADER_CONST_VS_CLIP_PLANES;
10195 if (entry->vs.pointsize_min_location != -1)
10196 entry->constant_update_mask |= WINED3D_SHADER_CONST_VS_POINTSIZE;
10197
10198 if (hshader)
10199 shader_glsl_load_program_resources(context, priv, program_id, hshader);
10200
10201 if (dshader)
10202 {
10203 if (entry->ds.pos_fixup_location != -1)
10204 entry->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP;
10205
10206 shader_glsl_load_program_resources(context, priv, program_id, dshader);
10207 }
10208
10209 if (gshader)
10210 {
10211 if (entry->gs.pos_fixup_location != -1)
10212 entry->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP;
10213
10214 shader_glsl_load_program_resources(context, priv, program_id, gshader);
10215 }
10216
10217 if (ps_id)
10218 {
10219 if (pshader)
10220 {
10221 entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_F;
10222 if (pshader->reg_maps.integer_constants)
10223 entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_I;
10224 if (pshader->reg_maps.boolean_constants)
10225 entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_B;
10226 if (entry->ps.ycorrection_location != -1)
10227 entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_Y_CORR;
10228
10229 shader_glsl_load_program_resources(context, priv, program_id, pshader);
10230 shader_glsl_load_images(gl_info, priv, program_id, &pshader->reg_maps);
10231 }
10232 else
10233 {
10234 entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_PS;
10235
10236 shader_glsl_load_samplers(context, priv, program_id, NULL);
10237 }
10238
10239 for (i = 0; i < MAX_TEXTURES; ++i)
10240 {
10241 if (entry->ps.bumpenv_mat_location[i] != -1)
10242 {
10243 entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_BUMP_ENV;
10244 break;
10245 }
10246 }
10247
10248 if (entry->ps.fog_color_location != -1)
10249 entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_FOG;
10250 if (entry->ps.alpha_test_ref_location != -1)
10251 entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_ALPHA_TEST;
10252 if (entry->ps.np2_fixup_location != -1)
10253 entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_NP2_FIXUP;
10254 if (entry->ps.color_key_location != -1)
10255 entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_COLOR_KEY;
10256 }
10257}
struct mke2fs_defaults settings[]
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
Definition: list.h:37
void find_ds_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader, struct ds_compile_args *args, const struct wined3d_context *context)
Definition: shader.c:3748
void find_vs_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader, WORD swizzle_map, struct vs_compile_args *args, const struct wined3d_context *context)
Definition: shader.c:3463
struct wined3d_string_buffer * string_buffer_get(struct wined3d_string_buffer_list *list)
Definition: shader.c:495
void find_gs_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader, struct gs_compile_args *args, const struct wined3d_context *context)
Definition: shader.c:3771
void find_ps_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader, BOOL position_transformed, struct ps_compile_args *args, const struct wined3d_context *context)
Definition: shader.c:3782
void string_buffer_release(struct wined3d_string_buffer_list *list, struct wined3d_string_buffer *buffer)
Definition: shader.c:543
void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d_state *state, struct ffp_frag_settings *settings, BOOL ignore_textype)
Definition: utils.c:5751
void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, const struct wined3d_state *state, struct wined3d_ffp_vs_settings *settings)
Definition: utils.c:6238
unsigned short WORD
Definition: ntddk_ex.h:93
#define GL_FALSE
Definition: gl.h:173
#define GL_FIXED_ONLY_ARB
Definition: glext.h:1625
static GLuint find_glsl_geometry_shader(const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader, const struct gs_compile_args *args)
Definition: glsl_shader.c:8319
static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_shader_prog_link *entry)
Definition: glsl_shader.c:6569
void shader_glsl_validate_link(const struct wined3d_gl_info *gl_info, GLuint program)
Definition: glsl_shader.c:577
static GLuint find_glsl_domain_shader(const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader, const struct ds_compile_args *args)
Definition: glsl_shader.c:8264
static BOOL shader_glsl_use_explicit_attrib_location(const struct wined3d_gl_info *gl_info)
Definition: glsl_shader.c:1806
static void shader_glsl_init_gs_uniform_locations(const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, struct glsl_gs_program *gs)
Definition: glsl_shader.c:9638
static void shader_glsl_init_transform_feedback(const struct wined3d_context *context, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader *shader)
Definition: glsl_shader.c:888
static void shader_glsl_init_ps_uniform_locations(const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, struct glsl_ps_program *ps, unsigned int ps_c_count)
Definition: glsl_shader.c:9644
static unsigned int vec4_varyings(DWORD shader_major, const struct wined3d_gl_info *gl_info)
Definition: glsl_shader.c:1790
static void shader_glsl_load_images(const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps)
Definition: glsl_shader.c:729
static GLuint find_glsl_vshader(const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader, const struct vs_compile_args *args)
Definition: glsl_shader.c:8155
const struct fragment_pipeline glsl_fragment_pipe
static void shader_glsl_load_program_resources(const struct wined3d_context *context, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader *shader)
Definition: glsl_shader.c:759
static GLuint find_glsl_pshader(const struct wined3d_context *context, struct wined3d_string_buffer *buffer, struct wined3d_string_buffer_list *string_buffers, struct wined3d_shader *shader, const struct ps_compile_args *args, const struct ps_np2fixup_info **np2fixup_info)
Definition: glsl_shader.c:8062
static GLuint find_glsl_hull_shader(const struct wined3d_context *context, struct shader_glsl_priv *priv, struct wined3d_shader *shader)
Definition: glsl_shader.c:8219
static void shader_glsl_init_ds_uniform_locations(const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, struct glsl_ds_program *ds)
Definition: glsl_shader.c:9632
static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *gl_info, struct shader_glsl_priv *priv, GLuint program_id, struct glsl_vs_program *vs, unsigned int vs_c_count)
Definition: glsl_shader.c:9545
static struct glsl_ffp_fragment_shader * shader_glsl_find_ffp_fragment_shader(struct shader_glsl_priv *priv, const struct ffp_frag_settings *args, const struct wined3d_context *context)
Definition: glsl_shader.c:9524
static void shader_glsl_load_samplers(const struct wined3d_context *context, struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps)
Definition: glsl_shader.c:690
static struct glsl_ffp_vertex_shader * shader_glsl_find_ffp_vertex_shader(struct shader_glsl_priv *priv, const struct wined3d_gl_info *gl_info, const struct wined3d_ffp_vs_settings *settings)
Definition: glsl_shader.c:9503
const struct wined3d_vertex_pipe_ops glsl_vertex_pipe
static GLuint shader_glsl_generate_vs3_rasterizer_input_setup(struct shader_glsl_priv *priv, const struct wined3d_shader *vs, const struct wined3d_shader *ps, BOOL per_vertex_point_size, BOOL flatshading, const struct wined3d_gl_info *gl_info)
Definition: glsl_shader.c:6839
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const char * var
Definition: shader.c:5666
static char * tmp_name
Definition: cache.c:24
struct list linked_programs
Definition: glsl_shader.c:336
struct list linked_programs
Definition: glsl_shader.c:329
struct wined3d_string_buffer_list string_buffers
Definition: glsl_shader.c:122
const struct fragment_pipeline * fragment_pipe
Definition: glsl_shader.c:130
const struct wined3d_vertex_pipe_ops * vertex_pipe
Definition: glsl_shader.c:129
union wined3d_shader::@289 u