ReactOS 0.4.16-dev-112-g52265ae
effect.c File Reference
#include <stdio.h>
#include <assert.h>
#include "d3dx9_private.h"
#include "d3dcompiler.h"
#include "winternl.h"
#include "wine/list.h"
Include dependency graph for effect.c:

Go to the source code of this file.

Classes

struct  d3dx_object
 
struct  d3dx_state
 
struct  d3dx_sampler
 
struct  d3dx_pass
 
struct  d3dx_technique
 
struct  d3dx_parameter_block
 
struct  d3dx_recorded_parameter
 
struct  d3dx_effect
 
struct  d3dx_effect_pool
 
struct  ID3DXEffectCompilerImpl
 

Macros

#define INT_FLOAT_MULTI   255.0f
 
#define INT_FLOAT_MULTI_INVERSE   (1/INT_FLOAT_MULTI)
 
#define PARAMETER_FLAG_SHARED   1
 
#define INITIAL_POOL_SIZE   16
 
#define INITIAL_PARAM_BLOCK_SIZE   1024
 
#define INITIAL_SHARED_DATA_SIZE   4
 
#define INITIAL_CONST_NAMES_SIZE   4
 

Typedefs

typedef BOOL(* walk_parameter_dep_func) (void *data, struct d3dx_parameter *param)
 

Enumerations

enum  STATE_CLASS {
  SC_LIGHTENABLE , SC_FVF , SC_LIGHT , SC_MATERIAL ,
  SC_NPATCHMODE , SC_PIXELSHADER , SC_RENDERSTATE , SC_SETSAMPLER ,
  SC_SAMPLERSTATE , SC_TEXTURE , SC_TEXTURESTAGE , SC_TRANSFORM ,
  SC_VERTEXSHADER , SC_SHADERCONST , SC_UNKNOWN
}
 
enum  MATERIAL_TYPE {
  MT_DIFFUSE , MT_AMBIENT , MT_SPECULAR , MT_EMISSIVE ,
  MT_POWER
}
 
enum  LIGHT_TYPE {
  LT_TYPE , LT_DIFFUSE , LT_SPECULAR , LT_AMBIENT ,
  LT_POSITION , LT_DIRECTION , LT_RANGE , LT_FALLOFF ,
  LT_ATTENUATION0 , LT_ATTENUATION1 , LT_ATTENUATION2 , LT_THETA ,
  LT_PHI
}
 
enum  SHADER_CONSTANT_TYPE {
  SCT_VSFLOAT , SCT_VSBOOL , SCT_VSINT , SCT_PSFLOAT ,
  SCT_PSBOOL , SCT_PSINT
}
 
enum  STATE_TYPE { ST_CONSTANT , ST_PARAMETER , ST_FXLC , ST_ARRAY_SELECTOR }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dx)
 
static HRESULT d3dx_parse_state (struct d3dx_effect *effect, struct d3dx_state *state, const char *data, const char **ptr, struct d3dx_object *objects)
 
static void free_parameter (struct d3dx_parameter *param, BOOL element, BOOL child)
 
static void read_dword (const char **ptr, DWORD *d)
 
static void skip_dword_unknown (const char **ptr, unsigned int count)
 
static D3DXHANDLE get_parameter_handle (struct d3dx_parameter *parameter)
 
static D3DXHANDLE get_technique_handle (struct d3dx_technique *technique)
 
static D3DXHANDLE get_pass_handle (struct d3dx_pass *pass)
 
static struct d3dx_techniqueget_technique_by_name (struct d3dx_effect *effect, const char *name)
 
static struct d3dx_techniqueget_valid_technique (struct d3dx_effect *effect, D3DXHANDLE technique)
 
static struct d3dx_passget_valid_pass (struct d3dx_effect *effect, D3DXHANDLE pass)
 
static struct d3dx_parameterget_valid_parameter (struct d3dx_effect *effect, D3DXHANDLE parameter)
 
static struct d3dx_parameter_blockget_valid_parameter_block (D3DXHANDLE handle)
 
static void free_state (struct d3dx_state *state)
 
static void free_object (struct d3dx_object *object)
 
static void free_sampler (struct d3dx_sampler *sampler)
 
static void d3dx_pool_release_shared_parameter (struct d3dx_top_level_parameter *param)
 
static void free_parameter_object_data (struct d3dx_parameter *param, const void *data, unsigned int bytes)
 
static void free_parameter_data (struct d3dx_parameter *param, BOOL child)
 
static void free_top_level_parameter (struct d3dx_top_level_parameter *param)
 
static void free_pass (struct d3dx_pass *pass)
 
static void free_technique (struct d3dx_technique *technique)
 
static unsigned int get_recorded_parameter_size (const struct d3dx_recorded_parameter *record)
 
static void free_parameter_block (struct d3dx_parameter_block *block)
 
static void d3dx_effect_cleanup (struct d3dx_effect *effect)
 
static void get_vector (struct d3dx_parameter *param, D3DXVECTOR4 *vector)
 
static void set_vector (struct d3dx_parameter *param, const D3DXVECTOR4 *vector, void *dst_data)
 
static void get_matrix (struct d3dx_parameter *param, D3DXMATRIX *matrix, BOOL transpose)
 
static void set_matrix (struct d3dx_parameter *param, const D3DXMATRIX *matrix, void *dst_data)
 
static void set_matrix_transpose (struct d3dx_parameter *param, const D3DXMATRIX *matrix, void *dst_data)
 
static HRESULT set_string (char **param_data, const char *string)
 
static HRESULT set_value (struct d3dx_parameter *param, const void *data, unsigned int bytes, void *dst_data)
 
static struct d3dx_parameterget_parameter_element_by_name (struct d3dx_effect *effect, struct d3dx_parameter *parameter, const char *name)
 
static struct d3dx_parameterget_annotation_by_name (struct d3dx_effect *effect, unsigned int count, struct d3dx_parameter *annotations, const char *name)
 
struct d3dx_parameterget_parameter_by_name (struct d3dx_effect *effect, struct d3dx_parameter *parameter, const char *name)
 
static DWORD d3dx9_effect_version (DWORD major, DWORD minor)
 
static HRESULT d3dx9_get_param_value_ptr (struct d3dx_pass *pass, struct d3dx_state *state, void **param_value, struct d3dx_parameter **out_param, BOOL update_all, BOOL *param_dirty)
 
static unsigned int get_annotation_from_object (struct d3dx_effect *effect, D3DXHANDLE object, struct d3dx_parameter **annotations)
 
static BOOL walk_parameter_tree (struct d3dx_parameter *param, walk_parameter_dep_func param_func, void *data)
 
static ULONG64get_version_counter_ptr (struct d3dx_effect *effect)
 
static ULONG64 next_effect_update_version (struct d3dx_effect *effect)
 
static voidrecord_parameter (struct d3dx_effect *effect, struct d3dx_parameter *param, unsigned int bytes)
 
static void set_dirty (struct d3dx_parameter *param)
 
static voidparam_get_data_and_dirtify (struct d3dx_effect *effect, struct d3dx_parameter *param, unsigned int bytes, BOOL value_changed)
 
static void d3dx9_set_light_parameter (enum LIGHT_TYPE op, D3DLIGHT9 *light, void *value)
 
static void d3dx9_set_material_parameter (enum MATERIAL_TYPE op, D3DMATERIAL9 *material, void *value)
 
static HRESULT d3dx_set_shader_const_state (struct d3dx_effect *effect, enum SHADER_CONSTANT_TYPE op, UINT index, struct d3dx_parameter *param, void *value_ptr)
 
static HRESULT d3dx9_apply_state (struct d3dx_effect *effect, struct d3dx_pass *pass, struct d3dx_state *state, unsigned int parent_index, BOOL update_all)
 
static HRESULT d3dx_set_shader_constants (struct d3dx_effect *effect, struct d3dx_pass *pass, struct d3dx_parameter *param, BOOL vs, BOOL update_all)
 
static HRESULT d3dx9_apply_pass_states (struct d3dx_effect *effect, struct d3dx_pass *pass, BOOL update_all)
 
static void param_set_data_pointer (struct d3dx_parameter *param, unsigned char *data, BOOL child, BOOL free_data)
 
static BOOL is_same_parameter (void *param1_, struct d3dx_parameter *param2)
 
static HRESULT d3dx_pool_sync_shared_parameter (struct d3dx_effect_pool *pool, struct d3dx_top_level_parameter *param)
 
static BOOL param_zero_data_func (void *dummy, struct d3dx_parameter *param)
 
static struct d3dx_effect_poolimpl_from_ID3DXEffectPool (ID3DXEffectPool *iface)
 
static struct d3dx_effect_poolunsafe_impl_from_ID3DXEffectPool (ID3DXEffectPool *iface)
 
static struct d3dx_effectimpl_from_ID3DXEffect (ID3DXEffect *iface)
 
static HRESULT WINAPI d3dx_effect_QueryInterface (ID3DXEffect *iface, REFIID riid, void **object)
 
static ULONG WINAPI d3dx_effect_AddRef (ID3DXEffect *iface)
 
static ULONG WINAPI d3dx_effect_Release (ID3DXEffect *iface)
 
