* Introduce wpp as a cross compiling lib, and rename out host one as wpphost.
[WIDL]
* Update the link reference to the host wpp.
[PSDK]
* Update d3d9types.h and import d3d11shader.h and d3dcompiler.h from Wine.
[DXGUID]
* Introduce dx10guid to contain some GUIDs needed only by Wine DirectX modules.
[D3DCOMPILER_43]
* Import from Wine 1.7.1.

svn path=/trunk/; revision=60098
This commit is contained in:
Amine Khaldi 2013-09-14 10:30:44 +00:00
parent 35c4461605
commit 1f1d1b19dc
31 changed files with 33213 additions and 21 deletions

View file

@ -233,6 +233,7 @@ else()
add_subdirectory(modules)
add_subdirectory(ntoskrnl)
add_subdirectory(subsystems)
add_subdirectory(tools/wpp)
add_subdirectory(win32ss)
# Create {bootcd, livecd, bootcdregtest}.lst

View file

@ -1,6 +1,7 @@
add_subdirectory(d3d8)
add_subdirectory(d3d9)
add_subdirectory(d3dcompiler_43)
add_subdirectory(d3dx9_24)
if(NOT MSVC)
add_subdirectory(d3dx9_25)

View file

@ -0,0 +1,30 @@
add_definitions(
-D__WINESRC__
-DDIRECT3D_VERSION=0x0900)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(d3dcompiler_43.dll d3dcompiler_43.spec ADD_IMPORTLIB)
list(APPEND SOURCE
asmparser.c
asmshader.tab.c
asmshader.yy.c
blob.c
bytecodewriter.c
compiler.c
d3dcompiler_43_main.c
hlsl.tab.c
hlsl.yy.c
reflection.c
utils.c
${CMAKE_CURRENT_BINARY_DIR}/d3dcompiler_43_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/d3dcompiler_43.def)
add_library(d3dcompiler_43 SHARED ${SOURCE} version.rc)
set_module_type(d3dcompiler_43 win32dll)
target_link_libraries(d3dcompiler_43 dx10guid uuid wine wpp)
add_importlibs(d3dcompiler_43 msvcrt kernel32 ntdll)
add_dependencies(d3dcompiler_43 d3d_idl_headers)
add_cd_file(TARGET d3dcompiler_43 DESTINATION reactos/system32 FOR all)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,501 @@
/*
* Direct3D shader assembler
*
* Copyright 2008 Stefan Dösinger
* Copyright 2009 Matteo Bruni
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
%{
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#include "d3dcompiler_private.h"
#include "asmshader.tab.h"
WINE_DEFAULT_DEBUG_CHANNEL(asmshader);
%}
%option noyywrap
%option prefix="asmshader_"
%option noinput nounput never-interactive
/* Swizzles and writemasks consist of a dot and up to 4 x, y, z or w characters,
* or up to 4 a, r, g, b characters. There are different rules for swizzles and
* writemasks wrt repetition, those are handled in the grammar.
*/
DOT \.
COMPONENT [xyzw]|[rgba]
/* Registers */
REG_TEMP r[0-9]+
/* for relative addressing in the form o[x], v[x] and c[x] */
REG_OUTPUT o[0-9]*
REG_INPUT v[0-9]*
REG_CONSTFLOAT c[0-9]*
REG_CONSTINT i[0-9]+
REG_CONSTBOOL b[0-9]+
REG_TEXTURE t[0-9]+
REG_TEXCRDOUT oT[0-9]+
REG_SAMPLER s[0-9]+
REG_OPOS oPos
REG_OFOG oFog
REG_OPTS oPts
REG_VERTEXCOLOR oD[01]
REG_FRAGCOLOR oC[0-9]+
REG_FRAGDEPTH oDepth
REG_VPOS vPos
REG_VFACE vFace
REG_ADDRESS a0
REG_LOOP aL
REG_PREDICATE p0
/* Not really a register, but it is considered as such */
REG_LABEL l[0-9]+
DCL_POSITION _position[0-9]*
DCL_BLENDWEIGHT _blendweight[0-9]*
DCL_BLENDINDICES _blendindices[0-9]*
DCL_NORMAL _normal[0-9]*
DCL_PSIZE _psize[0-9]*
DCL_TEXCOORD _texcoord[0-9]*
DCL_TANGENT _tangent[0-9]*
DCL_BINORMAL _binormal[0-9]*
DCL_TESSFACTOR _tessfactor[0-9]*
DCL_POSITIONT _positiont[0-9]*
DCL_COLOR _color[0-9]*
DCL_FOG _fog[0-9]*
DCL_DEPTH _depth[0-9]*
DCL_SAMPLE _sample[0-9]*
DCL_SAMPLER1D _1d
DCL_SAMPLER2D _2d
DCL_SAMPLERCUBE _cube
DCL_SAMPLERVOLUME _volume
PREPROCESSORDIRECTIVE #[^\n]*\n
/* Comments */
DOUBLESLASHCOMMENT "//"[^\n]*
SEMICOLONCOMMENT ";"[^\n]*
/* Whitespaces are spaces, tabs and newlines */
WHITESPACE [ \t]+
NEWLINE (\n)|(\r\n)
COMMA ","
IMMVAL \-?(([0-9]+\.?)|([0-9]*\.[0-9]+))(f)?
ANY (.)
%%
/* Common instructions(vertex and pixel shaders) */
add {return INSTR_ADD; }
nop {return INSTR_NOP; }
mov {return INSTR_MOV; }
sub {return INSTR_SUB; }
mad {return INSTR_MAD; }
mul {return INSTR_MUL; }
rcp {return INSTR_RCP; }
rsq {return INSTR_RSQ; }
dp3 {return INSTR_DP3; }
dp4 {return INSTR_DP4; }
min {return INSTR_MIN; }
max {return INSTR_MAX; }
slt {return INSTR_SLT; }
sge {return INSTR_SGE; }
abs {return INSTR_ABS; }
exp {return INSTR_EXP; }
log {return INSTR_LOG; }
expp {return INSTR_EXPP; }
logp {return INSTR_LOGP; }
dst {return INSTR_DST; }
lrp {return INSTR_LRP; }
frc {return INSTR_FRC; }
pow {return INSTR_POW; }
crs {return INSTR_CRS; }
sgn {return INSTR_SGN; }
nrm {return INSTR_NRM; }
sincos {return INSTR_SINCOS; }
m4x4 {return INSTR_M4x4; }
m4x3 {return INSTR_M4x3; }
m3x4 {return INSTR_M3x4; }
m3x3 {return INSTR_M3x3; }
m3x2 {return INSTR_M3x2; }
dcl {return INSTR_DCL; }
def {return INSTR_DEF; }
defb {return INSTR_DEFB; }
defi {return INSTR_DEFI; }
rep {return INSTR_REP; }
endrep {return INSTR_ENDREP; }
if {return INSTR_IF; }
else {return INSTR_ELSE; }
endif {return INSTR_ENDIF; }
break {return INSTR_BREAK; }
breakp {return INSTR_BREAKP; }
call {return INSTR_CALL; }
callnz {return INSTR_CALLNZ; }
loop {return INSTR_LOOP; }
ret {return INSTR_RET; }
endloop {return INSTR_ENDLOOP; }
label {return INSTR_LABEL; }
setp {return INSTR_SETP; }
texldl {return INSTR_TEXLDL; }
/* Vertex shader only instructions */
lit {return INSTR_LIT; }
mova {return INSTR_MOVA; }
/* Pixel shader only instructions */
cnd {return INSTR_CND; }
cmp {return INSTR_CMP; }
dp2add {return INSTR_DP2ADD; }
texcoord {return INSTR_TEXCOORD; }
texcrd {return INSTR_TEXCRD; }
texkill {return INSTR_TEXKILL; }
tex {return INSTR_TEX; }
texld {return INSTR_TEXLD; }
texbem {return INSTR_TEXBEM; }
texbeml {return INSTR_TEXBEML; }
texreg2ar {return INSTR_TEXREG2AR; }
texreg2gb {return INSTR_TEXREG2GB; }
texreg2rgb {return INSTR_TEXREG2RGB; }
texm3x2pad {return INSTR_TEXM3x2PAD; }
texm3x2tex {return INSTR_TEXM3x2TEX; }
texm3x3pad {return INSTR_TEXM3x3PAD; }
texm3x3spec {return INSTR_TEXM3x3SPEC; }
texm3x3vspec {return INSTR_TEXM3x3VSPEC; }
texm3x3tex {return INSTR_TEXM3x3TEX; }
texdp3tex {return INSTR_TEXDP3TEX; }
texm3x2depth {return INSTR_TEXM3x2DEPTH; }
texdp3 {return INSTR_TEXDP3; }
texm3x3 {return INSTR_TEXM3x3; }
texdepth {return INSTR_TEXDEPTH; }
bem {return INSTR_BEM; }
dsx {return INSTR_DSX; }
dsy {return INSTR_DSY; }
texldp {return INSTR_TEXLDP; }
texldb {return INSTR_TEXLDB; }
texldd {return INSTR_TEXLDD; }
phase {return INSTR_PHASE; }
{REG_TEMP} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_TEMP;
}
{REG_OUTPUT} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_OUTPUT;
}
{REG_INPUT} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_INPUT;
}
{REG_CONSTFLOAT} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_CONSTFLOAT;
}
{REG_CONSTINT} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_CONSTINT;
}
{REG_CONSTBOOL} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_CONSTBOOL;
}
{REG_TEXTURE} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_TEXTURE;
}
{REG_TEXCRDOUT} {
asmshader_lval.regnum = atoi(yytext + 2);
return REG_TEXCRDOUT;
}
{REG_SAMPLER} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_SAMPLER;
}
{REG_OPOS} {return REG_OPOS; }
{REG_OFOG} {return REG_OFOG; }
{REG_OPTS} {return REG_OPTS; }
{REG_VERTEXCOLOR} {
asmshader_lval.regnum = atoi(yytext + 2);
return REG_VERTEXCOLOR;
}
{REG_FRAGCOLOR} {
asmshader_lval.regnum = atoi(yytext + 2);
return REG_FRAGCOLOR;
}
{REG_FRAGDEPTH} {return REG_FRAGDEPTH; }
{REG_VPOS} {return REG_VPOS; }
{REG_VFACE} {return REG_VFACE; }
{REG_ADDRESS} {return REG_ADDRESS; }
{REG_LOOP} {return REG_LOOP; }
{REG_PREDICATE} {return REG_PREDICATE; }
{REG_LABEL} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_LABEL;
}
/* Shader versions. These are important to select the correct
* parser profile.
*/
vs\.1\.0|vs_1_0 {return VER_VS10; }
vs\.1\.1|vs_1_1 {return VER_VS11; }
vs\.2\.0|vs_2_0 {return VER_VS20; }
vs\.2\.x|vs_2_x {return VER_VS2X; }
vs\.3\.0|vs_3_0 {return VER_VS30; }
ps\.1\.0|ps_1_0 {return VER_PS10; }
ps\.1\.1|ps_1_1 {return VER_PS11; }
ps\.1\.2|ps_1_2 {return VER_PS12; }
ps\.1\.3|ps_1_3 {return VER_PS13; }
ps\.1\.4|ps_1_4 {return VER_PS14; }
ps\.2\.0|ps_2_0 {return VER_PS20; }
ps\.2\.x|ps_2_x {return VER_PS2X; }
ps\.3\.0|ps_3_0 {return VER_PS30; }
{DOT} {return yytext[0]; }
{COMPONENT} {
switch(yytext[0]) {
case 'x':
case 'r':
asmshader_lval.component = 0;
break;
case 'y':
case 'g':
asmshader_lval.component = 1;
break;
case 'z':
case 'b':
asmshader_lval.component = 2;
break;
case 'w':
case 'a':
asmshader_lval.component = 3;
break;
}
return COMPONENT;
}
/* Output modifiers */
\_x2 {return SHIFT_X2; }
\_x4 {return SHIFT_X4; }
\_x8 {return SHIFT_X8; }
\_d2 {return SHIFT_D2; }
\_d4 {return SHIFT_D4; }
\_d8 {return SHIFT_D8; }
\_sat {return MOD_SAT; }
\_pp {return MOD_PP; }
\_centroid {return MOD_CENTROID; }
/* compare params */
\_gt {return COMP_GT; }
\_lt {return COMP_LT; }
\_ge {return COMP_GE; }
\_le {return COMP_LE; }
\_eq {return COMP_EQ; }
\_ne {return COMP_NE; }
{IMMVAL} {
asmshader_lval.immval.val = atof(yytext);
asmshader_lval.immval.integer = ((strstr(yytext, ".") == NULL) && (strstr(yytext, "f") == NULL));
return IMMVAL;
}
true {
asmshader_lval.immbool = TRUE;
return IMMBOOL;
}
false {
asmshader_lval.immbool = FALSE;
return IMMBOOL;
}
{COMMA} {return yytext[0]; }
- {return yytext[0]; }
\( {return yytext[0]; }
\) {return yytext[0]; }
/* for relative addressing */
\[|\]|\+ {return yytext[0]; }
\_bias {return SMOD_BIAS; }
/* No _x2 here; it is identical to MOD_X2 */
\_bx2 {return SMOD_SCALEBIAS; }
\_dz {return SMOD_DZ; }
\_dw {return SMOD_DW; }
\_abs {return SMOD_ABS; }
! {return SMOD_NOT; }
{DCL_POSITION} {
if(yytext[strlen("_position")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_position"));
}
return USAGE_POSITION;
}
{DCL_BLENDWEIGHT} {
if(yytext[strlen("_blendweight")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_blendweight"));
}
return USAGE_BLENDWEIGHT;
}
{DCL_BLENDINDICES} {
if(yytext[strlen("_blendindices")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_blendindices"));
}
return USAGE_BLENDINDICES;
}
{DCL_NORMAL} {
if(yytext[strlen("_normal")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_normal"));
}
return USAGE_NORMAL;
}
{DCL_PSIZE} {
if(yytext[strlen("_psize")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_psize"));
}
return USAGE_PSIZE;
}
{DCL_TEXCOORD} {
if(yytext[strlen("_texcoord")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_texcoord"));
}
return USAGE_TEXCOORD;
}
{DCL_TANGENT} {
if(yytext[strlen("_tangent")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_tangent"));
}
return USAGE_TANGENT;
}
{DCL_BINORMAL} {
if(yytext[strlen("_binormal")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_binormal"));
}
return USAGE_BINORMAL;
}
{DCL_TESSFACTOR} {
if(yytext[strlen("_tessfactor")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_tessfactor"));
}
return USAGE_TESSFACTOR;
}
{DCL_POSITIONT} {
if(yytext[strlen("_positiont")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_positiont"));
}
return USAGE_POSITIONT;
}
{DCL_COLOR} {
if(yytext[strlen("_color")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_color"));
}
return USAGE_COLOR;
}
{DCL_FOG} {
if(yytext[strlen("_fog")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_fog"));
}
return USAGE_FOG;
}
{DCL_DEPTH} {
if(yytext[strlen("_depth")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_depth"));
}
return USAGE_DEPTH;
}
{DCL_SAMPLE} {
if(yytext[strlen("_sample")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_sample"));
}
return USAGE_SAMPLE;
}
{DCL_SAMPLER1D} { return SAMPTYPE_1D; }
{DCL_SAMPLER2D} { return SAMPTYPE_2D; }
{DCL_SAMPLERCUBE} { return SAMPTYPE_CUBE; }
{DCL_SAMPLERVOLUME} { return SAMPTYPE_VOLUME; }
{PREPROCESSORDIRECTIVE} {
/* TODO: update current line information */
TRACE("line info update: %s", yytext);
}
/* Skip comments */
{DOUBLESLASHCOMMENT} { }
{SEMICOLONCOMMENT} { }
{WHITESPACE} { /* Do nothing */ }
{NEWLINE} {
asm_ctx.line_no++;
}
{ANY} {
asmparser_message(&asm_ctx, "Line %u: Unexpected input %s\n", asm_ctx.line_no, yytext);
set_parse_status(&asm_ctx.status, PARSE_ERR);
}
%%
struct bwriter_shader *SlAssembleShader(const char *text, char **messages) {
struct bwriter_shader *ret = NULL;
YY_BUFFER_STATE buffer;
TRACE("%p, %p\n", text, messages);
buffer = asmshader__scan_string(text);
asmshader__switch_to_buffer(buffer);
ret = parse_asm_shader(messages);
asmshader__delete_buffer(buffer);
return ret;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,257 @@
/* A Bison parser, made by GNU Bison 2.5. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
INSTR_ADD = 258,
INSTR_NOP = 259,
INSTR_MOV = 260,
INSTR_SUB = 261,
INSTR_MAD = 262,
INSTR_MUL = 263,
INSTR_RCP = 264,
INSTR_RSQ = 265,
INSTR_DP3 = 266,
INSTR_DP4 = 267,
INSTR_MIN = 268,
INSTR_MAX = 269,
INSTR_SLT = 270,
INSTR_SGE = 271,
INSTR_ABS = 272,
INSTR_EXP = 273,
INSTR_LOG = 274,
INSTR_EXPP = 275,
INSTR_LOGP = 276,
INSTR_DST = 277,
INSTR_LRP = 278,
INSTR_FRC = 279,
INSTR_POW = 280,
INSTR_CRS = 281,
INSTR_SGN = 282,
INSTR_NRM = 283,
INSTR_SINCOS = 284,
INSTR_M4x4 = 285,
INSTR_M4x3 = 286,
INSTR_M3x4 = 287,
INSTR_M3x3 = 288,
INSTR_M3x2 = 289,
INSTR_DCL = 290,
INSTR_DEF = 291,
INSTR_DEFB = 292,
INSTR_DEFI = 293,
INSTR_REP = 294,
INSTR_ENDREP = 295,
INSTR_IF = 296,
INSTR_ELSE = 297,
INSTR_ENDIF = 298,
INSTR_BREAK = 299,
INSTR_BREAKP = 300,
INSTR_CALL = 301,
INSTR_CALLNZ = 302,
INSTR_LOOP = 303,
INSTR_RET = 304,
INSTR_ENDLOOP = 305,
INSTR_LABEL = 306,
INSTR_SETP = 307,
INSTR_TEXLDL = 308,
INSTR_LIT = 309,
INSTR_MOVA = 310,
INSTR_CND = 311,
INSTR_CMP = 312,
INSTR_DP2ADD = 313,
INSTR_TEXCOORD = 314,
INSTR_TEXCRD = 315,
INSTR_TEXKILL = 316,
INSTR_TEX = 317,
INSTR_TEXLD = 318,
INSTR_TEXBEM = 319,
INSTR_TEXBEML = 320,
INSTR_TEXREG2AR = 321,
INSTR_TEXREG2GB = 322,
INSTR_TEXREG2RGB = 323,
INSTR_TEXM3x2PAD = 324,
INSTR_TEXM3x2TEX = 325,
INSTR_TEXM3x3PAD = 326,
INSTR_TEXM3x3SPEC = 327,
INSTR_TEXM3x3VSPEC = 328,
INSTR_TEXM3x3TEX = 329,
INSTR_TEXDP3TEX = 330,
INSTR_TEXM3x2DEPTH = 331,
INSTR_TEXDP3 = 332,
INSTR_TEXM3x3 = 333,
INSTR_TEXDEPTH = 334,
INSTR_BEM = 335,
INSTR_DSX = 336,
INSTR_DSY = 337,
INSTR_TEXLDP = 338,
INSTR_TEXLDB = 339,
INSTR_TEXLDD = 340,
INSTR_PHASE = 341,
REG_TEMP = 342,
REG_OUTPUT = 343,
REG_INPUT = 344,
REG_CONSTFLOAT = 345,
REG_CONSTINT = 346,
REG_CONSTBOOL = 347,
REG_TEXTURE = 348,
REG_SAMPLER = 349,
REG_TEXCRDOUT = 350,
REG_OPOS = 351,
REG_OFOG = 352,
REG_OPTS = 353,
REG_VERTEXCOLOR = 354,
REG_FRAGCOLOR = 355,
REG_FRAGDEPTH = 356,
REG_VPOS = 357,
REG_VFACE = 358,
REG_ADDRESS = 359,
REG_LOOP = 360,
REG_PREDICATE = 361,
REG_LABEL = 362,
VER_VS10 = 363,
VER_VS11 = 364,
VER_VS20 = 365,
VER_VS2X = 366,
VER_VS30 = 367,
VER_PS10 = 368,
VER_PS11 = 369,
VER_PS12 = 370,
VER_PS13 = 371,
VER_PS14 = 372,
VER_PS20 = 373,
VER_PS2X = 374,
VER_PS30 = 375,
SHIFT_X2 = 376,
SHIFT_X4 = 377,
SHIFT_X8 = 378,
SHIFT_D2 = 379,
SHIFT_D4 = 380,
SHIFT_D8 = 381,
MOD_SAT = 382,
MOD_PP = 383,
MOD_CENTROID = 384,
COMP_GT = 385,
COMP_LT = 386,
COMP_GE = 387,
COMP_LE = 388,
COMP_EQ = 389,
COMP_NE = 390,
SMOD_BIAS = 391,
SMOD_SCALEBIAS = 392,
SMOD_DZ = 393,
SMOD_DW = 394,
SMOD_ABS = 395,
SMOD_NOT = 396,
SAMPTYPE_1D = 397,
SAMPTYPE_2D = 398,
SAMPTYPE_CUBE = 399,
SAMPTYPE_VOLUME = 400,
USAGE_POSITION = 401,
USAGE_BLENDWEIGHT = 402,
USAGE_BLENDINDICES = 403,
USAGE_NORMAL = 404,
USAGE_PSIZE = 405,
USAGE_TEXCOORD = 406,
USAGE_TANGENT = 407,
USAGE_BINORMAL = 408,
USAGE_TESSFACTOR = 409,
USAGE_POSITIONT = 410,
USAGE_COLOR = 411,
USAGE_FOG = 412,
USAGE_DEPTH = 413,
USAGE_SAMPLE = 414,
COMPONENT = 415,
IMMVAL = 416,
IMMBOOL = 417
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 2068 of yacc.c */
#line 70 "asmshader.y"
struct {
float val;
BOOL integer;
} immval;
BOOL immbool;
unsigned int regnum;
struct shader_reg reg;
DWORD srcmod;
DWORD writemask;
struct {
DWORD writemask;
DWORD idx;
DWORD last;
} wm_components;
DWORD swizzle;
struct {
DWORD swizzle;
DWORD idx;
} sw_components;
DWORD component;
struct {
DWORD mod;
DWORD shift;
} modshift;
BWRITER_COMPARISON_TYPE comptype;
struct {
DWORD dclusage;
unsigned int regnum;
} declaration;
BWRITERSAMPLER_TEXTURE_TYPE samplertype;
struct rel_reg rel_reg;
struct src_regs sregs;
/* Line 2068 of yacc.c */
#line 249 "asmshader.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE asmshader_lval;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,465 @@
/*
* Direct3D blob file
*
* Copyright 2010 Rico Schüller
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include "config.h"
#include "wine/port.h"
#include "d3dcompiler_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
struct d3dcompiler_blob
{
ID3DBlob ID3DBlob_iface;
LONG refcount;
SIZE_T size;
void *data;
};
static inline struct d3dcompiler_blob *impl_from_ID3DBlob(ID3DBlob *iface)
{
return CONTAINING_RECORD(iface, struct d3dcompiler_blob, ID3DBlob_iface);
}
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3dcompiler_blob_QueryInterface(ID3DBlob *iface, REFIID riid, void **object)
{
TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_ID3D10Blob)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IUnknown_AddRef(iface);
*object = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
*object = NULL;
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE d3dcompiler_blob_AddRef(ID3DBlob *iface)
{
struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
ULONG refcount = InterlockedIncrement(&blob->refcount);
TRACE("%p increasing refcount to %u\n", blob, refcount);
return refcount;
}
static ULONG STDMETHODCALLTYPE d3dcompiler_blob_Release(ID3DBlob *iface)
{
struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
ULONG refcount = InterlockedDecrement(&blob->refcount);
TRACE("%p decreasing refcount to %u\n", blob, refcount);
if (!refcount)
{
HeapFree(GetProcessHeap(), 0, blob->data);
HeapFree(GetProcessHeap(), 0, blob);
}
return refcount;
}
/* ID3DBlob methods */
static void * STDMETHODCALLTYPE d3dcompiler_blob_GetBufferPointer(ID3DBlob *iface)
{
struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
TRACE("iface %p\n", iface);
return blob->data;
}
static SIZE_T STDMETHODCALLTYPE d3dcompiler_blob_GetBufferSize(ID3DBlob *iface)
{
struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
TRACE("iface %p\n", iface);
return blob->size;
}
static const struct ID3D10BlobVtbl d3dcompiler_blob_vtbl =
{
/* IUnknown methods */
d3dcompiler_blob_QueryInterface,
d3dcompiler_blob_AddRef,
d3dcompiler_blob_Release,
/* ID3DBlob methods */
d3dcompiler_blob_GetBufferPointer,
d3dcompiler_blob_GetBufferSize,
};
static HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
{
blob->ID3DBlob_iface.lpVtbl = &d3dcompiler_blob_vtbl;
blob->refcount = 1;
blob->size = data_size;
blob->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, data_size);
if (!blob->data)
{
ERR("Failed to allocate D3D blob data memory\n");
return E_OUTOFMEMORY;
}
return S_OK;
}
HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
{
struct d3dcompiler_blob *object;
HRESULT hr;
TRACE("data_size %lu, blob %p\n", data_size, blob);
if (!blob)
{
WARN("Invalid blob specified.\n");
return D3DERR_INVALIDCALL;
}
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
hr = d3dcompiler_blob_init(object, data_size);
if (FAILED(hr))
{
WARN("Failed to initialize blob, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
*blob = &object->ID3DBlob_iface;
TRACE("Created ID3DBlob %p\n", *blob);
return S_OK;
}
static BOOL check_blob_part(DWORD tag, D3D_BLOB_PART part)
{
BOOL add = FALSE;
switch(part)
{
case D3D_BLOB_INPUT_SIGNATURE_BLOB:
if (tag == TAG_ISGN) add = TRUE;
break;
case D3D_BLOB_OUTPUT_SIGNATURE_BLOB:
if (tag == TAG_OSGN || tag == TAG_OSG5) add = TRUE;
break;
case D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB:
if (tag == TAG_ISGN || tag == TAG_OSGN || tag == TAG_OSG5) add = TRUE;
break;
case D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB:
if (tag == TAG_PCSG) add = TRUE;
break;
case D3D_BLOB_ALL_SIGNATURE_BLOB:
if (tag == TAG_ISGN || tag == TAG_OSGN || tag == TAG_OSG5 || tag == TAG_PCSG) add = TRUE;
break;
case D3D_BLOB_DEBUG_INFO:
if (tag == TAG_SDBG) add = TRUE;
break;
case D3D_BLOB_LEGACY_SHADER:
if (tag == TAG_Aon9) add = TRUE;
break;
case D3D_BLOB_XNA_PREPASS_SHADER:
if (tag == TAG_XNAP) add = TRUE;
break;
case D3D_BLOB_XNA_SHADER:
if (tag == TAG_XNAS) add = TRUE;
break;
default:
FIXME("Unhandled D3D_BLOB_PART %s.\n", debug_d3dcompiler_d3d_blob_part(part));
break;
}
TRACE("%s tag %s\n", add ? "Add" : "Skip", debugstr_an((const char *)&tag, 4));
return add;
}
static HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
{
struct dxbc src_dxbc, dst_dxbc;
HRESULT hr;
unsigned int i, count;
if (!data || !data_size || flags || !blob)
{
WARN("Invalid arguments: data %p, data_size %lu, flags %#x, blob %p\n", data, data_size, flags, blob);
return D3DERR_INVALIDCALL;
}
if (part > D3D_BLOB_TEST_COMPILE_PERF
|| (part < D3D_BLOB_TEST_ALTERNATE_SHADER && part > D3D_BLOB_XNA_SHADER))
{
WARN("Invalid D3D_BLOB_PART: part %s\n", debug_d3dcompiler_d3d_blob_part(part));
return D3DERR_INVALIDCALL;
}
hr = dxbc_parse(data, data_size, &src_dxbc);
if (FAILED(hr))
{
WARN("Failed to parse blob part\n");
return hr;
}
hr = dxbc_init(&dst_dxbc, 0);
if (FAILED(hr))
{
dxbc_destroy(&src_dxbc);
WARN("Failed to init dxbc\n");
return hr;
}
for (i = 0; i < src_dxbc.count; ++i)
{
struct dxbc_section *section = &src_dxbc.sections[i];
if (check_blob_part(section->tag, part))
{
hr = dxbc_add_section(&dst_dxbc, section->tag, section->data, section->data_size);
if (FAILED(hr))
{
dxbc_destroy(&src_dxbc);
dxbc_destroy(&dst_dxbc);
WARN("Failed to add section to dxbc\n");
return hr;
}
}
}
count = dst_dxbc.count;
switch(part)
{
case D3D_BLOB_INPUT_SIGNATURE_BLOB:
case D3D_BLOB_OUTPUT_SIGNATURE_BLOB:
case D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB:
case D3D_BLOB_DEBUG_INFO:
case D3D_BLOB_LEGACY_SHADER:
case D3D_BLOB_XNA_PREPASS_SHADER:
case D3D_BLOB_XNA_SHADER:
if (count != 1) count = 0;
break;
case D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB:
if (count != 2) count = 0;
break;
case D3D_BLOB_ALL_SIGNATURE_BLOB:
if (count != 3) count = 0;
break;
default:
FIXME("Unhandled D3D_BLOB_PART %s.\n", debug_d3dcompiler_d3d_blob_part(part));
break;
}
if (count == 0)
{
dxbc_destroy(&src_dxbc);
dxbc_destroy(&dst_dxbc);
WARN("Nothing to write into the blob (count = 0)\n");
return E_FAIL;
}
/* some parts aren't full DXBCs, they contain only the data */
if (count == 1 && (part == D3D_BLOB_DEBUG_INFO || part == D3D_BLOB_LEGACY_SHADER || part == D3D_BLOB_XNA_PREPASS_SHADER
|| part == D3D_BLOB_XNA_SHADER))
{
hr = D3DCreateBlob(dst_dxbc.sections[0].data_size, blob);
if (SUCCEEDED(hr))
{
memcpy(ID3D10Blob_GetBufferPointer(*blob), dst_dxbc.sections[0].data, dst_dxbc.sections[0].data_size);
}
else
{
WARN("Could not create blob\n");
}
}
else
{
hr = dxbc_write_blob(&dst_dxbc, blob);
if (FAILED(hr))
{
WARN("Failed to write blob part\n");
}
}
dxbc_destroy(&src_dxbc);
dxbc_destroy(&dst_dxbc);
return hr;
}
static BOOL check_blob_strip(DWORD tag, UINT flags)
{
BOOL add = TRUE;
if (flags & D3DCOMPILER_STRIP_TEST_BLOBS) FIXME("Unhandled flag D3DCOMPILER_STRIP_TEST_BLOBS.\n");
switch(tag)
{
case TAG_RDEF:
case TAG_STAT:
if (flags & D3DCOMPILER_STRIP_REFLECTION_DATA) add = FALSE;
break;
case TAG_SDBG:
if (flags & D3DCOMPILER_STRIP_DEBUG_INFO) add = FALSE;
break;
default:
break;
}
TRACE("%s tag %s\n", add ? "Add" : "Skip", debugstr_an((const char *)&tag, 4));
return add;
}
static HRESULT d3dcompiler_strip_shader(const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob)
{
struct dxbc src_dxbc, dst_dxbc;
HRESULT hr;
unsigned int i;
if (!blob)
{
WARN("NULL for blob specified\n");
return E_FAIL;
}
if (!data || !data_size)
{
WARN("Invalid arguments: data %p, data_size %lu\n", data, data_size);
return D3DERR_INVALIDCALL;
}
hr = dxbc_parse(data, data_size, &src_dxbc);
if (FAILED(hr))
{
WARN("Failed to parse blob part\n");
return hr;
}
/* src_dxbc.count >= dst_dxbc.count */
hr = dxbc_init(&dst_dxbc, src_dxbc.count);
if (FAILED(hr))
{
dxbc_destroy(&src_dxbc);
WARN("Failed to init dxbc\n");
return hr;
}
for (i = 0; i < src_dxbc.count; ++i)
{
struct dxbc_section *section = &src_dxbc.sections[i];
if (check_blob_strip(section->tag, flags))
{
hr = dxbc_add_section(&dst_dxbc, section->tag, section->data, section->data_size);
if (FAILED(hr))
{
dxbc_destroy(&src_dxbc);
dxbc_destroy(&dst_dxbc);
WARN("Failed to add section to dxbc\n");
return hr;
}
}
}
hr = dxbc_write_blob(&dst_dxbc, blob);
if (FAILED(hr))
{
WARN("Failed to write blob part\n");
}
dxbc_destroy(&src_dxbc);
dxbc_destroy(&dst_dxbc);
return hr;
}
HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
{
TRACE("data %p, data_size %lu, part %s, flags %#x, blob %p\n", data,
data_size, debug_d3dcompiler_d3d_blob_part(part), flags, blob);
return d3dcompiler_get_blob_part(data, data_size, part, flags, blob);
}
HRESULT WINAPI D3DGetInputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob)
{
TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
return d3dcompiler_get_blob_part(data, data_size, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, blob);
}
HRESULT WINAPI D3DGetOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob)
{
TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
return d3dcompiler_get_blob_part(data, data_size, D3D_BLOB_OUTPUT_SIGNATURE_BLOB, 0, blob);
}
HRESULT WINAPI D3DGetInputAndOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob)
{
TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
return d3dcompiler_get_blob_part(data, data_size, D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, 0, blob);
}
HRESULT WINAPI D3DGetDebugInfo(const void *data, SIZE_T data_size, ID3DBlob **blob)
{
TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
return d3dcompiler_get_blob_part(data, data_size, D3D_BLOB_DEBUG_INFO, 0, blob);
}
HRESULT WINAPI D3DStripShader(const void *data, SIZE_T data_size, UINT flags, ID3D10Blob **blob)
{
TRACE("data %p, data_size %lu, flags %#x, blob %p\n", data, data_size, flags, blob);
return d3dcompiler_strip_shader(data, data_size, flags, blob);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,763 @@
/*
* Copyright 2009 Matteo Bruni
* Copyright 2010 Matteo Bruni for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "d3dcompiler_private.h"
#include "wine/wpp.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
#define D3DXERR_INVALIDDATA 0x88760b59
#define BUFFER_INITIAL_CAPACITY 256
struct mem_file_desc
{
const char *buffer;
unsigned int size;
unsigned int pos;
};
static struct mem_file_desc current_shader;
static ID3DInclude *current_include;
static const char *initial_filename;
#define INCLUDES_INITIAL_CAPACITY 4
struct loaded_include
{
const char *name;
const char *data;
};
static struct loaded_include *includes;
static int includes_capacity, includes_size;
static const char *parent_include;
static char *wpp_output;
static int wpp_output_capacity, wpp_output_size;
static char *wpp_messages;
static int wpp_messages_capacity, wpp_messages_size;
/* Mutex used to guarantee a single invocation
of the D3DXAssembleShader function (or its variants) at a time.
This is needed as wpp isn't thread-safe */
static CRITICAL_SECTION wpp_mutex;
static CRITICAL_SECTION_DEBUG wpp_mutex_debug =
{
0, 0, &wpp_mutex,
{ &wpp_mutex_debug.ProcessLocksList,
&wpp_mutex_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": wpp_mutex") }
};
static CRITICAL_SECTION wpp_mutex = { &wpp_mutex_debug, -1, 0, 0, 0, 0 };
/* Preprocessor error reporting functions */
static void wpp_write_message(const char *fmt, va_list args)
{
char* newbuffer;
int rc, newsize;
if(wpp_messages_capacity == 0)
{
wpp_messages = HeapAlloc(GetProcessHeap(), 0, MESSAGEBUFFER_INITIAL_SIZE);
if(wpp_messages == NULL)
return;
wpp_messages_capacity = MESSAGEBUFFER_INITIAL_SIZE;
}
while(1)
{
rc = vsnprintf(wpp_messages + wpp_messages_size,
wpp_messages_capacity - wpp_messages_size, fmt, args);
if (rc < 0 || /* C89 */
rc >= wpp_messages_capacity - wpp_messages_size) { /* C99 */
/* Resize the buffer */
newsize = wpp_messages_capacity * 2;
newbuffer = HeapReAlloc(GetProcessHeap(), 0, wpp_messages, newsize);
if(newbuffer == NULL)
{
ERR("Error reallocating memory for parser messages\n");
return;
}
wpp_messages = newbuffer;
wpp_messages_capacity = newsize;
}
else
{
wpp_messages_size += rc;
return;
}
}
}
static void PRINTF_ATTR(1,2) wpp_write_message_var(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
wpp_write_message(fmt, args);
va_end(args);
}
static void wpp_error(const char *file, int line, int col, const char *_near,
const char *msg, va_list ap)
{
wpp_write_message_var("%s:%d:%d: %s: ", file ? file : "'main file'",
line, col, "Error");
wpp_write_message(msg, ap);
wpp_write_message_var("\n");
}
static void wpp_warning(const char *file, int line, int col, const char *_near,
const char *msg, va_list ap)
{
wpp_write_message_var("%s:%d:%d: %s: ", file ? file : "'main file'",
line, col, "Warning");
wpp_write_message(msg, ap);
wpp_write_message_var("\n");
}
static char *wpp_lookup_mem(const char *filename, int type, const char *parent_name,
char **include_path, int include_path_count)
{
/* Here we return always ok. We will maybe fail on the next wpp_open_mem */
char *path;
int i;
parent_include = NULL;
if(parent_name[0] != '\0')
{
for(i = 0; i < includes_size; i++)
{
if(!strcmp(parent_name, includes[i].name))
{
parent_include = includes[i].data;
break;
}
}
if(parent_include == NULL)
{
ERR("Parent include file missing\n");
return NULL;
}
}
path = malloc(strlen(filename) + 1);
if(path)
memcpy(path, filename, strlen(filename) + 1);
return path;
}
static void *wpp_open_mem(const char *filename, int type)
{
struct mem_file_desc *desc;
HRESULT hr;
if(!strcmp(filename, initial_filename))
{
current_shader.pos = 0;
return &current_shader;
}
if(current_include == NULL) return NULL;
desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*desc));
if(!desc)
return NULL;
hr = ID3DInclude_Open(current_include,
type ? D3D_INCLUDE_LOCAL : D3D_INCLUDE_SYSTEM,
filename, parent_include, (LPCVOID *)&desc->buffer,
&desc->size);
if(FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, desc);
return NULL;
}
if(includes_capacity == includes_size)
{
if(includes_capacity == 0)
{
includes = HeapAlloc(GetProcessHeap(), 0, INCLUDES_INITIAL_CAPACITY * sizeof(*includes));
if(includes == NULL)
{
ERR("Error allocating memory for the loaded includes structure\n");
goto error;
}
includes_capacity = INCLUDES_INITIAL_CAPACITY * sizeof(*includes);
}
else
{
int newcapacity = includes_capacity * 2;
struct loaded_include *newincludes =
HeapReAlloc(GetProcessHeap(), 0, includes, newcapacity);
if(newincludes == NULL)
{
ERR("Error reallocating memory for the loaded includes structure\n");
goto error;
}
includes = newincludes;
includes_capacity = newcapacity;
}
}
includes[includes_size].name = filename;
includes[includes_size++].data = desc->buffer;
desc->pos = 0;
return desc;
error:
ID3DInclude_Close(current_include, desc->buffer);
HeapFree(GetProcessHeap(), 0, desc);
return NULL;
}
static void wpp_close_mem(void *file)
{
struct mem_file_desc *desc = file;
if(desc != &current_shader)
{
if(current_include)
ID3DInclude_Close(current_include, desc->buffer);
else
ERR("current_include == NULL, desc == %p, buffer = %s\n",
desc, desc->buffer);
HeapFree(GetProcessHeap(), 0, desc);
}
}
static int wpp_read_mem(void *file, char *buffer, unsigned int len)
{
struct mem_file_desc *desc = file;
len = min(len, desc->size - desc->pos);
memcpy(buffer, desc->buffer + desc->pos, len);
desc->pos += len;
return len;
}
static void wpp_write_mem(const char *buffer, unsigned int len)
{
char *new_wpp_output;
if(wpp_output_capacity == 0)
{
wpp_output = HeapAlloc(GetProcessHeap(), 0, BUFFER_INITIAL_CAPACITY);
if(!wpp_output)
return;
wpp_output_capacity = BUFFER_INITIAL_CAPACITY;
}
if(len > wpp_output_capacity - wpp_output_size)
{
while(len > wpp_output_capacity - wpp_output_size)
{
wpp_output_capacity *= 2;
}
new_wpp_output = HeapReAlloc(GetProcessHeap(), 0, wpp_output,
wpp_output_capacity);
if(!new_wpp_output)
{
ERR("Error allocating memory\n");
return;
}
wpp_output = new_wpp_output;
}
memcpy(wpp_output + wpp_output_size, buffer, len);
wpp_output_size += len;
}
static int wpp_close_output(void)
{
char *new_wpp_output = HeapReAlloc(GetProcessHeap(), 0, wpp_output,
wpp_output_size + 1);
if(!new_wpp_output) return 0;
wpp_output = new_wpp_output;
wpp_output[wpp_output_size]='\0';
wpp_output_size++;
return 1;
}
static HRESULT preprocess_shader(const void *data, SIZE_T data_size, const char *filename,
const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **error_messages)
{
int ret;
HRESULT hr = S_OK;
const D3D_SHADER_MACRO *def = defines;
static const struct wpp_callbacks wpp_callbacks =
{
wpp_lookup_mem,
wpp_open_mem,
wpp_close_mem,
wpp_read_mem,
wpp_write_mem,
wpp_error,
wpp_warning,
};
if (def != NULL)
{
while (def->Name != NULL)
{
wpp_add_define(def->Name, def->Definition);
def++;
}
}
current_include = include;
includes_size = 0;
wpp_output_size = wpp_output_capacity = 0;
wpp_output = NULL;
wpp_set_callbacks(&wpp_callbacks);
wpp_messages_size = wpp_messages_capacity = 0;
wpp_messages = NULL;
current_shader.buffer = data;
current_shader.size = data_size;
initial_filename = filename ? filename : "";
ret = wpp_parse(initial_filename, NULL);
if (!wpp_close_output())
ret = 1;
if (ret)
{
TRACE("Error during shader preprocessing\n");
if (wpp_messages)
{
int size;
ID3DBlob *buffer;
TRACE("Preprocessor messages:\n%s\n", debugstr_a(wpp_messages));
if (error_messages)
{
size = strlen(wpp_messages) + 1;
hr = D3DCreateBlob(size, &buffer);
if (FAILED(hr))
goto cleanup;
CopyMemory(ID3D10Blob_GetBufferPointer(buffer), wpp_messages, size);
*error_messages = buffer;
}
}
if (data)
TRACE("Shader source:\n%s\n", debugstr_an(data, data_size));
hr = E_FAIL;
}
cleanup:
/* Remove the previously added defines */
if (defines != NULL)
{
while (defines->Name != NULL)
{
wpp_del_define(defines->Name);
defines++;
}
}
HeapFree(GetProcessHeap(), 0, wpp_messages);
return hr;
}
static HRESULT assemble_shader(const char *preproc_shader,
ID3DBlob **shader_blob, ID3DBlob **error_messages)
{
struct bwriter_shader *shader;
char *messages = NULL;
HRESULT hr;
DWORD *res, size;
ID3DBlob *buffer;
char *pos;
shader = SlAssembleShader(preproc_shader, &messages);
if (messages)
{
TRACE("Assembler messages:\n");
TRACE("%s\n", debugstr_a(messages));
TRACE("Shader source:\n");
TRACE("%s\n", debugstr_a(preproc_shader));
if (error_messages)
{
const char *preproc_messages = *error_messages ? ID3D10Blob_GetBufferPointer(*error_messages) : NULL;
size = strlen(messages) + (preproc_messages ? strlen(preproc_messages) : 0) + 1;
hr = D3DCreateBlob(size, &buffer);
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, messages);
if (shader) SlDeleteShader(shader);
return hr;
}
pos = ID3D10Blob_GetBufferPointer(buffer);
if (preproc_messages)
{
CopyMemory(pos, preproc_messages, strlen(preproc_messages) + 1);
pos += strlen(preproc_messages);
}
CopyMemory(pos, messages, strlen(messages) + 1);
if (*error_messages) ID3D10Blob_Release(*error_messages);
*error_messages = buffer;
}
HeapFree(GetProcessHeap(), 0, messages);
}
if (shader == NULL)
{
ERR("Asm reading failed\n");
return D3DXERR_INVALIDDATA;
}
hr = SlWriteBytecode(shader, 9, &res, &size);
SlDeleteShader(shader);
if (FAILED(hr))
{
ERR("SlWriteBytecode failed with 0x%08x\n", hr);
return D3DXERR_INVALIDDATA;
}
if (shader_blob)
{
hr = D3DCreateBlob(size, &buffer);
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, res);
return hr;
}
CopyMemory(ID3D10Blob_GetBufferPointer(buffer), res, size);
*shader_blob = buffer;
}
HeapFree(GetProcessHeap(), 0, res);
return S_OK;
}
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)
{
HRESULT hr;
TRACE("data %p, datasize %lu, filename %s, defines %p, include %p, sflags %#x,\n"
"shader %p, error_messages %p\n",
data, datasize, debugstr_a(filename), defines, include, flags, shader, error_messages);
EnterCriticalSection(&wpp_mutex);
/* TODO: flags */
if (flags) FIXME("flags %x\n", flags);
if (shader) *shader = NULL;
if (error_messages) *error_messages = NULL;
hr = preprocess_shader(data, datasize, filename, defines, include, error_messages);
if (SUCCEEDED(hr))
hr = assemble_shader(wpp_output, shader, error_messages);
HeapFree(GetProcessHeap(), 0, wpp_output);
LeaveCriticalSection(&wpp_mutex);
return hr;
}
struct target_info {
const char *name;
enum shader_type type;
DWORD sm_major;
DWORD sm_minor;
DWORD level_major;
DWORD level_minor;
BOOL sw;
BOOL support;
};
/* Must be kept sorted for binary search */
static const struct target_info targets_info[] = {
{ "cs_4_0", ST_UNKNOWN, 4, 0, 0, 0, FALSE, FALSE },
{ "cs_4_1", ST_UNKNOWN, 4, 1, 0, 0, FALSE, FALSE },
{ "cs_5_0", ST_UNKNOWN, 5, 0, 0, 0, FALSE, FALSE },
{ "ds_5_0", ST_UNKNOWN, 5, 0, 0, 0, FALSE, FALSE },
{ "fx_2_0", ST_UNKNOWN, 2, 0, 0, 0, FALSE, FALSE },
{ "fx_4_0", ST_UNKNOWN, 4, 0, 0, 0, FALSE, FALSE },
{ "fx_4_1", ST_UNKNOWN, 4, 1, 0, 0, FALSE, FALSE },
{ "fx_5_0", ST_UNKNOWN, 5, 0, 0, 0, FALSE, FALSE },
{ "gs_4_0", ST_UNKNOWN, 4, 0, 0, 0, FALSE, FALSE },
{ "gs_4_1", ST_UNKNOWN, 4, 1, 0, 0, FALSE, FALSE },
{ "gs_5_0", ST_UNKNOWN, 5, 0, 0, 0, FALSE, FALSE },
{ "hs_5_0", ST_UNKNOWN, 5, 0, 0, 0, FALSE, FALSE },
{ "ps.1.0", ST_PIXEL, 1, 0, 0, 0, FALSE, TRUE },
{ "ps.1.1", ST_PIXEL, 1, 1, 0, 0, FALSE, FALSE },
{ "ps.1.2", ST_PIXEL, 1, 2, 0, 0, FALSE, FALSE },
{ "ps.1.3", ST_PIXEL, 1, 3, 0, 0, FALSE, FALSE },
{ "ps.1.4", ST_PIXEL, 1, 4, 0, 0, FALSE, FALSE },
{ "ps.2.0", ST_PIXEL, 2, 0, 0, 0, FALSE, TRUE },
{ "ps.2.a", ST_PIXEL, 2, 1, 0, 0, FALSE, FALSE },
{ "ps.2.b", ST_PIXEL, 2, 2, 0, 0, FALSE, FALSE },
{ "ps.2.sw", ST_PIXEL, 2, 0, 0, 0, TRUE, FALSE },
{ "ps.3.0", ST_PIXEL, 3, 0, 0, 0, FALSE, TRUE },
{ "ps_1_0", ST_PIXEL, 1, 0, 0, 0, FALSE, TRUE },
{ "ps_1_1", ST_PIXEL, 1, 1, 0, 0, FALSE, FALSE },
{ "ps_1_2", ST_PIXEL, 1, 2, 0, 0, FALSE, FALSE },
{ "ps_1_3", ST_PIXEL, 1, 3, 0, 0, FALSE, FALSE },
{ "ps_1_4", ST_PIXEL, 1, 4, 0, 0, FALSE, FALSE },
{ "ps_2_0", ST_PIXEL, 2, 0, 0, 0, FALSE, TRUE },
{ "ps_2_a", ST_PIXEL, 2, 1, 0, 0, FALSE, FALSE },
{ "ps_2_b", ST_PIXEL, 2, 2, 0, 0, FALSE, FALSE },
{ "ps_2_sw", ST_PIXEL, 2, 0, 0, 0, TRUE, FALSE },
{ "ps_3_0", ST_PIXEL, 3, 0, 0, 0, FALSE, TRUE },
{ "ps_3_sw", ST_PIXEL, 3, 0, 0, 0, TRUE, FALSE },
{ "ps_4_0", ST_PIXEL, 4, 0, 0, 0, FALSE, TRUE },
{ "ps_4_0_level_9_0", ST_PIXEL, 4, 0, 9, 0, FALSE, FALSE },
{ "ps_4_0_level_9_1", ST_PIXEL, 4, 0, 9, 1, FALSE, FALSE },
{ "ps_4_0_level_9_3", ST_PIXEL, 4, 0, 9, 3, FALSE, FALSE },
{ "ps_4_1", ST_PIXEL, 4, 1, 0, 0, FALSE, TRUE },
{ "ps_5_0", ST_PIXEL, 5, 0, 0, 0, FALSE, TRUE },
{ "tx_1_0", ST_UNKNOWN, 1, 0, 0, 0, FALSE, FALSE },
{ "vs.1.0", ST_VERTEX, 1, 0, 0, 0, FALSE, TRUE },
{ "vs.1.1", ST_VERTEX, 1, 1, 0, 0, FALSE, TRUE },
{ "vs.2.0", ST_VERTEX, 2, 0, 0, 0, FALSE, TRUE },
{ "vs.2.a", ST_VERTEX, 2, 1, 0, 0, FALSE, FALSE },
{ "vs.2.sw", ST_VERTEX, 2, 0, 0, 0, TRUE, FALSE },
{ "vs.3.0", ST_VERTEX, 3, 0, 0, 0, FALSE, TRUE },
{ "vs.3.sw", ST_VERTEX, 3, 0, 0, 0, TRUE, FALSE },
{ "vs_1_0", ST_VERTEX, 1, 0, 0, 0, FALSE, TRUE },
{ "vs_1_1", ST_VERTEX, 1, 1, 0, 0, FALSE, TRUE },
{ "vs_2_0", ST_VERTEX, 2, 0, 0, 0, FALSE, TRUE },
{ "vs_2_a", ST_VERTEX, 2, 1, 0, 0, FALSE, FALSE },
{ "vs_2_sw", ST_VERTEX, 2, 0, 0, 0, TRUE, FALSE },
{ "vs_3_0", ST_VERTEX, 3, 0, 0, 0, FALSE, TRUE },
{ "vs_3_sw", ST_VERTEX, 3, 0, 0, 0, TRUE, FALSE },
{ "vs_4_0", ST_VERTEX, 4, 0, 0, 0, FALSE, TRUE },
{ "vs_4_0_level_9_0", ST_VERTEX, 4, 0, 9, 0, FALSE, FALSE },
{ "vs_4_0_level_9_1", ST_VERTEX, 4, 0, 9, 1, FALSE, FALSE },
{ "vs_4_0_level_9_3", ST_VERTEX, 4, 0, 9, 3, FALSE, FALSE },
{ "vs_4_1", ST_VERTEX, 4, 1, 0, 0, FALSE, TRUE },
{ "vs_5_0", ST_VERTEX, 5, 0, 0, 0, FALSE, TRUE },
};
static const struct target_info * get_target_info(const char *target)
{
LONG min = 0;
LONG max = sizeof(targets_info) / sizeof(targets_info[0]) - 1;
LONG cur;
int res;
while (min <= max)
{
cur = (min + max) / 2;
res = strcmp(target, targets_info[cur].name);
if (res < 0)
max = cur - 1;
else if (res > 0)
min = cur + 1;
else
return &targets_info[cur];
}
return NULL;
}
static HRESULT compile_shader(const char *preproc_shader, const char *target, const char *entrypoint,
ID3DBlob **shader_blob, ID3DBlob **error_messages)
{
struct bwriter_shader *shader;
char *messages = NULL;
HRESULT hr;
DWORD *res, size, major, minor;
ID3DBlob *buffer;
char *pos;
enum shader_type shader_type;
const struct target_info *info;
TRACE("Preprocessed shader source: %s\n", debugstr_a(preproc_shader));
TRACE("Checking compilation target %s\n", debugstr_a(target));
info = get_target_info(target);
if (!info)
{
FIXME("Unknown compilation target %s\n", debugstr_a(target));
return D3DERR_INVALIDCALL;
}
else
{
if (!info->support)
{
FIXME("Compilation target %s not yet supported\n", debugstr_a(target));
return D3DERR_INVALIDCALL;
}
else
{
shader_type = info->type;
major = info->sm_major;
minor = info->sm_minor;
}
}
shader = parse_hlsl_shader(preproc_shader, shader_type, major, minor, entrypoint, &messages);
if (messages)
{
TRACE("Compiler messages:\n");
TRACE("%s\n", debugstr_a(messages));
TRACE("Shader source:\n");
TRACE("%s\n", debugstr_a(preproc_shader));
if (error_messages)
{
const char *preproc_messages = *error_messages ? ID3D10Blob_GetBufferPointer(*error_messages) : NULL;
size = strlen(messages) + (preproc_messages ? strlen(preproc_messages) : 0) + 1;
hr = D3DCreateBlob(size, &buffer);
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, messages);
if (shader) SlDeleteShader(shader);
return hr;
}
pos = ID3D10Blob_GetBufferPointer(buffer);
if (preproc_messages)
{
memcpy(pos, preproc_messages, strlen(preproc_messages) + 1);
pos += strlen(preproc_messages);
}
memcpy(pos, messages, strlen(messages) + 1);
if (*error_messages) ID3D10Blob_Release(*error_messages);
*error_messages = buffer;
}
HeapFree(GetProcessHeap(), 0, messages);
}
if (!shader)
{
ERR("HLSL shader parsing failed.\n");
return D3DXERR_INVALIDDATA;
}
hr = SlWriteBytecode(shader, 9, &res, &size);
SlDeleteShader(shader);
if (FAILED(hr))
{
ERR("SlWriteBytecode failed with error 0x%08x.\n", hr);
return D3DXERR_INVALIDDATA;
}
if (shader_blob)
{
hr = D3DCreateBlob(size, &buffer);
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, res);
return hr;
}
memcpy(ID3D10Blob_GetBufferPointer(buffer), res, size);
*shader_blob = buffer;
}
HeapFree(GetProcessHeap(), 0, res);
return S_OK;
}
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)
{
HRESULT hr;
TRACE("data %p, data_size %lu, filename %s, defines %p, include %p, entrypoint %s,\n"
"target %s, sflags %#x, eflags %#x, shader %p, error_messages %p\n",
data, data_size, debugstr_a(filename), defines, include, debugstr_a(entrypoint),
debugstr_a(target), sflags, eflags, shader, error_messages);
if (shader) *shader = NULL;
if (error_messages) *error_messages = NULL;
EnterCriticalSection(&wpp_mutex);
hr = preprocess_shader(data, data_size, filename, defines, include, error_messages);
if (SUCCEEDED(hr))
hr = compile_shader(wpp_output, target, entrypoint, shader, error_messages);
HeapFree(GetProcessHeap(), 0, wpp_output);
LeaveCriticalSection(&wpp_mutex);
return hr;
}
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 hr;
ID3DBlob *buffer;
TRACE("data %p, size %lu, filename %s, defines %p, include %p, shader %p, error_messages %p\n",
data, size, debugstr_a(filename), defines, include, shader, error_messages);
if (!data)
return E_INVALIDARG;
EnterCriticalSection(&wpp_mutex);
if (shader) *shader = NULL;
if (error_messages) *error_messages = NULL;
hr = preprocess_shader(data, size, filename, defines, include, error_messages);
if (SUCCEEDED(hr))
{
if (shader)
{
hr = D3DCreateBlob(wpp_output_size, &buffer);
if (FAILED(hr))
goto cleanup;
CopyMemory(ID3D10Blob_GetBufferPointer(buffer), wpp_output, wpp_output_size);
*shader = buffer;
}
else
hr = E_INVALIDARG;
}
cleanup:
HeapFree(GetProcessHeap(), 0, wpp_output);
LeaveCriticalSection(&wpp_mutex);
return hr;
}
HRESULT WINAPI D3DDisassemble(const void *data, SIZE_T size, UINT flags, const char *comments, ID3DBlob **disassembly)
{
FIXME("data %p, size %lu, flags %#x, comments %p, disassembly %p stub!\n",
data, size, flags, comments, disassembly);
return E_NOTIMPL;
}

