40 return (
token & 0xfffe0000) == 0xfffe0000;
95 TRACE(
"byte_code %p\n", byte_code);
111 return (
ptr - byte_code) *
sizeof(*ptr);
116 TRACE(
"byte_code %p\n", byte_code);
118 return byte_code ? *byte_code : 0;
155 TRACE(
"byte_code %p, fourcc %x, data %p, size %p\n", byte_code, fourcc,
data,
size);
170 WARN(
"Invalid data supplied\n");
182 if (*(
ptr + 1) == fourcc)
184 UINT ctab_size = (comment_size - 1) *
sizeof(
DWORD);
185 const void *ctab_data =
ptr + 2;
190 TRACE(
"Returning comment data at %p with size %d\n", ctab_data, ctab_size);
205 TRACE(
"data %p, data_len %u, defines %p, include %p, flags %#x, shader %p, error_messages %p\n",
227 0, 0, {(
DWORD_PTR)(__FILE__
": from_file_mutex")}
239 const char *
p, *parent_name =
"";
247 parent_name = *((
const char **)parent_data - 1);
257 if ((
p =
strrchr(parent_name,
'\\')))
328 TRACE(
"filename %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n",
353 TRACE(
"filename %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n",
392 TRACE(
"module %p, resource %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n",
410 TRACE(
"module %p, resource %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n",
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",
467 while (prev >
messages && *(prev - 1) !=
'\n') prev--;
494 TRACE(
"filename %s, defines %p, include %p, entrypoint %s, profile %s, "
495 "flags %#x, shader %p, error_messages %p, constant_table %p.\n",
524 TRACE(
"filename %s, defines %p, include %p, entrypoint %s, profile %s, "
525 "flags %#x, shader %p, error_messages %p, constant_table %p.\n",
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",
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",
612 TRACE(
"data %s, data_len %u, defines %p, include %p, shader %p, error_messages %p.\n",
627 TRACE(
"filename %s, defines %p, include %p, shader %p, error_messages %p.\n",
652 TRACE(
"filename %s, defines %p, include %p, shader %p, error_messages %p.\n",
694 TRACE(
"module %p, resource %s, defines %p, include %p, shader %p, error_messages %p.\n",
712 TRACE(
"module %p, resource %s, defines %p, include %p, shader %p, error_messages %p.\n",
749 if (
table->constants)
753 for (
i = 0;
i <
table->desc.Constants; ++
i)
769 return (
version & 0xffff0000) == 0xfffe0000;
805 TRACE(
"Returning parameter %p\n",
c);
809 FIXME(
"Unhandled case \"%c\"\n", *--part);
814 TRACE(
"Constant not found\n");
862 TRACE(
"Constant not found\n");
894 for (
i = 0;
i <
table->desc.Constants; ++
i)
897 return &
table->constants[
i];
955 TRACE(
"iface %p.\n", iface);
1001 WARN(
"Invalid argument specified\n");
1020 WARN(
"Invalid argument specified\n");
1024 TRACE(
"Returning RegisterIndex %u\n",
c->desc.RegisterIndex);
1025 return c->desc.RegisterIndex;
1038 if (
c && index < c->
desc.StructMembers)
1041 TRACE(
"Returning constant %p\n",
c);
1047 if (index < This->
desc.Constants)
1050 TRACE(
"Returning constant %p\n",
c);
1055 WARN(
"Index out of range\n");
1068 TRACE(
"Returning constant %p\n",
c);
1080 if (
c && index < c->
desc.Elements)
1082 if (
c->desc.Elements > 1)
c = &
c->constants[
index];
1083 TRACE(
"Returning constant %p\n",
c);
1087 WARN(
"Invalid argument specified\n");
1111 if (*size < desc->
Rows *
desc->Columns)
1129 if (
desc->Elements > 1)
1164 for (
i = 0;
i <
desc->StructMembers; ++
i)
1181 for (
i = 1;
i <
desc->StructMembers; ++
i)
1188 for (
i = 0;
i <
desc->StructMembers; ++
i)
1200 if (
desc->Elements > 1)
1218 switch (
desc->Class)
1226 regsize =
desc->Columns;
1230 regcount =
min(
desc->RegisterCount,
desc->Columns);
1233 regsize =
desc->Rows;
1250 switch (
desc->Class)
1253 if (*
size < regcount * 4)
1259 *
size -= 4 * regcount;
1264 *
size -= 4 * regcount;
1284 switch (
desc->Class)
1312 switch (
desc->Class)
1345 switch (
desc->RegisterSet)
1350 for (
i = 0;
i < regcount; ++
i)
1362 if (++
l >= regsize)
l = 0;
1367 for (
i = 0;
i < regcount; ++
i)
1369 INT vec[4] = {0, 0, 1, 0};
1371 for (
l = 0;
l < regsize; ++
l)
1386 for (
i = 0;
i < regcount; ++
i)
1390 for (
l = 0;
l < regsize; ++
l)
1418 WARN(
"Invalid argument specified\n");
1422 switch (
c->desc.Class)
1447 WARN(
"Invalid argument specified\n");
1451 switch (
c->desc.Class)
1475 WARN(
"Invalid argument specified\n");
1479 switch (
c->desc.Class)
1504 WARN(
"Invalid argument specified\n");
1508 switch (
c->desc.Class)
1532 WARN(
"Invalid argument specified\n");
1536 switch (
c->desc.Class)
1561 WARN(
"Invalid argument specified\n");
1565 switch (
c->desc.Class)
1584 struct IDirect3DDevice9 *
device)
1593 WARN(
"Invalid argument specified\n");
1597 for (
i = 0;
i <
This->desc.Constants;
i++)
1602 if (!
desc->DefaultValue)
1605 switch (
desc->RegisterSet)
1610 desc->RegisterCount);
1613 desc->RegisterCount);
1619 desc->RegisterCount);
1622 desc->RegisterCount);
1628 desc->RegisterCount);
1631 desc->RegisterCount);
1658 WARN(
"Invalid argument specified\n");
1664 switch (
desc->Class)
1869 constant->desc.Elements = is_element ? 1 :
type->Elements;
1871 constant->desc.Name = ctab + nameoffset;
1875 TRACE(
"name %s, elements %u, index %u, defaultvalue %p, regset %s\n",
constant->desc.Name,
1878 TRACE(
"class %s, type %s, rows %d, columns %d, elements %d, struct_members %d\n",
1882 if (
type->Elements > 1 && !is_element)
1897 ERR(
"Out of memory\n");
1906 memberinfo ? memberinfo[
i].
Name : nameoffset,
regset);
1929 switch (
type->Class)
1935 offsetdiff =
type->Rows * 4;
1939 offsetdiff =
type->Rows * 4;
1944 offsetdiff =
type->Columns * 4;
2003 TRACE(
"byte_code %p, flags %x, constant_table %p\n", byte_code,
flags, constant_table);
2005 if (constant_table) *constant_table =
NULL;
2007 if (!byte_code || !constant_table)
2009 WARN(
"Invalid argument specified.\n");
2015 WARN(
"Invalid byte_code specified.\n");
2024 WARN(
"CTAB not found.\n");
2028 if (
size <
sizeof(*ctab_header))
2030 WARN(
"Invalid CTAB size.\n");
2035 if (ctab_header->
Size !=
sizeof(*ctab_header))
2037 WARN(
"Invalid D3DXSHADER_CONSTANTTABLE size.\n");
2051 ERR(
"Out of memory\n");
2055 object->size =
size;
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",
2069 ERR(
"Out of memory\n");
2095 object->constants[
i].desc.RegisterCount = constant_info[
i].
RegisterCount;
2097 object->constants[
i].constantinfo_reserved = constant_info[
i].
Reserved;
2100 *constant_table = &
object->ID3DXConstantTable_iface;
2113 TRACE(
"(%p, %p): Forwarded to D3DXGetShaderConstantTableEx\n", byte_code, constant_table);
2139 iface->lpVtbl->AddRef(iface);
2154 TRACE(
"%p increasing refcount to %u.\n", linker, refcount);
2164 TRACE(
"%p decreasing refcount to %u.\n", linker, refcount);
2183 WARN(
"Invalid argument supplied.\n");
2196 FIXME(
"iface %p: stub.\n", iface);
2203 FIXME(
"iface %p, index %u: stub.\n", iface,
index);
2219 FIXME(
"iface %p, name %p, desc %p: stub.\n", iface,
name,
desc);
2226 FIXME(
"iface %p, fragments %p: stub.\n", iface, fragments);
2233 FIXME(
"iface %p, buffer %p: stub.\n", iface,
buffer);
2250 FIXME(
"iface %p, profile %s, flags %#x, handles %p, fragment_count %u, buffer %p, errors %p: stub.\n",
2260 FIXME(
"iface %p, profile %s, flags %#x, handles %p, fragment_count %u, shader %p, errors %p: stub.\n",
2270 FIXME(
"iface %p, profile %s, flags %#x, handles %p, fragment_count %u, shader %p, errors %p: stub.\n",
2278 FIXME(
"iface %p: stub.\n", iface);
2303 ID3DXFragmentLinker **linker)
2318 object->flags =
flags;
2320 *linker = &
object->ID3DXFragmentLinker_iface;
2334 UINT i, sampler_count = 0;
2347 if (
size <
sizeof(*ctab_header))
return D3D_OK;
2350 if (ctab_header->
Size !=
sizeof(*ctab_header))
return D3D_OK;
2373 TRACE(
"Found %u samplers\n", sampler_count);
2381static const char *
decl_usage[] = {
"position",
"blendweight",
"blendindices",
"normal",
"psize",
"texcoord",
2382 "tangent",
"binormal",
"tessfactor",
"positiont",
"color" };
2384static const char *
tex_type[] = {
"",
"1d",
"2d",
"cube",
"volume" };
2478 (
double)*(
float*)(*
ptr+2), (
double)*(
float*)(*
ptr+3),
2479 (
double)*(
float*)(*
ptr+4), (
double)*(
float*)(*
ptr+5));
2526 for (
j = 0;
j <
info->length;
j++)
2649 UINT capacity = 4096;
2656 if (!
shader || !disassembly)
2663 ps = (*
ptr >> 16) & 1;
2698 while (*++
ptr & (1u << 31));
2728 iface->lpVtbl->AddRef(iface);
2743 TRACE(
"%p increasing refcount to %u.\n", texture_shader, refcount);
2753 TRACE(
"%p decreasing refcount to %u.\n", texture_shader, refcount);
2765 FIXME(
"iface %p, function %p stub.\n", iface, function);
2772 FIXME(
"iface %p, constant_buffer %p stub.\n", iface, constant_buffer);
2779 FIXME(
"iface %p, desc %p stub.\n", iface,
desc);
2786 FIXME(
"iface %p, constant %p, constant_desc %p, count %p stub.\n", iface,
constant, constant_desc,
count);
2814 FIXME(
"iface %p stub.\n", iface);
2828 FIXME(
"iface %p, constant %p, b %u stub.\n", iface,
constant,
b);
2842 FIXME(
"iface %p, constant %p, n %d stub.\n", iface,
constant,
n);
2856 FIXME(
"iface %p, constant %p, f %f stub.\n", iface,
constant,
f);
2960 TRACE(
"function %p, texture_shader %p.\n", function, texture_shader);
2962 if (!function || !texture_shader)
2972 *texture_shader = &
object->ID3DXTextureShader_iface;
2979 DWORD opcode = *byte_code & 0xffff;
2980 unsigned int len = 0;
2991 ERR(
"Unexpected END token.\n");
3000 while (*byte_code & 0x80000000)
3032 BOOL is_ps = version_token >> 16 == 0xffff;
3034 BYTE colors = 0, rastout = 0;
3038 if ((version_token & 0xffff0000) != 0xfffe0000 && (version_token & 0xffff0000) != 0xffff0000)
3041 major = version_token >> 8 & 0xff;
3042 minor = version_token & 0xff;
3044 TRACE(
"%s shader, version %u.%u.\n", is_ps ?
"Pixel" :
"Vertex",
major,
minor);
3047 has_dcl = (!is_ps && (!output ||
major == 3)) || (is_ps && !output &&
major >= 2);
3051 if (has_dcl && (*byte_code & 0xffff) ==
D3DSIO_DCL)
3053 DWORD usage_token = byte_code[1];
3059 if (is_ps && !output &&
major == 2)
3095 switch (*byte_code & 0xffff)
3105 while (*byte_code & 0x80000000)
3120 rastout |= 1u <<
index;
3124 texcoords |= 1u <<
index;
3126 colors |= 1u <<
index;
3177 WARN(
"Invalid RASTOUT register index.\n");
3213 TRACE(
"byte_code %p, semantics %p, count %p.\n", byte_code, semantics,
count);
3220 TRACE(
"byte_code %p, semantics %p, count %p.\n", byte_code, semantics,
count);
char * strstr(char *String1, char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
char * strchr(const char *String, int ch)
static unsigned char bytes[4]
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages)
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)
#define D3DXERR_INVALIDDATA
#define D3DSP_WRITEMASK_ALL
#define D3DSP_WRITEMASK_2
#define D3DPS_VERSION(major, minor)
#define D3DVS_SWIZZLE_MASK
#define D3DSP_WRITEMASK_3
#define D3DSP_SWIZZLE_MASK
#define D3DSP_DSTMOD_MASK
#define D3DSI_OPCODE_MASK
#define D3DSP_WRITEMASK_0
#define D3DSHADER_VERSION_MAJOR(version)
#define D3DSI_COMMENTSIZE_SHIFT
#define D3DSP_SRCMOD_MASK
#define D3DSP_WRITEMASK_1
#define D3DVS_SWIZZLE_SHIFT
#define D3DVS_ADDRESSMODE_MASK
#define D3DSHADER_VERSION_MINOR(version)
#define D3DSI_COMMENTSIZE_MASK
#define D3DSP_REGTYPE_MASK
#define D3DVS_VERSION(major, minor)
#define D3DSP_REGTYPE_SHIFT
#define IDirect3DDevice9_GetDeviceCaps(p, a)
#define IDirect3DDevice9_SetPixelShaderConstantI(p, a, b, c)
#define IDirect3DDevice9_SetVertexShaderConstantF(p, a, b, c)
#define IDirect3DDevice9_SetPixelShaderConstantF(p, a, b, c)
#define IDirect3DDevice9_Release(p)
#define IDirect3DDevice9_SetVertexShaderConstantI(p, a, b, c)
#define IDirect3DDevice9_SetPixelShaderConstantB(p, a, b, c)
#define IDirect3DDevice9_SetVertexShaderConstantB(p, a, b, c)
#define IDirect3DDevice9_AddRef(p)
#define D3DPS20CAPS_NODEPENDENTREADLIMIT
#define D3DPS20CAPS_GRADIENTINSTRUCTIONS
#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT
#define D3DPS20CAPS_PREDICATION
#define D3DPS20CAPS_ARBITRARYSWIZZLE
#define D3DSP_REGTYPE_MASK2
#define D3DSP_TEXTURETYPE_SHIFT
#define D3DSI_INSTLENGTH_SHIFT
@ D3DSPDM_PARTIALPRECISION
#define D3DSP_DCL_USAGE_MASK
#define D3DSP_REGTYPE_SHIFT2
enum _D3DDECLUSAGE D3DDECLUSAGE
#define D3DSP_DCL_USAGE_SHIFT