static HRESULT WINAPI d3dx_effect_GetDesc (ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
 
static HRESULT WINAPI d3dx_effect_GetParameterDesc (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
 
static HRESULT WINAPI d3dx_effect_GetTechniqueDesc (ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
 
static HRESULT WINAPI d3dx_effect_GetPassDesc (ID3DXEffect *iface, D3DXHANDLE pass_handle, D3DXPASS_DESC *desc)
 
static HRESULT WINAPI d3dx_effect_GetFunctionDesc (ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
 
static D3DXHANDLE WINAPI d3dx_effect_GetParameter (ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
 
static D3DXHANDLE WINAPI d3dx_effect_GetParameterByName (ID3DXEffect *iface, D3DXHANDLE parameter, const char *name)
 
static D3DXHANDLE WINAPI d3dx_effect_GetParameterBySemantic (ID3DXEffect *iface, D3DXHANDLE parameter, const char *semantic)
 
static D3DXHANDLE WINAPI d3dx_effect_GetParameterElement (ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
 
static D3DXHANDLE WINAPI d3dx_effect_GetTechnique (ID3DXEffect *iface, UINT index)
 
static D3DXHANDLE WINAPI d3dx_effect_GetTechniqueByName (ID3DXEffect *iface, const char *name)
 
static D3DXHANDLE WINAPI d3dx_effect_GetPass (ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
 
static D3DXHANDLE WINAPI d3dx_effect_GetPassByName (ID3DXEffect *iface, D3DXHANDLE technique, const char *name)
 
static D3DXHANDLE WINAPI d3dx_effect_GetFunction (ID3DXEffect *iface, UINT index)
 
static D3DXHANDLE WINAPI d3dx_effect_GetFunctionByName (ID3DXEffect *iface, const char *name)
 
static D3DXHANDLE WINAPI d3dx_effect_GetAnnotation (ID3DXEffect *iface, D3DXHANDLE object, UINT index)
 
static D3DXHANDLE WINAPI d3dx_effect_GetAnnotationByName (ID3DXEffect *iface, D3DXHANDLE object, const char *name)
 
static HRESULT WINAPI d3dx_effect_SetValue (ID3DXEffect *iface, D3DXHANDLE parameter, const void *data, UINT bytes)
 
static HRESULT WINAPI d3dx_effect_GetValue (ID3DXEffect *iface, D3DXHANDLE parameter, void *data, UINT bytes)
 
static HRESULT WINAPI d3dx_effect_SetBool (ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
 
static HRESULT WINAPI d3dx_effect_GetBool (ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
 
static HRESULT WINAPI d3dx_effect_SetBoolArray (ID3DXEffect *iface, D3DXHANDLE parameter, const BOOL *b, UINT count)
 
static HRESULT WINAPI d3dx_effect_GetBoolArray (ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
 
static HRESULT WINAPI d3dx_effect_SetInt (ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
 
static HRESULT WINAPI d3dx_effect_GetInt (ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
 
static HRESULT WINAPI d3dx_effect_SetIntArray (ID3DXEffect *iface, D3DXHANDLE parameter, const INT *n, UINT count)
 
static HRESULT WINAPI d3dx_effect_GetIntArray (ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
 
static HRESULT WINAPI d3dx_effect_SetFloat (ID3DXEffect *iface, D3DXHANDLE parameter, float f)
 
static HRESULT WINAPI d3dx_effect_GetFloat (ID3DXEffect *iface, D3DXHANDLE parameter, float *f)
 
static HRESULT WINAPI d3dx_effect_SetFloatArray (ID3DXEffect *iface, D3DXHANDLE parameter, const float *f, UINT count)
 
static HRESULT WINAPI d3dx_effect_GetFloatArray (ID3DXEffect *iface, D3DXHANDLE parameter, float *f, UINT count)
 
static HRESULT WINAPI d3dx_effect_SetVector (ID3DXEffect *iface, D3DXHANDLE parameter, const D3DXVECTOR4 *vector)
 
static HRESULT WINAPI d3dx_effect_GetVector (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
 
static HRESULT WINAPI d3dx_effect_SetVectorArray (ID3DXEffect *iface, D3DXHANDLE parameter, const D3DXVECTOR4 *vector, UINT count)
 
static HRESULT WINAPI d3dx_effect_GetVectorArray (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
 
static HRESULT WINAPI d3dx_effect_SetMatrix (ID3DXEffect *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix)
 
static HRESULT WINAPI d3dx_effect_GetMatrix (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
 
static HRESULT WINAPI d3dx_effect_SetMatrixArray (ID3DXEffect *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI d3dx_effect_GetMatrixArray (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI d3dx_effect_SetMatrixPointerArray (ID3DXEffect *iface, D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI d3dx_effect_GetMatrixPointerArray (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI d3dx_effect_SetMatrixTranspose (ID3DXEffect *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix)
 
static HRESULT WINAPI d3dx_effect_GetMatrixTranspose (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
 
static HRESULT WINAPI d3dx_effect_SetMatrixTransposeArray (ID3DXEffect *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI d3dx_effect_GetMatrixTransposeArray (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI d3dx_effect_SetMatrixTransposePointerArray (ID3DXEffect *iface, D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI d3dx_effect_GetMatrixTransposePointerArray (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI d3dx_effect_SetString (ID3DXEffect *iface, D3DXHANDLE parameter, const char *string)
 
static HRESULT WINAPI d3dx_effect_GetString (ID3DXEffect *iface, D3DXHANDLE parameter, const char **string)
 
static HRESULT WINAPI d3dx_effect_SetTexture (ID3DXEffect *iface, D3DXHANDLE parameter, IDirect3DBaseTexture9 *texture)
 
static HRESULT WINAPI d3dx_effect_GetTexture (ID3DXEffect *iface, D3DXHANDLE parameter, IDirect3DBaseTexture9 **texture)
 
static HRESULT WINAPI d3dx_effect_GetPixelShader (ID3DXEffect *iface, D3DXHANDLE parameter, IDirect3DPixelShader9 **shader)
 
static HRESULT WINAPI d3dx_effect_GetVertexShader (ID3DXEffect *iface, D3DXHANDLE parameter, IDirect3DVertexShader9 **shader)
 
static HRESULT WINAPI d3dx_effect_SetArrayRange (ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
 
static HRESULT WINAPI d3dx_effect_GetPool (ID3DXEffect *iface, ID3DXEffectPool **pool)
 
static HRESULT WINAPI d3dx_effect_SetTechnique (ID3DXEffect *iface, D3DXHANDLE technique)
 
static D3DXHANDLE WINAPI d3dx_effect_GetCurrentTechnique (ID3DXEffect *iface)
 
static HRESULT WINAPI d3dx_effect_ValidateTechnique (ID3DXEffect *iface, D3DXHANDLE technique)
 
static HRESULT WINAPI d3dx_effect_FindNextValidTechnique (ID3DXEffect *iface, D3DXHANDLE technique, D3DXHANDLE *next_technique)
 
static BOOL walk_parameter_dep (struct d3dx_parameter *param, walk_parameter_dep_func param_func, void *data)
 
static BOOL walk_param_eval_dep (struct d3dx_param_eval *param_eval, walk_parameter_dep_func param_func, void *data)
 
static BOOL walk_state_dep (struct d3dx_state *state, walk_parameter_dep_func param_func, void *data)
 
static BOOL is_parameter_used (struct d3dx_parameter *param, struct d3dx_technique *tech)
 
static BOOL WINAPI d3dx_effect_IsParameterUsed (ID3DXEffect *iface, D3DXHANDLE parameter, D3DXHANDLE technique)
 
static HRESULT WINAPI d3dx_effect_Begin (ID3DXEffect *iface, UINT *passes, DWORD flags)
 
static HRESULT WINAPI d3dx_effect_BeginPass (ID3DXEffect *iface, UINT pass)
 
static HRESULT WINAPI d3dx_effect_CommitChanges (ID3DXEffect *iface)
 
static HRESULT WINAPI d3dx_effect_EndPass (ID3DXEffect *iface)
 
static HRESULT WINAPI d3dx_effect_End (ID3DXEffect *iface)
 
static HRESULT WINAPI d3dx_effect_GetDevice (ID3DXEffect *iface, struct IDirect3DDevice9 **device)
 
static BOOL param_on_lost_device (void *data, struct d3dx_parameter *param)
 
static HRESULT WINAPI d3dx_effect_OnLostDevice (ID3DXEffect *iface)
 
static HRESULT WINAPI d3dx_effect_OnResetDevice (ID3DXEffect *iface)
 
static HRESULT WINAPI d3dx_effect_SetStateManager (ID3DXEffect *iface, ID3DXEffectStateManager *manager)
 
static HRESULT WINAPI d3dx_effect_GetStateManager (ID3DXEffect *iface, ID3DXEffectStateManager **manager)
 
static HRESULT WINAPI d3dx_effect_BeginParameterBlock (ID3DXEffect *iface)
 
static D3DXHANDLE WINAPI d3dx_effect_EndParameterBlock (ID3DXEffect *iface)
 
static HRESULT WINAPI d3dx_effect_ApplyParameterBlock (ID3DXEffect *iface, D3DXHANDLE parameter_block)
 
static HRESULT WINAPI d3dx_effect_CloneEffect (ID3DXEffect *iface, IDirect3DDevice9 *device, ID3DXEffect **new_effect)
 
static struct ID3DXEffectCompilerImplimpl_from_ID3DXEffectCompiler (ID3DXEffectCompiler *iface)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface (ID3DXEffectCompiler *iface, REFIID riid, void **object)
 
static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef (ID3DXEffectCompiler *iface)
 
static ULONG WINAPI ID3DXEffectCompilerImpl_Release (ID3DXEffectCompiler *iface)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc (ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc (ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc (ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc (ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const char *name)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const char *semantic)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique (ID3DXEffectCompiler *iface, UINT index)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName (ID3DXEffectCompiler *iface, const char *name)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass (ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName (ID3DXEffectCompiler *iface, D3DXHANDLE technique, const char *name)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction (ID3DXEffectCompiler *iface, UINT index)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName (ID3DXEffectCompiler *iface, const char *name)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation (ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
 
static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName (ID3DXEffectCompiler *iface, D3DXHANDLE object, const char *name)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const void *data, UINT bytes)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, void *data, UINT bytes)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const BOOL *b, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const INT *n, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, float f)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, float *f)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const float *f, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, float *f, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const D3DXVECTOR4 *vector)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const D3DXVECTOR4 *vector, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const char *string)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, const char **string)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture (struct ID3DXEffectCompiler *iface, D3DXHANDLE parameter, struct IDirect3DBaseTexture9 *texture)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture (struct ID3DXEffectCompiler *iface, D3DXHANDLE parameter, struct IDirect3DBaseTexture9 **texture)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, struct IDirect3DPixelShader9 **shader)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader (struct ID3DXEffectCompiler *iface, D3DXHANDLE parameter, struct IDirect3DVertexShader9 **shader)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral (ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect (ID3DXEffectCompiler *iface, DWORD flags, ID3DXBuffer **effect, ID3DXBuffer **error_msgs)
 
static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader (ID3DXEffectCompiler *iface, D3DXHANDLE function, const char *target, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_msgs, ID3DXConstantTable **constant_table)
 
static HRESULT d3dx_parse_sampler (struct d3dx_effect *effect, struct d3dx_sampler *sampler, const char *data, const char **ptr, struct d3dx_object *objects)
 
static HRESULT d3dx_parse_value (struct d3dx_effect *effect, struct d3dx_parameter *param, void *value, const char *data, const char **ptr, struct d3dx_object *objects)
 
static HRESULT d3dx_parse_init_value (struct d3dx_effect *effect, struct d3dx_parameter *param, const char *data, const char *ptr, struct d3dx_object *objects)
 
static HRESULT d3dx9_parse_name (char **name, const char *ptr)
 
static HRESULT d3dx9_copy_data (struct d3dx_effect *effect, unsigned int object_id, const char **ptr)
 
static void param_set_magic_number (struct d3dx_parameter *param)
 
static int param_rb_compare (const void *key, const struct wine_rb_entry *entry)
 
static void add_param_to_tree (struct d3dx_effect *effect, struct d3dx_parameter *param, struct d3dx_parameter *parent, char separator, unsigned int element)
 
static HRESULT d3dx_parse_effect_typedef (struct d3dx_effect *effect, struct d3dx_parameter *param, const char *data, const char **ptr, struct d3dx_parameter *parent, UINT flags)
 
static HRESULT d3dx_parse_effect_annotation (struct d3dx_effect *effect, struct d3dx_parameter *anno, const char *data, const char **ptr, struct d3dx_object *objects)
 
static HRESULT d3dx_parse_effect_parameter (struct d3dx_effect *effect, struct d3dx_top_level_parameter *param, const char *data, const char **ptr, struct d3dx_object *objects)
 
static HRESULT d3dx_parse_effect_pass (struct d3dx_effect *effect, struct d3dx_pass *pass, const char *data, const char **ptr, struct d3dx_object *objects)
 
static HRESULT d3dx_parse_effect_technique (struct d3dx_effect *effect, struct d3dx_technique *technique, const char *data, const char **ptr, struct d3dx_object *objects)
 
static HRESULT d3dx9_create_object (struct d3dx_effect *effect, struct d3dx_object *object)
 
static HRESULT d3dx_parse_array_selector (struct d3dx_effect *effect, struct d3dx_state *state, const char **skip_constants, unsigned int skip_constants_count)
 
static HRESULT d3dx_parse_resource (struct d3dx_effect *effect, const char *data, const char **ptr, const char **skip_constants, unsigned int skip_constants_count)
 
static BOOL param_set_top_level_param (void *top_level_param, struct d3dx_parameter *param)
 
static HRESULT d3dx_parse_effect (struct d3dx_effect *effect, const char *data, UINT data_size, DWORD start, const char **skip_constants, unsigned int skip_constants_count)
 
static charnext_valid_constant_name (char **string)
 
static const char ** parse_skip_constants_string (char *skip_constants_string, unsigned int *names_count)
 
static HRESULT d3dx9_effect_init (struct d3dx_effect *effect, struct IDirect3DDevice9 *device, const char *data, SIZE_T data_size, const D3D_SHADER_MACRO *defines, ID3DInclude *include, UINT eflags, ID3DBlob **errors, struct ID3DXEffectPool *pool, const char *skip_constants_string)
 
HRESULT WINAPI D3DXCreateEffectEx (struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatalen, const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skip_constants, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilation_errors)
 
HRESULT WINAPI D3DXCreateEffect (struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatalen, const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilation_errors)
 
static HRESULT d3dx9_effect_compiler_init (struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size, const D3D_SHADER_MACRO *defines, ID3DInclude *include, UINT eflags, ID3DBlob **error_messages)
 
HRESULT WINAPI D3DXCreateEffectCompiler (const char *srcdata, UINT srcdatalen, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **compiler, ID3DXBuffer **parse_errors)
 
static HRESULT WINAPI d3dx_effect_pool_QueryInterface (ID3DXEffectPool *iface, REFIID riid, void **object)
 
static ULONG WINAPI d3dx_effect_pool_AddRef (ID3DXEffectPool *iface)
 
static void free_effect_pool (struct d3dx_effect_pool *pool)
 
static ULONG WINAPI d3dx_effect_pool_Release (ID3DXEffectPool *iface)
 
HRESULT WINAPI D3DXCreateEffectPool (ID3DXEffectPool **pool)
 
HRESULT WINAPI D3DXCreateEffectFromFileExW (struct IDirect3DDevice9 *device, const WCHAR *srcfile, const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
 
HRESULT WINAPI D3DXCreateEffectFromFileExA (struct IDirect3DDevice9 *device, const char *srcfile, const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
 
HRESULT WINAPI D3DXCreateEffectFromFileW (struct IDirect3DDevice9 *device, const WCHAR *srcfile, const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
 
HRESULT WINAPI D3DXCreateEffectFromFileA (struct IDirect3DDevice9 *device, const char *srcfile, const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
 
HRESULT WINAPI D3DXCreateEffectFromResourceExW (struct IDirect3DDevice9 *device, HMODULE srcmodule, const WCHAR *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
 
HRESULT WINAPI D3DXCreateEffectFromResourceExA (struct IDirect3DDevice9 *device, HMODULE srcmodule, const char *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
 
HRESULT WINAPI D3DXCreateEffectFromResourceW (struct IDirect3DDevice9 *device, HMODULE srcmodule, const WCHAR *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
 
HRESULT WINAPI D3DXCreateEffectFromResourceA (struct IDirect3DDevice9 *device, HMODULE srcmodule, const char *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
 
HRESULT WINAPI D3DXCreateEffectCompilerFromFileW (const WCHAR *srcfile, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors)
 
HRESULT WINAPI D3DXCreateEffectCompilerFromFileA (const char *srcfile, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors)
 
HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA (HMODULE srcmodule, const char *srcresource, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors)
 
HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW (HMODULE srcmodule, const WCHAR *srcresource, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors)
 
HRESULT WINAPI D3DXDisassembleEffect (ID3DXEffect *effect, BOOL enable_color_code, ID3DXBuffer **disassembly)
 

Variables

static const char parameter_magic_string [4] = {'@', '!', '#', '\xFF'}
 
static const char parameter_block_magic_string [4] = {'@', '!', '#', '\xFE'}
 
struct {
   enum STATE_CLASS   class
 
   UINT   op
 
   const char *   name
 
state_table []
 
static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl
 
static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl
 
static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl
 

Macro Definition Documentation

◆ INITIAL_CONST_NAMES_SIZE

#define INITIAL_CONST_NAMES_SIZE   4

Definition at line 6339 of file effect.c.

◆ INITIAL_PARAM_BLOCK_SIZE

#define INITIAL_PARAM_BLOCK_SIZE   1024

Definition at line 43 of file effect.c.

◆ INITIAL_POOL_SIZE

#define INITIAL_POOL_SIZE   16

Definition at line 42 of file effect.c.

◆ INITIAL_SHARED_DATA_SIZE

#define INITIAL_SHARED_DATA_SIZE   4

Definition at line 208 of file effect.c.

◆ INT_FLOAT_MULTI

#define INT_FLOAT_MULTI   255.0f

Definition at line 34 of file effect.c.

◆ INT_FLOAT_MULTI_INVERSE

#define INT_FLOAT_MULTI_INVERSE   (1/INT_FLOAT_MULTI)

Definition at line 35 of file effect.c.

◆ PARAMETER_FLAG_SHARED

#define PARAMETER_FLAG_SHARED   1

Definition at line 40 of file effect.c.

Typedef Documentation

◆ walk_parameter_dep_func

typedef BOOL(* walk_parameter_dep_func) (void *data, struct d3dx_parameter *param)

Definition at line 231 of file effect.c.

Enumeration Type Documentation

◆ LIGHT_TYPE

Enumerator
LT_TYPE 
LT_DIFFUSE 
LT_SPECULAR 
LT_AMBIENT 
LT_POSITION 
LT_DIRECTION 
LT_RANGE 
LT_FALLOFF 
LT_ATTENUATION0 
LT_ATTENUATION1 
LT_ATTENUATION2 
LT_THETA 
LT_PHI 

Definition at line 75 of file effect.c.

76{
77 LT_TYPE,
89 LT_PHI,
90};
@ LT_ATTENUATION0
Definition: effect.c:85
@ LT_THETA
Definition: effect.c:88
@ LT_SPECULAR
Definition: effect.c:79
@ LT_DIFFUSE
Definition: effect.c:78
@ LT_RANGE
Definition: effect.c:83
@ LT_ATTENUATION2
Definition: effect.c:87
@ LT_AMBIENT
Definition: effect.c:80
@ LT_TYPE
Definition: effect.c:77
@ LT_POSITION
Definition: effect.c:81
@ LT_DIRECTION
Definition: effect.c:82
@ LT_ATTENUATION1
Definition: effect.c:86
@ LT_PHI
Definition: effect.c:89
@ LT_FALLOFF
Definition: effect.c:84

◆ MATERIAL_TYPE

Enumerator
MT_DIFFUSE 
MT_AMBIENT 
MT_SPECULAR 
MT_EMISSIVE 
MT_POWER 

Definition at line 66 of file effect.c.

67{
73};
@ MT_EMISSIVE
Definition: effect.c:71
@ MT_POWER
Definition: effect.c:72
@ MT_DIFFUSE
Definition: effect.c:68
@ MT_AMBIENT
Definition: effect.c:69
@ MT_SPECULAR
Definition: effect.c:70

◆ SHADER_CONSTANT_TYPE

Enumerator
SCT_VSFLOAT 
SCT_VSBOOL 
SCT_VSINT 
SCT_PSFLOAT 
SCT_PSBOOL 
SCT_PSINT 

Definition at line 92 of file effect.c.

93{
100};
@ SCT_PSINT
Definition: effect.c:99
@ SCT_VSBOOL
Definition: effect.c:95
@ SCT_VSINT
Definition: effect.c:96
@ SCT_VSFLOAT
Definition: effect.c:94
@ SCT_PSBOOL
Definition: effect.c:98
@ SCT_PSFLOAT
Definition: effect.c:97

◆ STATE_CLASS

Enumerator
SC_LIGHTENABLE 
SC_FVF 
SC_LIGHT 
SC_MATERIAL 
SC_NPATCHMODE 
SC_PIXELSHADER 
SC_RENDERSTATE 
SC_SETSAMPLER 
SC_SAMPLERSTATE 
SC_TEXTURE 
SC_TEXTURESTAGE 
SC_TRANSFORM 
SC_VERTEXSHADER 
SC_SHADERCONST 
SC_UNKNOWN 

Definition at line 47 of file effect.c.

48{
50 SC_FVF,
64};
@ SC_NPATCHMODE
Definition: effect.c:53
@ SC_TEXTURE
Definition: effect.c:58
@ SC_TEXTURESTAGE
Definition: effect.c:59
@ SC_UNKNOWN
Definition: effect.c:63
@ SC_TRANSFORM
Definition: effect.c:60
@ SC_LIGHTENABLE
Definition: effect.c:49
@ SC_SHADERCONST
Definition: effect.c:62
@ SC_MATERIAL
Definition: effect.c:52
@ SC_SAMPLERSTATE
Definition: effect.c:57
@ SC_RENDERSTATE
Definition: effect.c:55
@ SC_VERTEXSHADER
Definition: effect.c:61
@ SC_SETSAMPLER
Definition: effect.c:56
@ SC_PIXELSHADER
Definition: effect.c:54
@ SC_LIGHT
Definition: effect.c:51
@ SC_FVF
Definition: effect.c:50

◆ STATE_TYPE

Enumerator
ST_CONSTANT 
ST_PARAMETER 
ST_FXLC 
ST_ARRAY_SELECTOR 

Definition at line 102 of file effect.c.

103{
106 ST_FXLC,
108};
@ ST_FXLC
Definition: effect.c:106
@ ST_PARAMETER
Definition: effect.c:105
@ ST_CONSTANT
Definition: effect.c:104
@ ST_ARRAY_SELECTOR
Definition: effect.c:107

Function Documentation

◆ add_param_to_tree()

static void add_param_to_tree ( struct d3dx_effect effect,
struct d3dx_parameter param,
struct d3dx_parameter parent,
char  separator,
unsigned int  element 
)
static

Definition at line 5266 of file effect.c.

5268{
5269 const char *parent_name = parent ? parent->full_name : NULL;
5270 unsigned int i;
5271
5272 TRACE("Adding parameter %p (%s - parent %p, element %u) to the rbtree.\n",
5273 param, debugstr_a(param->name), parent, element);
5274
5275 if (parent_name)
5276 {
5277 unsigned int parent_name_len = strlen(parent_name);
5278 unsigned int name_len = strlen(param->name);
5279 unsigned int part_str_len;
5280 unsigned int len;
5281 char part_str[16];
5282
5283 if (separator == '[')
5284 {
5285 sprintf(part_str, "[%u]", element);
5286 part_str_len = strlen(part_str);
5287 name_len = 0;
5288 }
5289 else
5290 {
5291 part_str[0] = separator;
5292 part_str[1] = 0;
5293 part_str_len = 1;
5294 }
5295 len = parent_name_len + part_str_len + name_len + 1;
5296
5297 if (!(param->full_name = heap_alloc(len)))
5298 {
5299 ERR("Out of memory.\n");
5300 return;
5301 }
5302
5303 memcpy(param->full_name, parent_name, parent_name_len);
5304 memcpy(param->full_name + parent_name_len, part_str, part_str_len);
5305 memcpy(param->full_name + parent_name_len + part_str_len, param->name, name_len);
5306 param->full_name[len - 1] = 0;
5307 }
5308 else
5309 {
5310 unsigned int len = strlen(param->name) + 1;
5311
5312 if (!(param->full_name = heap_alloc(len)))
5313 {
5314 ERR("Out of memory.\n");
5315 return;
5316 }
5317
5318 memcpy(param->full_name, param->name, len);
5319 }
5320 TRACE("Full name is %s.\n", param->full_name);
5321 wine_rb_put(&effect->param_tree, param->full_name, &param->rb_entry);
5322
5324 for (i = 0; i < param->top_level_param->annotation_count; ++i)
5325 add_param_to_tree(effect, &param->top_level_param->annotations[i], param, '@', 0);
5326
5327 if (param->element_count)
5328 for (i = 0; i < param->element_count; ++i)
5329 add_param_to_tree(effect, &param->members[i], param, '[', i);
5330 else
5331 for (i = 0; i < param->member_count; ++i)
5332 add_param_to_tree(effect, &param->members[i], param, '.', 0);
5333}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define ERR(fmt,...)
Definition: precomp.h:57
static BOOL is_top_level_parameter(struct d3dx_parameter *param)
#define NULL
Definition: types.h:112
static void add_param_to_tree(struct d3dx_effect *effect, struct d3dx_parameter *param, struct d3dx_parameter *parent, char separator, unsigned int element)
Definition: effect.c:5266
static const WCHAR separator[]
Definition: asmname.c:65
r parent
Definition: btrfs.c:3010
GLfloat param
Definition: glext.h:5796
GLenum GLsizei len
Definition: glext.h:6722
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
#define debugstr_a
Definition: kernel32.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
Definition: rbtree.h:215
#define TRACE(s)
Definition: solgame.cpp:4
struct wine_rb_tree param_tree
Definition: effect.c:186

Referenced by add_param_to_tree(), and d3dx_parse_effect().

◆ d3dx9_apply_pass_states()

static HRESULT d3dx9_apply_pass_states ( struct d3dx_effect effect,
struct d3dx_pass pass,
BOOL  update_all 
)
static

Definition at line 1731 of file effect.c.

1732{
1733 unsigned int i;
1734 HRESULT ret;
1735 HRESULT hr;
1736 ULONG64 new_update_version = next_effect_update_version(effect);
1737
1738 TRACE("effect %p, pass %p, state_count %u.\n", effect, pass, pass->state_count);
1739
1740 ret = D3D_OK;
1741 for (i = 0; i < pass->state_count; ++i)
1742 {
1743 if (FAILED(hr = d3dx9_apply_state(effect, pass, &pass->states[i], ~0u, update_all)))
1744 {
1745 WARN("Error applying state, hr %#x.\n", hr);
1746 ret = hr;
1747 }
1748 }
1749
1750 if (effect->light_updated)
1751 {
1752 for (i = 0; i < ARRAY_SIZE(effect->current_light); ++i)
1753 {
1754 if ((effect->light_updated & (1u << i))
1755 && FAILED(hr = SET_D3D_STATE(effect, SetLight, i, &effect->current_light[i])))
1756 {
1757 WARN("Error setting light, hr %#x.\n", hr);
1758 ret = hr;
1759 }
1760 }
1761 effect->light_updated = 0;
1762 }
1763
1764 if (effect->material_updated
1765 && FAILED(hr = SET_D3D_STATE(effect, SetMaterial, &effect->current_material)))
1766 {
1767 WARN("Error setting material, hr %#x.\n", hr);
1768 ret = hr;
1769 }
1770 effect->material_updated = FALSE;
1771
1772 pass->update_version = new_update_version;
1773 return ret;
1774}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define WARN(fmt,...)
Definition: precomp.h:61
#define D3D_OK
Definition: d3d.h:106
#define SET_D3D_STATE(base_effect, args...)
#define FALSE
Definition: types.h:117
static HRESULT d3dx9_apply_state(struct d3dx_effect *effect, struct d3dx_pass *pass, struct d3dx_state *state, unsigned int parent_index, BOOL update_all)
Definition: effect.c:1595
static ULONG64 next_effect_update_version(struct d3dx_effect *effect)
Definition: effect.c:1276
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 * u
Definition: glfuncs.h:240
#define FAILED(hr)
Definition: intsafe.h:51
unsigned __int64 ULONG64
Definition: imports.h:198
HRESULT hr
Definition: shlfolder.c:183
D3DMATERIAL9 current_material
Definition: effect.c:201
BOOL material_updated
Definition: effect.c:202
D3DLIGHT9 current_light[8]
Definition: effect.c:199
unsigned int light_updated
Definition: effect.c:200
pass
Definition: typegen.h:25
int ret

Referenced by d3dx_effect_Begin(), d3dx_effect_BeginPass(), and d3dx_effect_CommitChanges().

◆ d3dx9_apply_state()

static HRESULT d3dx9_apply_state ( struct d3dx_effect effect,
struct d3dx_pass pass,
struct d3dx_state state,
unsigned int  parent_index,
BOOL  update_all 
)
static

Definition at line 1595 of file effect.c.

1597{
1598 struct d3dx_parameter *param;
1599 void *param_value;
1600 BOOL param_dirty;
1601 HRESULT hr;
1602
1603 TRACE("operation %u, index %u, type %u.\n", state->operation, state->index, state->type);
1604
1605 if (FAILED(hr = d3dx9_get_param_value_ptr(pass, state, &param_value, &param,
1606 update_all, &param_dirty)))
1607 {
1608 if (!update_all && hr == E_FAIL)
1609 {
1610 /* Native d3dx9 returns D3D_OK from CommitChanges() involving
1611 * out of bounds array access and does not touch the affected
1612 * states. */
1613 WARN("Returning D3D_OK on out of bounds array access.\n");
1614 return D3D_OK;
1615 }
1616 return hr;
1617 }
1618
1619 if (!(update_all || param_dirty
1620 || state_table[state->operation].class == SC_VERTEXSHADER
1621 || state_table[state->operation].class == SC_PIXELSHADER
1622 || state_table[state->operation].class == SC_SETSAMPLER))
1623 return D3D_OK;
1624
1625 switch (state_table[state->operation].class)
1626 {
1627 case SC_RENDERSTATE:
1628 TRACE("%s, operation %u, value %u.\n", state_table[state->operation].name,
1629 state_table[state->operation].op, *(DWORD *)param_value);
1630 return SET_D3D_STATE(effect, SetRenderState, state_table[state->operation].op, *(DWORD *)param_value);
1631 case SC_FVF:
1632 TRACE("%s, value %#x.\n", state_table[state->operation].name, *(DWORD *)param_value);
1633 return SET_D3D_STATE(effect, SetFVF, *(DWORD *)param_value);
1634 case SC_TEXTURE:
1635 {
1636 UINT unit;
1637
1638 unit = parent_index == ~0u ? state->index : parent_index;
1639 TRACE("%s, unit %u, value %p.\n", state_table[state->operation].name, unit,
1640 *(IDirect3DBaseTexture9 **)param_value);
1641 return SET_D3D_STATE(effect, SetTexture, unit, *(IDirect3DBaseTexture9 **)param_value);
1642 }
1643 case SC_TEXTURESTAGE:
1644 TRACE("%s, stage %u, value %u.\n", state_table[state->operation].name, state->index, *(DWORD *)param_value);
1645 return SET_D3D_STATE(effect, SetTextureStageState, state->index,
1646 state_table[state->operation].op, *(DWORD *)param_value);
1647 case SC_SETSAMPLER:
1648 {
1649 struct d3dx_sampler *sampler;
1650 HRESULT ret, hr;
1651 unsigned int i;
1652
1653 sampler = (struct d3dx_sampler *)param_value;
1654 TRACE("%s, sampler %u, applying %u states.\n", state_table[state->operation].name, state->index,
1655 sampler->state_count);
1656 ret = D3D_OK;
1657 for (i = 0; i < sampler->state_count; i++)
1658 {
1659 if (FAILED(hr = d3dx9_apply_state(effect, pass, &sampler->states[i], state->index, update_all)))
1660 ret = hr;
1661 }
1662 return ret;
1663 }
1664 case SC_SAMPLERSTATE:
1665 {
1666 UINT sampler;
1667
1668 sampler = parent_index == ~0u ? state->index : parent_index;
1669 TRACE("%s, sampler %u, value %u.\n", state_table[state->operation].name, sampler, *(DWORD *)param_value);
1670 return SET_D3D_STATE(effect, SetSamplerState, sampler, state_table[state->operation].op,
1671 *(DWORD *)param_value);
1672 }
1673 case SC_VERTEXSHADER:
1674 TRACE("%s, shader %p.\n", state_table[state->operation].name, *(IDirect3DVertexShader9 **)param_value);
1675 if ((update_all || param_dirty)
1676 && FAILED(hr = SET_D3D_STATE(effect, SetVertexShader,
1677 *(IDirect3DVertexShader9 **)param_value)))
1678 ERR("Could not set vertex shader, hr %#x.\n", hr);
1679 else if (*(IDirect3DVertexShader9 **)param_value)
1680 hr = d3dx_set_shader_constants(effect, pass, param, TRUE, update_all || param_dirty);
1681 return hr;
1682 case SC_PIXELSHADER:
1683 TRACE("%s, shader %p.\n", state_table[state->operation].name, *(IDirect3DPixelShader9 **)param_value);
1684 if ((update_all || param_dirty)
1685 && FAILED(hr = SET_D3D_STATE(effect, SetPixelShader,
1686 *(IDirect3DPixelShader9 **)param_value)))
1687 ERR("Could not set pixel shader, hr %#x.\n", hr);
1688 else if (*(IDirect3DPixelShader9 **)param_value)
1689 hr = d3dx_set_shader_constants(effect, pass, param, FALSE, update_all || param_dirty);
1690 return hr;
1691 case SC_TRANSFORM:
1692 TRACE("%s, state %u.\n", state_table[state->operation].name, state->index);
1693 return SET_D3D_STATE(effect, SetTransform, state_table[state->operation].op + state->index,
1694 (D3DMATRIX *)param_value);
1695 case SC_LIGHTENABLE:
1696 TRACE("%s, index %u, value %u.\n", state_table[state->operation].name, state->index, *(BOOL *)param_value);
1697 return SET_D3D_STATE(effect, LightEnable, state->index, *(BOOL *)param_value);
1698 case SC_LIGHT:
1699 {
1700 TRACE("%s, index %u, op %u.\n", state_table[state->operation].name, state->index,
1701 state_table[state->operation].op);
1703 &effect->current_light[state->index], param_value);
1704 effect->light_updated |= 1u << state->index;
1705 return D3D_OK;
1706 }
1707 case SC_MATERIAL:
1708 {
1709 TRACE("%s, index %u, op %u.\n", state_table[state->operation].name, state->index,
1710 state_table[state->operation].op);
1712 &effect->current_material, param_value);
1713 effect->material_updated = TRUE;
1714 return D3D_OK;
1715 }
1716 case SC_NPATCHMODE:
1717 TRACE("%s, nsegments %f.\n", state_table[state->operation].name, *(float *)param_value);
1718 return SET_D3D_STATE(effect, SetNPatchMode, *(float *)param_value);
1719 case SC_SHADERCONST:
1720 TRACE("%s, index %u, op %u.\n", state_table[state->operation].name, state->index,
1721 state_table[state->operation].op);
1722 return d3dx_set_shader_const_state(effect, state_table[state->operation].op, state->index,
1723 param, param_value);
1724 default:
1725 FIXME("%s not handled.\n", state_table[state->operation].name);
1726 break;
1727 }
1728 return D3D_OK;
1729}
static int state
Definition: maze.c:121
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_FAIL
Definition: ddrawi.h:102
#define TRUE
Definition: types.h:120
static const struct @243 state_table[]
static void d3dx9_set_light_parameter(enum LIGHT_TYPE op, D3DLIGHT9 *light, void *value)
Definition: effect.c:1341
static void d3dx9_set_material_parameter(enum MATERIAL_TYPE op, D3DMATERIAL9 *material, void *value)
Definition: effect.c:1408
static HRESULT d3dx_set_shader_constants(struct d3dx_effect *effect, struct d3dx_pass *pass, struct d3dx_parameter *param, BOOL vs, BOOL update_all)
Definition: effect.c:1549
static HRESULT d3dx_set_shader_const_state(struct d3dx_effect *effect, enum SHADER_CONSTANT_TYPE op, UINT index, struct d3dx_parameter *param, void *value_ptr)
Definition: effect.c:1451
static HRESULT d3dx9_get_param_value_ptr(struct d3dx_pass *pass, struct d3dx_state *state, void **param_value, struct d3dx_parameter **out_param, BOOL update_all, BOOL *param_dirty)
Definition: effect.c:1119
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint sampler
Definition: glext.h:7283
unsigned int UINT
Definition: ndis.h:50
png_const_structrp png_const_inforp int * unit
Definition: png.h:2159

Referenced by d3dx9_apply_pass_states(), d3dx9_apply_state(), and d3dx_set_shader_constants().

◆ d3dx9_copy_data()

static HRESULT d3dx9_copy_data ( struct d3dx_effect effect,
unsigned int  object_id,
const char **  ptr 
)
static

Definition at line 5217 of file effect.c.

5218{
5219 struct d3dx_object *object = &effect->objects[object_id];
5220
5221 if (object->size || object->data)
5222 {
5223 if (object_id)
5224 FIXME("Overwriting object id %u!\n", object_id);
5225 else
5226 TRACE("Overwriting object id 0.\n");
5227
5228 HeapFree(GetProcessHeap(), 0, object->data);
5229 object->data = NULL;
5230 }
5231
5232 read_dword(ptr, &object->size);
5233 TRACE("Data size: %#x.\n", object->size);
5234
5235 if (!object->size)
5236 return D3D_OK;
5237
5238 object->data = HeapAlloc(GetProcessHeap(), 0, object->size);
5239 if (!object->data)
5240 {
5241 ERR("Failed to allocate object memory.\n");
5242 return E_OUTOFMEMORY;
5243 }
5244
5245 TRACE("Data: %s.\n", debugstr_an(*ptr, object->size));
5246 memcpy(object->data, *ptr, object->size);
5247
5248 *ptr += ((object->size + 3) & ~3);
5249
5250 return D3D_OK;
5251}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static void read_dword(const char **ptr, DWORD *d)
Definition: effect.c:436
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define HeapFree(x, y, z)
Definition: compat.h:735
static PVOID ptr
Definition: dispmode.c:27
struct d3dx_object * objects
Definition: effect.c:183

Referenced by d3dx_parse_effect(), and d3dx_parse_resource().

◆ d3dx9_create_object()

static HRESULT d3dx9_create_object ( struct d3dx_effect effect,
struct d3dx_object object 
)
static

Definition at line 5901 of file effect.c.

5902{
5903 struct d3dx_parameter *param = object->param;
5904 IDirect3DDevice9 *device = effect->device;
5905 HRESULT hr;
5906
5907 if (*(char **)param->data)
5908 ERR("Parameter data already allocated.\n");
5909
5910 switch (param->type)
5911 {
5912 case D3DXPT_STRING:
5913 *(char **)param->data = HeapAlloc(GetProcessHeap(), 0, object->size);
5914 if (!*(char **)param->data)
5915 {
5916 ERR("Out of memory.\n");
5917 return E_OUTOFMEMORY;
5918 }
5919 memcpy(*(char **)param->data, object->data, object->size);
5920 break;
5923 (IDirect3DVertexShader9 **)param->data)))
5924 {
5925 WARN("Failed to create vertex shader.\n");
5926 object->creation_failed = TRUE;
5927 }
5928 break;
5929 case D3DXPT_PIXELSHADER:
5931 (IDirect3DPixelShader9 **)param->data)))
5932 {
5933 WARN("Failed to create pixel shader.\n");
5934 object->creation_failed = TRUE;
5935 }
5936 break;
5937 default:
5938 break;
5939 }
5940 return D3D_OK;
5941}
#define IDirect3DDevice9_CreatePixelShader(p, a, b)
Definition: d3d9.h:1613
#define IDirect3DDevice9_CreateVertexShader(p, a, b)
Definition: d3d9.h:1598
@ D3DXPT_STRING
Definition: d3dx9shader.h:77
@ D3DXPT_VERTEXSHADER
Definition: d3dx9shader.h:89
@ D3DXPT_PIXELSHADER
Definition: d3dx9shader.h:88
struct IDirect3DDevice9 * device
Definition: effect.c:191
Definition: devices.h:37

Referenced by d3dx_parse_effect(), and d3dx_parse_resource().

◆ d3dx9_effect_compiler_init()

static HRESULT d3dx9_effect_compiler_init ( struct ID3DXEffectCompilerImpl compiler,
const char data,
SIZE_T  data_size,
const D3D_SHADER_MACRO defines,
ID3DInclude include,
UINT  eflags,
ID3DBlob **  error_messages 
)
static

Definition at line 6611 of file effect.c.

6614{
6615 TRACE("compiler %p, data %p, data_size %lu, defines %p, include %p, eflags %#x, error_messages %p.\n",
6616 compiler, data, data_size, defines, include, eflags, error_messages);
6617
6619 compiler->ref = 1;
6620
6621 FIXME("ID3DXEffectCompiler implementation is only a stub.\n");
6622
6623 return D3D_OK;
6624}
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:31
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:32
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:31
static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl
Definition: effect.c:4925
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
ID3DXEffectCompiler ID3DXEffectCompiler_iface
Definition: effect.c:223

Referenced by D3DXCreateEffectCompiler().

◆ d3dx9_effect_init()

static HRESULT d3dx9_effect_init ( struct d3dx_effect effect,
struct IDirect3DDevice9 *  device,
const char data,
SIZE_T  data_size,
const D3D_SHADER_MACRO defines,
ID3DInclude include,
UINT  eflags,
ID3DBlob **  errors,
struct ID3DXEffectPool *  pool,
const char skip_constants_string 
)
static

Definition at line 6394 of file effect.c.

6397{
6398#if D3DX_SDK_VERSION <= 36
6400#else
6401 UINT compile_flags = 0;
6402#endif
6403 ID3DBlob *bytecode = NULL, *temp_errors = NULL;
6404 unsigned int skip_constants_count = 0;
6405 char *skip_constants_buffer = NULL;
6406 const char **skip_constants = NULL;
6407 const char *ptr = data;
6408 DWORD tag, offset;
6409 unsigned int i, j;
6410 HRESULT hr;
6411
6412 TRACE("effect %p, device %p, data %p, data_size %lu, defines %p, include %p, eflags %#x, errors %p, "
6413 "pool %p, skip_constants %s.\n",
6414 effect, device, data, data_size, defines, include, eflags, errors, pool,
6415 debugstr_a(skip_constants_string));
6416
6417 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
6418 effect->ref = 1;
6419
6420 if (pool)
6421 {
6423 pool->lpVtbl->AddRef(pool);
6424 }
6425
6427 effect->device = device;
6428
6429 effect->flags = eflags;
6430
6432
6433 read_dword(&ptr, &tag);
6434 TRACE("Tag: %x\n", tag);
6435
6436 if (tag != d3dx9_effect_version(9, 1))
6437 {
6438 TRACE("HLSL ASCII effect, trying to compile it.\n");
6439 hr = D3DCompile(data, data_size, NULL, defines, include,
6440 NULL, "fx_2_0", compile_flags, eflags, &bytecode, &temp_errors);
6441 if (FAILED(hr))
6442 {
6443 WARN("Failed to compile ASCII effect.\n");
6444 if (bytecode)
6445 ID3D10Blob_Release(bytecode);
6446 if (temp_errors)
6447 {
6448 const char *error_string = ID3D10Blob_GetBufferPointer(temp_errors);
6449 const char *string_ptr;
6450
6451 while (*error_string)
6452 {
6453 string_ptr = error_string;
6454 while (*string_ptr && *string_ptr != '\n' && *string_ptr != '\r'
6455 && string_ptr - error_string < 80)
6456 ++string_ptr;
6457 TRACE("%s\n", debugstr_an(error_string, string_ptr - error_string));
6458 error_string = string_ptr;
6459 while (*error_string == '\n' || *error_string == '\r')
6460 ++error_string;
6461 }
6462 }
6463 if (errors)
6464 *errors = temp_errors;
6465 else if (temp_errors)
6466 ID3D10Blob_Release(temp_errors);
6467 return hr;
6468 }
6469 if (!bytecode)
6470 {
6471 FIXME("No output from effect compilation.\n");
6472 return D3DERR_INVALIDCALL;
6473 }
6474 if (errors)
6475 *errors = temp_errors;
6476 else if (temp_errors)
6477 ID3D10Blob_Release(temp_errors);
6478
6479 ptr = ID3D10Blob_GetBufferPointer(bytecode);
6480 read_dword(&ptr, &tag);
6481 TRACE("Tag: %x\n", tag);
6482 }
6483
6484 if (skip_constants_string)
6485 {
6486 skip_constants_buffer = HeapAlloc(GetProcessHeap(), 0,
6487 sizeof(*skip_constants_buffer) * (strlen(skip_constants_string) + 1));
6488 if (!skip_constants_buffer)
6489 {
6490 if (bytecode)
6491 ID3D10Blob_Release(bytecode);
6492 return E_OUTOFMEMORY;
6493 }
6494 strcpy(skip_constants_buffer, skip_constants_string);
6495
6496 if (!(skip_constants = parse_skip_constants_string(skip_constants_buffer, &skip_constants_count)))
6497 {
6498 HeapFree(GetProcessHeap(), 0, skip_constants_buffer);
6499 if (bytecode)
6500 ID3D10Blob_Release(bytecode);
6501 return E_OUTOFMEMORY;
6502 }
6503 }
6504 read_dword(&ptr, &offset);
6505 TRACE("Offset: %x\n", offset);
6506
6507 hr = d3dx_parse_effect(effect, ptr, data_size, offset, skip_constants, skip_constants_count);
6508 if (bytecode)
6509 ID3D10Blob_Release(bytecode);
6510 if (hr != D3D_OK)
6511 {
6512 FIXME("Failed to parse effect.\n");
6513 HeapFree(GetProcessHeap(), 0, skip_constants_buffer);
6514 HeapFree(GetProcessHeap(), 0, skip_constants);
6515 return hr;
6516 }
6517
6518 for (i = 0; i < skip_constants_count; ++i)
6519 {
6520 struct d3dx_parameter *param;
6521 param = get_parameter_by_name(effect, NULL, skip_constants[i]);
6522 if (param)
6523 {
6524 for (j = 0; j < effect->technique_count; ++j)
6525 {
6526 if (is_parameter_used(param, &effect->techniques[j]))
6527 {
6528 WARN("skip_constants parameter %s is used in technique %u.\n",
6529 debugstr_a(skip_constants[i]), j);
6530 HeapFree(GetProcessHeap(), 0, skip_constants_buffer);
6531 HeapFree(GetProcessHeap(), 0, skip_constants);
6532 return D3DERR_INVALIDCALL;
6533 }
6534 }
6535 }
6536 else
6537 {
6538 TRACE("skip_constants parameter %s not found.\n",
6539 debugstr_a(skip_constants[i]));
6540 }
6541 }
6542
6543 HeapFree(GetProcessHeap(), 0, skip_constants_buffer);
6544 HeapFree(GetProcessHeap(), 0, skip_constants);
6545
6546 /* initialize defaults - check because of unsupported ascii effects */
6547 if (effect->techniques)
6548 {
6549 effect->active_technique = &effect->techniques[0];
6550 effect->active_pass = NULL;
6551 }
6552
6553 return D3D_OK;
6554}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static void list_init(struct list_entry *head)
Definition: list.h:51
HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages)
Definition: compiler.c:889
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
#define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY
Definition: d3dcompiler.h:51
#define D3DERR_INVALIDCALL
static BOOL is_parameter_used(struct d3dx_parameter *param, struct d3dx_technique *tech)
Definition: effect.c:3914
static DWORD d3dx9_effect_version(DWORD major, DWORD minor)
Definition: effect.c:1114
static const char ** parse_skip_constants_string(char *skip_constants_string, unsigned int *names_count)
Definition: effect.c:6360
static struct d3dx_effect_pool * unsafe_impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
Definition: effect.c:6737
static HRESULT d3dx_parse_effect(struct d3dx_effect *effect, const char *data, UINT data_size, DWORD start, const char **skip_constants, unsigned int skip_constants_count)
Definition: effect.c:6187
struct d3dx_parameter * get_parameter_by_name(struct d3dx_effect *effect, struct d3dx_parameter *parameter, const char *name)
Definition: effect.c:1026
static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl
Definition: effect.c:4332
GLintptr offset
Definition: glext.h:5920
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
struct d3dx_technique * active_technique
Definition: effect.c:193
unsigned int technique_count
Definition: effect.c:179
struct d3dx_technique * techniques
Definition: effect.c:182
struct d3dx_pass * active_pass
Definition: effect.c:194
struct d3dx_effect_pool * pool
Definition: effect.c:192
ID3DXEffect ID3DXEffect_iface
Definition: effect.c:175
LONG ref
Definition: effect.c:176
struct list parameter_block_list
Definition: effect.c:204
DWORD flags
Definition: effect.c:184
Definition: ecma_167.h:138

Referenced by D3DXCreateEffectEx().

◆ d3dx9_effect_version()

static DWORD d3dx9_effect_version ( DWORD  major,
DWORD  minor 
)
inlinestatic

Definition at line 1114 of file effect.c.

1115{
1116 return (0xfeff0000 | ((major) << 8) | (minor));
1117}
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928

Referenced by d3dx9_effect_init().

◆ d3dx9_get_param_value_ptr()

static HRESULT d3dx9_get_param_value_ptr ( struct d3dx_pass pass,
struct d3dx_state state,
void **  param_value,
struct d3dx_parameter **  out_param,
BOOL  update_all,
BOOL param_dirty 
)
static

Definition at line 1119 of file effect.c.

1122{
1123 struct d3dx_parameter *param = &state->parameter;
1124
1125 *param_value = NULL;
1126 *out_param = NULL;
1127 *param_dirty = FALSE;
1128
1129 switch (state->type)
1130 {
1131 case ST_PARAMETER:
1132 param = state->referenced_param;
1133 *param_dirty = is_param_dirty(param, pass->update_version);
1134 /* fallthrough */
1135 case ST_CONSTANT:
1136 *out_param = param;
1137 *param_value = param->data;
1138 return D3D_OK;
1139 case ST_ARRAY_SELECTOR:
1140 {
1141 unsigned int array_idx;
1142 static const struct d3dx_parameter array_idx_param =
1143 {"", NULL, NULL, NULL, NULL, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 0, 0, 0, sizeof(array_idx)};
1144 HRESULT hr;
1145 struct d3dx_parameter *ref_param, *selected_param;
1146
1147 if (!param->param_eval)
1148 {
1149 FIXME("Preshader structure is null.\n");
1150 return D3DERR_INVALIDCALL;
1151 }
1152 /* We override with the update_version of the pass because we want
1153 * to force index recomputation and check for out of bounds. */
1154 if (is_param_eval_input_dirty(param->param_eval, pass->update_version))
1155 {
1156 if (FAILED(hr = d3dx_evaluate_parameter(param->param_eval, &array_idx_param, &array_idx)))
1157 return hr;
1158 }
1159 else
1160 {
1161 array_idx = state->index;
1162 }
1163 ref_param = state->referenced_param;
1164 TRACE("Array index %u, stored array index %u, element_count %u.\n", array_idx, state->index,
1165 ref_param->element_count);
1166 /* According to the tests, native d3dx handles the case of array index evaluated to -1
1167 * in a specific way, always selecting first array element and not returning error. */
1168 if (array_idx == ~0u)
1169 {
1170 WARN("Array index is -1, setting to 0.\n");
1171 array_idx = 0;
1172 }
1173
1174 if (array_idx >= ref_param->element_count)
1175 {
1176 WARN("Computed array index %u is larger than array size %u.\n",
1177 array_idx, ref_param->element_count);
1178 return E_FAIL;
1179 }
1180 selected_param = &ref_param->members[array_idx];
1181 *param_dirty = state->index != array_idx || is_param_dirty(selected_param, pass->update_version);
1182 state->index = array_idx;
1183
1184 *param_value = selected_param->data;
1185 *out_param = selected_param;
1186 return D3D_OK;
1187 }
1188 case ST_FXLC:
1189 if (param->param_eval)
1190 {
1191 *out_param = param;
1192 *param_value = param->data;
1193 /* We check with the update_version of the pass because the
1194 * same preshader might be used by both the vertex and the
1195 * pixel shader (that can happen e.g. for sampler states). */
1196 if (update_all || is_param_eval_input_dirty(param->param_eval, pass->update_version))
1197 {
1198 *param_dirty = TRUE;
1199 return d3dx_evaluate_parameter(param->param_eval, param, *param_value);
1200 }
1201 else
1202 return D3D_OK;
1203 }
1204 else
1205 {
1206 FIXME("No preshader for FXLC parameter.\n");
1207 return D3DERR_INVALIDCALL;
1208 }
1209 }
1210 return E_NOTIMPL;
1211}
static BOOL is_param_dirty(struct d3dx_parameter *param, ULONG64 update_version)
HRESULT d3dx_evaluate_parameter(struct d3dx_param_eval *peval, const struct d3dx_parameter *param, void *param_value) DECLSPEC_HIDDEN
Definition: preshader.c:1723
BOOL is_param_eval_input_dirty(struct d3dx_param_eval *peval, ULONG64 update_version) DECLSPEC_HIDDEN
Definition: preshader.c:1717
@ D3DXPC_SCALAR
Definition: d3dx9shader.h:62
@ D3DXPT_INT
Definition: d3dx9shader.h:75
#define E_NOTIMPL
Definition: ddrawi.h:99
struct d3dx_parameter * members

Referenced by d3dx9_apply_state(), d3dx_effect_GetPassDesc(), and d3dx_effect_ValidateTechnique().

◆ d3dx9_parse_name()

static HRESULT d3dx9_parse_name ( char **  name,
const char ptr 
)
static

Definition at line 5192 of file effect.c.

5193{
5194 DWORD size;
5195
5196 read_dword(&ptr, &size);
5197 TRACE("Name size: %#x\n", size);
5198
5199 if (!size)
5200 {
5201 return D3D_OK;
5202 }
5203
5205 if (!*name)
5206 {
5207 ERR("Failed to allocate name memory.\n");
5208 return E_OUTOFMEMORY;
5209 }
5210
5211 TRACE("Name: %s.\n", debugstr_an(ptr, size));
5212 memcpy(*name, ptr, size);
5213
5214 return D3D_OK;
5215}
GLsizeiptr size
Definition: glext.h:5919
Definition: name.c:39

Referenced by d3dx_parse_effect_pass(), d3dx_parse_effect_technique(), and d3dx_parse_effect_typedef().

◆ d3dx9_set_light_parameter()

static void d3dx9_set_light_parameter ( enum LIGHT_TYPE  op,
D3DLIGHT9 light,
void value 
)
static

Definition at line 1341 of file effect.c.

1342{
1343 static const struct
1344 {
1345 unsigned int offset;
1346 const char *name;
1347 }
1348 light_tbl[] =
1349 {
1350 {FIELD_OFFSET(D3DLIGHT9, Type), "LC_TYPE"},
1351 {FIELD_OFFSET(D3DLIGHT9, Diffuse), "LT_DIFFUSE"},
1352 {FIELD_OFFSET(D3DLIGHT9, Specular), "LT_SPECULAR"},
1353 {FIELD_OFFSET(D3DLIGHT9, Ambient), "LT_AMBIENT"},
1354 {FIELD_OFFSET(D3DLIGHT9, Position), "LT_POSITION"},
1355 {FIELD_OFFSET(D3DLIGHT9, Direction), "LT_DIRECTION"},
1356 {FIELD_OFFSET(D3DLIGHT9, Range), "LT_RANGE"},
1357 {FIELD_OFFSET(D3DLIGHT9, Falloff), "LT_FALLOFF"},
1358 {FIELD_OFFSET(D3DLIGHT9, Attenuation0), "LT_ATTENUATION0"},
1359 {FIELD_OFFSET(D3DLIGHT9, Attenuation1), "LT_ATTENUATION1"},
1360 {FIELD_OFFSET(D3DLIGHT9, Attenuation2), "LT_ATTENUATION2"},
1361 {FIELD_OFFSET(D3DLIGHT9, Theta), "LT_THETA"},
1362 {FIELD_OFFSET(D3DLIGHT9, Phi), "LT_PHI"}
1363 };
1364 switch (op)
1365 {
1366 case LT_TYPE:
1367 TRACE("LT_TYPE %u.\n", *(D3DLIGHTTYPE *)value);
1368 light->Type = *(D3DLIGHTTYPE *)value;
1369 break;
1370 case LT_DIFFUSE:
1371 case LT_SPECULAR:
1372 case LT_AMBIENT:
1373 {
1375
1376 TRACE("%s (%.8e %.8e %.8e %.8e).\n", light_tbl[op].name, c.r, c.g, c.b, c.a);
1377 *(D3DCOLORVALUE *)((BYTE *)light + light_tbl[op].offset) = c;
1378 break;
1379 }
1380 case LT_POSITION:
1381 case LT_DIRECTION:
1382 {
1383 D3DVECTOR v = *(D3DVECTOR *)value;
1384
1385 TRACE("%s (%.8e %.8e %.8e).\n", light_tbl[op].name, v.x, v.y, v.z);
1386 *(D3DVECTOR *)((BYTE *)light + light_tbl[op].offset) = v;
1387 break;
1388 }
1389 case LT_RANGE:
1390 case LT_FALLOFF:
1391 case LT_ATTENUATION0:
1392 case LT_ATTENUATION1:
1393 case LT_ATTENUATION2:
1394 case LT_THETA:
1395 case LT_PHI:
1396 {
1397 float v = *(float *)value;
1398 TRACE("%s %.8e.\n", light_tbl[op].name, v);
1399 *(float *)((BYTE *)light + light_tbl[op].offset) = v;
1400 break;
1401 }
1402 default:
1403 WARN("Unknown light parameter %u.\n", op);
1404 break;
1405 }
1406}
Type
Definition: Type.h:7
D3DLIGHTTYPE
Definition: d3dtypes.h:554
UINT op
Definition: effect.c:236
const char * name
Definition: effect.c:237
const GLdouble * v
Definition: gl.h:2040
const GLubyte * c
Definition: glext.h:8905
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 light
Definition: glfuncs.h:170
Definition: range.c:39
static COORD Position
Definition: mouse.c:34
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
Definition: pdh_main.c:94
WDF_EXTERN_C_START typedef _In_ WDFDEVICE _In_ WDFCONTEXT _In_ WDF_DMA_DIRECTION Direction
unsigned char BYTE
Definition: xxhash.c:193

Referenced by d3dx9_apply_state().

◆ d3dx9_set_material_parameter()

static void d3dx9_set_material_parameter ( enum MATERIAL_TYPE  op,
D3DMATERIAL9 material,
void value 
)
static

Definition at line 1408 of file effect.c.

1409{
1410 static const struct
1411 {
1412 unsigned int offset;
1413 const char *name;
1414 }
1415 material_tbl[] =
1416 {
1417 {FIELD_OFFSET(D3DMATERIAL9, Diffuse), "MT_DIFFUSE"},
1418 {FIELD_OFFSET(D3DMATERIAL9, Ambient), "MT_AMBIENT"},
1419 {FIELD_OFFSET(D3DMATERIAL9, Specular), "MT_SPECULAR"},
1420 {FIELD_OFFSET(D3DMATERIAL9, Emissive), "MT_EMISSIVE"},
1421 {FIELD_OFFSET(D3DMATERIAL9, Power), "MT_POWER"}
1422 };
1423
1424 switch (op)
1425 {
1426 case MT_POWER:
1427 {
1428 float v = *(float *)value;
1429
1430 TRACE("%s %.8e.\n", material_tbl[op].name, v);
1431 material->Power = v;
1432 break;
1433 }
1434 case MT_DIFFUSE:
1435 case MT_AMBIENT:
1436 case MT_SPECULAR:
1437 case MT_EMISSIVE:
1438 {
1440
1441 TRACE("%s, value (%.8e %.8e %.8e %.8e).\n", material_tbl[op].name, c.r, c.g, c.b, c.a);
1442 *(D3DCOLORVALUE *)((BYTE *)material + material_tbl[op].offset) = c;
1443 break;
1444 }
1445 default:
1446 WARN("Unknown material parameter %u.\n", op);
1447 break;
1448 }
1449}

Referenced by d3dx9_apply_state().

◆ d3dx_effect_AddRef()

static ULONG WINAPI d3dx_effect_AddRef ( ID3DXEffect *  iface)
static

Definition at line 1978 of file effect.c.

1979{
1980 struct d3dx_effect *This = impl_from_ID3DXEffect(iface);
1981
1982 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
1983
1984 return InterlockedIncrement(&This->ref);
1985}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3dx_effect * impl_from_ID3DXEffect(ID3DXEffect *iface)
Definition: effect.c:1955

◆ d3dx_effect_ApplyParameterBlock()

static HRESULT WINAPI d3dx_effect_ApplyParameterBlock ( ID3DXEffect *  iface,
D3DXHANDLE  parameter_block 
)
static

Definition at line 4252 of file effect.c.

4253{
4254 struct d3dx_parameter_block *block = get_valid_parameter_block(parameter_block);
4256
4257 TRACE("iface %p, parameter_block %p.\n", iface, parameter_block);
4258
4259 if (!block || !block->offset)
4260 return D3DERR_INVALIDCALL;
4261
4262 record = (struct d3dx_recorded_parameter *)block->buffer;
4263 while ((BYTE *)record < block->buffer + block->offset)
4264 {
4265 set_value(record->param, record + 1, record->bytes,
4266 param_get_data_and_dirtify(block->effect, record->param, record->bytes, TRUE));
4268 }
4269 assert((BYTE *)record == block->buffer + block->offset);
4270 return D3D_OK;
4271}
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
static struct d3dx_parameter_block * get_valid_parameter_block(D3DXHANDLE handle)
Definition: effect.c:527
static HRESULT set_value(struct d3dx_parameter *param, const void *data, unsigned int bytes, void *dst_data)
Definition: effect.c:889
static unsigned int get_recorded_parameter_size(const struct d3dx_recorded_parameter *record)
Definition: effect.c:722
static void * param_get_data_and_dirtify(struct d3dx_effect *effect, struct d3dx_parameter *param, unsigned int bytes, BOOL value_changed)
Definition: effect.c:1330
#define assert(x)
Definition: debug.h:53
static unsigned int block
Definition: xmlmemory.c:101

◆ d3dx_effect_Begin()

static HRESULT WINAPI d3dx_effect_Begin ( ID3DXEffect *  iface,
UINT passes,
DWORD  flags 
)
static

Definition at line 3949 of file effect.c.

3950{
3951 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3952 struct d3dx_technique *technique = effect->active_technique;
3953
3954 TRACE("iface %p, passes %p, flags %#x.\n", iface, passes, flags);
3955
3956 if (technique)
3957 {
3959 WARN("Invalid flags (%#x) specified.\n", flags);
3960
3962 {
3963 TRACE("State capturing disabled.\n");
3964 }
3965 else
3966 {
3967 HRESULT hr;
3968 unsigned int i;
3969
3970 if (!technique->saved_state)
3971 {
3972 ID3DXEffectStateManager *manager;
3973
3974 manager = effect->manager;
3975 effect->manager = NULL;
3977 ERR("BeginStateBlock failed, hr %#x.\n", hr);
3978 for (i = 0; i < technique->pass_count; i++)
3979 d3dx9_apply_pass_states(effect, &technique->passes[i], TRUE);
3980 if (FAILED(hr = IDirect3DDevice9_EndStateBlock(effect->device, &technique->saved_state)))
3981 ERR("EndStateBlock failed, hr %#x.\n", hr);
3982 effect->manager = manager;
3983 }
3985 ERR("StateBlock Capture failed, hr %#x.\n", hr);
3986 }
3987
3988 if (passes)
3989 *passes = technique->pass_count;
3990 effect->started = TRUE;
3991 effect->begin_flags = flags;
3992
3993 return D3D_OK;
3994 }
3995
3996 WARN("Invalid argument supplied.\n");
3997
3998 return D3DERR_INVALIDCALL;
3999}
#define IDirect3DDevice9_EndStateBlock(p, a)
Definition: d3d9.h:1568
#define IDirect3DDevice9_BeginStateBlock(p)
Definition: d3d9.h:1567
#define IDirect3DStateBlock9_Capture(p)
Definition: d3d9.h:1303
#define D3DXFX_DONOTSAVESTATE
Definition: d3dx9effect.h:24
#define D3DXFX_DONOTSAVESAMPLERSTATE
Definition: d3dx9effect.h:26
#define D3DXFX_DONOTSAVESHADERSTATE
Definition: d3dx9effect.h:25
static HRESULT d3dx9_apply_pass_states(struct d3dx_effect *effect, struct d3dx_pass *pass, BOOL update_all)
Definition: effect.c:1731
GLbitfield flags
Definition: glext.h:7161
struct ID3DXEffectStateManager * manager
Definition: effect.c:190
DWORD begin_flags
Definition: effect.c:196
BOOL started
Definition: effect.c:195
struct d3dx_pass * passes
Definition: effect.c:152
struct IDirect3DStateBlock9 * saved_state
Definition: effect.c:154
UINT pass_count
Definition: effect.c:148

◆ d3dx_effect_BeginParameterBlock()

static HRESULT WINAPI d3dx_effect_BeginParameterBlock ( ID3DXEffect *  iface)
static

Definition at line 4210 of file effect.c.

4211{
4212 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
4213
4214 TRACE("iface %p.\n", iface);
4215
4216 if (effect->current_parameter_block)
4217 {
4218 WARN("Parameter block is already started.\n");
4219 return D3DERR_INVALIDCALL;
4220 }
4221
4222 effect->current_parameter_block = heap_alloc_zero(sizeof(*effect->current_parameter_block));
4225 effect->current_parameter_block->effect = effect;
4226
4227 return D3D_OK;
4228}
static const char parameter_block_magic_string[4]
Definition: effect.c:38
struct d3dx_parameter_block * current_parameter_block
Definition: effect.c:205

◆ d3dx_effect_BeginPass()

static HRESULT WINAPI d3dx_effect_BeginPass ( ID3DXEffect *  iface,
UINT  pass 
)
static

Definition at line 4001 of file effect.c.

4002{
4003 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
4004 struct d3dx_technique *technique = effect->active_technique;
4005
4006 TRACE("iface %p, pass %u\n", effect, pass);
4007
4008 if (technique && pass < technique->pass_count && !effect->active_pass)
4009 {
4010 HRESULT hr;
4011
4012 memset(effect->current_light, 0, sizeof(effect->current_light));
4013 memset(&effect->current_material, 0, sizeof(effect->current_material));
4014
4015 if (SUCCEEDED(hr = d3dx9_apply_pass_states(effect, &technique->passes[pass], TRUE)))
4016 effect->active_pass = &technique->passes[pass];
4017 return hr;
4018 }
4019
4020 WARN("Invalid argument supplied.\n");
4021
4022 return D3DERR_INVALIDCALL;
4023}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define memset(x, y, z)
Definition: compat.h:39

◆ d3dx_effect_cleanup()

static void d3dx_effect_cleanup ( struct d3dx_effect effect)
static

Definition at line 746 of file effect.c.

747{
749 ID3DXEffectPool *pool;
750 unsigned int i;
751
752 TRACE("effect %p.\n", effect);
753
754 free_parameter_block(effect->current_parameter_block);
755 LIST_FOR_EACH_ENTRY_SAFE(block, cursor, &effect->parameter_block_list, struct d3dx_parameter_block, entry)
756 {
757 list_remove(&block->entry);
759 }
760
761 heap_free(effect->full_name_tmp);
762
763 if (effect->parameters)
764 {
765 for (i = 0; i < effect->parameter_count; ++i)
766 free_top_level_parameter(&effect->parameters[i]);
767 heap_free(effect->parameters);
768 }
769
770 if (effect->techniques)
771 {
772 for (i = 0; i < effect->technique_count; ++i)
773 free_technique(&effect->techniques[i]);
774 heap_free(effect->techniques);
775 }
776
777 if (effect->objects)
778 {
779 for (i = 0; i < effect->object_count; ++i)
780 free_object(&effect->objects[i]);
781 heap_free(effect->objects);
782 }
783
784 if (effect->pool)
785 {
786 pool = &effect->pool->ID3DXEffectPool_iface;
787 pool->lpVtbl->Release(pool);
788 }
789
790 if (effect->manager)
791 IUnknown_Release(effect->manager);
792
795}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1508
static void free_top_level_parameter(struct d3dx_top_level_parameter *param)
Definition: effect.c:644
static void free_technique(struct d3dx_technique *technique)
Definition: effect.c:687
static void free_parameter_block(struct d3dx_parameter_block *block)
Definition: effect.c:727
static void free_object(struct d3dx_object *object)
Definition: effect.c:540
const char cursor[]
Definition: icontest.c:13
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct d3dx_effect * effect
Definition: effect.c:160

Referenced by d3dx_effect_Release(), and D3DXCreateEffectEx().

◆ d3dx_effect_CloneEffect()

static HRESULT WINAPI d3dx_effect_CloneEffect ( ID3DXEffect *  iface,
IDirect3DDevice9 *  device,
ID3DXEffect **  new_effect 
)
static

Definition at line 4300 of file effect.c.

4302{
4303 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
4304
4305 FIXME("iface %p, device %p, new_effect %p stub.\n", effect, device, new_effect);
4306
4307 if (!new_effect)
4308 return D3DERR_INVALIDCALL;
4309
4310 if (effect->flags & D3DXFX_NOT_CLONEABLE)
4311 return E_FAIL;
4312
4313 if (!device)
4314 return D3DERR_INVALIDCALL;
4315
4316 iface->lpVtbl->AddRef(iface);
4317 *new_effect = iface;
4318 return S_OK;
4319}
#define D3DXFX_NOT_CLONEABLE
Definition: d3dx9effect.h:27
#define S_OK
Definition: intsafe.h:52

◆ d3dx_effect_CommitChanges()

static HRESULT WINAPI d3dx_effect_CommitChanges ( ID3DXEffect *  iface)
static

Definition at line 4025 of file effect.c.

4026{
4027 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
4028
4029 TRACE("iface %p.\n", iface);
4030
4031 if (!effect->active_pass)
4032 {
4033 WARN("Called without an active pass.\n");
4034 return D3D_OK;
4035 }
4036 return d3dx9_apply_pass_states(effect, effect->active_pass, FALSE);
4037}

◆ d3dx_effect_End()

static HRESULT WINAPI d3dx_effect_End ( ID3DXEffect *  iface)
static

Definition at line 4056 of file effect.c.

4057{
4058 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
4059 struct d3dx_technique *technique = effect->active_technique;
4060
4061 TRACE("iface %p.\n", iface);
4062
4063 if (!effect->started)
4064 return D3D_OK;
4065
4066 if (effect->begin_flags & D3DXFX_DONOTSAVESTATE)
4067 {
4068 TRACE("State restoring disabled.\n");
4069 }
4070 else
4071 {
4072 HRESULT hr;
4073
4074 if (technique && technique->saved_state)
4075 {
4077 ERR("State block apply failed, hr %#x.\n", hr);
4078 }
4079 else
4080 ERR("No saved state.\n");
4081 }
4082
4083 effect->started = FALSE;
4084
4085 return D3D_OK;
4086}
#define IDirect3DStateBlock9_Apply(p)
Definition: d3d9.h:1304

◆ d3dx_effect_EndParameterBlock()

static D3DXHANDLE WINAPI d3dx_effect_EndParameterBlock ( ID3DXEffect *  iface)
static

Definition at line 4230 of file effect.c.

4231{
4232 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
4233 struct d3dx_parameter_block *ret;
4234
4235 TRACE("iface %p.\n", iface);
4236
4237 if (!effect->current_parameter_block)
4238 {
4239 WARN("No active parameter block.\n");
4240 return NULL;
4241 }
4242 ret = effect->current_parameter_block;
4243
4244 ret->buffer = heap_realloc(ret->buffer, ret->offset);
4245 ret->size = ret->offset;
4246
4247 effect->current_parameter_block = NULL;
4248 list_add_tail(&effect->parameter_block_list, &ret->entry);
4249 return (D3DXHANDLE)ret;
4250}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
const char * D3DXHANDLE
Definition: d3dx9shader.h:48

◆ d3dx_effect_EndPass()

static HRESULT WINAPI d3dx_effect_EndPass ( ID3DXEffect *  iface)
static

Definition at line 4039 of file effect.c.

4040{
4041 struct d3dx_effect *This = impl_from_ID3DXEffect(iface);
4042
4043 TRACE("iface %p\n", This);
4044
4045 if (This->active_pass)
4046 {
4047 This->active_pass = NULL;
4048 return D3D_OK;
4049 }
4050
4051 WARN("Invalid call.\n");
4052
4053 return D3DERR_INVALIDCALL;
4054}

◆ d3dx_effect_FindNextValidTechnique()

static HRESULT WINAPI d3dx_effect_FindNextValidTechnique ( ID3DXEffect *  iface,
D3DXHANDLE  technique,
D3DXHANDLE next_technique 
)
static

Definition at line 3784 of file effect.c.

3786{
3787 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3788 struct d3dx_technique *prev_tech, *tech;
3789 unsigned int i;
3790
3791 TRACE("iface %p, technique %p, next_technique %p.\n", iface, technique, next_technique);
3792
3793 if (technique)
3794 {
3795 if (!(prev_tech = get_valid_technique(effect, technique)))
3796 return D3DERR_INVALIDCALL;
3797
3798 for (i = 0; i < effect->technique_count; ++i)
3799 {
3800 tech = &effect->techniques[i];
3801 if (tech == prev_tech)
3802 {
3803 ++i;
3804 break;
3805 }
3806 }
3807 }
3808 else
3809 {
3810 i = 0;
3811 }
3812
3813 for (; i < effect->technique_count; ++i)
3814 {
3815 tech = &effect->techniques[i];
3817 {
3818 *next_technique = get_technique_handle(tech);
3819 return D3D_OK;
3820 }
3821 }
3822
3823 *next_technique = get_technique_handle(&effect->techniques[0]);
3824 return S_FALSE;
3825}
static D3DXHANDLE get_technique_handle(struct d3dx_technique *technique)
Definition: effect.c:460
static struct d3dx_technique * get_valid_technique(struct d3dx_effect *effect, D3DXHANDLE technique)
Definition: effect.c:485
static HRESULT WINAPI d3dx_effect_ValidateTechnique(ID3DXEffect *iface, D3DXHANDLE technique)
Definition: effect.c:3737
#define S_FALSE
Definition: winerror.h:2357

◆ d3dx_effect_GetAnnotation()

static D3DXHANDLE WINAPI d3dx_effect_GetAnnotation ( ID3DXEffect *  iface,
D3DXHANDLE  object,
UINT  index 
)
static

Definition at line 2370 of file effect.c.

2371{
2372 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2373 struct d3dx_parameter *annotations = NULL;
2374 unsigned int annotation_count;
2375
2376 TRACE("iface %p, object %p, index %u.\n", iface, object, index);
2377
2378 annotation_count = get_annotation_from_object(effect, object, &annotations);
2379
2380 if (index < annotation_count)
2381 {
2382 TRACE("Returning parameter %p\n", &annotations[index]);
2383 return get_parameter_handle(&annotations[index]);
2384 }
2385
2386 WARN("Annotation not found.\n");
2387
2388 return NULL;
2389}
static unsigned int get_annotation_from_object(struct d3dx_effect *effect, D3DXHANDLE object, struct d3dx_parameter **annotations)
Definition: effect.c:1213
static D3DXHANDLE get_parameter_handle(struct d3dx_parameter *parameter)
Definition: effect.c:455
GLuint index
Definition: glext.h:6031

◆ d3dx_effect_GetAnnotationByName()

static D3DXHANDLE WINAPI d3dx_effect_GetAnnotationByName ( ID3DXEffect *  iface,
D3DXHANDLE  object,
const char name 
)
static

Definition at line 2391 of file effect.c.

2393{
2394 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2395 struct d3dx_parameter *annotation = NULL;
2396 struct d3dx_parameter *annotations = NULL;
2397 unsigned int annotation_count;
2398
2399 TRACE("iface %p, object %p, name %s.\n", iface, object, debugstr_a(name));
2400
2401 if (!name)
2402 {
2403 WARN("Invalid argument specified\n");
2404 return NULL;
2405 }
2406
2407 annotation_count = get_annotation_from_object(effect, object, &annotations);
2408
2409 annotation = get_annotation_by_name(effect, annotation_count, annotations, name);
2410 if (annotation)
2411 {
2412 TRACE("Returning parameter %p\n", annotation);
2414 }
2415
2416 WARN("Annotation not found.\n");
2417
2418 return NULL;
2419}
#define annotation(x)
Definition: dispex.idl:19
static struct d3dx_parameter * get_annotation_by_name(struct d3dx_effect *effect, unsigned int count, struct d3dx_parameter *annotations, const char *name)
Definition: effect.c:982

◆ d3dx_effect_GetBool()

static HRESULT WINAPI d3dx_effect_GetBool ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
BOOL b 
)
static

Definition at line 2532 of file effect.c.

2533{
2534 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2535 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2536
2537 TRACE("iface %p, parameter %p, b %p.\n", iface, parameter, b);
2538
2539 if (b && param && !param->element_count && param->rows == 1 && param->columns == 1)
2540 {
2541 set_number(b, D3DXPT_BOOL, param->data, param->type);
2542 TRACE("Returning %s\n", *b ? "TRUE" : "FALSE");
2543 return D3D_OK;
2544 }
2545
2546 WARN("Parameter not found.\n");
2547
2548 return D3DERR_INVALIDCALL;
2549}
static void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
@ D3DXPT_BOOL
Definition: d3dx9shader.h:74
static struct d3dx_parameter * get_valid_parameter(struct d3dx_effect *effect, D3DXHANDLE parameter)
Definition: effect.c:516
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

◆ d3dx_effect_GetBoolArray()

static HRESULT WINAPI d3dx_effect_GetBoolArray ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
BOOL b,
UINT  count 
)
static

Definition at line 2593 of file effect.c.

2594{
2595 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2596 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2597
2598 TRACE("iface %p, parameter %p, b %p, count %u.\n", iface, parameter, b, count);
2599
2600 if (b && param && (param->class == D3DXPC_SCALAR
2601 || param->class == D3DXPC_VECTOR
2602 || param->class == D3DXPC_MATRIX_ROWS
2603 || param->class == D3DXPC_MATRIX_COLUMNS))
2604 {
2605 unsigned int i, size = min(count, param->bytes / sizeof(DWORD));
2606
2607 for (i = 0; i < size; ++i)
2608 {
2609 set_number(&b[i], D3DXPT_BOOL, (DWORD *)param->data + i, param->type);
2610 }
2611 return D3D_OK;
2612 }
2613
2614 WARN("Parameter not found.\n");
2615
2616 return D3DERR_INVALIDCALL;
2617}
@ D3DXPC_MATRIX_COLUMNS
Definition: d3dx9shader.h:65
@ D3DXPC_MATRIX_ROWS
Definition: d3dx9shader.h:64
@ D3DXPC_VECTOR
Definition: d3dx9shader.h:63
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define min(a, b)
Definition: monoChain.cc:55

◆ d3dx_effect_GetCurrentTechnique()

static D3DXHANDLE WINAPI d3dx_effect_GetCurrentTechnique ( ID3DXEffect *  iface)
static

Definition at line 3728 of file effect.c.

3729{
3730 struct d3dx_effect *This = impl_from_ID3DXEffect(iface);
3731
3732 TRACE("iface %p\n", This);
3733
3734 return get_technique_handle(This->active_technique);
3735}

◆ d3dx_effect_GetDesc()

static HRESULT WINAPI d3dx_effect_GetDesc ( ID3DXEffect *  iface,
D3DXEFFECT_DESC desc 
)
static

Definition at line 2001 of file effect.c.

2002{
2003 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2004
2005 FIXME("iface %p, desc %p partial stub.\n", iface, desc);
2006
2007 if (!desc)
2008 {
2009 WARN("Invalid argument specified.\n");
2010 return D3DERR_INVALIDCALL;
2011 }
2012
2013 /* TODO: add creator and function count. */
2014 desc->Creator = NULL;
2015 desc->Functions = 0;
2016 desc->Parameters = effect->parameter_count;
2017 desc->Techniques = effect->technique_count;
2018
2019 return D3D_OK;
2020}
static const WCHAR desc[]
Definition: protectdata.c:36
unsigned int parameter_count
Definition: effect.c:178

◆ d3dx_effect_GetDevice()

static HRESULT WINAPI d3dx_effect_GetDevice ( ID3DXEffect *  iface,
struct IDirect3DDevice9 **  device 
)
static

Definition at line 4088 of file effect.c.

4089{
4090 struct d3dx_effect *This = impl_from_ID3DXEffect(iface);
4091
4092 TRACE("iface %p, device %p\n", This, device);
4093
4094 if (!device)
4095 {
4096 WARN("Invalid argument supplied.\n");
4097 return D3DERR_INVALIDCALL;
4098 }
4099
4101
4102 *device = This->device;
4103
4104 TRACE("Returning device %p\n", *device);
4105
4106 return S_OK;
4107}

◆ d3dx_effect_GetFloat()

static HRESULT WINAPI d3dx_effect_GetFloat ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
float f 
)
static

Definition at line 2788 of file effect.c.

2789{
2790 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2791 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2792
2793 TRACE("iface %p, parameter %p, f %p.\n", iface, parameter, f);
2794
2795 if (f && param && !param->element_count && param->columns == 1 && param->rows == 1)
2796 {
2797 set_number(f, D3DXPT_FLOAT, (DWORD *)param->data, param->type);
2798 TRACE("Returning %f.\n", *f);
2799 return D3D_OK;
2800 }
2801
2802 WARN("Parameter not found.\n");
2803
2804 return D3DERR_INVALIDCALL;
2805}
@ D3DXPT_FLOAT
Definition: d3dx9shader.h:76
GLfloat f
Definition: glext.h:7540

◆ d3dx_effect_GetFloatArray()

static HRESULT WINAPI d3dx_effect_GetFloatArray ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
float f,
UINT  count 
)
static

Definition at line 2847 of file effect.c.

2848{
2849 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2850 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2851
2852 TRACE("iface %p, parameter %p, f %p, count %u.\n", iface, parameter, f, count);
2853
2854 if (f && param && (param->class == D3DXPC_SCALAR
2855 || param->class == D3DXPC_VECTOR
2856 || param->class == D3DXPC_MATRIX_ROWS
2857 || param->class == D3DXPC_MATRIX_COLUMNS))
2858 {
2859 unsigned int i, size = min(count, param->bytes / sizeof(DWORD));
2860
2861 for (i = 0; i < size; ++i)
2862 set_number(&f[i], D3DXPT_FLOAT, (DWORD *)param->data + i, param->type);
2863 return D3D_OK;
2864 }
2865
2866 WARN("Parameter not found.\n");
2867
2868 return D3DERR_INVALIDCALL;
2869}

◆ d3dx_effect_GetFunction()

static D3DXHANDLE WINAPI d3dx_effect_GetFunction ( ID3DXEffect *  iface,
UINT  index 
)
static

Definition at line 2356 of file effect.c.

2357{
2358 FIXME("iface %p, index %u stub.\n", iface, index);
2359
2360 return NULL;
2361}

◆ d3dx_effect_GetFunctionByName()

static D3DXHANDLE WINAPI d3dx_effect_GetFunctionByName ( ID3DXEffect *  iface,
const char name 
)
static

Definition at line 2363 of file effect.c.

2364{
2365 FIXME("iface %p, name %s stub.\n", iface, debugstr_a(name));
2366
2367 return NULL;
2368}

◆ d3dx_effect_GetFunctionDesc()

static HRESULT WINAPI d3dx_effect_GetFunctionDesc ( ID3DXEffect *  iface,
D3DXHANDLE  shader,
D3DXFUNCTION_DESC desc 
)
static

Definition at line 2124 of file effect.c.

2126{
2127 FIXME("iface %p, shader %p, desc %p stub.\n", iface, shader, desc);
2128
2129 return E_NOTIMPL;
2130}
GLuint shader
Definition: glext.h:6030

◆ d3dx_effect_GetInt()

static HRESULT WINAPI d3dx_effect_GetInt ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
INT n 
)
static

Definition at line 2665 of file effect.c.

2666{
2667 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2668 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2669
2670 TRACE("iface %p, parameter %p, n %p.\n", iface, parameter, n);
2671
2672 if (n && param && !param->element_count)
2673 {
2674 if (param->columns == 1 && param->rows == 1)
2675 {
2676 set_number(n, D3DXPT_INT, param->data, param->type);
2677 TRACE("Returning %d.\n", *n);
2678 return D3D_OK;
2679 }
2680
2681 if (param->type == D3DXPT_FLOAT &&
2682 ((param->class == D3DXPC_VECTOR && param->columns != 2)
2683 || (param->class == D3DXPC_MATRIX_ROWS && param->rows != 2 && param->columns == 1)))
2684 {
2685 TRACE("Vector fixup.\n");
2686
2687 *n = min(max(0.0f, *((float *)param->data + 2)), 1.0f) * INT_FLOAT_MULTI;
2688 *n += ((int)(min(max(0.0f, *((float *)param->data + 1)), 1.0f) * INT_FLOAT_MULTI)) << 8;
2689 *n += ((int)(min(max(0.0f, *((float *)param->data + 0)), 1.0f) * INT_FLOAT_MULTI)) << 16;
2690 if (param->columns * param->rows > 3)
2691 *n += ((int)(min(max(0.0f, *((float *)param->data + 3)), 1.0f) * INT_FLOAT_MULTI)) << 24;
2692
2693 TRACE("Returning %d.\n", *n);
2694 return D3D_OK;
2695 }
2696 }
2697
2698 WARN("Parameter not found.\n");
2699
2700 return D3DERR_INVALIDCALL;
2701}
#define INT_FLOAT_MULTI
Definition: effect.c:34
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLdouble n
Definition: glext.h:7729
#define max(a, b)
Definition: svc.c:63

◆ d3dx_effect_GetIntArray()

static HRESULT WINAPI d3dx_effect_GetIntArray ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
INT n,
UINT  count 
)
static

Definition at line 2742 of file effect.c.

2743{
2744 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2745 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2746
2747 TRACE("iface %p, parameter %p, n %p, count %u.\n", iface, parameter, n, count);
2748
2749 if (n && param && (param->class == D3DXPC_SCALAR
2750 || param->class == D3DXPC_VECTOR
2751 || param->class == D3DXPC_MATRIX_ROWS
2752 || param->class == D3DXPC_MATRIX_COLUMNS))
2753 {
2754 unsigned int i, size = min(count, param->bytes / sizeof(DWORD));
2755
2756 for (i = 0; i < size; ++i)
2757 set_number(&n[i], D3DXPT_INT, (DWORD *)param->data + i, param->type);
2758 return D3D_OK;
2759 }
2760
2761 WARN("Parameter not found.\n");
2762
2763 return D3DERR_INVALIDCALL;
2764}

◆ d3dx_effect_GetMatrix()

static HRESULT WINAPI d3dx_effect_GetMatrix ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXMATRIX matrix 
)
static

Definition at line 3101 of file effect.c.

3102{
3103 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3104 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3105
3106 TRACE("iface %p, parameter %p, matrix %p.\n", iface, parameter, matrix);
3107
3108 if (matrix && param && !param->element_count)
3109 {
3110 TRACE("Class %s.\n", debug_d3dxparameter_class(param->class));
3111
3112 switch (param->class)
3113 {
3114 case D3DXPC_MATRIX_ROWS:
3116 return D3D_OK;
3117
3118 case D3DXPC_SCALAR:
3119 case D3DXPC_VECTOR:
3120 case D3DXPC_OBJECT:
3121 case D3DXPC_STRUCT:
3122 break;
3123
3124 default:
3125 FIXME("Unhandled class %s.\n", debug_d3dxparameter_class(param->class));
3126 break;
3127 }
3128 }
3129
3130 WARN("Parameter not found.\n");
3131
3132 return D3DERR_INVALIDCALL;
3133}
const char * debug_d3dxparameter_class(D3DXPARAMETER_CLASS c) DECLSPEC_HIDDEN
Definition: util.c:237
@ D3DXPC_STRUCT
Definition: d3dx9shader.h:67
@ D3DXPC_OBJECT
Definition: d3dx9shader.h:66
static void get_matrix(struct d3dx_parameter *param, D3DXMATRIX *matrix, BOOL transpose)
Definition: effect.c:818
GLuint GLenum matrix
Definition: glext.h:9407

◆ d3dx_effect_GetMatrixArray()

static HRESULT WINAPI d3dx_effect_GetMatrixArray ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXMATRIX matrix,
UINT  count 
)
static

Definition at line 3179 of file effect.c.

3181{
3182 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3183 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3184
3185 TRACE("iface %p, parameter %p, matrix %p, count %u.\n", iface, parameter, matrix, count);
3186
3187 if (!count)
3188 return D3D_OK;
3189
3190 if (matrix && param && count <= param->element_count)
3191 {
3192 unsigned int i;
3193
3194 TRACE("Class %s.\n", debug_d3dxparameter_class(param->class));
3195
3196 switch (param->class)
3197 {
3198 case D3DXPC_MATRIX_ROWS:
3199 for (i = 0; i < count; ++i)
3200 get_matrix(&param->members[i], &matrix[i], FALSE);
3201 return D3D_OK;
3202
3203 case D3DXPC_SCALAR:
3204 case D3DXPC_VECTOR:
3205 case D3DXPC_OBJECT:
3206 case D3DXPC_STRUCT:
3207 break;
3208
3209 default:
3210 FIXME("Unhandled class %s.\n", debug_d3dxparameter_class(param->class));
3211 break;
3212 }
3213 }
3214
3215 WARN("Parameter not found.\n");
3216
3217 return D3DERR_INVALIDCALL;
3218}

◆ d3dx_effect_GetMatrixPointerArray()

static HRESULT WINAPI d3dx_effect_GetMatrixPointerArray ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXMATRIX **  matrix,
UINT  count 
)
static

Definition at line 3261 of file effect.c.

3263{
3264 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3265 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3266
3267 TRACE("iface %p, parameter %p, matrix %p, count %u.\n", iface, parameter, matrix, count);
3268
3269 if (!count)
3270 return D3D_OK;
3271
3272 if (param && matrix && count <= param->element_count)
3273 {
3274 unsigned int i;
3275
3276 TRACE("Class %s.\n", debug_d3dxparameter_class(param->class));
3277
3278 switch (param->class)
3279 {
3280 case D3DXPC_MATRIX_ROWS:
3281 for (i = 0; i < count; ++i)
3282 get_matrix(&param->members[i], matrix[i], FALSE);
3283 return D3D_OK;
3284
3285 case D3DXPC_SCALAR:
3286 case D3DXPC_VECTOR:
3287 case D3DXPC_OBJECT:
3288 break;
3289
3290 default:
3291 FIXME("Unhandled class %s.\n", debug_d3dxparameter_class(param->class));
3292 break;
3293 }
3294 }
3295
3296 WARN("Parameter not found.\n");
3297
3298 return D3DERR_INVALIDCALL;
3299}

◆ d3dx_effect_GetMatrixTranspose()

static HRESULT WINAPI d3dx_effect_GetMatrixTranspose ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXMATRIX matrix 
)
static

Definition at line 3337 of file effect.c.

3339{
3340 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3341 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3342
3343 TRACE("iface %p, parameter %p, matrix %p.\n", iface, parameter, matrix);
3344
3345 if (matrix && param && !param->element_count)
3346 {
3347 TRACE("Class %s.\n", debug_d3dxparameter_class(param->class));
3348
3349 switch (param->class)
3350 {
3351 case D3DXPC_SCALAR:
3352 case D3DXPC_VECTOR:
3354 return D3D_OK;
3355
3356 case D3DXPC_MATRIX_ROWS:
3358 return D3D_OK;
3359
3360 case D3DXPC_OBJECT:
3361 case D3DXPC_STRUCT:
3362 break;
3363
3364 default:
3365 FIXME("Unhandled class %s.\n", debug_d3dxparameter_class(param->class));
3366 break;
3367 }
3368 }
3369
3370 WARN("Parameter not found.\n");
3371
3372 return D3DERR_INVALIDCALL;
3373}

◆ d3dx_effect_GetMatrixTransposeArray()

static HRESULT WINAPI d3dx_effect_GetMatrixTransposeArray ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXMATRIX matrix,
UINT  count 
)
static

Definition at line 3419 of file effect.c.

3421{
3422 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3423 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3424
3425 TRACE("iface %p, parameter %p, matrix %p, count %u.\n", iface, parameter, matrix, count);
3426
3427 if (!count)
3428 return D3D_OK;
3429
3430 if (matrix && param && count <= param->element_count)
3431 {
3432 unsigned int i;
3433
3434 TRACE("Class %s.\n", debug_d3dxparameter_class(param->class));
3435
3436 switch (param->class)
3437 {
3438 case D3DXPC_MATRIX_ROWS:
3439 for (i = 0; i < count; ++i)
3440 get_matrix(&param->members[i], &matrix[i], TRUE);
3441 return D3D_OK;
3442
3443 case D3DXPC_SCALAR:
3444 case D3DXPC_VECTOR:
3445 case D3DXPC_OBJECT:
3446 case D3DXPC_STRUCT:
3447 break;
3448
3449 default:
3450 FIXME("Unhandled class %s.\n", debug_d3dxparameter_class(param->class));
3451 break;
3452 }
3453 }
3454
3455 WARN("Parameter not found.\n");
3456
3457 return D3DERR_INVALIDCALL;
3458}

◆ d3dx_effect_GetMatrixTransposePointerArray()

static HRESULT WINAPI d3dx_effect_GetMatrixTransposePointerArray ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXMATRIX **  matrix,
UINT  count 
)
static

Definition at line 3501 of file effect.c.

3503{
3504 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3505 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3506
3507 TRACE("iface %p, parameter %p, matrix %p, count %u.\n", iface, parameter, matrix, count);
3508
3509 if (!count)
3510 return D3D_OK;
3511
3512 if (matrix && param && count <= param->element_count)
3513 {
3514 unsigned int i;
3515
3516 TRACE("Class %s.\n", debug_d3dxparameter_class(param->class));
3517
3518 switch (param->class)
3519 {
3520 case D3DXPC_MATRIX_ROWS:
3521 for (i = 0; i < count; ++i)
3522 get_matrix(&param->members[i], matrix[i], TRUE);
3523 return D3D_OK;
3524
3525 case D3DXPC_SCALAR:
3526 case D3DXPC_VECTOR:
3527 case D3DXPC_OBJECT:
3528 break;
3529
3530 default:
3531 FIXME("Unhandled class %s.\n", debug_d3dxparameter_class(param->class));
3532 break;
3533 }
3534 }
3535
3536 WARN("Parameter not found.\n");
3537
3538 return D3DERR_INVALIDCALL;
3539}

◆ d3dx_effect_GetParameter()

static D3DXHANDLE WINAPI d3dx_effect_GetParameter ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
UINT  index 
)
static

Definition at line 2132 of file effect.c.

2133{
2134 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2135 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2136
2137 TRACE("iface %p, parameter %p, index %u.\n", iface, parameter, index);
2138
2139 if (!parameter)
2140 {
2141 if (index < effect->parameter_count)
2142 {
2143 TRACE("Returning parameter %p.\n", &effect->parameters[index]);
2144 return get_parameter_handle(&effect->parameters[index].param);
2145 }
2146 }
2147 else
2148 {
2149 if (param && !param->element_count && index < param->member_count)
2150 {
2151 TRACE("Returning parameter %p.\n", &param->members[index]);
2152 return get_parameter_handle(&param->members[index]);
2153 }
2154 }
2155
2156 WARN("Parameter not found.\n");
2157
2158 return NULL;
2159}
struct d3dx_top_level_parameter * parameters
Definition: effect.c:181

◆ d3dx_effect_GetParameterByName()

static D3DXHANDLE WINAPI d3dx_effect_GetParameterByName ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
const char name 
)
static

Definition at line 2161 of file effect.c.

2163{
2164 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2165 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2167
2168 TRACE("iface %p, parameter %p, name %s.\n", iface, parameter, debugstr_a(name));
2169
2170 if (!name)
2171 {
2173 TRACE("Returning parameter %p.\n", handle);
2174 return handle;
2175 }
2176
2178 TRACE("Returning parameter %p.\n", handle);
2179
2180 return handle;
2181}

◆ d3dx_effect_GetParameterBySemantic()

static D3DXHANDLE WINAPI d3dx_effect_GetParameterBySemantic ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
const char semantic 
)
static

Definition at line 2183 of file effect.c.

2185{
2186 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2187 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2188 struct d3dx_parameter *temp_param;
2189 unsigned int i;
2190
2191 TRACE("iface %p, parameter %p, semantic %s.\n", iface, parameter, debugstr_a(semantic));
2192
2193 if (!parameter)
2194 {
2195 for (i = 0; i < effect->parameter_count; ++i)
2196 {
2197 temp_param = &effect->parameters[i].param;
2198
2199 if (!temp_param->semantic)
2200 {
2201 if (!semantic)
2202 {
2203 TRACE("Returning parameter %p\n", temp_param);
2204 return get_parameter_handle(temp_param);
2205 }
2206 continue;
2207 }
2208
2209 if (!stricmp(temp_param->semantic, semantic))
2210 {
2211 TRACE("Returning parameter %p\n", temp_param);
2212 return get_parameter_handle(temp_param);
2213 }
2214 }
2215 }
2216 else if (param)
2217 {
2218 for (i = 0; i < param->member_count; ++i)
2219 {
2220 temp_param = &param->members[i];
2221
2222 if (!temp_param->semantic)
2223 {
2224 if (!semantic)
2225 {
2226 TRACE("Returning parameter %p\n", temp_param);
2227 return get_parameter_handle(temp_param);
2228 }
2229 continue;
2230 }
2231
2232 if (!stricmp(temp_param->semantic, semantic))
2233 {
2234 TRACE("Returning parameter %p\n", temp_param);
2235 return get_parameter_handle(temp_param);
2236 }
2237 }
2238 }
2239
2240 WARN("Parameter not found.\n");
2241
2242 return NULL;
2243}
#define stricmp(_String1, _String2)
Definition: compat.h:24

◆ d3dx_effect_GetParameterDesc()

static HRESULT WINAPI d3dx_effect_GetParameterDesc ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXPARAMETER_DESC desc 
)
static

Definition at line 2022 of file effect.c.

2024{
2025 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2026 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2027
2028 TRACE("iface %p, parameter %p, desc %p.\n", iface, parameter, desc);
2029
2030 if (!desc || !param)
2031 {
2032 WARN("Invalid argument specified.\n");
2033 return D3DERR_INVALIDCALL;
2034 }
2035
2036 desc->Name = param->name;
2037 desc->Semantic = param->semantic;
2038 desc->Class = param->class;
2039 desc->Type = param->type;
2040 desc->Rows = param->rows;
2041 desc->Columns = param->columns;
2042 desc->Elements = param->element_count;
2043 desc->Annotations = is_top_level_parameter(param)
2044 ? top_level_parameter_from_parameter(param)->annotation_count : 0;
2045 desc->StructMembers = param->member_count;
2046 desc->Flags = param->flags;
2047 desc->Bytes = param->bytes;
2048
2049 return D3D_OK;
2050}
static struct d3dx_top_level_parameter * top_level_parameter_from_parameter(struct d3dx_parameter *param)

◆ d3dx_effect_GetParameterElement()

static D3DXHANDLE WINAPI d3dx_effect_GetParameterElement ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
UINT  index 
)
static

Definition at line 2245 of file effect.c.

2246{
2247 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2248 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2249
2250 TRACE("iface %p, parameter %p, index %u.\n", iface, parameter, index);
2251
2252 if (!param)
2253 {
2254 if (index < effect->parameter_count)
2255 {
2256 TRACE("Returning parameter %p.\n", &effect->parameters[index]);
2257 return get_parameter_handle(&effect->parameters[index].param);
2258 }
2259 }
2260 else
2261 {
2262 if (index < param->element_count)
2263 {
2264 TRACE("Returning parameter %p.\n", &param->members[index]);
2265 return get_parameter_handle(&param->members[index]);
2266 }
2267 }
2268
2269 WARN("Parameter not found.\n");
2270
2271 return NULL;
2272}

◆ d3dx_effect_GetPass()

static D3DXHANDLE WINAPI d3dx_effect_GetPass ( ID3DXEffect *  iface,
D3DXHANDLE  technique,
UINT  index 
)
static

Definition at line 2310 of file effect.c.

2311{
2312 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2313 struct d3dx_technique *tech = get_valid_technique(effect, technique);
2314
2315 TRACE("iface %p, technique %p, index %u.\n", iface, technique, index);
2316
2317 if (tech && index < tech->pass_count)
2318 {
2319 TRACE("Returning pass %p\n", &tech->passes[index]);
2320 return get_pass_handle(&tech->passes[index]);
2321 }
2322
2323 WARN("Pass not found.\n");
2324
2325 return NULL;
2326}
static D3DXHANDLE get_pass_handle(struct d3dx_pass *pass)
Definition: effect.c:465

◆ d3dx_effect_GetPassByName()

static D3DXHANDLE WINAPI d3dx_effect_GetPassByName ( ID3DXEffect *  iface,
D3DXHANDLE  technique,
const char name 
)
static

Definition at line 2328 of file effect.c.

2329{
2330 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2331 struct d3dx_technique *tech = get_valid_technique(effect, technique);
2332
2333 TRACE("iface %p, technique %p, name %s.\n", iface, technique, debugstr_a(name));
2334
2335 if (tech && name)
2336 {
2337 unsigned int i;
2338
2339 for (i = 0; i < tech->pass_count; ++i)
2340 {
2341 struct d3dx_pass *pass = &tech->passes[i];
2342
2343 if (!strcmp(pass->name, name))
2344 {
2345 TRACE("Returning pass %p\n", pass);
2346 return get_pass_handle(pass);
2347 }
2348 }
2349 }
2350
2351 WARN("Pass not found.\n");
2352
2353 return NULL;
2354}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ d3dx_effect_GetPassDesc()

static HRESULT WINAPI d3dx_effect_GetPassDesc ( ID3DXEffect *  iface,
D3DXHANDLE  pass_handle,
D3DXPASS_DESC desc 
)
static

Definition at line 2073 of file effect.c.

2074{
2075 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2076 struct d3dx_pass *pass = get_valid_pass(effect, pass_handle);
2077 unsigned int i;
2078
2079 TRACE("iface %p, pass %p, desc %p.\n", iface, pass, desc);
2080
2081 if (!desc || !pass)
2082 {
2083 WARN("Invalid argument specified.\n");
2084 return D3DERR_INVALIDCALL;
2085 }
2086
2087 desc->Name = pass->name;
2088 desc->Annotations = pass->annotation_count;
2089
2090 desc->pVertexShaderFunction = NULL;
2091 desc->pPixelShaderFunction = NULL;
2092
2093 if (effect->flags & D3DXFX_NOT_CLONEABLE)
2094 return D3D_OK;
2095
2096 for (i = 0; i < pass->state_count; ++i)
2097 {
2098 struct d3dx_state *state = &pass->states[i];
2099
2100 if (state_table[state->operation].class == SC_VERTEXSHADER
2101 || state_table[state->operation].class == SC_PIXELSHADER)
2102 {
2103 struct d3dx_parameter *param;
2104 void *param_value;
2105 BOOL param_dirty;
2106 HRESULT hr;
2107 void *data;
2108
2109 if (FAILED(hr = d3dx9_get_param_value_ptr(pass, &pass->states[i], &param_value, &param,
2110 FALSE, &param_dirty)))
2111 return hr;
2112
2113 data = param->object_id ? effect->objects[param->object_id].data : NULL;
2114 if (state_table[state->operation].class == SC_VERTEXSHADER)
2115 desc->pVertexShaderFunction = data;
2116 else
2117 desc->pPixelShaderFunction = data;
2118 }
2119 }
2120
2121 return D3D_OK;
2122}
static struct d3dx_pass * get_valid_pass(struct d3dx_effect *effect, D3DXHANDLE pass)
Definition: effect.c:498

◆ d3dx_effect_GetPixelShader()

static HRESULT WINAPI d3dx_effect_GetPixelShader ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
IDirect3DPixelShader9 **  shader 
)
static

Definition at line 3635 of file effect.c.

3637{
3638 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3639 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3640
3641 TRACE("iface %p, parameter %p, shader %p.\n", iface, parameter, shader);
3642
3643 if (shader && param && !param->element_count && param->type == D3DXPT_PIXELSHADER)
3644 {
3645 if ((*shader = *(IDirect3DPixelShader9 **)param->data))
3647 TRACE("Returning %p.\n", *shader);
3648 return D3D_OK;
3649 }
3650
3651 WARN("Parameter not found.\n");
3652
3653 return D3DERR_INVALIDCALL;
3654}
#define IDirect3DPixelShader9_AddRef(p)
Definition: d3d9.h:1260

◆ d3dx_effect_GetPool()

static HRESULT WINAPI d3dx_effect_GetPool ( ID3DXEffect *  iface,
ID3DXEffectPool **  pool 
)
static

Definition at line 3685 of file effect.c.

3686{
3687 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3688
3689 TRACE("iface %p, pool %p.\n", effect, pool);
3690
3691 if (!pool)
3692 {
3693 WARN("Invalid argument supplied.\n");
3694 return D3DERR_INVALIDCALL;
3695 }
3696
3697 *pool = NULL;
3698 if (effect->pool)
3699 {
3700 *pool = &effect->pool->ID3DXEffectPool_iface;
3701 (*pool)->lpVtbl->AddRef(*pool);
3702 }
3703
3704 TRACE("Returning pool %p.\n", *pool);
3705
3706 return S_OK;
3707}
ULONG AddRef()

◆ d3dx_effect_GetStateManager()

static HRESULT WINAPI d3dx_effect_GetStateManager ( ID3DXEffect *  iface,
ID3DXEffectStateManager **  manager 
)
static

Definition at line 4192 of file effect.c.

4193{
4194 struct d3dx_effect *This = impl_from_ID3DXEffect(iface);
4195
4196 TRACE("iface %p, manager %p\n", This, manager);
4197
4198 if (!manager)
4199 {
4200 WARN("Invalid argument supplied.\n");
4201 return D3DERR_INVALIDCALL;
4202 }
4203
4204 if (This->manager) IUnknown_AddRef(This->manager);
4205 *manager = This->manager;
4206
4207 return D3D_OK;
4208}

◆ d3dx_effect_GetString()

static HRESULT WINAPI d3dx_effect_GetString ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
const char **  string 
)
static

Definition at line 3556 of file effect.c.

3557{
3558 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3559 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3560
3561 TRACE("iface %p, parameter %p, string %p.\n", iface, parameter, string);
3562
3563 if (string && param && !param->element_count && param->type == D3DXPT_STRING)
3564 {
3565 *string = *(const char **)param->data;
3566 TRACE("Returning %s.\n", debugstr_a(*string));
3567 return D3D_OK;
3568 }
3569
3570 WARN("Parameter not found.\n");
3571
3572 return D3DERR_INVALIDCALL;
3573}

◆ d3dx_effect_GetTechnique()

static D3DXHANDLE WINAPI d3dx_effect_GetTechnique ( ID3DXEffect *  iface,
UINT  index 
)
static

Definition at line 2274 of file effect.c.

2275{
2276 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2277
2278 TRACE("iface %p, index %u.\n", iface, index);
2279
2280 if (index >= effect->technique_count)
2281 {
2282 WARN("Invalid argument specified.\n");
2283 return NULL;
2284 }
2285
2286 TRACE("Returning technique %p.\n", &effect->techniques[index]);
2287
2288 return get_technique_handle(&effect->techniques[index]);
2289}

◆ d3dx_effect_GetTechniqueByName()

static D3DXHANDLE WINAPI d3dx_effect_GetTechniqueByName ( ID3DXEffect *  iface,
const char name 
)
static

Definition at line 2291 of file effect.c.

2292{
2293 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2294 struct d3dx_technique *tech = get_technique_by_name(effect, name);
2295
2296 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
2297
2298 if (tech)
2299 {
2301 TRACE("Returning technique %p\n", t);
2302 return t;
2303 }
2304
2305 WARN("Technique not found.\n");
2306
2307 return NULL;
2308}
static struct d3dx_technique * get_technique_by_name(struct d3dx_effect *effect, const char *name)
Definition: effect.c:470
GLdouble GLdouble t
Definition: gl.h:2047

◆ d3dx_effect_GetTechniqueDesc()

static HRESULT WINAPI d3dx_effect_GetTechniqueDesc ( ID3DXEffect *  iface,
D3DXHANDLE  technique,
D3DXTECHNIQUE_DESC desc 
)
static

Definition at line 2052 of file effect.c.

2054{
2055 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2056 struct d3dx_technique *tech = technique ? get_valid_technique(effect, technique) : &effect->techniques[0];
2057
2058 TRACE("iface %p, technique %p, desc %p.\n", iface, technique, desc);
2059
2060 if (!desc || !tech)
2061 {
2062 WARN("Invalid argument specified.\n");
2063 return D3DERR_INVALIDCALL;
2064 }
2065
2066 desc->Name = tech->name;
2067 desc->Passes = tech->pass_count;
2068 desc->Annotations = tech->annotation_count;
2069
2070 return D3D_OK;
2071}
char * name
Definition: effect.c:147
UINT annotation_count
Definition: effect.c:149

◆ d3dx_effect_GetTexture()

static HRESULT WINAPI d3dx_effect_GetTexture ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
IDirect3DBaseTexture9 **  texture 
)
static

Definition at line 3610 of file effect.c.

3612{
3613 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3614 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3615
3616 TRACE("iface %p, parameter %p, texture %p.\n", iface, parameter, texture);
3617
3618 if (texture && param && !param->element_count
3619 && (param->type == D3DXPT_TEXTURE || param->type == D3DXPT_TEXTURE1D
3620 || param->type == D3DXPT_TEXTURE2D || param->type == D3DXPT_TEXTURE3D
3621 || param->type == D3DXPT_TEXTURECUBE))
3622 {
3623 *texture = *(IDirect3DBaseTexture9 **)param->data;
3624 if (*texture)
3626 TRACE("Returning %p.\n", *texture);
3627 return D3D_OK;
3628 }
3629
3630 WARN("Parameter not found.\n");
3631
3632 return D3DERR_INVALIDCALL;
3633}
#define IDirect3DBaseTexture9_AddRef(p)
Definition: d3d9.h:834
@ D3DXPT_TEXTURE
Definition: d3dx9shader.h:78
@ D3DXPT_TEXTURE1D
Definition: d3dx9shader.h:79
@ D3DXPT_TEXTURECUBE
Definition: d3dx9shader.h:82
@ D3DXPT_TEXTURE3D
Definition: d3dx9shader.h:81
@ D3DXPT_TEXTURE2D
Definition: d3dx9shader.h:80
GLenum GLuint texture
Definition: glext.h:6295
if(dx< 0)
Definition: linetemp.h:194

◆ d3dx_effect_GetValue()

static HRESULT WINAPI d3dx_effect_GetValue ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
void data,
UINT  bytes 
)
static

Definition at line 2448 of file effect.c.

2449{
2450 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2451 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2452
2453 TRACE("iface %p, parameter %p, data %p, bytes %u.\n", iface, parameter, data, bytes);
2454
2455 if (!param)
2456 {
2457 WARN("Invalid parameter %p specified.\n", parameter);
2458 return D3DERR_INVALIDCALL;
2459 }
2460 if (param->class == D3DXPC_OBJECT && is_param_type_sampler(param->type))
2461 {
2462 WARN("Parameter is a sampler, returning E_FAIL.\n");
2463 return E_FAIL;
2464 }
2465
2466 if (data && param->bytes <= bytes)
2467 {
2468 TRACE("Type %s.\n", debug_d3dxparameter_type(param->type));
2469
2470 switch (param->type)
2471 {
2472 case D3DXPT_VOID:
2473 case D3DXPT_BOOL:
2474 case D3DXPT_INT:
2475 case D3DXPT_FLOAT:
2476 case D3DXPT_STRING:
2477 break;
2478
2480 case D3DXPT_PIXELSHADER:
2481 case D3DXPT_TEXTURE:
2482 case D3DXPT_TEXTURE1D:
2483 case D3DXPT_TEXTURE2D:
2484 case D3DXPT_TEXTURE3D:
2485 case D3DXPT_TEXTURECUBE:
2486 {
2487 unsigned int i;
2488
2489 for (i = 0; i < (param->element_count ? param->element_count : 1); ++i)
2490 {
2491 IUnknown *unk = ((IUnknown **)param->data)[i];
2492 if (unk)
2493 IUnknown_AddRef(unk);
2494 }
2495 break;
2496 }
2497
2498 default:
2499 FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(param->type));
2500 break;
2501 }
2502
2503 TRACE("Copy %u bytes.\n", param->bytes);
2504 memcpy(data, param->data, param->bytes);
2505 return D3D_OK;
2506 }
2507
2508 WARN("Parameter not found.\n");
2509
2510 return D3DERR_INVALIDCALL;
2511}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
static BOOL is_param_type_sampler(D3DXPARAMETER_TYPE type)
const char * debug_d3dxparameter_type(D3DXPARAMETER_TYPE t) DECLSPEC_HIDDEN
Definition: util.c:253
@ D3DXPT_VOID
Definition: d3dx9shader.h:73

◆ d3dx_effect_GetVector()

static HRESULT WINAPI d3dx_effect_GetVector ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXVECTOR4 vector 
)
static