View file

@ -0,0 +1,17 @@
@ stdcall D3DAssemble(ptr long str ptr ptr long ptr ptr)
@ stub DebugSetMute
@ stdcall D3DCompile(ptr long str ptr ptr str str long long ptr ptr)
@ stub D3DCompressShaders
@ stdcall D3DCreateBlob(long ptr)
@ stub D3DDecompressShaders
@ stdcall -stub D3DDisassemble10Effect(ptr long ptr)
@ stdcall D3DDisassemble(ptr long long ptr ptr)
@ stdcall D3DGetBlobPart(ptr long long long ptr)
@ stdcall D3DGetDebugInfo(ptr long ptr)
@ stdcall D3DGetInputAndOutputSignatureBlob(ptr long ptr)
@ stdcall D3DGetInputSignatureBlob(ptr long ptr)
@ stdcall D3DGetOutputSignatureBlob(ptr long ptr)
@ stdcall D3DPreprocess(ptr long str ptr ptr ptr ptr)
@ stdcall D3DReflect(ptr long ptr ptr)
@ stub D3DReturnFailure1
@ stdcall D3DStripShader(ptr long long ptr)

View file

@ -0,0 +1,42 @@
/*
* Direct3D shader compiler main file
*
* Copyright 2010 Matteo Bruni for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "d3dcompiler_private.h"
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
{
switch (reason)
{
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(inst);
break;
}
return TRUE;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,294 @@
/*
* HLSL parser
*
* Copyright 2008 Stefan Dösinger
* Copyright 2012 Matteo Bruni for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
%{
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#define YY_NO_UNISTD_H
#include "d3dcompiler_private.h"
#include "hlsl.tab.h"
WINE_DEFAULT_DEBUG_CHANNEL(hlsl_parser);
#define YY_USER_ACTION \
do { \
hlsl_lloc.first_column = hlsl_ctx.column; \
hlsl_lloc.first_line = hlsl_ctx.line_no; \
hlsl_ctx.column += yyleng; \
} while(0);
%}
%option noyywrap nounput noinput never-interactive
%option prefix="hlsl_"
%x pp pp_line pp_pragma pp_ignore
RESERVED1 auto|case|catch|char|class|const_cast|default|delete|dynamic_cast|enum
RESERVED2 explicit|friend|goto|long|mutable|new|operator|private|protected|public
RESERVED3 reinterpret_cast|short|signed|sizeof|static_cast|template|this|throw|try
RESERVED4 typename|union|unsigned|using|virtual
WS [ \t]
NEWLINE (\n)|(\r\n)
DOUBLESLASHCOMMENT "//"[^\n]*
STRING \"[^\"]*\"
IDENTIFIER [A-Za-z_][A-Za-z0-9_]*
ANY (.)
%%
{RESERVED1} {
hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, yytext);
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
}
{RESERVED2} {
hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, yytext);
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
}
{RESERVED3} {
hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, yytext);
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
}
{RESERVED4} {
hlsl_message("Line %u: Reserved keyword \"%s\" used.\n", hlsl_ctx.line_no, yytext);
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
}
BlendState {return KW_BLENDSTATE; }
break {return KW_BREAK; }
Buffer {return KW_BUFFER; }
cbuffer {return KW_CBUFFER; }
compile {return KW_COMPILE; }
const {return KW_CONST; }
continue {return KW_CONTINUE; }
DepthStencilState {return KW_DEPTHSTENCILSTATE; }
DepthStencilView {return KW_DEPTHSTENCILVIEW; }
discard {return KW_DISCARD; }
do {return KW_DO; }
double {return KW_DOUBLE; }
else {return KW_ELSE; }
extern {return KW_EXTERN; }
false {return KW_FALSE; }
for {return KW_FOR; }
GeometryShader {return KW_GEOMETRYSHADER; }
groupshared {return KW_GROUPSHARED; }
if {return KW_IF; }
in {return KW_IN; }
inline {return KW_INLINE; }
inout {return KW_INOUT; }
matrix {return KW_MATRIX; }
namespace {return KW_NAMESPACE; }
nointerpolation {return KW_NOINTERPOLATION; }
out {return KW_OUT; }
pass {return KW_PASS; }
PixelShader {return KW_PIXELSHADER; }
precise {return KW_PRECISE; }
RasterizerState {return KW_RASTERIZERSTATE; }
RenderTargetView {return KW_RENDERTARGETVIEW; }
return {return KW_RETURN; }
register {return KW_REGISTER; }
sampler {return KW_SAMPLER; }
sampler1D {return KW_SAMPLER1D; }
sampler2D {return KW_SAMPLER2D; }
sampler3D {return KW_SAMPLER3D; }
samplerCUBE {return KW_SAMPLERCUBE; }
sampler_state {return KW_SAMPLER_STATE; }
SamplerComparisonState {return KW_SAMPLERCOMPARISONSTATE;}
shared {return KW_SHARED; }
stateblock {return KW_STATEBLOCK; }
stateblock_state {return KW_STATEBLOCK_STATE; }
static {return KW_STATIC; }
string {return KW_STRING; }
struct {return KW_STRUCT; }
switch {return KW_SWITCH; }
tbuffer {return KW_TBUFFER; }
technique {return KW_TECHNIQUE; }
technique10 {return KW_TECHNIQUE10; }
texture {return KW_TEXTURE; }
texture1D {return KW_TEXTURE1D; }
Texture1DArray {return KW_TEXTURE1DARRAY; }
texture2D {return KW_TEXTURE2D; }
Texture2DArray {return KW_TEXTURE2DARRAY; }
Texture2DMS {return KW_TEXTURE2DMS; }
Texture2DMSArray {return KW_TEXTURE2DMSARRAY; }
texture3D {return KW_TEXTURE3D; }
Texture3DArray {return KW_TEXTURE3DARRAY; }
textureCUBE {return KW_TEXTURECUBE; }
true {return KW_TRUE; }
typedef {return KW_TYPEDEF; }
uniform {return KW_UNIFORM; }
vector {return KW_VECTOR; }
VertexShader {return KW_VERTEXSHADER; }
void {return KW_VOID; }
volatile {return KW_VOLATILE; }
while {return KW_WHILE; }
\+\+ {return OP_INC; }
\-\- {return OP_DEC; }
&& {return OP_AND; }
\|\| {return OP_OR; }
== {return OP_EQ; }
\<\< {return OP_LEFTSHIFT; }
\<\<= {return OP_LEFTSHIFTASSIGN; }
\>\> {return OP_RIGHTSHIFT; }
\>\>= {return OP_RIGHTSHIFTASSIGN; }
\.\.\. {return OP_ELLIPSIS; }
\<= {return OP_LE; }
\>= {return OP_GE; }
!= {return OP_NE; }
\+= {return OP_ADDASSIGN; }
\-= {return OP_SUBASSIGN; }
\*= {return OP_MULASSIGN; }
\/= {return OP_DIVASSIGN; }
%= {return OP_MODASSIGN; }
&= {return OP_ANDASSIGN; }
\|= {return OP_ORASSIGN; }
^= {return OP_XORASSIGN; }
## {return OP_UNKNOWN1; }
#@ {return OP_UNKNOWN2; }
:: {return OP_UNKNOWN3; }
\-\> {return OP_UNKNOWN4; }
column_major {return KW_COLUMN_MAJOR; }
row_major {return KW_ROW_MAJOR; }
{IDENTIFIER} {
hlsl_lval.name = d3dcompiler_strdup(yytext);
if (get_variable(hlsl_ctx.cur_scope, yytext)
|| find_function(yytext))
return VAR_IDENTIFIER;
else if (get_type(hlsl_ctx.cur_scope, yytext, TRUE))
return TYPE_IDENTIFIER;
else
return NEW_IDENTIFIER;
}
[0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[h|H|f|F]? {
hlsl_lval.floatval = atof(yytext);
return C_FLOAT;
}
[0-9]+\.([eE][+-]?[0-9]+)?[h|H|f|F]? {
hlsl_lval.floatval = atof(yytext);
return C_FLOAT;
}
[0-9]+([eE][+-]?[0-9]+)?[h|H|f|F] {
hlsl_lval.floatval = atof(yytext);
return C_FLOAT;
}
0x[0-9a-fA-F]+ {
sscanf(yytext, "0x%x", &hlsl_lval.intval);
return C_INTEGER;
}
0[0-7]+ {
sscanf(yytext, "0%o", &hlsl_lval.intval);
return C_INTEGER;
}
[0-9]+ {
hlsl_lval.intval = (atoi(yytext));
return C_INTEGER;
}
{DOUBLESLASHCOMMENT} {}
{WS}+ {}
{NEWLINE} {
hlsl_ctx.line_no++;
hlsl_ctx.column = 1;
}
^# {
BEGIN pp;
}
<pp>pragma{WS}+ {
TRACE("Got a #pragma.\n");
BEGIN pp_pragma;
}
<pp_pragma>pack_matrix{WS}*\({WS}*row_major{WS}*\) {
TRACE("#pragma setting row_major mode.\n");
hlsl_ctx.matrix_majority = HLSL_ROW_MAJOR;
BEGIN pp_ignore;
}
<pp_pragma>pack_matrix{WS}*\({WS}*column_major{WS}*\) {
TRACE("#pragma setting column_major mode.\n");
hlsl_ctx.matrix_majority = HLSL_COLUMN_MAJOR;
BEGIN pp_ignore;
}
<pp_pragma>{NEWLINE} {
FIXME("Unsupported preprocessor #pragma directive at line %u.\n", hlsl_ctx.line_no);
BEGIN INITIAL;
}
<pp_pragma>{ANY} {}
<pp>[0-9]+ {
TRACE("Preprocessor line info.\n");
BEGIN pp_line;
hlsl_lval.intval = (atoi(yytext));
return PRE_LINE;
}
<pp_line>{STRING} {
char *string = d3dcompiler_strdup(yytext + 1);
BEGIN pp_ignore;
string[strlen(string) - 1] = 0;
hlsl_lval.name = string;
return STRING;
}
<pp_line>{WS}+ {}
<pp_line>{NEWLINE} {
FIXME("Malformed preprocessor line directive?\n");
BEGIN INITIAL;
}
<pp_ignore>{NEWLINE} {
BEGIN INITIAL;
}
<pp_ignore>{ANY} {}
<pp>{NEWLINE} {
FIXME("Unexpected preprocessor directive.\n");
BEGIN INITIAL;
}
<pp>{ANY} {}
{ANY} {
return yytext[0];
}
%%
struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD minor,
const char *entrypoint, char **messages);
struct bwriter_shader *parse_hlsl_shader(const char *text, enum shader_type type, DWORD major, DWORD minor,
const char *entrypoint, char **messages)
{
struct bwriter_shader *ret = NULL;
YY_BUFFER_STATE buffer;
buffer = hlsl__scan_string(text);
hlsl__switch_to_buffer(buffer);
ret = parse_hlsl(type, major, minor, entrypoint, messages);
hlsl__delete_buffer(buffer);
return ret;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,196 @@
/* A Bison parser, made by GNU Bison 2.5. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
KW_BLENDSTATE = 258,
KW_BREAK = 259,
KW_BUFFER = 260,
KW_CBUFFER = 261,
KW_COLUMN_MAJOR = 262,
KW_COMPILE = 263,
KW_CONST = 264,
KW_CONTINUE = 265,
KW_DEPTHSTENCILSTATE = 266,
KW_DEPTHSTENCILVIEW = 267,
KW_DISCARD = 268,
KW_DO = 269,
KW_DOUBLE = 270,
KW_ELSE = 271,
KW_EXTERN = 272,
KW_FALSE = 273,
KW_FOR = 274,
KW_GEOMETRYSHADER = 275,
KW_GROUPSHARED = 276,
KW_IF = 277,
KW_IN = 278,
KW_INLINE = 279,
KW_INOUT = 280,
KW_MATRIX = 281,
KW_NAMESPACE = 282,
KW_NOINTERPOLATION = 283,
KW_OUT = 284,
KW_PASS = 285,
KW_PIXELSHADER = 286,
KW_PRECISE = 287,
KW_RASTERIZERSTATE = 288,
KW_RENDERTARGETVIEW = 289,
KW_RETURN = 290,
KW_REGISTER = 291,
KW_ROW_MAJOR = 292,
KW_SAMPLER = 293,
KW_SAMPLER1D = 294,
KW_SAMPLER2D = 295,
KW_SAMPLER3D = 296,
KW_SAMPLERCUBE = 297,
KW_SAMPLER_STATE = 298,
KW_SAMPLERCOMPARISONSTATE = 299,
KW_SHARED = 300,
KW_STATEBLOCK = 301,
KW_STATEBLOCK_STATE = 302,
KW_STATIC = 303,
KW_STRING = 304,
KW_STRUCT = 305,
KW_SWITCH = 306,
KW_TBUFFER = 307,
KW_TECHNIQUE = 308,
KW_TECHNIQUE10 = 309,
KW_TEXTURE = 310,
KW_TEXTURE1D = 311,
KW_TEXTURE1DARRAY = 312,
KW_TEXTURE2D = 313,
KW_TEXTURE2DARRAY = 314,
KW_TEXTURE2DMS = 315,
KW_TEXTURE2DMSARRAY = 316,
KW_TEXTURE3D = 317,
KW_TEXTURE3DARRAY = 318,
KW_TEXTURECUBE = 319,
KW_TRUE = 320,
KW_TYPEDEF = 321,
KW_UNIFORM = 322,
KW_VECTOR = 323,
KW_VERTEXSHADER = 324,
KW_VOID = 325,
KW_VOLATILE = 326,
KW_WHILE = 327,
OP_INC = 328,
OP_DEC = 329,
OP_AND = 330,
OP_OR = 331,
OP_EQ = 332,
OP_LEFTSHIFT = 333,
OP_LEFTSHIFTASSIGN = 334,
OP_RIGHTSHIFT = 335,
OP_RIGHTSHIFTASSIGN = 336,
OP_ELLIPSIS = 337,
OP_LE = 338,
OP_GE = 339,
OP_NE = 340,
OP_ADDASSIGN = 341,
OP_SUBASSIGN = 342,
OP_MULASSIGN = 343,
OP_DIVASSIGN = 344,
OP_MODASSIGN = 345,
OP_ANDASSIGN = 346,
OP_ORASSIGN = 347,
OP_XORASSIGN = 348,
OP_UNKNOWN1 = 349,
OP_UNKNOWN2 = 350,
OP_UNKNOWN3 = 351,
OP_UNKNOWN4 = 352,
PRE_LINE = 353,
VAR_IDENTIFIER = 354,
TYPE_IDENTIFIER = 355,
NEW_IDENTIFIER = 356,
STRING = 357,
C_FLOAT = 358,
C_INTEGER = 359
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 2068 of yacc.c */
#line 841 "hlsl.y"
struct hlsl_type *type;
INT intval;
FLOAT floatval;
BOOL boolval;
char *name;
DWORD modifiers;
struct hlsl_ir_var *var;
struct hlsl_ir_node *instr;
struct list *list;
struct parse_function function;
struct parse_parameter parameter;
struct parse_variable_def *variable_def;
struct parse_if_body if_body;
enum parse_unary_op unary_op;
enum parse_assign_op assign_op;
/* Line 2068 of yacc.c */
#line 174 "hlsl.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE hlsl_lval;
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
} YYLTYPE;
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
extern YYLTYPE hlsl_lloc;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
/*
* Copyright 2010 Matteo Bruni for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_FILEDESCRIPTION_STR "Wine D3DCompiler"
#define WINE_FILENAME_STR "d3dcompiler_43.dll"
#define WINE_FILEVERSION 9,29,952,3111
#define WINE_FILEVERSION_STR "9.29.952.3111"
#define WINE_PRODUCTVERSION 9,29,952,3111
#define WINE_PRODUCTVERSION_STR "9.29.952.3111"
#include "wine/wine_common_ver.rc"

View file

@ -0,0 +1,208 @@
/*
* Copyright 2010 Matteo Bruni for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __D3D11SHADER_H__
#define __D3D11SHADER_H__
#include "d3dcommon.h"
/* These are defined as version-neutral in d3dcommon.h */
typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE;
typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE;
typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN;
typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING;
typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
typedef struct _D3D11_SHADER_DESC
{
UINT Version;
LPCSTR Creator;
UINT Flags;
UINT ConstantBuffers;
UINT BoundResources;
UINT InputParameters;
UINT OutputParameters;
UINT InstructionCount;
UINT TempRegisterCount;
UINT TempArrayCount;
UINT DefCount;
UINT DclCount;
UINT TextureNormalInstructions;
UINT TextureLoadInstructions;
UINT TextureCompInstructions;
UINT TextureBiasInstructions;
UINT TextureGradientInstructions;
UINT FloatInstructionCount;
UINT IntInstructionCount;
UINT UintInstructionCount;
UINT StaticFlowControlCount;
UINT DynamicFlowControlCount;
UINT MacroInstructionCount;
UINT ArrayInstructionCount;
UINT CutInstructionCount;
UINT EmitInstructionCount;
D3D_PRIMITIVE_TOPOLOGY GSOutputTopology;
UINT GSMaxOutputVertexCount;
D3D_PRIMITIVE InputPrimitive;
UINT PatchConstantParameters;
UINT cGSInstanceCount;
UINT cControlPoints;
D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive;
D3D_TESSELLATOR_PARTITIONING HSPartitioning;
D3D_TESSELLATOR_DOMAIN TessellatorDomain;
UINT cBarrierInstructions;
UINT cInterlockedInstructions;
UINT cTextureStoreInstructions;
} D3D11_SHADER_DESC;
typedef struct _D3D11_SHADER_VARIABLE_DESC
{
LPCSTR Name;
UINT StartOffset;
UINT Size;
UINT uFlags;
LPVOID DefaultValue;
UINT StartTexture;
UINT TextureSize;
UINT StartSampler;
UINT SamplerSize;
} D3D11_SHADER_VARIABLE_DESC;
typedef struct _D3D11_SHADER_TYPE_DESC
{
D3D_SHADER_VARIABLE_CLASS Class;
D3D_SHADER_VARIABLE_TYPE Type;
UINT Rows;
UINT Columns;
UINT Elements;
UINT Members;
UINT Offset;
LPCSTR Name;
} D3D11_SHADER_TYPE_DESC;
typedef struct _D3D11_SHADER_BUFFER_DESC
{
LPCSTR Name;
D3D_CBUFFER_TYPE Type;
UINT Variables;
UINT Size;
UINT uFlags;
} D3D11_SHADER_BUFFER_DESC;
typedef struct _D3D11_SHADER_INPUT_BIND_DESC
{
LPCSTR Name;
D3D_SHADER_INPUT_TYPE Type;
UINT BindPoint;
UINT BindCount;
UINT uFlags;
D3D_RESOURCE_RETURN_TYPE ReturnType;
D3D_SRV_DIMENSION Dimension;
UINT NumSamples;
} D3D11_SHADER_INPUT_BIND_DESC;
typedef struct _D3D11_SIGNATURE_PARAMETER_DESC
{
LPCSTR SemanticName;
UINT SemanticIndex;
UINT Register;
D3D_NAME SystemValueType;
D3D_REGISTER_COMPONENT_TYPE ComponentType;
BYTE Mask;
BYTE ReadWriteMask;
UINT Stream;
} D3D11_SIGNATURE_PARAMETER_DESC;
DEFINE_GUID(IID_ID3D11ShaderReflectionType, 0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21);
#define INTERFACE ID3D11ShaderReflectionType
DECLARE_INTERFACE(ID3D11ShaderReflectionType)
{
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_TYPE_DESC *desc) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByIndex)(THIS_ UINT index) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionType *, GetMemberTypeByName)(THIS_ LPCSTR name) PURE;
STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT index) PURE;
STDMETHOD(IsEqual)(THIS_ struct ID3D11ShaderReflectionType *type) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionType *, GetSubType)(THIS) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionType *, GetBaseClass)(THIS) PURE;
STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionType *, GetInterfaceByIndex)(THIS_ UINT index) PURE;
STDMETHOD(IsOfType)(THIS_ struct ID3D11ShaderReflectionType *type) PURE;
STDMETHOD(ImplementsInterface)(THIS_ ID3D11ShaderReflectionType *base) PURE;
};
#undef INTERFACE
DEFINE_GUID(IID_ID3D11ShaderReflectionVariable, 0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c);
#define INTERFACE ID3D11ShaderReflectionVariable
DECLARE_INTERFACE(ID3D11ShaderReflectionVariable)
{
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_VARIABLE_DESC *desc) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionType *, GetType)(THIS) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetBuffer)(THIS) PURE;
STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ UINT index) PURE;
};
#undef INTERFACE
DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer, 0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8);
#define INTERFACE ID3D11ShaderReflectionConstantBuffer
DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer)
{
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *desc) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByIndex)(THIS_ UINT index) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ LPCSTR name) PURE;
};
#undef INTERFACE
DEFINE_GUID(IID_ID3D11ShaderReflection, 0x0a233719, 0x3960, 0x4578, 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1);
#define INTERFACE ID3D11ShaderReflection
DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown)
{
/* IUnknown methods */
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *object) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
/* ID3D11ShaderReflection methods */
STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_DESC *desc) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ UINT index) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ LPCSTR name) PURE;
STDMETHOD(GetResourceBindingDesc)(THIS_ UINT index, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE;
STDMETHOD(GetInputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
STDMETHOD(GetOutputParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
STDMETHOD(GetPatchConstantParameterDesc)(THIS_ UINT index, D3D11_SIGNATURE_PARAMETER_DESC *desc) PURE;
STDMETHOD_(struct ID3D11ShaderReflectionVariable *, GetVariableByName)(THIS_ LPCSTR name) PURE;
STDMETHOD(GetResourceBindingDescByName)(THIS_ LPCSTR name, D3D11_SHADER_INPUT_BIND_DESC *desc) PURE;
STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE;
STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
STDMETHOD(GetMinFeatureLevel)(THIS_ enum D3D_FEATURE_LEVEL *level) PURE;
STDMETHOD_(UINT, GetThreadGroupSize)(THIS_ UINT *sizex, UINT *sizey, UINT *sizez) PURE;
};
#undef INTERFACE
#endif

View file

@ -461,6 +461,9 @@ typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE {
#define D3DSHADER_INSTRUCTION_PREDICATED (1 << 28)
#define D3DSI_TEXLD_PROJECT 0x00010000
#define D3DSI_TEXLD_BIAS 0x00020000
/** for parallelism */
#define D3DSI_COISSUE 0x40000000
@ -1586,6 +1589,19 @@ typedef enum _D3DCOMPOSERECTSOP{
} D3DCOMPOSERECTSOP;
#endif /* D3D_DISABLE_9EX */
typedef enum _D3DSHADER_COMPARISON
{
D3DSPC_RESERVED0 = 0,
D3DSPC_GT,
D3DSPC_EQ,
D3DSPC_GE,
D3DSPC_LT,
D3DSPC_NE,
D3DSPC_LE,
D3DSPC_RESERVED1,
} D3DSHADER_COMPARISON;
#pragma pack(pop)
#endif /* DIRECT3D_VERSION >= 0x0900 */

View file

@ -0,0 +1,123 @@
/*
* Copyright 2010 Matteo Bruni for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __D3DCOMPILER_H__
#define __D3DCOMPILER_H__
#include "d3d11shader.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__GNUC__)
#define D3DCOMPILER_DLL_W (const WCHAR[]){'d','3','d','c','o','m','p','i','l','e','r','_','4','3','.','d','l','l',0}
#elif defined(_MSC_VER)
#define D3DCOMPILER_DLL_W L"d3dcompiler_43.dll"
#else
static const WCHAR D3DCOMPILER_DLL_W[] = {'d','3','d','c','o','m','p','i','l','e','r','_','4','3','.','d','l','l',0};
#endif
#define D3DCOMPILER_DLL_A "d3dcompiler_43.dll"
#define D3DCOMPILER_DLL WINELIB_NAME_AW(D3DCOMPILER_DLL_)
#define D3DCOMPILE_DEBUG 0x00000001
#define D3DCOMPILE_SKIP_VALIDATION 0x00000002
#define D3DCOMPILE_SKIP_OPTIMIZATION 0x00000004
#define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR 0x00000008
#define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR 0x00000010
#define D3DCOMPILE_PARTIAL_PRECISION 0x00000020
#define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT 0x00000040
#define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT 0x00000080
#define D3DCOMPILE_NO_PRESHADER 0x00000100
#define D3DCOMPILE_AVOID_FLOW_CONTROL 0x00000200
#define D3DCOMPILE_PREFER_FLOW_CONTROL 0x00000400
#define D3DCOMPILE_ENABLE_STRICTNESS 0x00000800
#define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY 0x00001000
#define D3DCOMPILE_IEEE_STRICTNESS 0x00002000
#define D3DCOMPILE_OPTIMIZATION_LEVEL0 0x00004000
#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0x00000000
#define D3DCOMPILE_OPTIMIZATION_LEVEL2 0x0000c000
#define D3DCOMPILE_OPTIMIZATION_LEVEL3 0x00008000
#define D3DCOMPILE_WARNINGS_ARE_ERRORS 0x00040000
#define D3D_DISASM_ENABLE_COLOR_CODE 0x00000001
#define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS 0x00000002
#define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING 0x00000004
#define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE 0x00000008
#define D3D_DISASM_DISABLE_DEBUG_INFO 0x00000010
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);
typedef HRESULT (WINAPI *pD3DCompile)(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);
typedef enum D3DCOMPILER_STRIP_FLAGS
{
D3DCOMPILER_STRIP_REFLECTION_DATA = 1,
D3DCOMPILER_STRIP_DEBUG_INFO = 2,
D3DCOMPILER_STRIP_TEST_BLOBS = 4,
D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff
} D3DCOMPILER_STRIP_FLAGS;
HRESULT WINAPI D3DStripShader(const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob);
typedef enum D3D_BLOB_PART
{
D3D_BLOB_INPUT_SIGNATURE_BLOB,
D3D_BLOB_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB,
D3D_BLOB_ALL_SIGNATURE_BLOB,
D3D_BLOB_DEBUG_INFO,
D3D_BLOB_LEGACY_SHADER,
D3D_BLOB_XNA_PREPASS_SHADER,
D3D_BLOB_XNA_SHADER,
D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000,
D3D_BLOB_TEST_COMPILE_DETAILS,
D3D_BLOB_TEST_COMPILE_PERF
} D3D_BLOB_PART;
HRESULT WINAPI D3DDisassemble(const void *data, SIZE_T data_size,
UINT flags, const char *comments, ID3DBlob **disassembly);
typedef HRESULT (WINAPI *pD3DDisassemble)(const void *data, SIZE_T data_size,
UINT flags, const char *comments, ID3DBlob **disassembly);
HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob);
HRESULT WINAPI D3DGetInputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
HRESULT WINAPI D3DGetOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
HRESULT WINAPI D3DGetInputAndOutputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
HRESULT WINAPI D3DGetDebugInfo(const void *data, SIZE_T data_size, ID3DBlob **blob);
HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector);
HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob);
HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename,
const D3D_SHADER_MACRO *defines, ID3DInclude *include,
ID3DBlob **shader, ID3DBlob **error_messages);
typedef HRESULT (WINAPI *pD3DPreprocess)(const void *data, SIZE_T size, const char *filename,
const D3D_SHADER_MACRO *defines, ID3DInclude *include,
ID3DBlob **shader, ID3DBlob **error_messages);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,2 +1,3 @@
add_library(dxguid dxguid-mingw.c)
add_library(dx10guid dx10guid.c)

View file

@ -0,0 +1,40 @@
/*
* DirectX 10 GUID definitions
*
* Copyright 2000 Alexandre Julliard
* Copyright 2000 Francois Gouget
* Copyright 2003 Raphael Junqueira
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "olectl.h"
#include "initguid.h"
#if 0
#include "d3d10_1.h"
#include "d3d11.h"
#include "d3d10_1shader.h"
#endif
#include "d3d11shader.h"

View file

@ -27,23 +27,25 @@ reactos/tools/wpp # Synced to Wine-1.7.1
The following libraries are shared with Wine.
reactos/dll/directx/amstream # Synced to Wine-1.3.37
reactos/dll/directx/dinput # Synced to Wine-1.5.26
reactos/dll/directx/dinput8 # Synced to Wine-1.5.26
reactos/dll/directx/dmusic # Synced to Wine-1.5.26
reactos/dll/directx/dplay # Synced to Wine-1.5.26
reactos/dll/directx/dplayx # Synced to Wine-1.5.26
reactos/dll/directx/dsound # Synced to Wine-1.5.26
reactos/dll/directx/dxdiagn # Synced to Wine-0_9_5
reactos/dll/directx/dxgi # Synced to Wine-1.7.1
reactos/dll/directx/msdmo # Autosync
reactos/dll/directx/qedit # Autosync
reactos/dll/directx/quartz # Synced to Wine-1.5.26
reactos/dll/directx/wine/d3d8 # Synced to Wine-1.7.1
reactos/dll/directx/wine/d3d9 # Synced to Wine-1.7.1
reactos/dll/directx/wine/d3dxof # Synced to Wine-1.7.1
reactos/dll/directx/wine/ddraw # Synced to Wine-1.7.1
reactos/dll/directx/wine/wined3d # Synced to Wine-1.7.1
reactos/dll/directx/amstream # Synced to Wine-1.3.37
reactos/dll/directx/dinput # Synced to Wine-1.5.26
reactos/dll/directx/dinput8 # Synced to Wine-1.5.26
reactos/dll/directx/dmusic # Synced to Wine-1.5.26
reactos/dll/directx/dplay # Synced to Wine-1.5.26
reactos/dll/directx/dplayx # Synced to Wine-1.5.26
reactos/dll/directx/dsound # Synced to Wine-1.5.26
reactos/dll/directx/dxdiagn # Synced to Wine-0_9_5
reactos/dll/directx/dxgi # Synced to Wine-1.7.1
reactos/dll/directx/msdmo # Autosync
reactos/dll/directx/qedit # Autosync
reactos/dll/directx/quartz # Synced to Wine-1.5.26
reactos/dll/directx/wine/d3d8 # Synced to Wine-1.7.1
reactos/dll/directx/wine/d3d9 # Synced to Wine-1.7.1
reactos/dll/directx/wine/d3dcompiler_43 # Synced to Wine-1.7.1
reactos/dll/directx/wine/d3dxof # Synced to Wine-1.7.1
reactos/dll/directx/wine/ddraw # Synced to Wine-1.7.1
reactos/dll/directx/wine/wined3d # Synced to Wine-1.7.1
reactos/dll/win32/activeds # Synced to Wine-1.1.43?
reactos/dll/win32/actxprxy # Synced to Wine-1.5.26
reactos/dll/win32/advpack # Synced to Wine-1.7.1

View file

@ -35,4 +35,4 @@ add_definitions(-DINT16=SHORT)
add_executable(widl ${SOURCE})
target_link_libraries(widl wpp)
target_link_libraries(widl wpphost)

View file

@ -12,12 +12,27 @@ if(MSVC)
endif()
endif()
if(CMAKE_CROSSCOMPILING)
add_definitions(
-D_DLL -D__USE_CRTIMP
-D__NO_ISOCEXT
-Dstrtoull=_strtoui64
-Dstrtoll=_strtoi64
-Dopen=_open
-Dclose=_close)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
endif()
list(APPEND SOURCE
preproc.c
wpp.c
ppl.yy.c
ppy.tab.c)
add_library(wpp ${SOURCE})
add_dependencies(wpp build_header)
if(CMAKE_CROSSCOMPILING)
add_library(wpp ${SOURCE})
else()
add_library(wpphost ${SOURCE})
add_dependencies(wpphost build_header)
endif()