ReactOS  0.4.15-dev-2359-g0dedb9b
shader.c File Reference
#include <stdio.h>
#include "d3dx9_private.h"
#include "d3dcommon.h"
#include "d3dcompiler.h"
Include dependency graph for shader.c:

Go to the source code of this file.

Classes

struct  ID3DXConstantTableImpl
 
struct  d3dx9_fragment_linker
 
struct  instr_info
 
struct  d3dx9_texture_shader
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dx)
 
HRESULT WINAPI D3DAssemble (const void *data, SIZE_T datasize, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, UINT flags, ID3DBlob **shader, ID3DBlob **error_messages)
 
static BOOL is_valid_bytecode (DWORD token)
 
const char *WINAPI D3DXGetPixelShaderProfile (struct IDirect3DDevice9 *device)
 
UINT WINAPI D3DXGetShaderSize (const DWORD *byte_code)
 
DWORD WINAPI D3DXGetShaderVersion (const DWORD *byte_code)
 
const char *WINAPI D3DXGetVertexShaderProfile (struct IDirect3DDevice9 *device)
 
HRESULT WINAPI D3DXFindShaderComment (const DWORD *byte_code, DWORD fourcc, const void **data, UINT *size)
 
HRESULT WINAPI D3DXAssembleShader (const char *data, UINT data_len, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
static HRESULT WINAPI d3dx_include_from_file_open (ID3DXInclude *iface, D3DXINCLUDE_TYPE include_type, const char *filename, const void *parent_data, const void **data, UINT *bytes)
 
static HRESULT WINAPI d3dx_include_from_file_close (ID3DXInclude *iface, const void *data)
 
HRESULT WINAPI D3DXAssembleShaderFromFileA (const char *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
HRESULT WINAPI D3DXAssembleShaderFromFileW (const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
HRESULT WINAPI D3DXAssembleShaderFromResourceA (HMODULE module, const char *resource, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
HRESULT WINAPI D3DXAssembleShaderFromResourceW (HMODULE module, const WCHAR *resource, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
HRESULT WINAPI D3DXCompileShader (const char *data, UINT length, const D3DXMACRO *defines, ID3DXInclude *include, const char *function, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_msgs, ID3DXConstantTable **constant_table)
 
HRESULT WINAPI D3DXCompileShaderFromFileA (const char *filename, const D3DXMACRO *defines, ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table)
 
HRESULT WINAPI D3DXCompileShaderFromFileW (const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table)
 
HRESULT WINAPI D3DXCompileShaderFromResourceA (HMODULE module, const char *resource, const D3DXMACRO *defines, ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table)
 
HRESULT WINAPI D3DXCompileShaderFromResourceW (HMODULE module, const WCHAR *resource, const D3DXMACRO *defines, ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table)
 
HRESULT WINAPI D3DXPreprocessShader (const char *data, UINT data_len, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
HRESULT WINAPI D3DXPreprocessShaderFromFileA (const char *filename, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
HRESULT WINAPI D3DXPreprocessShaderFromFileW (const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
HRESULT WINAPI D3DXPreprocessShaderFromResourceA (HMODULE module, const char *resource, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
HRESULT WINAPI D3DXPreprocessShaderFromResourceW (HMODULE module, const WCHAR *resource, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
 
static void free_constant (struct ctab_constant *constant)
 
static void free_constant_table (struct ID3DXConstantTableImpl *table)
 
static struct ID3DXConstantTableImplimpl_from_ID3DXConstantTable (ID3DXConstantTable *iface)
 
static BOOL is_vertex_shader (DWORD version)
 
static D3DXHANDLE handle_from_constant (struct ctab_constant *constant)
 
static struct ctab_constantget_constant_by_name (struct ID3DXConstantTableImpl *table, struct ctab_constant *constant, const char *name)
 
static struct ctab_constantget_constant_element_by_name (struct ctab_constant *constant, const char *name)
 
static struct ctab_constantis_valid_sub_constant (struct ctab_constant *parent, D3DXHANDLE handle)
 
static struct ctab_constantget_valid_constant (struct ID3DXConstantTableImpl *table, D3DXHANDLE handle)
 
static HRESULT WINAPI ID3DXConstantTableImpl_QueryInterface (ID3DXConstantTable *iface, REFIID riid, void **out)
 
static ULONG WINAPI ID3DXConstantTableImpl_AddRef (ID3DXConstantTable *iface)
 
static ULONG WINAPI ID3DXConstantTableImpl_Release (ID3DXConstantTable *iface)
 
static void *WINAPI ID3DXConstantTableImpl_GetBufferPointer (ID3DXConstantTable *iface)
 
static DWORD WINAPI ID3DXConstantTableImpl_GetBufferSize (ID3DXConstantTable *iface)
 
static HRESULT WINAPI ID3DXConstantTableImpl_GetDesc (ID3DXConstantTable *iface, D3DXCONSTANTTABLE_DESC *desc)
 
const struct ctab_constantd3dx_shader_get_ctab_constant (ID3DXConstantTable *iface, D3DXHANDLE constant)
 
static HRESULT WINAPI ID3DXConstantTableImpl_GetConstantDesc (ID3DXConstantTable *iface, D3DXHANDLE constant, D3DXCONSTANT_DESC *desc, UINT *count)
 
static UINT WINAPI ID3DXConstantTableImpl_GetSamplerIndex (ID3DXConstantTable *iface, D3DXHANDLE constant)
 
static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstant (ID3DXConstantTable *iface, D3DXHANDLE constant, UINT index)
 
static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantByName (ID3DXConstantTable *iface, D3DXHANDLE constant, const char *name)
 
static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantElement (ID3DXConstantTable *iface, D3DXHANDLE constant, UINT index)
 
static DWORD get_index (const void **indata, UINT index, BOOL is_pointer)
 
static UINT set (struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
 
static HRESULT set_scalar (struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, D3DXHANDLE constant, const void *indata, D3DXPARAMETER_TYPE intype)
 
static HRESULT set_scalar_array (struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, D3DXHANDLE constant, const void *indata, UINT count, D3DXPARAMETER_TYPE intype)
 
static HRESULT set_vector (struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, D3DXHANDLE constant, const void *indata, D3DXPARAMETER_TYPE intype)
 
static HRESULT set_vector_array (struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, D3DXHANDLE constant, const void *indata, UINT count, D3DXPARAMETER_TYPE intype)
 
static HRESULT set_matrix_array (struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, D3DXHANDLE constant, const void *indata, UINT count, BOOL transpose)
 
static HRESULT set_matrix_pointer_array (struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, D3DXHANDLE constant, const void **indata, UINT count, BOOL transpose)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetDefaults (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetValue (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const void *data, unsigned int bytes)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetBool (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, BOOL b)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetBoolArray (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const BOOL *b, UINT count)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetInt (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, INT n)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetIntArray (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const INT *n, UINT count)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetFloat (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, float f)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetFloatArray (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const float *f, UINT count)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetVector (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXVECTOR4 *vector)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetVectorArray (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXVECTOR4 *vector, UINT count)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrix (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXMATRIX *matrix)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixArray (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixPointerArray (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTranspose (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXMATRIX *matrix)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTransposeArray (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTransposePointerArray (struct ID3DXConstantTable *iface, struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXMATRIX **matrix, UINT count)
 
static HRESULT parse_ctab_constant_type (const char *ctab, DWORD typeoffset, struct ctab_constant *constant, BOOL is_element, WORD index, WORD max_index, DWORD *offset, DWORD nameoffset, UINT regset)
 
HRESULT WINAPI D3DXGetShaderConstantTableEx (const DWORD *byte_code, DWORD flags, ID3DXConstantTable **constant_table)
 
HRESULT WINAPI D3DXGetShaderConstantTable (const DWORD *byte_code, ID3DXConstantTable **constant_table)
 
static struct d3dx9_fragment_linkerimpl_from_ID3DXFragmentLinker (ID3DXFragmentLinker *iface)
 
static HRESULT WINAPI d3dx9_fragment_linker_QueryInterface (ID3DXFragmentLinker *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3dx9_fragment_linker_AddRef (ID3DXFragmentLinker *iface)
 
static ULONG WINAPI d3dx9_fragment_linker_Release (ID3DXFragmentLinker *iface)
 
static HRESULT WINAPI d3dx9_fragment_linker_GetDevice (ID3DXFragmentLinker *iface, struct IDirect3DDevice9 **device)
 
static UINT WINAPI d3dx9_fragment_linker_GetNumberOfFragments (ID3DXFragmentLinker *iface)
 
static D3DXHANDLE WINAPI d3dx9_fragment_linker_GetFragmentHandleByIndex (ID3DXFragmentLinker *iface, UINT index)
 
static D3DXHANDLE WINAPI d3dx9_fragment_linker_GetFragmentHandleByName (ID3DXFragmentLinker *iface, const char *name)
 
static HRESULT WINAPI d3dx9_fragment_linker_GetFragmentDesc (ID3DXFragmentLinker *iface, D3DXHANDLE name, D3DXFRAGMENT_DESC *desc)
 
static HRESULT WINAPI d3dx9_fragment_linker_AddFragments (ID3DXFragmentLinker *iface, const DWORD *fragments)
 
static HRESULT WINAPI d3dx9_fragment_linker_GetAllFragments (ID3DXFragmentLinker *iface, ID3DXBuffer **buffer)
 
static HRESULT WINAPI d3dx9_fragment_linker_GetFragment (ID3DXFragmentLinker *iface, D3DXHANDLE name, ID3DXBuffer **buffer)
 
static HRESULT WINAPI d3dx9_fragment_linker_LinkShader (ID3DXFragmentLinker *iface, const char *profile, DWORD flags, const D3DXHANDLE *handles, UINT fragment_count, ID3DXBuffer **buffer, ID3DXBuffer **errors)
 
static HRESULT WINAPI d3dx9_fragment_linker_LinkVertexShader (ID3DXFragmentLinker *iface, const char *profile, DWORD flags, const D3DXHANDLE *handles, UINT fragment_count, IDirect3DVertexShader9 **shader, ID3DXBuffer **errors)
 
static HRESULT WINAPI d3dx9_fragment_linker_LinkPixelShader (ID3DXFragmentLinker *iface, const char *profile, DWORD flags, const D3DXHANDLE *handles, UINT fragment_count, IDirect3DPixelShader9 **shader, ID3DXBuffer **errors)
 
static HRESULT WINAPI d3dx9_fragment_linker_ClearCache (ID3DXFragmentLinker *iface)
 
HRESULT WINAPI D3DXCreateFragmentLinkerEx (IDirect3DDevice9 *device, UINT size, DWORD flags, ID3DXFragmentLinker **linker)
 
HRESULT WINAPI D3DXCreateFragmentLinker (IDirect3DDevice9 *device, UINT size, ID3DXFragmentLinker **linker)
 
HRESULT WINAPI D3DXGetShaderSamplers (const DWORD *byte_code, const char **samplers, UINT *count)
 
static int add_modifier (char *buffer, DWORD param)
 
static int add_register (char *buffer, DWORD param, BOOL dst, BOOL ps)
 
static int instr_comment (const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps)
 
static int instr_def (const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps)
 
static int instr_dcl (const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps)
 
static int instr_generic (const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps)
 
HRESULT WINAPI D3DXDisassembleShader (const DWORD *shader, BOOL colorcode, const char *comments, ID3DXBuffer **disassembly)
 
static struct d3dx9_texture_shaderimpl_from_ID3DXTextureShader (ID3DXTextureShader *iface)
 
static HRESULT WINAPI d3dx9_texture_shader_QueryInterface (ID3DXTextureShader *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3dx9_texture_shader_AddRef (ID3DXTextureShader *iface)
 
static ULONG WINAPI d3dx9_texture_shader_Release (ID3DXTextureShader *iface)
 
static HRESULT WINAPI d3dx9_texture_shader_GetFunction (ID3DXTextureShader *iface, struct ID3DXBuffer **function)
 
static HRESULT WINAPI d3dx9_texture_shader_GetConstantBuffer (ID3DXTextureShader *iface, struct ID3DXBuffer **constant_buffer)
 
static HRESULT WINAPI d3dx9_texture_shader_GetDesc (ID3DXTextureShader *iface, D3DXCONSTANTTABLE_DESC *desc)
 
static HRESULT WINAPI d3dx9_texture_shader_GetConstantDesc (ID3DXTextureShader *iface, D3DXHANDLE constant, D3DXCONSTANT_DESC *constant_desc, UINT *count)
 
static D3DXHANDLE WINAPI d3dx9_texture_shader_GetConstant (ID3DXTextureShader *iface, D3DXHANDLE constant, UINT index)
 
static D3DXHANDLE WINAPI d3dx9_texture_shader_GetConstantByName (ID3DXTextureShader *iface, D3DXHANDLE constant, const char *name)
 
static D3DXHANDLE WINAPI d3dx9_texture_shader_GetConstantElement (ID3DXTextureShader *iface, D3DXHANDLE constant, UINT index)
 
static HRESULT WINAPI d3dx9_texture_shader_SetDefaults (ID3DXTextureShader *iface)
 
static HRESULT WINAPI d3dx9_texture_shader_SetValue (ID3DXTextureShader *iface, D3DXHANDLE constant, const void *data, UINT bytes)
 
static HRESULT WINAPI d3dx9_texture_shader_SetBool (ID3DXTextureShader *iface, D3DXHANDLE constant, BOOL b)
 
static HRESULT WINAPI d3dx9_texture_shader_SetBoolArray (ID3DXTextureShader *iface, D3DXHANDLE constant, const BOOL *b, UINT count)
 
static HRESULT WINAPI d3dx9_texture_shader_SetInt (ID3DXTextureShader *iface, D3DXHANDLE constant, INT n)
 
static HRESULT WINAPI d3dx9_texture_shader_SetIntArray (ID3DXTextureShader *iface, D3DXHANDLE constant, const INT *n, UINT count)
 
static HRESULT WINAPI d3dx9_texture_shader_SetFloat (ID3DXTextureShader *iface, D3DXHANDLE constant, FLOAT f)
 
static HRESULT WINAPI d3dx9_texture_shader_SetFloatArray (ID3DXTextureShader *iface, D3DXHANDLE constant, const FLOAT *f, UINT count)
 
static HRESULT WINAPI d3dx9_texture_shader_SetVector (ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXVECTOR4 *vector)
 
static HRESULT WINAPI d3dx9_texture_shader_SetVectorArray (ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXVECTOR4 *vector, UINT count)
 
static HRESULT WINAPI d3dx9_texture_shader_SetMatrix (ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX *matrix)
 
static HRESULT WINAPI d3dx9_texture_shader_SetMatrixArray (ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI d3dx9_texture_shader_SetMatrixPointerArray (ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX **matrix, UINT count)
 
static HRESULT WINAPI d3dx9_texture_shader_SetMatrixTranspose (ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX *matrix)
 
static HRESULT WINAPI d3dx9_texture_shader_SetMatrixTransposeArray (ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX *matrix, UINT count)
 
static HRESULT WINAPI d3dx9_texture_shader_SetMatrixTransposePointerArray (ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX **matrix, UINT count)
 
HRESULT WINAPI D3DXCreateTextureShader (const DWORD *function, ID3DXTextureShader **texture_shader)
 
static unsigned int get_instr_length (const DWORD *byte_code, unsigned int major, unsigned int minor)
 
static HRESULT get_shader_semantics (const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count, BOOL output)
 
HRESULT WINAPI D3DXGetShaderInputSemantics (const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count)
 
HRESULT WINAPI D3DXGetShaderOutputSemantics (const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count)
 

Variables

static const voidmain_file_data
 
static CRITICAL_SECTION_DEBUG from_file_mutex_debug
 
CRITICAL_SECTION from_file_mutex = {&from_file_mutex_debug, -1, 0, 0, 0, 0}
 
const struct ID3DXIncludeVtbl d3dx_include_from_file_vtbl
 
static const struct ID3DXConstantTableVtbl ID3DXConstantTable_Vtbl
 
static const struct ID3DXFragmentLinkerVtbl d3dx9_fragment_linker_vtbl
 
static const chardecl_usage []
 
static const chartex_type [] = { "", "1d", "2d", "cube", "volume" }
 
const struct instr_info instructions []
 
static const struct ID3DXTextureShaderVtbl d3dx9_texture_shader_vtbl
 

Function Documentation

◆ add_modifier()

static int add_modifier ( char buffer,
DWORD  param 
)
static

Definition at line 2386 of file shader.c.

2387 {
2388  char *buf = buffer;
2389  DWORD dst_mod = param & D3DSP_DSTMOD_MASK;
2390 
2391  if (dst_mod & D3DSPDM_SATURATE)
2392  buf += sprintf(buf, "_sat");
2393  if (dst_mod & D3DSPDM_PARTIALPRECISION)
2394  buf += sprintf(buf, "_pp");
2395  if (dst_mod & D3DSPDM_MSAMPCENTROID)
2396  buf += sprintf(buf, "_centroid");
2397 
2398  return buf - buffer;
2399 }
GLuint buffer
Definition: glext.h:5915
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define D3DSP_DSTMOD_MASK
Definition: d3d8types.h:381
GLfloat param
Definition: glext.h:5796
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by instr_dcl(), and instr_generic().

◆ add_register()

static int add_register ( char buffer,
DWORD  param,
BOOL  dst,
BOOL  ps 
)
static

Definition at line 2401 of file shader.c.

2402 {
2403  char *buf = buffer;
2406  DWORD reg_num = param & D3DSP_REGNUM_MASK;
2407 
2408  if (reg_type == D3DSPR_INPUT)
2409  buf += sprintf(buf, "v%d", reg_num);
2410  else if (reg_type == D3DSPR_CONST)
2411  buf += sprintf(buf, "c%d", reg_num);
2412  else if (reg_type == D3DSPR_TEMP)
2413  buf += sprintf(buf, "r%d", reg_num);
2414  else if (reg_type == D3DSPR_ADDR)
2415  buf += sprintf(buf, "%s%d", ps ? "t" : "a", reg_num);
2416  else if (reg_type == D3DSPR_SAMPLER)
2417  buf += sprintf(buf, "s%d", reg_num);
2418  else if (reg_type == D3DSPR_RASTOUT)
2419  buf += sprintf(buf, "oPos");
2420  else if (reg_type == D3DSPR_COLOROUT)
2421  buf += sprintf(buf, "oC%d", reg_num);
2422  else if (reg_type == D3DSPR_TEXCRDOUT)
2423  buf += sprintf(buf, "oT%d", reg_num);
2424  else if (reg_type == D3DSPR_ATTROUT)
2425  buf += sprintf(buf, "oD%d", reg_num);
2426  else
2427  buf += sprintf(buf, "? (%d)", reg_type);
2428 
2429  if (dst)
2430  {
2432  {
2433  buf += sprintf(buf, ".%s%s%s%s", param & D3DSP_WRITEMASK_0 ? "x" : "",
2434  param & D3DSP_WRITEMASK_1 ? "y" : "",
2435  param & D3DSP_WRITEMASK_2 ? "z" : "",
2436  param & D3DSP_WRITEMASK_3 ? "w" : "");
2437  }
2438  }
2439  else
2440  {
2442  {
2447  buf += sprintf(buf, ".%c", 'w' + (((param >> D3DVS_SWIZZLE_SHIFT) + 1) & 0x3));
2448  else
2449  buf += sprintf(buf, ".%c%c%c%c", 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+0)) + 1) & 0x3),
2450  'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+2)) + 1) & 0x3),
2451  'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+4)) + 1) & 0x3),
2452  'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+6)) + 1) & 0x3));
2453  }
2454  }
2455 
2456  return buf - buffer;
2457 }
#define D3DSP_REGTYPE_MASK2
Definition: d3d9types.h:508
#define D3DVS_Z_Y
Definition: d3d8types.h:442
#define D3DVS_NOSWIZZLE
Definition: d3d8types.h:451
#define D3DVS_X_Y
Definition: d3d8types.h:432
#define D3DVS_Y_Z
Definition: d3d8types.h:438
GLuint buffer
Definition: glext.h:5915
#define D3DVS_Y_X
Definition: d3d8types.h:436
#define D3DSP_WRITEMASK_ALL
Definition: d3d8types.h:378
#define D3DVS_Z_W
Definition: d3d8types.h:444
#define D3DSP_REGTYPE_SHIFT
Definition: d3d8types.h:394
#define D3DVS_W_Z
Definition: d3d8types.h:448
#define D3DSP_WRITEMASK_2
Definition: d3d8types.h:376
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define D3DVS_Y_W
Definition: d3d8types.h:439
#define D3DVS_SWIZZLE_MASK
Definition: d3d8types.h:426
#define D3DVS_W_W
Definition: d3d8types.h:449
#define D3DVS_X_Z
Definition: d3d8types.h:433
type_t * reg_type(type_t *type, const char *name, struct namespace *namespace, int t)
#define D3DVS_W_Y
Definition: d3d8types.h:447
#define D3DVS_Z_Z
Definition: d3d8types.h:443
#define D3DSP_WRITEMASK_0
Definition: d3d8types.h:374
#define D3DVS_Y_Y
Definition: d3d8types.h:437
GLfloat param
Definition: glext.h:5796
unsigned long DWORD
Definition: ntddk_ex.h:95
#define D3DVS_Z_X
Definition: d3d8types.h:441
#define D3DSP_WRITEMASK_3
Definition: d3d8types.h:377
#define D3DSP_SWIZZLE_MASK
Definition: d3d8types.h:429
#define D3DSP_REGNUM_MASK
Definition: d3d9types.h:479
#define D3DVS_W_X
Definition: d3d8types.h:446
GLenum GLenum dst
Definition: glext.h:6340
#define D3DVS_X_X
Definition: d3d8types.h:431
#define D3DVS_SWIZZLE_SHIFT
Definition: d3d8types.h:425
#define D3DSP_WRITEMASK_1
Definition: d3d8types.h:375
#define D3DSP_REGTYPE_SHIFT2
Definition: d3d9types.h:506
#define D3DVS_X_W
Definition: d3d8types.h:434
#define D3DSP_REGTYPE_MASK
Definition: d3d8types.h:395

Referenced by instr_dcl(), and instr_generic().

◆ D3DAssemble()

HRESULT WINAPI D3DAssemble ( const void data,
SIZE_T  datasize,
const char filename,
const D3D_SHADER_MACRO defines,
ID3DInclude include,
UINT  flags,
ID3DBlob **  shader,
ID3DBlob **  error_messages 
)

Definition at line 630 of file compiler.c.

633 {
634  HRESULT hr;
635 
636  TRACE("data %p, datasize %lu, filename %s, defines %p, include %p, sflags %#x, "
637  "shader %p, error_messages %p.\n",
639 
641 
642  /* TODO: flags */
643  if (flags) FIXME("flags %x\n", flags);
644 
645  if (shader) *shader = NULL;
647 
649  if (SUCCEEDED(hr))
651 
654  return hr;
655 }
static char * wpp_output
Definition: compiler.c:57
HRESULT hr
Definition: shlfolder.c:183
static CRITICAL_SECTION wpp_mutex
Definition: compiler.c:75
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const char * filename
Definition: ioapi.h:135
static HRESULT assemble_shader(const char *preproc_shader, ID3DBlob **shader_blob, ID3DBlob **error_messages)
Definition: compiler.c:553
if SUCCEEDED(hr)
#define FIXME(fmt,...)
Definition: debug.h:111
static SIZE_T datasize
Definition: asm.c:30
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
static HRESULT preprocess_shader(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **error_messages)
Definition: compiler.c:484
#define NULL
Definition: types.h:112
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by D3DXAssembleShader().

◆ d3dx9_fragment_linker_AddFragments()

static HRESULT WINAPI d3dx9_fragment_linker_AddFragments ( ID3DXFragmentLinker *  iface,
const DWORD fragments 
)
static

Definition at line 2224 of file shader.c.

2225 {
2226  FIXME("iface %p, fragments %p: stub.\n", iface, fragments);
2227 
2228  return E_NOTIMPL;
2229 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_fragment_linker_AddRef()

static ULONG WINAPI d3dx9_fragment_linker_AddRef ( ID3DXFragmentLinker *  iface)
static

Definition at line 2149 of file shader.c.

2150 {
2151  struct d3dx9_fragment_linker *linker = impl_from_ID3DXFragmentLinker(iface);
2152  ULONG refcount = InterlockedIncrement(&linker->ref);
2153 
2154  TRACE("%p increasing refcount to %u.\n", linker, refcount);
2155 
2156  return refcount;
2157 }
static struct d3dx9_fragment_linker * impl_from_ID3DXFragmentLinker(ID3DXFragmentLinker *iface)
Definition: shader.c:2127
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ d3dx9_fragment_linker_ClearCache()

static HRESULT WINAPI d3dx9_fragment_linker_ClearCache ( ID3DXFragmentLinker *  iface)
static

Definition at line 2276 of file shader.c.

2277 {
2278  FIXME("iface %p: stub.\n", iface);
2279 
2280  return E_NOTIMPL;
2281 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_fragment_linker_GetAllFragments()

static HRESULT WINAPI d3dx9_fragment_linker_GetAllFragments ( ID3DXFragmentLinker *  iface,
ID3DXBuffer **  buffer 
)
static

Definition at line 2231 of file shader.c.

2232 {
2233  FIXME("iface %p, buffer %p: stub.\n", iface, buffer);
2234 
2235  return E_NOTIMPL;
2236 }
GLuint buffer
Definition: glext.h:5915
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_fragment_linker_GetDevice()

static HRESULT WINAPI d3dx9_fragment_linker_GetDevice ( ID3DXFragmentLinker *  iface,
struct IDirect3DDevice9 **  device 
)
static

Definition at line 2175 of file shader.c.

2176 {
2177  struct d3dx9_fragment_linker *linker = impl_from_ID3DXFragmentLinker(iface);
2178 
2179  TRACE("iface %p, device %p.\n", linker, device);
2180 
2181  if (!device)
2182  {
2183  WARN("Invalid argument supplied.\n");
2184  return D3DERR_INVALIDCALL;
2185  }
2186 
2188  *device = linker->device;
2189  TRACE("Returning device %p.\n", *device);
2190 
2191  return S_OK;
2192 }
#define WARN(fmt,...)
Definition: debug.h:112
#define D3DERR_INVALIDCALL
struct IDirect3DDevice9 * device
Definition: shader.c:2123
Definition: devices.h:37
static struct d3dx9_fragment_linker * impl_from_ID3DXFragmentLinker(ID3DXFragmentLinker *iface)
Definition: shader.c:2127
#define TRACE(s)
Definition: solgame.cpp:4
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
#define S_OK
Definition: intsafe.h:51

◆ d3dx9_fragment_linker_GetFragment()

static HRESULT WINAPI d3dx9_fragment_linker_GetFragment ( ID3DXFragmentLinker *  iface,
D3DXHANDLE  name,
ID3DXBuffer **  buffer 
)
static

Definition at line 2238 of file shader.c.

2240 {
2241  FIXME("iface %p, name %p, buffer %p: stub.\n", iface, name, buffer);
2242 
2243  return E_NOTIMPL;
2244 }
GLuint buffer
Definition: glext.h:5915
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: name.c:38

◆ d3dx9_fragment_linker_GetFragmentDesc()

static HRESULT WINAPI d3dx9_fragment_linker_GetFragmentDesc ( ID3DXFragmentLinker *  iface,
D3DXHANDLE  name,
D3DXFRAGMENT_DESC desc 
)
static

Definition at line 2216 of file shader.c.

2218 {
2219  FIXME("iface %p, name %p, desc %p: stub.\n", iface, name, desc);
2220 
2221  return E_NOTIMPL;
2222 }
D3DXCONSTANT_DESC desc
Definition: shader.c:1767
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: name.c:38

◆ d3dx9_fragment_linker_GetFragmentHandleByIndex()

static D3DXHANDLE WINAPI d3dx9_fragment_linker_GetFragmentHandleByIndex ( ID3DXFragmentLinker *  iface,
UINT  index 
)
static

Definition at line 2201 of file shader.c.

2202 {
2203  FIXME("iface %p, index %u: stub.\n", iface, index);
2204 
2205  return NULL;
2206 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLuint index
Definition: glext.h:6031
#define NULL
Definition: types.h:112

◆ d3dx9_fragment_linker_GetFragmentHandleByName()

static D3DXHANDLE WINAPI d3dx9_fragment_linker_GetFragmentHandleByName ( ID3DXFragmentLinker *  iface,
const char name 
)
static

Definition at line 2208 of file shader.c.

2210 {
2211  FIXME("iface %p, name %s: stub.\n", iface, debugstr_a(name));
2212 
2213  return NULL;
2214 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
#define NULL
Definition: types.h:112
Definition: name.c:38

◆ d3dx9_fragment_linker_GetNumberOfFragments()

static UINT WINAPI d3dx9_fragment_linker_GetNumberOfFragments ( ID3DXFragmentLinker *  iface)
static

Definition at line 2194 of file shader.c.

2195 {
2196  FIXME("iface %p: stub.\n", iface);
2197 
2198  return E_NOTIMPL;
2199 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_fragment_linker_LinkPixelShader()

static HRESULT WINAPI d3dx9_fragment_linker_LinkPixelShader ( ID3DXFragmentLinker *  iface,
const char profile,
DWORD  flags,
const D3DXHANDLE handles,
UINT  fragment_count,
IDirect3DPixelShader9 **  shader,
ID3DXBuffer **  errors 
)
static

Definition at line 2266 of file shader.c.

2269 {
2270  FIXME("iface %p, profile %s, flags %#x, handles %p, fragment_count %u, shader %p, errors %p: stub.\n",
2271  iface, debugstr_a(profile), flags, handles, fragment_count, shader, errors);
2272 
2273  return E_NOTIMPL;
2274 }
static struct object_header ** handles
Definition: handle.c:45
#define FIXME(fmt,...)
Definition: debug.h:111
WDF_DMA_PROFILE profile
GLuint shader
Definition: glext.h:6030
#define debugstr_a
Definition: kernel32.h:31
GLbitfield flags
Definition: glext.h:7161
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_fragment_linker_LinkShader()

static HRESULT WINAPI d3dx9_fragment_linker_LinkShader ( ID3DXFragmentLinker *  iface,
const char profile,
DWORD  flags,
const D3DXHANDLE handles,
UINT  fragment_count,
ID3DXBuffer **  buffer,
ID3DXBuffer **  errors 
)
static

Definition at line 2246 of file shader.c.

2249 {
2250  FIXME("iface %p, profile %s, flags %#x, handles %p, fragment_count %u, buffer %p, errors %p: stub.\n",
2251  iface, debugstr_a(profile), flags, handles, fragment_count, buffer, errors);
2252 
2253  return E_NOTIMPL;
2254 }
static struct object_header ** handles
Definition: handle.c:45
GLuint buffer
Definition: glext.h:5915
#define FIXME(fmt,...)
Definition: debug.h:111
WDF_DMA_PROFILE profile
#define debugstr_a
Definition: kernel32.h:31
GLbitfield flags
Definition: glext.h:7161
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_fragment_linker_LinkVertexShader()

static HRESULT WINAPI d3dx9_fragment_linker_LinkVertexShader ( ID3DXFragmentLinker *  iface,
const char profile,
DWORD  flags,
const D3DXHANDLE handles,
UINT  fragment_count,
IDirect3DVertexShader9 **  shader,
ID3DXBuffer **  errors 
)
static

Definition at line 2256 of file shader.c.

2259 {
2260  FIXME("iface %p, profile %s, flags %#x, handles %p, fragment_count %u, shader %p, errors %p: stub.\n",
2261  iface, debugstr_a(profile), flags, handles, fragment_count, shader, errors);
2262 
2263  return E_NOTIMPL;
2264 }
static struct object_header ** handles
Definition: handle.c:45
#define FIXME(fmt,...)
Definition: debug.h:111
WDF_DMA_PROFILE profile
GLuint shader
Definition: glext.h:6030
#define debugstr_a
Definition: kernel32.h:31
GLbitfield flags
Definition: glext.h:7161
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_fragment_linker_QueryInterface()

static HRESULT WINAPI d3dx9_fragment_linker_QueryInterface ( ID3DXFragmentLinker *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 2132 of file shader.c.

2133 {
2134  TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
2135 
2137  || IsEqualGUID(riid, &IID_ID3DXFragmentLinker))
2138  {
2139  iface->lpVtbl->AddRef(iface);
2140  *out = iface;
2141  return D3D_OK;
2142  }
2143 
2144  WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
2145  *out = NULL;
2146  return E_NOINTERFACE;
2147 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define D3D_OK
Definition: d3d.h:106
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ d3dx9_fragment_linker_Release()

static ULONG WINAPI d3dx9_fragment_linker_Release ( ID3DXFragmentLinker *  iface)
static

Definition at line 2159 of file shader.c.

2160 {
2161  struct d3dx9_fragment_linker *linker = impl_from_ID3DXFragmentLinker(iface);
2162  ULONG refcount = InterlockedDecrement(&linker->ref);
2163 
2164  TRACE("%p decreasing refcount to %u.\n", linker, refcount);
2165 
2166  if (!refcount)
2167  {
2169  heap_free(linker);
2170  }
2171 
2172  return refcount;
2173 }
struct IDirect3DDevice9 * device
Definition: shader.c:2123
static struct d3dx9_fragment_linker * impl_from_ID3DXFragmentLinker(ID3DXFragmentLinker *iface)
Definition: shader.c:2127
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1508
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ d3dx9_texture_shader_AddRef()

static ULONG WINAPI d3dx9_texture_shader_AddRef ( ID3DXTextureShader *  iface)
static

Definition at line 2738 of file shader.c.

2739 {
2740  struct d3dx9_texture_shader *texture_shader = impl_from_ID3DXTextureShader(iface);
2741  ULONG refcount = InterlockedIncrement(&texture_shader->ref);
2742 
2743  TRACE("%p increasing refcount to %u.\n", texture_shader, refcount);
2744 
2745  return refcount;
2746 }
static struct d3dx9_texture_shader * impl_from_ID3DXTextureShader(ID3DXTextureShader *iface)
Definition: shader.c:2716
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ d3dx9_texture_shader_GetConstant()

static D3DXHANDLE WINAPI d3dx9_texture_shader_GetConstant ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
UINT  index 
)
static

Definition at line 2791 of file shader.c.

2792 {
2793  FIXME("iface %p, constant %p, index %u stub.\n", iface, constant, index);
2794 
2795  return NULL;
2796 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLuint index
Definition: glext.h:6031
#define NULL
Definition: types.h:112

◆ d3dx9_texture_shader_GetConstantBuffer()

static HRESULT WINAPI d3dx9_texture_shader_GetConstantBuffer ( ID3DXTextureShader *  iface,
struct ID3DXBuffer **  constant_buffer 
)
static

Definition at line 2770 of file shader.c.

2771 {
2772  FIXME("iface %p, constant_buffer %p stub.\n", iface, constant_buffer);
2773 
2774  return E_NOTIMPL;
2775 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_GetConstantByName()

static D3DXHANDLE WINAPI d3dx9_texture_shader_GetConstantByName ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const char name 
)
static

Definition at line 2798 of file shader.c.

2799 {
2800  FIXME("iface %p, constant %p, name %s stub.\n", iface, constant, debugstr_a(name));
2801 
2802  return NULL;
2803 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
#define NULL
Definition: types.h:112
Definition: name.c:38

◆ d3dx9_texture_shader_GetConstantDesc()

static HRESULT WINAPI d3dx9_texture_shader_GetConstantDesc ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
D3DXCONSTANT_DESC constant_desc,
UINT count 
)
static

Definition at line 2784 of file shader.c.

2785 {
2786  FIXME("iface %p, constant %p, constant_desc %p, count %p stub.\n", iface, constant, constant_desc, count);
2787 
2788  return E_NOTIMPL;
2789 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_GetConstantElement()

static D3DXHANDLE WINAPI d3dx9_texture_shader_GetConstantElement ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
UINT  index 
)
static

Definition at line 2805 of file shader.c.

2806 {
2807  FIXME("iface %p, constant %p, index %u stub.\n", iface, constant, index);
2808 
2809  return NULL;
2810 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLuint index
Definition: glext.h:6031
#define NULL
Definition: types.h:112

◆ d3dx9_texture_shader_GetDesc()

static HRESULT WINAPI d3dx9_texture_shader_GetDesc ( ID3DXTextureShader *  iface,
D3DXCONSTANTTABLE_DESC desc 
)
static

Definition at line 2777 of file shader.c.

2778 {
2779  FIXME("iface %p, desc %p stub.\n", iface, desc);
2780 
2781  return E_NOTIMPL;
2782 }
D3DXCONSTANT_DESC desc
Definition: shader.c:1767
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_GetFunction()

static HRESULT WINAPI d3dx9_texture_shader_GetFunction ( ID3DXTextureShader *  iface,
struct ID3DXBuffer **  function 
)
static

Definition at line 2763 of file shader.c.

2764 {
2765  FIXME("iface %p, function %p stub.\n", iface, function);
2766 
2767  return E_NOTIMPL;
2768 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_QueryInterface()

static HRESULT WINAPI d3dx9_texture_shader_QueryInterface ( ID3DXTextureShader *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 2721 of file shader.c.

2722 {
2723  TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
2724 
2725  if (IsEqualGUID(riid, &IID_IUnknown) ||
2726  IsEqualGUID(riid, &IID_ID3DXTextureShader))
2727  {
2728  iface->lpVtbl->AddRef(iface);
2729  *out = iface;
2730  return D3D_OK;
2731  }
2732 
2733  WARN("Interface %s not found.\n", debugstr_guid(riid));
2734  *out = NULL;
2735  return E_NOINTERFACE;
2736 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define D3D_OK
Definition: d3d.h:106
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ d3dx9_texture_shader_Release()

static ULONG WINAPI d3dx9_texture_shader_Release ( ID3DXTextureShader *  iface)
static

Definition at line 2748 of file shader.c.

2749 {
2750  struct d3dx9_texture_shader *texture_shader = impl_from_ID3DXTextureShader(iface);
2751  ULONG refcount = InterlockedDecrement(&texture_shader->ref);
2752 
2753  TRACE("%p decreasing refcount to %u.\n", texture_shader, refcount);
2754 
2755  if (!refcount)
2756  {
2757  HeapFree(GetProcessHeap(), 0, texture_shader);
2758  }
2759 
2760  return refcount;
2761 }
static struct d3dx9_texture_shader * impl_from_ID3DXTextureShader(ID3DXTextureShader *iface)
Definition: shader.c:2716
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ d3dx9_texture_shader_SetBool()

static HRESULT WINAPI d3dx9_texture_shader_SetBool ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
BOOL  b 
)
static

Definition at line 2826 of file shader.c.

2827 {
2828  FIXME("iface %p, constant %p, b %u stub.\n", iface, constant, b);
2829 
2830  return E_NOTIMPL;
2831 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetBoolArray()

static HRESULT WINAPI d3dx9_texture_shader_SetBoolArray ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const BOOL b,
UINT  count 
)
static

Definition at line 2833 of file shader.c.

2834 {
2835  FIXME("iface %p, constant %p, b %p, count %u stub.\n", iface, constant, b, count);
2836 
2837  return E_NOTIMPL;
2838 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:111
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetDefaults()

static HRESULT WINAPI d3dx9_texture_shader_SetDefaults ( ID3DXTextureShader *  iface)
static

Definition at line 2812 of file shader.c.

2813 {
2814  FIXME("iface %p stub.\n", iface);
2815 
2816  return E_NOTIMPL;
2817 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetFloat()

static HRESULT WINAPI d3dx9_texture_shader_SetFloat ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
FLOAT  f 
)
static

Definition at line 2854 of file shader.c.

2855 {
2856  FIXME("iface %p, constant %p, f %f stub.\n", iface, constant, f);
2857 
2858  return E_NOTIMPL;
2859 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLfloat f
Definition: glext.h:7540
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetFloatArray()

static HRESULT WINAPI d3dx9_texture_shader_SetFloatArray ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const FLOAT f,
UINT  count 
)
static

Definition at line 2861 of file shader.c.

2862 {
2863  FIXME("iface %p, constant %p, f %p, count %u stub.\n", iface, constant, f, count);
2864 
2865  return E_NOTIMPL;
2866 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:111
GLfloat f
Definition: glext.h:7540
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetInt()

static HRESULT WINAPI d3dx9_texture_shader_SetInt ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
INT  n 
)
static

Definition at line 2840 of file shader.c.

2841 {
2842  FIXME("iface %p, constant %p, n %d stub.\n", iface, constant, n);
2843 
2844  return E_NOTIMPL;
2845 }
GLdouble n
Definition: glext.h:7729
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetIntArray()

static HRESULT WINAPI d3dx9_texture_shader_SetIntArray ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const INT n,
UINT  count 
)
static

Definition at line 2847 of file shader.c.

2848 {
2849  FIXME("iface %p, constant %p, n %p, count %u stub.\n", iface, constant, n, count);
2850 
2851  return E_NOTIMPL;
2852 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetMatrix()

static HRESULT WINAPI d3dx9_texture_shader_SetMatrix ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const D3DXMATRIX matrix 
)
static

Definition at line 2882 of file shader.c.

2883 {
2884  FIXME("iface %p, constant %p, matrix %p stub.\n", iface, constant, matrix);
2885 
2886  return E_NOTIMPL;
2887 }
GLuint GLenum matrix
Definition: glext.h:9407
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetMatrixArray()

static HRESULT WINAPI d3dx9_texture_shader_SetMatrixArray ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const D3DXMATRIX matrix,
UINT  count 
)
static

Definition at line 2889 of file shader.c.

2890 {
2891  FIXME("iface %p, constant %p, matrix %p, count %u stub.\n", iface, constant, matrix, count);
2892 
2893  return E_NOTIMPL;
2894 }
GLuint GLenum matrix
Definition: glext.h:9407
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetMatrixPointerArray()

static HRESULT WINAPI d3dx9_texture_shader_SetMatrixPointerArray ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const D3DXMATRIX **  matrix,
UINT  count 
)
static

Definition at line 2896 of file shader.c.

2897 {
2898  FIXME("iface %p, constant %p, matrix %p, count %u stub.\n", iface, constant, matrix, count);
2899 
2900  return E_NOTIMPL;
2901 }
GLuint GLenum matrix
Definition: glext.h:9407
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetMatrixTranspose()

static HRESULT WINAPI d3dx9_texture_shader_SetMatrixTranspose ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const D3DXMATRIX matrix 
)
static

Definition at line 2903 of file shader.c.

2904 {
2905  FIXME("iface %p, constant %p, matrix %p stub.\n", iface, constant, matrix);
2906 
2907  return E_NOTIMPL;
2908 }
GLuint GLenum matrix
Definition: glext.h:9407
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetMatrixTransposeArray()

static HRESULT WINAPI d3dx9_texture_shader_SetMatrixTransposeArray ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const D3DXMATRIX matrix,
UINT  count 
)
static

Definition at line 2910 of file shader.c.

2911 {
2912  FIXME("iface %p, constant %p, matrix %p, count %u stub.\n", iface, constant, matrix, count);
2913 
2914  return E_NOTIMPL;
2915 }
GLuint GLenum matrix
Definition: glext.h:9407
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetMatrixTransposePointerArray()

static HRESULT WINAPI d3dx9_texture_shader_SetMatrixTransposePointerArray ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const D3DXMATRIX **  matrix,
UINT  count 
)
static

Definition at line 2917 of file shader.c.

2918 {
2919  FIXME("iface %p, constant %p, matrix %p, count %u stub.\n", iface, constant, matrix, count);
2920 
2921  return E_NOTIMPL;
2922 }
GLuint GLenum matrix
Definition: glext.h:9407
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetValue()

static HRESULT WINAPI d3dx9_texture_shader_SetValue ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const void data,
UINT  bytes 
)
static

Definition at line 2819 of file shader.c.

2820 {
2821  FIXME("iface %p, constant %p, data %p, bytes %u stub.\n", iface, constant, data, bytes);
2822 
2823  return E_NOTIMPL;
2824 }
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define FIXME(fmt,...)
Definition: debug.h:111
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetVector()

static HRESULT WINAPI d3dx9_texture_shader_SetVector ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const D3DXVECTOR4 vector 
)
static

Definition at line 2868 of file shader.c.

2869 {
2870  FIXME("iface %p, constant %p, vector %p stub.\n", iface, constant, vector);
2871 
2872  return E_NOTIMPL;
2873 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx9_texture_shader_SetVectorArray()

static HRESULT WINAPI d3dx9_texture_shader_SetVectorArray ( ID3DXTextureShader *  iface,
D3DXHANDLE  constant,
const D3DXVECTOR4 vector,
UINT  count 
)
static

Definition at line 2875 of file shader.c.

2876 {
2877  FIXME("iface %p, constant %p, vector %p, count %u stub.\n", iface, constant, vector, count);
2878 
2879  return E_NOTIMPL;
2880 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ d3dx_include_from_file_close()

static HRESULT WINAPI d3dx_include_from_file_close ( ID3DXInclude *  iface,
const void data 
)
static

Definition at line 306 of file shader.c.

307 {
308  HeapFree(GetProcessHeap(), 0, *((char **)data - 1));
309  HeapFree(GetProcessHeap(), 0, (char **)data - 1);
310  if (main_file_data == data)
312  return S_OK;
313 }
#define GetProcessHeap()
Definition: compat.h:595
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static const void * main_file_data
Definition: shader.c:218
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ d3dx_include_from_file_open()

static HRESULT WINAPI d3dx_include_from_file_open ( ID3DXInclude *  iface,
D3DXINCLUDE_TYPE  include_type,
const char filename,
const void parent_data,
const void **  data,
UINT bytes 
)
static

Definition at line 236 of file shader.c.

238 {
239  const char *p, *parent_name = "";
240  char *pathname = NULL, *ptr;
241  char **buffer = NULL;
242  HANDLE file;
243  UINT size;
244 
245  if (parent_data)
246  {
247  parent_name = *((const char **)parent_data - 1);
248  }
249  else
250  {
251  if (main_file_data)
252  parent_name = *((const char **)main_file_data - 1);
253  }
254 
255  TRACE("Looking up include file %s, parent %s.\n", debugstr_a(filename), debugstr_a(parent_name));
256 
257  if ((p = strrchr(parent_name, '\\')))
258  ++p;
259  else
260  p = parent_name;
261  pathname = HeapAlloc(GetProcessHeap(), 0, (p - parent_name) + strlen(filename) + 1);
262  if(!pathname)
264 
265  memcpy(pathname, parent_name, p - parent_name);
266  strcpy(pathname + (p - parent_name), filename);
267  ptr = pathname + (p - parent_name);
268  while (*ptr)
269  {
270  if (*ptr == '/')
271  *ptr = '\\';
272  ++ptr;
273  }
274 
277  goto error;
278 
279  TRACE("Include file found at pathname = %s\n", debugstr_a(pathname));
280 
282  if(size == INVALID_FILE_SIZE)
283  goto error;
284 
285  buffer = HeapAlloc(GetProcessHeap(), 0, size + sizeof(char *));
286  if(!buffer)
287  goto error;
288  *buffer = pathname;
289  if(!ReadFile(file, buffer + 1, size, bytes, NULL))
290  goto error;
291 
292  *data = buffer + 1;
293  if (!main_file_data)
294  main_file_data = *data;
295 
296  CloseHandle(file);
297  return S_OK;
298 
299 error:
300  CloseHandle(file);
304 }
#define CloseHandle
Definition: compat.h:598
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define error(str)
Definition: mkdosfs.c:1605
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char pathname[512]
Definition: util.h:13
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
GLuint buffer
Definition: glext.h:5915
#define INVALID_FILE_SIZE
Definition: winbase.h:545
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
const char * filename
Definition: ioapi.h:135
#define FILE_SHARE_READ
Definition: compat.h:136
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
static PVOID ptr
Definition: dispmode.c:27
#define OPEN_EXISTING
Definition: compat.h:634
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define debugstr_a
Definition: kernel32.h:31
const char file[]
Definition: icontest.c:11
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GENERIC_READ
Definition: compat.h:135
static const void * main_file_data
Definition: shader.c:218
#define S_OK
Definition: intsafe.h:51
#define ReadFile(a, b, c, d, e)
Definition: compat.h:601
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599
GLfloat GLfloat p
Definition: glext.h:8902
#define HeapFree(x, y, z)
Definition: compat.h:594
Definition: fci.c:126

◆ d3dx_shader_get_ctab_constant()

const struct ctab_constant* d3dx_shader_get_ctab_constant ( ID3DXConstantTable *  iface,
D3DXHANDLE  constant 
)

Definition at line 984 of file shader.c.

985 {
987 
989 }
static struct ID3DXConstantTableImpl * impl_from_ID3DXConstantTable(ID3DXConstantTable *iface)
Definition: shader.c:762
static struct ctab_constant * get_valid_constant(struct ID3DXConstantTableImpl *table, D3DXHANDLE handle)
Definition: shader.c:887

Referenced by get_ctab_constant_desc().

◆ D3DXAssembleShader()

HRESULT WINAPI D3DXAssembleShader ( const char data,
UINT  data_len,
const D3DXMACRO defines,
ID3DXInclude *  include,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 200 of file shader.c.

202 {
203  HRESULT hr;
204 
205  TRACE("data %p, data_len %u, defines %p, include %p, flags %#x, shader %p, error_messages %p\n",
206  data, data_len, defines, include, flags, shader, error_messages);
207 
208  /* Forward to d3dcompiler: the parameter types aren't really different,
209  the actual data types are equivalent */
210  hr = D3DAssemble(data, data_len, NULL, (D3D_SHADER_MACRO *)defines,
213 
214  if(hr == E_FAIL) hr = D3DXERR_INVALIDDATA;
215  return hr;
216 }
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
LONG HRESULT
Definition: typedefs.h:79
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, UINT flags, ID3DBlob **shader, ID3DBlob **error_messages)
Definition: compiler.c:630
#define NULL
Definition: types.h:112
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30

Referenced by assembleshader_test(), D3DXAssembleShaderFromFileW(), D3DXAssembleShaderFromResourceA(), and D3DXAssembleShaderFromResourceW().

◆ D3DXAssembleShaderFromFileA()

HRESULT WINAPI D3DXAssembleShaderFromFileA ( const char filename,
const D3DXMACRO defines,
ID3DXInclude *  include,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 321 of file shader.c.

323 {
324  WCHAR *filename_w;
325  DWORD len;
326  HRESULT ret;
327 
328  TRACE("filename %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n",
330 
331  if (!filename) return D3DXERR_INVALIDDATA;
332 
333  len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0);
334  filename_w = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
335  if (!filename_w) return E_OUTOFMEMORY;
336  MultiByteToWideChar(CP_ACP, 0, filename, -1, filename_w, len);
337 
339 
340  HeapFree(GetProcessHeap(), 0, filename_w);
341  return ret;
342 }
#define CP_ACP
Definition: compat.h:109
const char * filename
Definition: ioapi.h:135
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
Definition: shader.c:344
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by assembleshader_test().

◆ D3DXAssembleShaderFromFileW()

HRESULT WINAPI D3DXAssembleShaderFromFileW ( const WCHAR filename,
const D3DXMACRO defines,
ID3DXInclude *  include,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 344 of file shader.c.

346 {
347  const void *buffer;
348  DWORD len;
349  HRESULT hr;
350  struct d3dx_include_from_file include_from_file;
351  char *filename_a;
352 
353  TRACE("filename %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n",
355 
356  if(!include)
357  {
358  include_from_file.ID3DXInclude_iface.lpVtbl = &d3dx_include_from_file_vtbl;
359  include = &include_from_file.ID3DXInclude_iface;
360  }
361 
363  filename_a = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
364  if (!filename_a)
365  return E_OUTOFMEMORY;
366  WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL);
367 
369  hr = ID3DXInclude_Open(include, D3DXINC_LOCAL, filename_a, NULL, &buffer, &len);
370  if (FAILED(hr))
371  {
373  HeapFree(GetProcessHeap(), 0, filename_a);
374  return D3DXERR_INVALIDDATA;
375  }
376 
378 
381  HeapFree(GetProcessHeap(), 0, filename_a);
382  return hr;
383 }
#define ID3DXInclude_Open(p, a, b, c, d, e)
Definition: d3dx9shader.h:303
const struct ID3DXIncludeVtbl d3dx_include_from_file_vtbl
Definition: shader.c:315
#define WideCharToMultiByte
Definition: compat.h:111
HRESULT hr
Definition: shlfolder.c:183
CRITICAL_SECTION from_file_mutex
Definition: shader.c:229
#define CP_ACP
Definition: compat.h:109
GLuint buffer
Definition: glext.h:5915
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const char * filename
Definition: ioapi.h:135
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define ID3DXInclude_Close(p, a)
Definition: d3dx9shader.h:304
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
HRESULT WINAPI D3DXAssembleShader(const char *data, UINT data_len, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
Definition: shader.c:200
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by assembleshader_test(), and D3DXAssembleShaderFromFileA().

◆ D3DXAssembleShaderFromResourceA()

HRESULT WINAPI D3DXAssembleShaderFromResourceA ( HMODULE  module,
const char resource,
const D3DXMACRO defines,
ID3DXInclude *  include,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 385 of file shader.c.

387 {
388  void *buffer;
389  HRSRC res;
390  DWORD len;
391 
392  TRACE("module %p, resource %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n",
394 
395  if (!(res = FindResourceA(module, resource, (const char *)RT_RCDATA)))
396  return D3DXERR_INVALIDDATA;
398  return D3DXERR_INVALIDDATA;
401 }
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
GLuint buffer
Definition: glext.h:5915
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:170
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLbitfield flags
Definition: glext.h:7161
#define RT_RCDATA
Definition: pedump.c:372
GLenum GLsizei len
Definition: glext.h:6722
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
GLuint res
Definition: glext.h:9613
HRESULT WINAPI D3DXAssembleShader(const char *data, UINT data_len, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
Definition: shader.c:200

Referenced by assembleshader_test().

◆ D3DXAssembleShaderFromResourceW()

HRESULT WINAPI D3DXAssembleShaderFromResourceW ( HMODULE  module,
const WCHAR resource,
const D3DXMACRO defines,
ID3DXInclude *  include,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 403 of file shader.c.

405 {
406  void *buffer;
407  HRSRC res;
408  DWORD len;
409 
410  TRACE("module %p, resource %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n",
412 
413  if (!(res = FindResourceW(module, resource, (const WCHAR *)RT_RCDATA)))
414  return D3DXERR_INVALIDDATA;
416  return D3DXERR_INVALIDDATA;
419 }
GLuint buffer
Definition: glext.h:5915
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define debugstr_w
Definition: kernel32.h:32
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:170
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLbitfield flags
Definition: glext.h:7161
#define RT_RCDATA
Definition: pedump.c:372
GLenum GLsizei len
Definition: glext.h:6722
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
GLuint res
Definition: glext.h:9613
HRESULT WINAPI D3DXAssembleShader(const char *data, UINT data_len, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
Definition: shader.c:200

◆ D3DXCompileShader()

HRESULT WINAPI D3DXCompileShader ( const char data,
UINT  length,
const D3DXMACRO defines,
ID3DXInclude *  include,
const char function,
const char profile,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_msgs,
ID3DXConstantTable **  constant_table 
)

Definition at line 421 of file shader.c.

424 {
425  HRESULT hr;
426 
427  TRACE("data %s, length %u, defines %p, include %p, function %s, profile %s, "
428  "flags %#x, shader %p, error_msgs %p, constant_table %p.\n",
430  flags, shader, error_msgs, constant_table);
431 
432  if (D3DX_SDK_VERSION <= 36)
434 
436  function, profile, flags, 0, (ID3DBlob **)shader, (ID3DBlob **)error_msgs);
437 
438  if (SUCCEEDED(hr) && constant_table)
439  {
441  if (FAILED(hr))
442  {
444  *shader = NULL;
445  }
446  }
447 
448  /* Filter out D3DCompile warning messages that are not present with D3DCompileShader */
449  if (SUCCEEDED(hr) && error_msgs && *error_msgs)
450  {
451  char *messages = ID3DXBuffer_GetBufferPointer(*error_msgs);
452  DWORD size = ID3DXBuffer_GetBufferSize(*error_msgs);
453 
454  /* Ensure messages are null terminated for safe processing */
455  if (size) messages[size - 1] = 0;
456 
457  while (size > 1)
458  {
459  char *prev, *next;
460 
461  /* Warning has the form "warning X3206: ... implicit truncation of vector type"
462  but we only search for "X3206:" in case d3dcompiler_43 has localization */
463  prev = next = strstr(messages, "X3206:");
464  if (!prev) break;
465 
466  /* get pointer to beginning and end of current line */
467  while (prev > messages && *(prev - 1) != '\n') prev--;
468  while (next < messages + size - 1 && *next != '\n') next++;
469  if (next < messages + size - 1 && *next == '\n') next++;
470 
471  memmove(prev, next, messages + size - next);
472  size -= (next - prev);
473  }
474 
475  /* Only return a buffer if the resulting string is not empty as some apps depend on that */
476  if (size <= 1)
477  {
478  ID3DXBuffer_Release(*error_msgs);
479  *error_msgs = NULL;
480  }
481  }
482 
483  return hr;
484 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI D3DXGetShaderConstantTable(const DWORD *byte_code, ID3DXConstantTable **constant_table)
Definition: shader.c:2111
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY
Definition: d3dcompiler.h:51
if SUCCEEDED(hr)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
WDF_DMA_PROFILE profile
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define ID3DXBuffer_GetBufferSize(p)
Definition: d3dx9core.h:86
GLsizeiptr size
Definition: glext.h:5919
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
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
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
static unsigned __int64 next
Definition: rand_nt.c:6
#define ID3DXBuffer_Release(p)
Definition: d3dx9core.h:83
#define NULL
Definition: types.h:112
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
#define ID3DXBuffer_GetBufferPointer(p)
Definition: d3dx9core.h:85

Referenced by D3DXCompileShaderFromResourceA(), and D3DXCompileShaderFromResourceW().

◆ D3DXCompileShaderFromFileA()

HRESULT WINAPI D3DXCompileShaderFromFileA ( const char filename,
const D3DXMACRO defines,
ID3DXInclude *  include,
const char entrypoint,
const char profile,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages,
ID3DXConstantTable **  constant_table 
)

Definition at line 486 of file shader.c.

489 {
490  WCHAR *filename_w;
491  DWORD len;
492  HRESULT ret;
493 
494  TRACE("filename %s, defines %p, include %p, entrypoint %s, profile %s, "
495  "flags %#x, shader %p, error_messages %p, constant_table %p.\n",
496  debugstr_a(filename), defines, include, debugstr_a(entrypoint),
497  debugstr_a(profile), flags, shader, error_messages, constant_table);
498 
499  if (!filename) return D3DXERR_INVALIDDATA;
500 
501  len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0);
502  filename_w = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
503  if (!filename_w) return E_OUTOFMEMORY;
504  MultiByteToWideChar(CP_ACP, 0, filename, -1, filename_w, len);
505 
507  entrypoint, profile, flags,
508  shader, error_messages, constant_table);
509 
510  HeapFree(GetProcessHeap(), 0, filename_w);
511  return ret;
512 }
#define CP_ACP
Definition: compat.h:109
const char * filename
Definition: ioapi.h:135
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table)
Definition: shader.c:514
WDF_DMA_PROFILE profile
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ D3DXCompileShaderFromFileW()

HRESULT WINAPI D3DXCompileShaderFromFileW ( const WCHAR filename,
const D3DXMACRO defines,
ID3DXInclude *  include,
const char entrypoint,
const char profile,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages,
ID3DXConstantTable **  constant_table 
)

Definition at line 514 of file shader.c.

517 {
518  const void *buffer;
519  DWORD len, filename_len;
520  HRESULT hr;
521  struct d3dx_include_from_file include_from_file;
522  char *filename_a;
523 
524  TRACE("filename %s, defines %p, include %p, entrypoint %s, profile %s, "
525  "flags %#x, shader %p, error_messages %p, constant_table %p.\n",
527  flags, shader, error_messages, constant_table);
528 
529  if (!include)
530  {
531  include_from_file.ID3DXInclude_iface.lpVtbl = &d3dx_include_from_file_vtbl;
532  include = &include_from_file.ID3DXInclude_iface;
533  }
534 
535  filename_len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL);
536  filename_a = HeapAlloc(GetProcessHeap(), 0, filename_len * sizeof(char));
537  if (!filename_a)
538  return E_OUTOFMEMORY;
539  WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, filename_len, NULL, NULL);
540 
542  hr = ID3DXInclude_Open(include, D3DXINC_LOCAL, filename_a, NULL, &buffer, &len);
543  if (FAILED(hr))
544  {
546  HeapFree(GetProcessHeap(), 0, filename_a);
547  return D3DXERR_INVALIDDATA;
548  }
549 
550  if (D3DX_SDK_VERSION <= 36)
552 
553  hr = D3DCompile(buffer, len, filename_a, (const D3D_SHADER_MACRO *)defines,
554  (ID3DInclude *)include, entrypoint, profile, flags, 0,
556 
557  if (SUCCEEDED(hr) && constant_table)
559  constant_table);
560 
563  HeapFree(GetProcessHeap(), 0, filename_a);
564  return hr;
565 }
#define ID3DXInclude_Open(p, a, b, c, d, e)
Definition: d3dx9shader.h:303
const struct ID3DXIncludeVtbl d3dx_include_from_file_vtbl
Definition: shader.c:315
#define WideCharToMultiByte
Definition: compat.h:111
HRESULT hr
Definition: shlfolder.c:183
CRITICAL_SECTION from_file_mutex
Definition: shader.c:229
HRESULT WINAPI D3DXGetShaderConstantTable(const DWORD *byte_code, ID3DXConstantTable **constant_table)
Definition: shader.c:2111
#define CP_ACP
Definition: compat.h:109
GLuint buffer
Definition: glext.h:5915
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const char * filename
Definition: ioapi.h:135
#define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY
Definition: d3dcompiler.h:51
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
#define ID3DXInclude_Close(p, a)
Definition: d3dx9shader.h:304
WDF_DMA_PROFILE profile
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
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
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ID3DXBuffer_GetBufferPointer(p)
Definition: d3dx9core.h:85

Referenced by D3DXCompileShaderFromFileA().

◆ D3DXCompileShaderFromResourceA()

HRESULT WINAPI D3DXCompileShaderFromResourceA ( HMODULE  module,
const char resource,
const D3DXMACRO defines,
ID3DXInclude *  include,
const char entrypoint,
const char profile,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages,
ID3DXConstantTable **  constant_table 
)

Definition at line 567 of file shader.c.

570 {
571  void *buffer;
572  HRSRC res;
573  DWORD len;
574 
575  TRACE("module %p, resource %s, defines %p, include %p, entrypoint %s, profile %s, "
576  "flags %#x, shader %p, error_messages %p, constant_table %p.\n",
578  flags, shader, error_messages, constant_table);
579 
580  if (!(res = FindResourceA(module, resource, (const char *)RT_RCDATA)))
581  return D3DXERR_INVALIDDATA;
583  return D3DXERR_INVALIDDATA;
584  return D3DXCompileShader(buffer, len, defines, include, entrypoint, profile,
585  flags, shader, error_messages, constant_table);
586 }
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
GLuint buffer
Definition: glext.h:5915
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:170
WDF_DMA_PROFILE profile
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLbitfield flags
Definition: glext.h:7161
#define RT_RCDATA
Definition: pedump.c:372
GLenum GLsizei len
Definition: glext.h:6722
HRESULT WINAPI D3DXCompileShader(const char *data, UINT length, const D3DXMACRO *defines, ID3DXInclude *include, const char *function, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_msgs, ID3DXConstantTable **constant_table)
Definition: shader.c:421
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
GLuint res
Definition: glext.h:9613

◆ D3DXCompileShaderFromResourceW()

HRESULT WINAPI D3DXCompileShaderFromResourceW ( HMODULE  module,
const WCHAR resource,
const D3DXMACRO defines,
ID3DXInclude *  include,
const char entrypoint,
const char profile,
DWORD  flags,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages,
ID3DXConstantTable **  constant_table 
)

Definition at line 588 of file shader.c.

591 {
592  void *buffer;
593  HRSRC res;
594  DWORD len;
595 
596  TRACE("module %p, resource %s, defines %p, include %p, entrypoint %s, profile %s, "
597  "flags %#x, shader %p, error_messages %p, constant_table %p.\n",
599  flags, shader, error_messages, constant_table);
600 
601  if (!(res = FindResourceW(module, resource, (const WCHAR *)RT_RCDATA)))
602  return D3DXERR_INVALIDDATA;
604  return D3DXERR_INVALIDDATA;
605  return D3DXCompileShader(buffer, len, defines, include, entrypoint, profile,
606  flags, shader, error_messages, constant_table);
607 }
GLuint buffer
Definition: glext.h:5915
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define debugstr_w
Definition: kernel32.h:32
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:170
WDF_DMA_PROFILE profile
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLbitfield flags
Definition: glext.h:7161
#define RT_RCDATA
Definition: pedump.c:372
GLenum GLsizei len
Definition: glext.h:6722
HRESULT WINAPI D3DXCompileShader(const char *data, UINT length, const D3DXMACRO *defines, ID3DXInclude *include, const char *function, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_msgs, ID3DXConstantTable **constant_table)
Definition: shader.c:421
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
GLuint res
Definition: glext.h:9613

◆ D3DXCreateFragmentLinker()

HRESULT WINAPI D3DXCreateFragmentLinker ( IDirect3DDevice9 *  device,
UINT  size,
ID3DXFragmentLinker **  linker 
)

Definition at line 2325 of file shader.c.

2326 {
2327  TRACE("device %p, size %u, linker %p.\n", device, size, linker);
2328 
2329  return D3DXCreateFragmentLinkerEx(device, size, 0, linker);
2330 }
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT WINAPI D3DXCreateFragmentLinkerEx(IDirect3DDevice9 *device, UINT size, DWORD flags, ID3DXFragmentLinker **linker)
Definition: shader.c:2302

Referenced by test_fragment_linker().

◆ D3DXCreateFragmentLinkerEx()

HRESULT WINAPI D3DXCreateFragmentLinkerEx ( IDirect3DDevice9 *  device,
UINT  size,
DWORD  flags,
ID3DXFragmentLinker **  linker 
)

Definition at line 2302 of file shader.c.

2304 {
2305  struct d3dx9_fragment_linker *object;
2306 
2307  TRACE("device %p, size %u, flags %#x, linker %p.\n", device, size, flags, linker);
2308 
2309  object = heap_alloc(sizeof(*object));
2310  if (!object)
2311  return E_OUTOFMEMORY;
2312 
2313  object->ID3DXFragmentLinker_iface.lpVtbl = &d3dx9_fragment_linker_vtbl;
2314  object->ref = 1;
2315 
2317  object->device = device;
2318  object->flags = flags;
2319 
2320  *linker = &object->ID3DXFragmentLinker_iface;
2321 
2322  return S_OK;
2323 }
coclass MSXML2::XSLTemplate40 object
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
FxDevice * device
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
GLbitfield flags
Definition: glext.h:7161
static const struct ID3DXFragmentLinkerVtbl d3dx9_fragment_linker_vtbl
Definition: shader.c:2283
#define S_OK
Definition: intsafe.h:51

Referenced by D3DXCreateFragmentLinker(), and test_fragment_linker().

◆ D3DXCreateTextureShader()

HRESULT WINAPI D3DXCreateTextureShader ( const DWORD function,
ID3DXTextureShader **  texture_shader 
)

Definition at line 2956 of file shader.c.

2957 {
2958  struct d3dx9_texture_shader *object;
2959 
2960  TRACE("function %p, texture_shader %p.\n", function, texture_shader);
2961 
2962  if (!function || !texture_shader)
2963  return D3DERR_INVALIDCALL;
2964 
2965  object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
2966  if (!object)
2967  return E_OUTOFMEMORY;
2968 
2969  object->ID3DXTextureShader_iface.lpVtbl = &d3dx9_texture_shader_vtbl;
2970  object->ref = 1;
2971 
2972  *texture_shader = &object->ID3DXTextureShader_iface;
2973 
2974  return D3D_OK;
2975 }
coclass MSXML2::XSLTemplate40 object
#define D3DERR_INVALIDCALL
static const struct ID3DXTextureShaderVtbl d3dx9_texture_shader_vtbl
Definition: shader.c:2924
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define D3D_OK
Definition: d3d.h:106

Referenced by test_texture_shader().

◆ D3DXDisassembleShader()

HRESULT WINAPI D3DXDisassembleShader ( const DWORD shader,
BOOL  colorcode,
const char comments,
ID3DXBuffer **  disassembly 
)

Definition at line 2645 of file shader.c.

2646 {
2647  DWORD *ptr = (DWORD *)shader;
2648  char *buffer, *buf;
2649  UINT capacity = 4096;
2650  BOOL ps;
2651  WORD version;
2652  HRESULT hr;
2653 
2654  TRACE("%p %d %s %p\n", shader, colorcode, debugstr_a(comments), disassembly);
2655 
2656  if (!shader || !disassembly)
2657  return D3DERR_INVALIDCALL;
2658 
2659  buf = buffer = HeapAlloc(GetProcessHeap(), 0, capacity);
2660  if (!buffer)
2661  return E_OUTOFMEMORY;
2662 
2663  ps = (*ptr >> 16) & 1;
2664  version = *ptr & 0xFFFF;
2665  buf += sprintf(buf, " %s_%d_%d\n", ps ? "ps" : "vs", D3DSHADER_VERSION_MAJOR(*ptr), D3DSHADER_VERSION_MINOR(*ptr));
2666  ptr++;
2667 
2668  while (*ptr != D3DSIO_END)
2669  {
2670  DWORD index;
2671 
2672  if ((buf - buffer + 128) > capacity)
2673  {
2674  UINT count = buf - buffer;
2675  char *new_buffer = HeapReAlloc(GetProcessHeap(), 0, buffer, capacity * 2);
2676  if (!new_buffer)
2677  {
2679  return E_OUTOFMEMORY;
2680  }
2681  capacity *= 2;
2682  buffer = new_buffer;
2683  buf = buffer + count;
2684  }
2685 
2686  for (index = 0; index < sizeof(instructions)/sizeof(instructions[0]); index++)
2687  if (((*ptr & D3DSI_OPCODE_MASK) == instructions[index].opcode) &&
2688  (version >= instructions[index].min_version) && (version <= instructions[index].max_version))
2689  break;
2690 
2691  if (index != sizeof(instructions)/sizeof(instructions[0]))
2692  {
2693  buf += instructions[index].function(&(instructions[index]), &ptr, buf, ps);
2694  }
2695  else
2696  {
2697  buf += sprintf(buf, " ??? (Unknown opcode %x)\n", *ptr);
2698  while (*++ptr & (1u << 31));
2699  }
2700  }
2701 
2702  hr = D3DXCreateBuffer(buf - buffer + 1 , disassembly);
2703  if (SUCCEEDED(hr))
2704  strcpy(ID3DXBuffer_GetBufferPointer(*disassembly), buffer);
2706 
2707  return hr;
2708 }
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 D3DSHADER_VERSION_MAJOR(version)
Definition: d3d8types.h:476
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
HRESULT WINAPI D3DXCreateBuffer(DWORD size, ID3DXBuffer **buffer)
Definition: core.c:131
#define D3DERR_INVALIDCALL
GLuint buffer
Definition: glext.h:5915
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
static PVOID ptr
Definition: dispmode.c:27
const struct instr_info instructions[]
Definition: shader.c:2553
static const WCHAR version[]
Definition: asmname.c:66
GLuint index
Definition: glext.h:6031
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
char comments[4096]
#define HeapReAlloc
Definition: compat.h:593
#define D3DSHADER_VERSION_MINOR(version)
Definition: d3d8types.h:477
unsigned int UINT
Definition: ndis.h:50
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define D3DSI_OPCODE_MASK
Definition: d3d8types.h:306
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ID3DXBuffer_GetBufferPointer(p)
Definition: d3dx9core.h:85

Referenced by test_disassemble_shader().

◆ D3DXFindShaderComment()

HRESULT WINAPI D3DXFindShaderComment ( const DWORD byte_code,
DWORD  fourcc,
const void **  data,
UINT size 
)

Definition at line 150 of file shader.c.

151 {
152  const DWORD *ptr = byte_code;
153  DWORD version;
154 
155  TRACE("byte_code %p, fourcc %x, data %p, size %p\n", byte_code, fourcc, data, size);
156 
157  if (data) *data = NULL;
158  if (size) *size = 0;
159 
160  if (!byte_code) return D3DERR_INVALIDCALL;
161 
162  version = *ptr >> 16;
163  if (version != 0x4658 /* FX */
164  && version != 0x5458 /* TX */
165  && version != 0x7ffe
166  && version != 0x7fff
167  && version != 0xfffe /* VS */
168  && version != 0xffff) /* PS */
169  {
170  WARN("Invalid data supplied\n");
171  return D3DXERR_INVALIDDATA;
172  }
173 
174  while (*++ptr != D3DSIO_END)
175  {
176  /* Check if it is a comment */
178  {
180 
181  /* Check if this is the comment we are looking for */
182  if (*(ptr + 1) == fourcc)
183  {
184  UINT ctab_size = (comment_size - 1) * sizeof(DWORD);
185  const void *ctab_data = ptr + 2;
186  if (size)
187  *size = ctab_size;
188  if (data)
189  *data = ctab_data;
190  TRACE("Returning comment data at %p with size %d\n", ctab_data, ctab_size);
191  return D3D_OK;
192  }
193  ptr += comment_size;
194  }
195  }
196 
197  return S_FALSE;
198 }
#define WARN(fmt,...)
Definition: debug.h:112
#define D3DERR_INVALIDCALL
static PVOID ptr
Definition: dispmode.c:27
#define D3DSI_COMMENTSIZE_SHIFT
Definition: d3d8types.h:479
#define S_FALSE
Definition: winerror.h:2357
static const WCHAR version[]
Definition: asmname.c:66
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define D3DSI_COMMENTSIZE_MASK
Definition: d3d8types.h:480
#define D3D_OK
Definition: d3d.h:106
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define D3DSI_OPCODE_MASK
Definition: d3d8types.h:306

Referenced by D3DXGetShaderConstantTableEx(), D3DXGetShaderSamplers(), and test_find_shader_comment().

◆ D3DXGetPixelShaderProfile()

const char* WINAPI D3DXGetPixelShaderProfile ( struct IDirect3DDevice9 *  device)

Definition at line 43 of file shader.c.

44 {
45  D3DCAPS9 caps;
46 
47  TRACE("device %p\n", device);
48 
49  if (!device) return NULL;
50 
52 
53  switch (caps.PixelShaderVersion)
54  {
55  case D3DPS_VERSION(1, 1):
56  return "ps_1_1";
57 
58  case D3DPS_VERSION(1, 2):
59  return "ps_1_2";
60 
61  case D3DPS_VERSION(1, 3):
62  return "ps_1_3";
63 
64  case D3DPS_VERSION(1, 4):
65  return "ps_1_4";
66 
67  case D3DPS_VERSION(2, 0):
68  if ((caps.PS20Caps.NumTemps>=22) &&
69  (caps.PS20Caps.Caps&D3DPS20CAPS_ARBITRARYSWIZZLE) &&
70  (caps.PS20Caps.Caps&D3DPS20CAPS_GRADIENTINSTRUCTIONS) &&
71  (caps.PS20Caps.Caps&D3DPS20CAPS_PREDICATION) &&
72  (caps.PS20Caps.Caps&D3DPS20CAPS_NODEPENDENTREADLIMIT) &&
73  (caps.PS20Caps.Caps&D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT))
74  {
75  return "ps_2_a";
76  }
77  if ((caps.PS20Caps.NumTemps>=32) &&
79  {
80  return "ps_2_b";
81  }
82  return "ps_2_0";
83 
84  case D3DPS_VERSION(3, 0):
85  return "ps_3_0";
86  }
87 
88  return NULL;
89 }
D3DPSHADERCAPS2_0 PS20Caps
Definition: d3d9caps.h:327
#define D3DPS20CAPS_GRADIENTINSTRUCTIONS
Definition: d3d9caps.h:226
return
Definition: dirsup.c:529
#define D3DPS20CAPS_PREDICATION
Definition: d3d9caps.h:227
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define D3DPS_VERSION(major, minor)
Definition: d3d8types.h:474
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define D3DPS20CAPS_NODEPENDENTREADLIMIT
Definition: d3d9caps.h:228
#define D3DPS20CAPS_ARBITRARYSWIZZLE
Definition: d3d9caps.h:225
DWORD PixelShaderVersion
Definition: d3d9caps.h:315
#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
Definition: d3d9caps.h:229
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
#define NULL
Definition: types.h:112

◆ D3DXGetShaderConstantTable()

HRESULT WINAPI D3DXGetShaderConstantTable ( const DWORD byte_code,
ID3DXConstantTable **  constant_table 
)

Definition at line 2111 of file shader.c.

2112 {
2113  TRACE("(%p, %p): Forwarded to D3DXGetShaderConstantTableEx\n", byte_code, constant_table);
2114 
2115  return D3DXGetShaderConstantTableEx(byte_code, 0, constant_table);
2116 }
HRESULT WINAPI D3DXGetShaderConstantTableEx(const DWORD *byte_code, DWORD flags, ID3DXConstantTable **constant_table)
Definition: shader.c:1993
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by compile_pixel_shader9(), D3DXCompileShader(), D3DXCompileShaderFromFileW(), get_constants_desc(), test_constant_table(), test_get_sampler_index(), test_get_shader_constant_variables(), test_registerset(), test_registerset_defaults(), test_SetDefaults(), test_setting_arrays_table(), test_setting_basic_table(), test_setting_matrices_table(), and test_SetValue().

◆ D3DXGetShaderConstantTableEx()

HRESULT WINAPI D3DXGetShaderConstantTableEx ( const DWORD byte_code,
DWORD  flags,
ID3DXConstantTable **  constant_table 
)

Definition at line 1993 of file shader.c.

1994 {
1995  struct ID3DXConstantTableImpl *object = NULL;
1996  const void *data;
1997  HRESULT hr;
1998  UINT size;
1999  const D3DXSHADER_CONSTANTTABLE *ctab_header;
2000  const D3DXSHADER_CONSTANTINFO *constant_info;
2001  DWORD i;
2002 
2003  TRACE("byte_code %p, flags %x, constant_table %p\n", byte_code, flags, constant_table);
2004 
2005  if (constant_table) *constant_table = NULL;
2006 
2007  if (!byte_code || !constant_table)
2008  {
2009  WARN("Invalid argument specified.\n");
2010  return D3DERR_INVALIDCALL;
2011  }
2012 
2013  if (!is_valid_bytecode(*byte_code))
2014  {
2015  WARN("Invalid byte_code specified.\n");
2016  return D3D_OK;
2017  }
2018 
2019  if (flags) FIXME("Flags (%#x) are not handled, yet!\n", flags);
2020 
2021  hr = D3DXFindShaderComment(byte_code, MAKEFOURCC('C','T','A','B'), &data, &size);
2022  if (hr != D3D_OK)
2023  {
2024  WARN("CTAB not found.\n");
2025  return D3DXERR_INVALIDDATA;
2026  }
2027 
2028  if (size < sizeof(*ctab_header))
2029  {
2030  WARN("Invalid CTAB size.\n");
2031  return D3DXERR_INVALIDDATA;
2032  }
2033 
2034  ctab_header = (const D3DXSHADER_CONSTANTTABLE *)data;
2035  if (ctab_header->Size != sizeof(*ctab_header))
2036  {
2037  WARN("Invalid D3DXSHADER_CONSTANTTABLE size.\n");
2038  return D3DXERR_INVALIDDATA;
2039  }
2040 
2041  object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
2042  if (!object)
2043  return E_OUTOFMEMORY;
2044 
2045  object->ID3DXConstantTable_iface.lpVtbl = &ID3DXConstantTable_Vtbl;
2046  object->ref = 1;
2047 
2048  object->ctab = HeapAlloc(GetProcessHeap(), 0, size);
2049  if (!object->ctab)
2050  {
2051  ERR("Out of memory\n");
2052  HeapFree(GetProcessHeap(), 0, object);
2053  return E_OUTOFMEMORY;
2054  }
2055  object->size = size;
2056  memcpy(object->ctab, data, object->size);
2057 
2058  object->desc.Creator = ctab_header->Creator ? object->ctab + ctab_header->Creator : NULL;
2059  object->desc.Version = ctab_header->Version;
2060  object->desc.Constants = ctab_header->Constants;
2061  TRACE("Creator %s, Version %x, Constants %u, Target %s\n",
2062  debugstr_a(object->desc.Creator), object->desc.Version, object->desc.Constants,
2063  debugstr_a(ctab_header->Target ? object->ctab + ctab_header->Target : NULL));
2064 
2065  object->constants = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
2066  sizeof(*object->constants) * object->desc.Constants);
2067  if (!object->constants)
2068  {
2069  ERR("Out of memory\n");
2070  hr = E_OUTOFMEMORY;
2071  goto error;
2072  }
2073 
2074  constant_info = (const D3DXSHADER_CONSTANTINFO *)(object->ctab + ctab_header->ConstantInfo);
2075  for (i = 0; i < ctab_header->Constants; i++)
2076  {
2077  DWORD offset = constant_info[i].DefaultValue;
2078 
2079  hr = parse_ctab_constant_type(object->ctab, constant_info[i].TypeInfo,
2080  &object->constants[i], FALSE, constant_info[i].RegisterIndex,
2081  constant_info[i].RegisterIndex + constant_info[i].RegisterCount,
2082  offset ? &offset : NULL, constant_info[i].Name, constant_info[i].RegisterSet);
2083  if (hr != D3D_OK)
2084  goto error;
2085 
2086  /*
2087  * Set the register count, it may differ for D3DXRS_INT4, because somehow
2088  * it makes the assumption that the register size is 1 instead of 4, so the
2089  * count is 4 times bigger. This holds true only for toplevel shader
2090  * constants. The count of elements and members is always based on a
2091  * register size of 4.
2092  */
2093  if (object->constants[i].desc.RegisterSet == D3DXRS_INT4)
2094  {
2095  object->constants[i].desc.RegisterCount = constant_info[i].RegisterCount;
2096  }
2097  object->constants[i].constantinfo_reserved = constant_info[i].Reserved;
2098  }
2099 
2100  *constant_table = &object->ID3DXConstantTable_iface;
2101 
2102  return D3D_OK;
2103 
2104 error:
2105  free_constant_table(object);
2106  HeapFree(GetProcessHeap(), 0, object);
2107 
2108  return hr;
2109 }
static void free_constant_table(struct ID3DXConstantTableImpl *table)
Definition: shader.c:747
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
#define WARN(fmt,...)
Definition: debug.h:112
#define D3DERR_INVALIDCALL
HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const void **data, UINT *size)
Definition: shader.c:150
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
static const struct ID3DXConstantTableVtbl ID3DXConstantTable_Vtbl
Definition: shader.c:1821
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
GLintptr offset
Definition: glext.h:5920
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
static BOOL is_valid_bytecode(DWORD token)
Definition: shader.c:38
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:110
#define D3D_OK
Definition: d3d.h:106
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, struct ctab_constant *constant, BOOL is_element, WORD index, WORD max_index, DWORD *offset, DWORD nameoffset, UINT regset)
Definition: shader.c:1855
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define MAKEFOURCC(ch0, ch1, ch2, ch3)
Definition: dmdls.h:24
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by D3DXGetShaderConstantTable(), and test_get_shader_constant_table_ex().

◆ D3DXGetShaderInputSemantics()

HRESULT WINAPI D3DXGetShaderInputSemantics ( const DWORD byte_code,
D3DXSEMANTIC semantics,
UINT count 
)

Definition at line 3211 of file shader.c.

3212 {
3213  TRACE("byte_code %p, semantics %p, count %p.\n", byte_code, semantics, count);
3214 
3215  return get_shader_semantics(byte_code, semantics, count, FALSE);
3216 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count, BOOL output)
Definition: shader.c:3010

Referenced by test_shader_semantics().

◆ D3DXGetShaderOutputSemantics()

HRESULT WINAPI D3DXGetShaderOutputSemantics ( const DWORD byte_code,
D3DXSEMANTIC semantics,
UINT count 
)

Definition at line 3218 of file shader.c.

3219 {
3220  TRACE("byte_code %p, semantics %p, count %p.\n", byte_code, semantics, count);
3221 
3222  return get_shader_semantics(byte_code, semantics, count, TRUE);
3223 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count, BOOL output)
Definition: shader.c:3010

Referenced by test_shader_semantics().

◆ D3DXGetShaderSamplers()

HRESULT WINAPI D3DXGetShaderSamplers ( const DWORD byte_code,
const char **  samplers,
UINT count 
)

Definition at line 2332 of file shader.c.

2333 {
2334  UINT i, sampler_count = 0;
2335  UINT size;
2336  const char *data;
2337  const D3DXSHADER_CONSTANTTABLE *ctab_header;
2338  const D3DXSHADER_CONSTANTINFO *constant_info;
2339 
2340  TRACE("byte_code %p, samplers %p, count %p\n", byte_code, samplers, count);
2341 
2342  if (count) *count = 0;
2343 
2344  if (D3DXFindShaderComment(byte_code, MAKEFOURCC('C','T','A','B'), (const void **)&data, &size) != D3D_OK)
2345  return D3D_OK;
2346 
2347  if (size < sizeof(*ctab_header)) return D3D_OK;
2348 
2349  ctab_header = (const D3DXSHADER_CONSTANTTABLE *)data;
2350  if (ctab_header->Size != sizeof(*ctab_header)) return D3D_OK;
2351 
2352  constant_info = (const D3DXSHADER_CONSTANTINFO *)(data + ctab_header->ConstantInfo);
2353  for (i = 0; i < ctab_header->Constants; i++)
2354  {
2355  const D3DXSHADER_TYPEINFO *type;
2356 
2357  TRACE("name = %s\n", data + constant_info[i].Name);
2358 
2359  type = (const D3DXSHADER_TYPEINFO *)(data + constant_info[i].TypeInfo);
2360 
2361  if (type->Type == D3DXPT_SAMPLER
2362  || type->Type == D3DXPT_SAMPLER1D
2363  || type->Type == D3DXPT_SAMPLER2D
2364  || type->Type == D3DXPT_SAMPLER3D
2365  || type->Type == D3DXPT_SAMPLERCUBE)
2366  {
2367  if (samplers) samplers[sampler_count] = data + constant_info[i].Name;
2368 
2369  ++sampler_count;
2370  }
2371  }
2372 
2373  TRACE("Found %u samplers\n", sampler_count);
2374 
2375  if (count) *count = sampler_count;
2376 
2377  return D3D_OK;
2378 }
__in WDFOBJECT __in PCWDF_OBJECT_CONTEXT_TYPE_INFO TypeInfo
Definition: handleapi.cpp:601
GLuint GLuint GLsizei count
Definition: gl.h:1545
HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const void **data, UINT *size)
Definition: shader.c:150
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define D3D_OK
Definition: d3d.h:106
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
unsigned int UINT
Definition: ndis.h:50
GLuint * samplers
Definition: glext.h:7280
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define MAKEFOURCC(ch0, ch1, ch2, ch3)
Definition: dmdls.h:24

Referenced by test_get_shader_samplers().

◆ D3DXGetShaderSize()

UINT WINAPI D3DXGetShaderSize ( const DWORD byte_code)

Definition at line 91 of file shader.c.

92 {
93  const DWORD *ptr = byte_code;
94 
95  TRACE("byte_code %p\n", byte_code);
96 
97  if (!ptr) return 0;
98 
99  /* Look for the END token, skipping the VERSION token */
100  while (*++ptr != D3DSIO_END)
101  {
102  /* Skip comments */
104  {
106  }
107  }
108  ++ptr;
109 
110  /* Return the shader size in bytes */
111  return (ptr - byte_code) * sizeof(*ptr);
112 }
static PVOID ptr
Definition: dispmode.c:27
#define D3DSI_COMMENTSIZE_SHIFT
Definition: d3d8types.h:479
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define D3DSI_COMMENTSIZE_MASK
Definition: d3d8types.h:480
#define D3DSI_OPCODE_MASK
Definition: d3d8types.h:306

Referenced by test_get_shader_size().

◆ D3DXGetShaderVersion()

DWORD WINAPI D3DXGetShaderVersion ( const DWORD byte_code)

Definition at line 114 of file shader.c.

115 {
116  TRACE("byte_code %p\n", byte_code);
117 
118  return byte_code ? *byte_code : 0;
119 }
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by test_get_shader_version().

◆ D3DXGetVertexShaderProfile()

const char* WINAPI D3DXGetVertexShaderProfile ( struct IDirect3DDevice9 *  device)

Definition at line 121 of file shader.c.

122 {
123  D3DCAPS9 caps;
124 
125  TRACE("device %p\n", device);
126 
127  if (!device) return NULL;
128 
130 
131  switch (caps.VertexShaderVersion)
132  {
133  case D3DVS_VERSION(1, 1):
134  return "vs_1_1";
135  case D3DVS_VERSION(2, 0):
136  if ((caps.VS20Caps.NumTemps>=13) &&
137  (caps.VS20Caps.DynamicFlowControlDepth==24) &&
138  (caps.VS20Caps.Caps&D3DPS20CAPS_PREDICATION))
139  {
140  return "vs_2_a";
141  }
142  return "vs_2_0";
143  case D3DVS_VERSION(3, 0):
144  return "vs_3_0";
145  }
146 
147  return NULL;
148 }
return
Definition: dirsup.c:529
#define D3DPS20CAPS_PREDICATION
Definition: d3d9caps.h:227
DWORD VertexShaderVersion
Definition: d3d9caps.h:313
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define D3DVS_VERSION(major, minor)
Definition: d3d8types.h:475
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
#define NULL
Definition: types.h:112

◆ D3DXPreprocessShader()

HRESULT WINAPI D3DXPreprocessShader ( const char data,
UINT  data_len,
const D3DXMACRO defines,
ID3DXInclude *  include,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 609 of file shader.c.

611 {
612  TRACE("data %s, data_len %u, defines %p, include %p, shader %p, error_messages %p.\n",
614 
615  return D3DPreprocess(data, data_len, NULL,
618 }
HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages)
Definition: compiler.c:902
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
#define debugstr_a
Definition: kernel32.h:31
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define NULL
Definition: types.h:112
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30

Referenced by D3DXPreprocessShaderFromResourceA(), and D3DXPreprocessShaderFromResourceW().

◆ D3DXPreprocessShaderFromFileA()

HRESULT WINAPI D3DXPreprocessShaderFromFileA ( const char filename,
const D3DXMACRO defines,
ID3DXInclude *  include,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 620 of file shader.c.

622 {
623  WCHAR *filename_w = NULL;
624  DWORD len;
625  HRESULT ret;
626 
627  TRACE("filename %s, defines %p, include %p, shader %p, error_messages %p.\n",
629 
630  if (!filename) return D3DXERR_INVALIDDATA;
631 
632  len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0);
633  filename_w = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
634  if (!filename_w) return E_OUTOFMEMORY;
635  MultiByteToWideChar(CP_ACP, 0, filename, -1, filename_w, len);
636 
638 
639  HeapFree(GetProcessHeap(), 0, filename_w);
640  return ret;
641 }
#define CP_ACP
Definition: compat.h:109
const char * filename
Definition: ioapi.h:135
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
int ret
GLenum GLsizei len
Definition: glext.h:6722
HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
Definition: shader.c:643
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by d3dxpreprocess_test().

◆ D3DXPreprocessShaderFromFileW()

HRESULT WINAPI D3DXPreprocessShaderFromFileW ( const WCHAR filename,
const D3DXMACRO defines,
ID3DXInclude *  include,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 643 of file shader.c.

645 {
646  const void *buffer;
647  DWORD len;
648  HRESULT hr;
649  struct d3dx_include_from_file include_from_file;
650  char *filename_a;
651 
652  TRACE("filename %s, defines %p, include %p, shader %p, error_messages %p.\n",
654 
655  if (!include)
656  {
657  include_from_file.ID3DXInclude_iface.lpVtbl = &d3dx_include_from_file_vtbl;
658  include = &include_from_file.ID3DXInclude_iface;
659  }
660 
662  filename_a = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
663  if (!filename_a)
664  return E_OUTOFMEMORY;
665  WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL);
666 
668  hr = ID3DXInclude_Open(include, D3DXINC_LOCAL, filename_a, NULL, &buffer, &len);
669  if (FAILED(hr))
670  {
672  HeapFree(GetProcessHeap(), 0, filename_a);
673  return D3DXERR_INVALIDDATA;
674  }
675 
677  (const D3D_SHADER_MACRO *)defines,
678  (ID3DInclude *) include,
680 
683  HeapFree(GetProcessHeap(), 0, filename_a);
684  return hr;
685 }
#define ID3DXInclude_Open(p, a, b, c, d, e)
Definition: d3dx9shader.h:303
const struct ID3DXIncludeVtbl d3dx_include_from_file_vtbl
Definition: shader.c:315
#define WideCharToMultiByte
Definition: compat.h:111
HRESULT hr
Definition: shlfolder.c:183
CRITICAL_SECTION from_file_mutex
Definition: shader.c:229
#define CP_ACP
Definition: compat.h:109
GLuint buffer
Definition: glext.h:5915
HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages)
Definition: compiler.c:902
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const char * filename
Definition: ioapi.h:135
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define ID3DXInclude_Close(p, a)
Definition: d3dx9shader.h:304
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by d3dxpreprocess_test(), and D3DXPreprocessShaderFromFileA().

◆ D3DXPreprocessShaderFromResourceA()

HRESULT WINAPI D3DXPreprocessShaderFromResourceA ( HMODULE  module,
const char resource,
const D3DXMACRO defines,
ID3DXInclude *  include,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 687 of file shader.c.

689 {
690  void *buffer;
691  HRSRC res;
692  DWORD len;
693 
694  TRACE("module %p, resource %s, defines %p, include %p, shader %p, error_messages %p.\n",
696 
697  if (!(res = FindResourceA(module, resource, (const char *)RT_RCDATA)))
698  return D3DXERR_INVALIDDATA;
700  return D3DXERR_INVALIDDATA;
703 }
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
GLuint buffer
Definition: glext.h:5915
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:170
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
#define RT_RCDATA
Definition: pedump.c:372
HRESULT WINAPI D3DXPreprocessShader(const char *data, UINT data_len, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
Definition: shader.c:609
GLenum GLsizei len
Definition: glext.h:6722
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
GLuint res
Definition: glext.h:9613

Referenced by d3dxpreprocess_test().

◆ D3DXPreprocessShaderFromResourceW()

HRESULT WINAPI D3DXPreprocessShaderFromResourceW ( HMODULE  module,
const WCHAR resource,
const D3DXMACRO defines,
ID3DXInclude *  include,
ID3DXBuffer **  shader,
ID3DXBuffer **  error_messages 
)

Definition at line 705 of file shader.c.

707 {
708  void *buffer;
709  HRSRC res;
710  DWORD len;
711 
712  TRACE("module %p, resource %s, defines %p, include %p, shader %p, error_messages %p.\n",
714 
715  if (!(res = FindResourceW(module, resource, (const WCHAR *)RT_RCDATA)))
716  return D3DXERR_INVALIDDATA;
718  return D3DXERR_INVALIDDATA;
721 
722 }
GLuint buffer
Definition: glext.h:5915
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define debugstr_w
Definition: kernel32.h:32
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:170
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: asm.c:30
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: asm.c:30
#define RT_RCDATA
Definition: pedump.c:372
HRESULT WINAPI D3DXPreprocessShader(const char *data, UINT data_len, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages)
Definition: shader.c:609
GLenum GLsizei len
Definition: glext.h:6722
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: asm.c:30
GLuint res
Definition: glext.h:9613

◆ free_constant()

static void free_constant ( struct ctab_constant constant)
static

Definition at line 733 of file shader.c.

734 {
735  if (constant->constants)
736  {
737  UINT i, count = constant->desc.Elements > 1 ? constant->desc.Elements : constant->desc.StructMembers;
738 
739  for (i = 0; i < count; ++i)
740  {
741  free_constant(&constant->constants[i]);
742  }
743  HeapFree(GetProcessHeap(), 0, constant->constants);
744  }
745 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define GetProcessHeap()
Definition: compat.h:595
static void free_constant(struct ctab_constant *constant)
Definition: shader.c:733
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
unsigned int UINT
Definition: ndis.h:50
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by free_constant_table(), and parse_ctab_constant_type().

◆ free_constant_table()

static void free_constant_table ( struct ID3DXConstantTableImpl table)
static

Definition at line 747 of file shader.c.

748 {
749  if (table->constants)
750  {
751  UINT i;
752 
753  for (i = 0; i < table->desc.Constants; ++i)
754  {
755  free_constant(&table->constants[i]);
756  }
757  HeapFree(GetProcessHeap(), 0, table->constants);
758  }
759  HeapFree(GetProcessHeap(), 0, table->ctab);
760 }
#define GetProcessHeap()
Definition: compat.h:595
static void free_constant(struct ctab_constant *constant)
Definition: shader.c:733
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
unsigned int UINT
Definition: ndis.h:50
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by D3DXGetShaderConstantTableEx(), and ID3DXConstantTableImpl_Release().

◆ get_constant_by_name()

static struct ctab_constant * get_constant_by_name ( struct ID3DXConstantTableImpl table,
struct ctab_constant constant,
const char name 
)
static

Definition at line 818 of file shader.c.

820 {
821  UINT i, count, length;
822  struct ctab_constant *handles;
823  const char *part;
824 
825  TRACE("table %p, constant %p, name %s\n", table, constant, debugstr_a(name));
826 
827  if (!name || !*name) return NULL;
828 
829  if (!constant)
830  {
831  count = table->desc.Constants;
832  handles = table->constants;
833  }
834  else
835  {
836  count = constant->desc.StructMembers;
837  handles = constant->constants;
838  }
839 
840  length = strcspn(name, "[.");
841  part = name + length;
842 
843  for (i = 0; i < count; i++)
844  {
846  {
847  switch (*part++)
848  {
849  case '.':
850  return get_constant_by_name(NULL, &handles[i], part);
851 
852  case '[':
853  return get_constant_element_by_name(&handles[i], part);
854 
855  default:
856  TRACE("Returning parameter %p\n", &handles[i]);
857  return &handles[i];
858  }
859  }
860  }
861 
862  TRACE("Constant not found\n");
863  return NULL;
864 }
static struct object_header ** handles
Definition: handle.c:45
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static struct ctab_constant * get_constant_by_name(struct ID3DXConstantTableImpl *table, struct ctab_constant *constant, const char *name)
Definition: shader.c:818
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
GLuint GLuint GLsizei count
Definition: gl.h:1545
D3DXCONSTANT_DESC desc
Definition: shader.c:1767
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
const char * Name
Definition: d3dx9shader.h:105
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
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static struct ctab_constant * get_constant_element_by_name(struct ctab_constant *constant, const char *name)
Definition: shader.c:780
Definition: name.c:38

Referenced by get_constant_element_by_name(), get_valid_constant(), and ID3DXConstantTableImpl_GetConstantByName().

◆ get_constant_element_by_name()

static