Definition at line 2925 of file effect.c.

2926{
2927 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
2928 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
2929
2930 TRACE("iface %p, parameter %p, vector %p.\n", iface, parameter, vector);
2931
2932 if (vector && param && !param->element_count)
2933 {
2934 TRACE("Class %s.\n", debug_d3dxparameter_class(param->class));
2935
2936 switch (param->class)
2937 {
2938 case D3DXPC_SCALAR:
2939 case D3DXPC_VECTOR:
2940 if (param->type == D3DXPT_INT && param->bytes == 4)
2941 {
2942 TRACE("INT fixup.\n");
2943 vector->x = (((*(int *)param->data) & 0xff0000) >> 16) * INT_FLOAT_MULTI_INVERSE;
2944 vector->y = (((*(int *)param->data) & 0xff00) >> 8) * INT_FLOAT_MULTI_INVERSE;
2945 vector->z = ((*(int *)param->data) & 0xff) * INT_FLOAT_MULTI_INVERSE;
2946 vector->w = (((*(int *)param->data) & 0xff000000) >> 24) * INT_FLOAT_MULTI_INVERSE;
2947 return D3D_OK;
2948 }
2950 return D3D_OK;
2951
2952 case D3DXPC_MATRIX_ROWS:
2953 case D3DXPC_OBJECT:
2954 case D3DXPC_STRUCT:
2955 break;
2956
2957 default:
2958 FIXME("Unhandled class %s.\n", debug_d3dxparameter_class(param->class));
2959 break;
2960 }
2961 }
2962
2963 WARN("Parameter not found.\n");
2964
2965 return D3DERR_INVALIDCALL;
2966}
#define INT_FLOAT_MULTI_INVERSE
Definition: effect.c:35
static void get_vector(struct d3dx_parameter *param, D3DXVECTOR4 *vector)
Definition: effect.c:797

◆ d3dx_effect_GetVectorArray()

static HRESULT WINAPI d3dx_effect_GetVectorArray ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXVECTOR4 vector,
UINT  count 
)
static

Definition at line 3025 of file effect.c.

3027{
3028 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3029 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3030
3031 TRACE("iface %p, parameter %p, vector %p, count %u.\n", iface, parameter, vector, count);
3032
3033 if (!count)
3034 return D3D_OK;
3035
3036 if (vector && param && count <= param->element_count)
3037 {
3038 unsigned int i;
3039
3040 TRACE("Class %s.\n", debug_d3dxparameter_class(param->class));
3041
3042 switch (param->class)
3043 {
3044 case D3DXPC_VECTOR:
3045 for (i = 0; i < count; ++i)
3046 get_vector(&param->members[i], &vector[i]);
3047 return D3D_OK;
3048
3049 case D3DXPC_SCALAR:
3050 case D3DXPC_MATRIX_ROWS:
3051 case D3DXPC_OBJECT:
3052 case D3DXPC_STRUCT:
3053 break;
3054
3055 default:
3056 FIXME("Unhandled class %s.\n", debug_d3dxparameter_class(param->class));
3057 break;
3058 }
3059 }
3060
3061 WARN("Parameter not found.\n");
3062
3063 return D3DERR_INVALIDCALL;
3064}

◆ d3dx_effect_GetVertexShader()

static HRESULT WINAPI d3dx_effect_GetVertexShader ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
IDirect3DVertexShader9 **  shader 
)
static

Definition at line 3656 of file effect.c.

3658{
3659 struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
3660 struct d3dx_parameter *param = get_valid_parameter(effect, parameter);
3661
3662 TRACE("iface %p, parameter %p, shader %p.\n", iface, parameter, shader);
3663
3664 if (shader && param && !param->element_count && param->type == D3DXPT_VERTEXSHADER)
3665 {
3666 if ((*shader = *(IDirect3DVertexShader9 **)param->data))
3668 TRACE("Returning %p.\n", *shader);
3669 return D3D_OK;
3670 }
3671
3672 WARN("Parameter not found.\n");
3673
3674 return D3DERR_INVALIDCALL;
3675}
#define IDirect3DVertexShader9_AddRef(p)
Definition: d3d9.h:1222

◆ d3dx_effect_IsParameterUsed()

static BOOL WINAPI d3dx_effect_IsParameterUsed ( ID3DXEffect *  iface,
D3DXHANDLE  parameter,
D3DXHANDLE  technique