wined3d: Add shader version/end masks to the WINED3D namespace.
This commit is contained in:
parent
9846602412
commit
ce2e980d1b
|
@ -638,14 +638,14 @@ void pshader_hw_tex(SHADER_OPCODE_ARG* arg) {
|
|||
|
||||
/* 1.0-1.3: Use destination register as coordinate source.
|
||||
1.4+: Use provided coordinate source register. */
|
||||
if (hex_version < D3DPS_VERSION(1,4))
|
||||
if (hex_version < WINED3DPS_VERSION(1,4))
|
||||
strcpy(reg_coord, reg_dest);
|
||||
else
|
||||
pshader_gen_input_modifier_line(buffer, src[0], 0, reg_coord);
|
||||
|
||||
/* 1.0-1.4: Use destination register number as texture code.
|
||||
2.0+: Use provided sampler number as texure code. */
|
||||
if (hex_version < D3DPS_VERSION(2,0))
|
||||
if (hex_version < WINED3DPS_VERSION(2,0))
|
||||
reg_sampler_code = reg_dest_code;
|
||||
else
|
||||
reg_sampler_code = src[1] & WINED3DSP_REGNUM_MASK;
|
||||
|
@ -692,7 +692,7 @@ void pshader_hw_texcoord(SHADER_OPCODE_ARG* arg) {
|
|||
|
||||
char tmp[20];
|
||||
pshader_get_write_mask(dst, tmp);
|
||||
if (hex_version != D3DPS_VERSION(1,4)) {
|
||||
if (hex_version != WINED3DPS_VERSION(1,4)) {
|
||||
DWORD reg = dst & WINED3DSP_REGNUM_MASK;
|
||||
shader_addline(buffer, "MOV_SAT T%u%s, fragment.texcoord[%u];\n", reg, tmp, reg);
|
||||
} else {
|
||||
|
|
|
@ -101,7 +101,7 @@ int shader_get_param(
|
|||
* The version check below should work in general */
|
||||
|
||||
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
||||
char rel_token = D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2 &&
|
||||
char rel_token = WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2 &&
|
||||
((*pToken & WINED3DSHADER_ADDRESSMODE_MASK) == WINED3DSHADER_ADDRMODE_RELATIVE);
|
||||
|
||||
*param = *pToken;
|
||||
|
@ -118,7 +118,7 @@ static inline int shader_skip_opcode(
|
|||
/* Shaders >= 2.0 may contain address tokens, but fortunately they
|
||||
* have a useful legnth mask - use it here. Shaders 1.0 contain no such tokens */
|
||||
|
||||
return (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2)?
|
||||
return (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2)?
|
||||
((opcode_token & WINED3DSI_INSTLENGTH_MASK) >> WINED3DSI_INSTLENGTH_SHIFT):
|
||||
curOpcode->num_params;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ HRESULT shader_get_registers_used(
|
|||
if (pToken == NULL)
|
||||
return WINED3D_OK;
|
||||
|
||||
while (D3DVS_END() != *pToken) {
|
||||
while (WINED3DVS_END() != *pToken) {
|
||||
CONST SHADER_OPCODE* curOpcode;
|
||||
DWORD opcode_token;
|
||||
|
||||
|
@ -292,7 +292,7 @@ HRESULT shader_get_registers_used(
|
|||
int i, limit;
|
||||
|
||||
/* Declare 1.X samplers implicitly, based on the destination reg. number */
|
||||
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
|
||||
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
|
||||
(WINED3DSIO_TEX == curOpcode->opcode ||
|
||||
WINED3DSIO_TEXBEM == curOpcode->opcode ||
|
||||
WINED3DSIO_TEXM3x2TEX == curOpcode->opcode ||
|
||||
|
@ -329,7 +329,7 @@ HRESULT shader_get_registers_used(
|
|||
}
|
||||
}
|
||||
|
||||
} else if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
|
||||
} else if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
|
||||
(WINED3DSIO_TEXM3x3SPEC == curOpcode->opcode ||
|
||||
WINED3DSIO_TEXM3x3VSPEC == curOpcode->opcode)) {
|
||||
|
||||
|
@ -339,7 +339,7 @@ HRESULT shader_get_registers_used(
|
|||
* For now, use Cube textures because they are more common. */
|
||||
DWORD sampler_code = *pToken & WINED3DSP_REGNUM_MASK;
|
||||
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_CUBE;
|
||||
} else if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
|
||||
} else if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
|
||||
(WINED3DSIO_TEXDP3TEX == curOpcode->opcode)) {
|
||||
|
||||
/* 1D Sampler usage */
|
||||
|
@ -414,7 +414,7 @@ static void shader_dump_decl_usage(
|
|||
|
||||
/* Pixel shaders 3.0 don't have usage semantics */
|
||||
char pshader = shader_is_pshader_version(This->baseShader.hex_version);
|
||||
if (pshader && This->baseShader.hex_version < D3DPS_VERSION(3,0))
|
||||
if (pshader && This->baseShader.hex_version < WINED3DPS_VERSION(3,0))
|
||||
return;
|
||||
else
|
||||
TRACE("_");
|
||||
|
@ -571,7 +571,7 @@ void shader_dump_param(
|
|||
/* Vertex shaders >= 3.0 use general purpose output registers
|
||||
* (WINED3DSPR_OUTPUT), which can include an address token */
|
||||
|
||||
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) {
|
||||
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) {
|
||||
TRACE("o");
|
||||
shader_dump_arr_entry(iface, param, addr_token, reg, input);
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ void shader_generate_main(
|
|||
|
||||
/* Second pass, process opcodes */
|
||||
if (NULL != pToken) {
|
||||
while (D3DPS_END() != *pToken) {
|
||||
while (WINED3DPS_END() != *pToken) {
|
||||
|
||||
/* Skip version token */
|
||||
if (shader_is_version_token(*pToken)) {
|
||||
|
@ -821,12 +821,12 @@ void shader_trace_init(
|
|||
TRACE("(%p) : Parsing programme\n", This);
|
||||
|
||||
if (NULL != pToken) {
|
||||
while (D3DVS_END() != *pToken) {
|
||||
while (WINED3DVS_END() != *pToken) {
|
||||
if (shader_is_version_token(*pToken)) { /** version */
|
||||
This->baseShader.hex_version = *pToken;
|
||||
TRACE("%s_%u_%u\n", shader_is_pshader_version(This->baseShader.hex_version)? "ps": "vs",
|
||||
D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version),
|
||||
D3DSHADER_VERSION_MINOR(This->baseShader.hex_version));
|
||||
WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version),
|
||||
WINED3DSHADER_VERSION_MINOR(This->baseShader.hex_version));
|
||||
++pToken;
|
||||
++len;
|
||||
continue;
|
||||
|
|
|
@ -2206,15 +2206,15 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
vs_nv_version which is based on NV_vertex_program. For Ati cards there's no easy way, so for
|
||||
now only support 2.0/3.0 detection on Nvidia GeforceFX cards and default to 3.0 for everything else */
|
||||
if(This->gl_info.vs_nv_version == VS_VERSION_20)
|
||||
*pCaps->VertexShaderVersion = D3DVS_VERSION(2,0);
|
||||
*pCaps->VertexShaderVersion = WINED3DVS_VERSION(2,0);
|
||||
else
|
||||
*pCaps->VertexShaderVersion = D3DVS_VERSION(3,0);
|
||||
*pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0);
|
||||
TRACE_(d3d_caps)("Hardware vertex shader version 3.0 enabled (GLSL)\n");
|
||||
} else if (vs_selected_mode == SHADER_ARB) {
|
||||
*pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
|
||||
*pCaps->VertexShaderVersion = WINED3DVS_VERSION(1,1);
|
||||
TRACE_(d3d_caps)("Hardware vertex shader version 1.1 enabled (ARB_PROGRAM)\n");
|
||||
} else if (vs_selected_mode == SHADER_SW) {
|
||||
*pCaps->VertexShaderVersion = D3DVS_VERSION(3,0);
|
||||
*pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0);
|
||||
TRACE_(d3d_caps)("Software vertex shader version 3.0 enabled\n");
|
||||
} else {
|
||||
*pCaps->VertexShaderVersion = 0;
|
||||
|
@ -2227,19 +2227,19 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
/* See the comment about VS2.0/VS3.0 detection as we do the same here but then based on NV_fragment_program
|
||||
in case of GeforceFX cards. */
|
||||
if(This->gl_info.ps_nv_version == PS_VERSION_20)
|
||||
*pCaps->PixelShaderVersion = D3DPS_VERSION(2,0);
|
||||
*pCaps->PixelShaderVersion = WINED3DPS_VERSION(2,0);
|
||||
else
|
||||
*pCaps->PixelShaderVersion = D3DPS_VERSION(3,0);
|
||||
*pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0);
|
||||
/* FIXME: The following line is card dependent. -1.0 to 1.0 is a safe default clamp range for now */
|
||||
*pCaps->PixelShader1xMaxValue = 1.0;
|
||||
TRACE_(d3d_caps)("Hardware pixel shader version 3.0 enabled (GLSL)\n");
|
||||
} else if (ps_selected_mode == SHADER_ARB) {
|
||||
*pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
|
||||
*pCaps->PixelShaderVersion = WINED3DPS_VERSION(1,4);
|
||||
*pCaps->PixelShader1xMaxValue = 1.0;
|
||||
TRACE_(d3d_caps)("Hardware pixel shader version 1.4 enabled (ARB_PROGRAM)\n");
|
||||
/* FIXME: Uncomment this when there is support for software Pixel Shader 3.0 and PS_SW is defined
|
||||
} else if (ps_selected_mode = SHADER_SW) {
|
||||
*pCaps->PixelShaderVersion = D3DPS_VERSION(3,0);
|
||||
*pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0);
|
||||
*pCaps->PixelShader1xMaxValue = 1.0;
|
||||
TRACE_(d3d_caps)("Software pixel shader version 3.0 enabled\n"); */
|
||||
} else {
|
||||
|
@ -2260,7 +2260,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
*pCaps->AdapterOrdinalInGroup = 0;
|
||||
*pCaps->NumberOfAdaptersInGroup = 1;
|
||||
|
||||
if(*pCaps->VertexShaderVersion >= D3DVS_VERSION(2,0)) {
|
||||
if(*pCaps->VertexShaderVersion >= WINED3DVS_VERSION(2,0)) {
|
||||
/* OpenGL supports all formats below, perhaps not always without conversion but it supports them.
|
||||
Further GLSL doesn't seem to have an official unsigned type as I'm not sure how we handle it
|
||||
don't advertise it yet. We might need to add some clamping in the shader engine to support it.
|
||||
|
@ -2285,7 +2285,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
*pCaps->StretchRectFilterCaps = 0;
|
||||
*pCaps->VertexTextureFilterCaps = 0;
|
||||
|
||||
if(*pCaps->VertexShaderVersion == D3DVS_VERSION(3,0)) {
|
||||
if(*pCaps->VertexShaderVersion == WINED3DVS_VERSION(3,0)) {
|
||||
/* Where possible set the caps based on OpenGL extensions and if they aren't set (in case of software rendering)
|
||||
use the VS 3.0 from MSDN or else if there's OpenGL spec use a hardcoded value minimum VS3.0 value. */
|
||||
*pCaps->VS20Caps.Caps = D3DVS20CAPS_PREDICATION;
|
||||
|
@ -2295,7 +2295,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
|
||||
*pCaps->MaxVShaderInstructionsExecuted = 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
|
||||
*pCaps->MaxVertexShader30InstructionSlots = max(512, This->gl_info.vs_arb_max_instructions);
|
||||
} else if(*pCaps->VertexShaderVersion == D3DVS_VERSION(2,0)) {
|
||||
} else if(*pCaps->VertexShaderVersion == WINED3DVS_VERSION(2,0)) {
|
||||
*pCaps->VS20Caps.Caps = 0;
|
||||
*pCaps->VS20Caps.DynamicFlowControlDepth = D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH;
|
||||
*pCaps->VS20Caps.NumTemps = max(12, This->gl_info.vs_arb_max_temps);
|
||||
|
@ -2313,7 +2313,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
*pCaps->MaxVertexShader30InstructionSlots = 0;
|
||||
}
|
||||
|
||||
if(*pCaps->PixelShaderVersion == D3DPS_VERSION(3,0)) {
|
||||
if(*pCaps->PixelShaderVersion == WINED3DPS_VERSION(3,0)) {
|
||||
/* Where possible set the caps based on OpenGL extensions and if they aren't set (in case of software rendering)
|
||||
use the PS 3.0 from MSDN or else if there's OpenGL spec use a hardcoded value minimum PS 3.0 value. */
|
||||
|
||||
|
@ -2330,7 +2330,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
|
|||
|
||||
*pCaps->MaxPShaderInstructionsExecuted = 65535;
|
||||
*pCaps->MaxPixelShader30InstructionSlots = max(D3DMIN30SHADERINSTRUCTIONS, This->gl_info.ps_arb_max_instructions);
|
||||
} else if(*pCaps->PixelShaderVersion == D3DPS_VERSION(2,0)) {
|
||||
} else if(*pCaps->PixelShaderVersion == WINED3DPS_VERSION(2,0)) {
|
||||
/* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
|
||||
*pCaps->PS20Caps.Caps = 0;
|
||||
*pCaps->PS20Caps.DynamicFlowControlDepth = 0; /* D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
|
||||
|
|
|
@ -616,7 +616,7 @@ static void shader_glsl_get_register_name(
|
|||
case WINED3DSPR_INPUT:
|
||||
if (pshader) {
|
||||
/* Pixel shaders >= 3.0 */
|
||||
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3)
|
||||
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3)
|
||||
sprintf(tmpStr, "IN%u", reg);
|
||||
else {
|
||||
if (reg==0)
|
||||
|
@ -639,7 +639,7 @@ static void shader_glsl_get_register_name(
|
|||
|
||||
/* Relative addressing on shaders 2.0+ have a relative address token,
|
||||
* prior to that, it was hard-coded as "A0.x" because there's only 1 register */
|
||||
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2) {
|
||||
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2) {
|
||||
char relStr[100], relReg[50], relMask[6];
|
||||
shader_glsl_add_param(arg, addr_token, 0, TRUE, relReg, relMask, relStr);
|
||||
sprintf(tmpStr, "%s[%s + %u]", prefix, relStr, reg);
|
||||
|
@ -708,7 +708,7 @@ static void shader_glsl_get_register_name(
|
|||
break;
|
||||
case WINED3DSPR_TEXCRDOUT:
|
||||
/* Vertex shaders >= 3.0: WINED3DSPR_OUTPUT */
|
||||
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3)
|
||||
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3)
|
||||
sprintf(tmpStr, "OUT%u", reg);
|
||||
else
|
||||
sprintf(tmpStr, "gl_TexCoord[%u]", reg);
|
||||
|
@ -1010,7 +1010,7 @@ void shader_glsl_expp(SHADER_OPCODE_ARG* arg) {
|
|||
shader_glsl_add_param(arg, arg->src[0], arg->src_addr[0], TRUE, src_reg, src_mask, src_str);
|
||||
shader_glsl_add_dst(arg->dst, dst_reg, dst_mask, tmpLine);
|
||||
|
||||
if (hex_version < D3DPS_VERSION(2,0)) {
|
||||
if (hex_version < WINED3DPS_VERSION(2,0)) {
|
||||
shader_addline(arg->buffer, "tmp0.x = vec4(exp2(floor(%s))).x;\n", src_str);
|
||||
shader_addline(arg->buffer, "tmp0.y = vec4(%s - floor(%s)).y;\n", src_str, src_str);
|
||||
shader_addline(arg->buffer, "tmp0.z = vec4(exp2(%s)).x;\n", src_str);
|
||||
|
@ -1376,14 +1376,14 @@ void pshader_glsl_tex(SHADER_OPCODE_ARG* arg) {
|
|||
|
||||
/* 1.0-1.3: Use destination register as coordinate source.
|
||||
1.4+: Use provided coordinate source register. */
|
||||
if (hex_version < D3DPS_VERSION(1,4))
|
||||
if (hex_version < WINED3DPS_VERSION(1,4))
|
||||
strcpy(coord_reg, dst_reg);
|
||||
else
|
||||
shader_glsl_add_param(arg, arg->src[0], arg->src_addr[0], TRUE, coord_reg, coord_mask, coord_str);
|
||||
|
||||
/* 1.0-1.4: Use destination register as coordinate source.
|
||||
* 2.0+: Use provided coordinate source register. */
|
||||
if (hex_version < D3DPS_VERSION(2,0)) {
|
||||
if (hex_version < WINED3DPS_VERSION(2,0)) {
|
||||
sprintf(sampler_str, "Psampler%u", reg_dest_code);
|
||||
sampler_code = reg_dest_code;
|
||||
}
|
||||
|
@ -1445,7 +1445,7 @@ void pshader_glsl_texcoord(SHADER_OPCODE_ARG* arg) {
|
|||
|
||||
shader_glsl_add_param(arg, arg->dst, 0, FALSE, tmpReg, tmpMask, tmpStr);
|
||||
|
||||
if (hex_version != D3DPS_VERSION(1,4)) {
|
||||
if (hex_version != WINED3DPS_VERSION(1,4)) {
|
||||
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
|
||||
shader_addline(buffer, "%s = clamp(gl_TexCoord[%u], 0.0, 1.0);\n", tmpReg, reg);
|
||||
} else {
|
||||
|
|
|
@ -643,8 +643,8 @@ CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = {
|
|||
{WINED3DSIO_DST, "dst", "DST", 1, 3, pshader_dst, pshader_hw_map2gl, shader_glsl_dst, 0, 0},
|
||||
{WINED3DSIO_LRP, "lrp", "LRP", 1, 4, pshader_lrp, pshader_hw_map2gl, shader_glsl_lrp, 0, 0},
|
||||
{WINED3DSIO_FRC, "frc", "FRC", 1, 2, pshader_frc, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0},
|
||||
{WINED3DSIO_CND, "cnd", NULL, 1, 4, pshader_cnd, pshader_hw_cnd, shader_glsl_cnd, D3DPS_VERSION(1,1), D3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_CMP, "cmp", NULL, 1, 4, pshader_cmp, pshader_hw_cmp, shader_glsl_cmp, D3DPS_VERSION(1,2), D3DPS_VERSION(3,0)},
|
||||
{WINED3DSIO_CND, "cnd", NULL, 1, 4, pshader_cnd, pshader_hw_cnd, shader_glsl_cnd, WINED3DPS_VERSION(1,1), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_CMP, "cmp", NULL, 1, 4, pshader_cmp, pshader_hw_cmp, shader_glsl_cmp, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(3,0)},
|
||||
{WINED3DSIO_POW, "pow", "POW", 1, 3, pshader_pow, NULL, shader_glsl_map2gl, 0, 0},
|
||||
{WINED3DSIO_CRS, "crs", "XPS", 1, 3, pshader_crs, NULL, shader_glsl_map2gl, 0, 0},
|
||||
/* TODO: xyz normalise can be performed as VS_ARB using one temporary register,
|
||||
|
@ -658,10 +658,10 @@ CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = {
|
|||
|
||||
*/
|
||||
{WINED3DSIO_NRM, "nrm", NULL, 1, 2, pshader_nrm, NULL, shader_glsl_map2gl, 0, 0},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, pshader_sincos2, NULL, shader_glsl_sincos, D3DPS_VERSION(2,0), D3DPS_VERSION(2,0)},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 2, pshader_sincos3, NULL, shader_glsl_sincos, D3DPS_VERSION(3,0), -1},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, pshader_sincos2, NULL, shader_glsl_sincos, WINED3DPS_VERSION(2,0), WINED3DPS_VERSION(2,0)},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 2, pshader_sincos3, NULL, shader_glsl_sincos, WINED3DPS_VERSION(3,0), -1},
|
||||
/* TODO: dp2add can be made out of multiple instuctions */
|
||||
{WINED3DSIO_DP2ADD, "dp2add", GLNAME_REQUIRE_GLSL, 1, 4, pshader_dp2add, NULL, pshader_glsl_dp2add, D3DPS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_DP2ADD, "dp2add", GLNAME_REQUIRE_GLSL, 1, 4, pshader_dp2add, NULL, pshader_glsl_dp2add, WINED3DPS_VERSION(2,0), -1},
|
||||
|
||||
/* Matrix */
|
||||
{WINED3DSIO_M4x4, "m4x4", "undefined", 1, 3, pshader_m4x4, NULL, shader_glsl_mnxn, 0, 0},
|
||||
|
@ -674,21 +674,21 @@ CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = {
|
|||
{WINED3DSIO_DCL, "dcl", NULL, 0, 2, pshader_dcl, NULL, NULL, 0, 0},
|
||||
|
||||
/* Flow control - requires GLSL or software shaders */
|
||||
{WINED3DSIO_REP , "rep", NULL, 0, 1, pshader_rep, NULL, shader_glsl_rep, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ENDREP, "endrep", NULL, 0, 0, pshader_endrep, NULL, shader_glsl_end, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_IF, "if", NULL, 0, 1, pshader_if, NULL, shader_glsl_if, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_IFC, "ifc", NULL, 0, 2, pshader_ifc, NULL, shader_glsl_ifc, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ELSE, "else", NULL, 0, 0, pshader_else, NULL, shader_glsl_else, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ENDIF, "endif", NULL, 0, 0, pshader_endif, NULL, shader_glsl_end, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_BREAK, "break", NULL, 0, 0, pshader_break, NULL, shader_glsl_break, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_BREAKC, "breakc", NULL, 0, 2, pshader_breakc, NULL, shader_glsl_breakc, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_REP , "rep", NULL, 0, 1, pshader_rep, NULL, shader_glsl_rep, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ENDREP, "endrep", NULL, 0, 0, pshader_endrep, NULL, shader_glsl_end, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_IF, "if", NULL, 0, 1, pshader_if, NULL, shader_glsl_if, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_IFC, "ifc", NULL, 0, 2, pshader_ifc, NULL, shader_glsl_ifc, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ELSE, "else", NULL, 0, 0, pshader_else, NULL, shader_glsl_else, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ENDIF, "endif", NULL, 0, 0, pshader_endif, NULL, shader_glsl_end, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_BREAK, "break", NULL, 0, 0, pshader_break, NULL, shader_glsl_break, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_BREAKC, "breakc", NULL, 0, 2, pshader_breakc, NULL, shader_glsl_breakc, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_BREAKP, "breakp", GLNAME_REQUIRE_GLSL, 0, 1, pshader_breakp, NULL, NULL, 0, 0},
|
||||
{WINED3DSIO_CALL, "call", NULL, 0, 1, pshader_call, NULL, shader_glsl_call, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_CALLNZ, "callnz", NULL, 0, 2, pshader_callnz, NULL, shader_glsl_callnz, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_LOOP, "loop", NULL, 0, 2, pshader_loop, NULL, shader_glsl_loop, D3DPS_VERSION(3,0), -1},
|
||||
{WINED3DSIO_RET, "ret", NULL, 0, 0, pshader_ret, NULL, NULL, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ENDLOOP, "endloop", NULL, 0, 0, pshader_endloop, NULL, shader_glsl_end, D3DPS_VERSION(3,0), -1},
|
||||
{WINED3DSIO_LABEL, "label", NULL, 0, 1, pshader_label, NULL, shader_glsl_label, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_CALL, "call", NULL, 0, 1, pshader_call, NULL, shader_glsl_call, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_CALLNZ, "callnz", NULL, 0, 2, pshader_callnz, NULL, shader_glsl_callnz, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_LOOP, "loop", NULL, 0, 2, pshader_loop, NULL, shader_glsl_loop, WINED3DPS_VERSION(3,0), -1},
|
||||
{WINED3DSIO_RET, "ret", NULL, 0, 0, pshader_ret, NULL, NULL, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ENDLOOP, "endloop", NULL, 0, 0, pshader_endloop, NULL, shader_glsl_end, WINED3DPS_VERSION(3,0), -1},
|
||||
{WINED3DSIO_LABEL, "label", NULL, 0, 1, pshader_label, NULL, shader_glsl_label, WINED3DPS_VERSION(2,1), -1},
|
||||
|
||||
/* Constant definitions */
|
||||
{WINED3DSIO_DEF, "def", "undefined", 1, 5, pshader_def, NULL, NULL, 0, 0},
|
||||
|
@ -696,33 +696,33 @@ CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = {
|
|||
{WINED3DSIO_DEFI, "defi", GLNAME_REQUIRE_GLSL, 1, 5, pshader_defi, NULL, NULL, 0, 0},
|
||||
|
||||
/* Texture */
|
||||
{WINED3DSIO_TEXCOORD, "texcoord", "undefined", 1, 1, pshader_texcoord, pshader_hw_texcoord, pshader_glsl_texcoord, 0, D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXCOORD, "texcrd", "undefined", 1, 2, pshader_texcoord, pshader_hw_texcoord, pshader_glsl_texcoord, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_TEXKILL, "texkill", "KIL", 1, 1, pshader_texkill, pshader_hw_map2gl, pshader_glsl_texkill, D3DPS_VERSION(1,0), D3DPS_VERSION(3,0)},
|
||||
{WINED3DSIO_TEX, "tex", "undefined", 1, 1, pshader_tex, pshader_hw_tex, pshader_glsl_tex, 0, D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEX, "texld", "undefined", 1, 2, pshader_texld, pshader_hw_tex, pshader_glsl_tex, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_TEX, "texld", "undefined", 1, 3, pshader_texld, pshader_hw_tex, pshader_glsl_tex, D3DPS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_TEXBEM, "texbem", "undefined", 1, 2, pshader_texbem, pshader_hw_texbem, pshader_glsl_texbem, 0, D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXBEML, "texbeml", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texbeml, NULL, NULL, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2AR,"texreg2ar","undefined", 1, 2, pshader_texreg2ar, pshader_hw_texreg2ar, pshader_glsl_texreg2ar, D3DPS_VERSION(1,1), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2GB,"texreg2gb","undefined", 1, 2, pshader_texreg2gb, pshader_hw_texreg2gb, pshader_glsl_texreg2gb, D3DPS_VERSION(1,1), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2RGB, "texreg2rgb", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texreg2rgb, NULL, pshader_glsl_texreg2rgb, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2PAD, "texm3x2pad", "undefined", 1, 2, pshader_texm3x2pad, pshader_hw_texm3x2pad, pshader_glsl_texm3x2pad, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2TEX, "texm3x2tex", "undefined", 1, 2, pshader_texm3x2tex, pshader_hw_texm3x2tex, pshader_glsl_texm3x2tex, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3PAD, "texm3x3pad", "undefined", 1, 2, pshader_texm3x3pad, pshader_hw_texm3x3pad, pshader_glsl_texm3x3pad, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3DIFF, "texm3x3diff", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x3diff, NULL, NULL, D3DPS_VERSION(0,0), D3DPS_VERSION(0,0)},
|
||||
{WINED3DSIO_TEXM3x3SPEC, "texm3x3spec", "undefined", 1, 3, pshader_texm3x3spec, pshader_hw_texm3x3spec, pshader_glsl_texm3x3spec, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3VSPEC, "texm3x3vspec", "undefined", 1, 2, pshader_texm3x3vspec, pshader_hw_texm3x3vspec, pshader_glsl_texm3x3vspec, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3TEX, "texm3x3tex", "undefined", 1, 2, pshader_texm3x3tex, pshader_hw_texm3x3tex, pshader_glsl_texm3x3tex, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDP3TEX, "texdp3tex", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texdp3tex, NULL, pshader_glsl_texdp3tex, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2DEPTH, "texm3x2depth", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x2depth, NULL, pshader_glsl_texm3x2depth, D3DPS_VERSION(1,3), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDP3, "texdp3", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texdp3, NULL, pshader_glsl_texdp3, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3, "texm3x3", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x3, NULL, pshader_glsl_texm3x3, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDEPTH, "texdepth", GLNAME_REQUIRE_GLSL, 1, 1, pshader_texdepth, NULL, pshader_glsl_texdepth, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_BEM, "bem", GLNAME_REQUIRE_GLSL, 1, 3, pshader_bem, NULL, NULL, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_TEXCOORD, "texcoord", "undefined", 1, 1, pshader_texcoord, pshader_hw_texcoord, pshader_glsl_texcoord, 0, WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXCOORD, "texcrd", "undefined", 1, 2, pshader_texcoord, pshader_hw_texcoord, pshader_glsl_texcoord, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_TEXKILL, "texkill", "KIL", 1, 1, pshader_texkill, pshader_hw_map2gl, pshader_glsl_texkill, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(3,0)},
|
||||
{WINED3DSIO_TEX, "tex", "undefined", 1, 1, pshader_tex, pshader_hw_tex, pshader_glsl_tex, 0, WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEX, "texld", "undefined", 1, 2, pshader_texld, pshader_hw_tex, pshader_glsl_tex, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_TEX, "texld", "undefined", 1, 3, pshader_texld, pshader_hw_tex, pshader_glsl_tex, WINED3DPS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_TEXBEM, "texbem", "undefined", 1, 2, pshader_texbem, pshader_hw_texbem, pshader_glsl_texbem, 0, WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXBEML, "texbeml", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texbeml, NULL, NULL, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2AR,"texreg2ar","undefined", 1, 2, pshader_texreg2ar, pshader_hw_texreg2ar, pshader_glsl_texreg2ar, WINED3DPS_VERSION(1,1), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2GB,"texreg2gb","undefined", 1, 2, pshader_texreg2gb, pshader_hw_texreg2gb, pshader_glsl_texreg2gb, WINED3DPS_VERSION(1,1), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2RGB, "texreg2rgb", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texreg2rgb, NULL, pshader_glsl_texreg2rgb, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2PAD, "texm3x2pad", "undefined", 1, 2, pshader_texm3x2pad, pshader_hw_texm3x2pad, pshader_glsl_texm3x2pad, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2TEX, "texm3x2tex", "undefined", 1, 2, pshader_texm3x2tex, pshader_hw_texm3x2tex, pshader_glsl_texm3x2tex, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3PAD, "texm3x3pad", "undefined", 1, 2, pshader_texm3x3pad, pshader_hw_texm3x3pad, pshader_glsl_texm3x3pad, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3DIFF, "texm3x3diff", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x3diff, NULL, NULL, WINED3DPS_VERSION(0,0), WINED3DPS_VERSION(0,0)},
|
||||
{WINED3DSIO_TEXM3x3SPEC, "texm3x3spec", "undefined", 1, 3, pshader_texm3x3spec, pshader_hw_texm3x3spec, pshader_glsl_texm3x3spec, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3VSPEC, "texm3x3vspec", "undefined", 1, 2, pshader_texm3x3vspec, pshader_hw_texm3x3vspec, pshader_glsl_texm3x3vspec, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3TEX, "texm3x3tex", "undefined", 1, 2, pshader_texm3x3tex, pshader_hw_texm3x3tex, pshader_glsl_texm3x3tex, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDP3TEX, "texdp3tex", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texdp3tex, NULL, pshader_glsl_texdp3tex, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2DEPTH, "texm3x2depth", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x2depth, NULL, pshader_glsl_texm3x2depth, WINED3DPS_VERSION(1,3), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDP3, "texdp3", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texdp3, NULL, pshader_glsl_texdp3, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3, "texm3x3", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x3, NULL, pshader_glsl_texm3x3, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDEPTH, "texdepth", GLNAME_REQUIRE_GLSL, 1, 1, pshader_texdepth, NULL, pshader_glsl_texdepth, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_BEM, "bem", GLNAME_REQUIRE_GLSL, 1, 3, pshader_bem, NULL, NULL, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_DSX, "dsx", GLNAME_REQUIRE_GLSL, 1, 2, pshader_dsx, NULL, NULL, 0, 0},
|
||||
{WINED3DSIO_DSY, "dsy", GLNAME_REQUIRE_GLSL, 1, 2, pshader_dsy, NULL, NULL, 0, 0},
|
||||
{WINED3DSIO_TEXLDD, "texldd", GLNAME_REQUIRE_GLSL, 1, 5, pshader_texldd, NULL, NULL, D3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_TEXLDD, "texldd", GLNAME_REQUIRE_GLSL, 1, 5, pshader_texldd, NULL, NULL, WINED3DPS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_SETP, "setp", GLNAME_REQUIRE_GLSL, 1, 3, pshader_setp, NULL, NULL, 0, 0},
|
||||
{WINED3DSIO_TEXLDL, "texldl", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texldl, NULL, NULL, 0, 0},
|
||||
{WINED3DSIO_PHASE, "phase", GLNAME_REQUIRE_GLSL, 0, 0, pshader_nop, NULL, NULL, 0, 0},
|
||||
|
@ -737,10 +737,10 @@ static void pshader_set_limits(
|
|||
This->baseShader.limits.packed_output = 0;
|
||||
|
||||
switch (This->baseShader.hex_version) {
|
||||
case D3DPS_VERSION(1,0):
|
||||
case D3DPS_VERSION(1,1):
|
||||
case D3DPS_VERSION(1,2):
|
||||
case D3DPS_VERSION(1,3):
|
||||
case WINED3DPS_VERSION(1,0):
|
||||
case WINED3DPS_VERSION(1,1):
|
||||
case WINED3DPS_VERSION(1,2):
|
||||
case WINED3DPS_VERSION(1,3):
|
||||
This->baseShader.limits.temporary = 2;
|
||||
This->baseShader.limits.constant_float = 8;
|
||||
This->baseShader.limits.constant_int = 0;
|
||||
|
@ -751,7 +751,7 @@ static void pshader_set_limits(
|
|||
This->baseShader.limits.label = 0;
|
||||
break;
|
||||
|
||||
case D3DPS_VERSION(1,4):
|
||||
case WINED3DPS_VERSION(1,4):
|
||||
This->baseShader.limits.temporary = 6;
|
||||
This->baseShader.limits.constant_float = 8;
|
||||
This->baseShader.limits.constant_int = 0;
|
||||
|
@ -763,7 +763,7 @@ static void pshader_set_limits(
|
|||
break;
|
||||
|
||||
/* FIXME: temporaries must match D3DPSHADERCAPS2_0.NumTemps */
|
||||
case D3DPS_VERSION(2,0):
|
||||
case WINED3DPS_VERSION(2,0):
|
||||
This->baseShader.limits.temporary = 32;
|
||||
This->baseShader.limits.constant_float = 32;
|
||||
This->baseShader.limits.constant_int = 16;
|
||||
|
@ -773,7 +773,7 @@ static void pshader_set_limits(
|
|||
This->baseShader.limits.packed_input = 0;
|
||||
break;
|
||||
|
||||
case D3DPS_VERSION(2,1):
|
||||
case WINED3DPS_VERSION(2,1):
|
||||
This->baseShader.limits.temporary = 32;
|
||||
This->baseShader.limits.constant_float = 32;
|
||||
This->baseShader.limits.constant_int = 16;
|
||||
|
@ -784,7 +784,7 @@ static void pshader_set_limits(
|
|||
This->baseShader.limits.label = 16;
|
||||
break;
|
||||
|
||||
case D3DPS_VERSION(3,0):
|
||||
case WINED3DPS_VERSION(3,0):
|
||||
This->baseShader.limits.temporary = 32;
|
||||
This->baseShader.limits.constant_float = 224;
|
||||
This->baseShader.limits.constant_int = 16;
|
||||
|
@ -846,14 +846,14 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateShader(
|
|||
shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, &buffer, &GLINFO_LOCATION);
|
||||
|
||||
/* Pack 3.0 inputs */
|
||||
if (This->baseShader.hex_version >= D3DPS_VERSION(3,0))
|
||||
if (This->baseShader.hex_version >= WINED3DPS_VERSION(3,0))
|
||||
pshader_glsl_input_pack(&buffer, This->semantics_in);
|
||||
|
||||
/* Base Shader Body */
|
||||
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
|
||||
|
||||
/* Pixel shaders < 2.0 place the resulting color in R0 implicitly */
|
||||
if (This->baseShader.hex_version < D3DPS_VERSION(2,0)) {
|
||||
if (This->baseShader.hex_version < WINED3DPS_VERSION(2,0)) {
|
||||
/* Some older cards like GeforceFX ones don't support multiple buffers, so also not gl_FragData */
|
||||
if(GL_SUPPORT(ARB_DRAW_BUFFERS))
|
||||
shader_addline(&buffer, "gl_FragData[0] = R0;\n");
|
||||
|
@ -889,7 +889,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateShader(
|
|||
/* Base Shader Body */
|
||||
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
|
||||
|
||||
if (This->baseShader.hex_version < D3DPS_VERSION(2,0))
|
||||
if (This->baseShader.hex_version < WINED3DPS_VERSION(2,0))
|
||||
shader_addline(&buffer, "MOV result.color, R0;\n");
|
||||
shader_addline(&buffer, "END\n\0");
|
||||
|
||||
|
|
|
@ -515,8 +515,8 @@ CONST SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[] = {
|
|||
|
||||
*/
|
||||
{WINED3DSIO_NRM, "nrm", NULL, 1, 2, vshader_nrm, NULL, shader_glsl_map2gl, 0, 0},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, vshader_sincos2, NULL, shader_glsl_sincos, D3DVS_VERSION(2,0), D3DVS_VERSION(2,0)},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 2, vshader_sincos3, NULL, shader_glsl_sincos, D3DVS_VERSION(3,0), -1},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, vshader_sincos2, NULL, shader_glsl_sincos, WINED3DVS_VERSION(2,0), WINED3DVS_VERSION(2,0)},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 2, vshader_sincos3, NULL, shader_glsl_sincos, WINED3DVS_VERSION(3,0), -1},
|
||||
|
||||
/* Matrix */
|
||||
{WINED3DSIO_M4x4, "m4x4", "undefined", 1, 3, vshader_m4x4, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0},
|
||||
|
@ -534,21 +534,21 @@ CONST SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[] = {
|
|||
{WINED3DSIO_DEFI, "defi", GLNAME_REQUIRE_GLSL, 1, 5, vshader_defi, NULL, NULL, 0, 0},
|
||||
|
||||
/* Flow control - requires GLSL or software shaders */
|
||||
{WINED3DSIO_REP , "rep", NULL, 0, 1, vshader_rep, NULL, shader_glsl_rep, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_ENDREP, "endrep", NULL, 0, 0, vshader_endrep, NULL, shader_glsl_end, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_IF, "if", NULL, 0, 1, vshader_if, NULL, shader_glsl_if, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_IFC, "ifc", NULL, 0, 2, vshader_ifc, NULL, shader_glsl_ifc, D3DVS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ELSE, "else", NULL, 0, 0, vshader_else, NULL, shader_glsl_else, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_ENDIF, "endif", NULL, 0, 0, vshader_endif, NULL, shader_glsl_end, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_BREAK, "break", NULL, 0, 0, vshader_break, NULL, shader_glsl_break, D3DVS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_BREAKC, "breakc", NULL, 0, 2, vshader_breakc, NULL, shader_glsl_breakc, D3DVS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_REP , "rep", NULL, 0, 1, vshader_rep, NULL, shader_glsl_rep, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_ENDREP, "endrep", NULL, 0, 0, vshader_endrep, NULL, shader_glsl_end, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_IF, "if", NULL, 0, 1, vshader_if, NULL, shader_glsl_if, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_IFC, "ifc", NULL, 0, 2, vshader_ifc, NULL, shader_glsl_ifc, WINED3DVS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_ELSE, "else", NULL, 0, 0, vshader_else, NULL, shader_glsl_else, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_ENDIF, "endif", NULL, 0, 0, vshader_endif, NULL, shader_glsl_end, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_BREAK, "break", NULL, 0, 0, vshader_break, NULL, shader_glsl_break, WINED3DVS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_BREAKC, "breakc", NULL, 0, 2, vshader_breakc, NULL, shader_glsl_breakc, WINED3DVS_VERSION(2,1), -1},
|
||||
{WINED3DSIO_BREAKP, "breakp", GLNAME_REQUIRE_GLSL, 0, 1, vshader_breakp, NULL, NULL, 0, 0},
|
||||
{WINED3DSIO_CALL, "call", NULL, 0, 1, vshader_call, NULL, shader_glsl_call, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_CALLNZ, "callnz", NULL, 0, 2, vshader_callnz, NULL, shader_glsl_callnz, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_LOOP, "loop", NULL, 0, 2, vshader_loop, NULL, shader_glsl_loop, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_RET, "ret", NULL, 0, 0, vshader_ret, NULL, NULL, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_ENDLOOP, "endloop", NULL, 0, 0, vshader_endloop, NULL, shader_glsl_end, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_LABEL, "label", NULL, 0, 1, vshader_label, NULL, shader_glsl_label, D3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_CALL, "call", NULL, 0, 1, vshader_call, NULL, shader_glsl_call, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_CALLNZ, "callnz", NULL, 0, 2, vshader_callnz, NULL, shader_glsl_callnz, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_LOOP, "loop", NULL, 0, 2, vshader_loop, NULL, shader_glsl_loop, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_RET, "ret", NULL, 0, 0, vshader_ret, NULL, NULL, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_ENDLOOP, "endloop", NULL, 0, 0, vshader_endloop, NULL, shader_glsl_end, WINED3DVS_VERSION(2,0), -1},
|
||||
{WINED3DSIO_LABEL, "label", NULL, 0, 1, vshader_label, NULL, shader_glsl_label, WINED3DVS_VERSION(2,0), -1},
|
||||
|
||||
{WINED3DSIO_MOVA, "mova", GLNAME_REQUIRE_GLSL, 1, 2, vshader_mova, NULL, shader_glsl_mov, 0, 0},
|
||||
{WINED3DSIO_SETP, "setp", GLNAME_REQUIRE_GLSL, 1, 3, vshader_setp, NULL, NULL, 0, 0},
|
||||
|
@ -567,8 +567,8 @@ static void vshader_set_limits(
|
|||
This->baseShader.limits.constant_float = GL_LIMITS(vshader_constantsF);
|
||||
|
||||
switch (This->baseShader.hex_version) {
|
||||
case D3DVS_VERSION(1,0):
|
||||
case D3DVS_VERSION(1,1):
|
||||
case WINED3DVS_VERSION(1,0):
|
||||
case WINED3DVS_VERSION(1,1):
|
||||
This->baseShader.limits.temporary = 12;
|
||||
This->baseShader.limits.constant_bool = 0;
|
||||
This->baseShader.limits.constant_int = 0;
|
||||
|
@ -578,8 +578,8 @@ static void vshader_set_limits(
|
|||
This->baseShader.limits.label = 0;
|
||||
break;
|
||||
|
||||
case D3DVS_VERSION(2,0):
|
||||
case D3DVS_VERSION(2,1):
|
||||
case WINED3DVS_VERSION(2,0):
|
||||
case WINED3DVS_VERSION(2,1):
|
||||
This->baseShader.limits.temporary = 12;
|
||||
This->baseShader.limits.constant_bool = 16;
|
||||
This->baseShader.limits.constant_int = 16;
|
||||
|
@ -589,7 +589,7 @@ static void vshader_set_limits(
|
|||
This->baseShader.limits.label = 16;
|
||||
break;
|
||||
|
||||
case D3DVS_VERSION(3,0):
|
||||
case WINED3DVS_VERSION(3,0):
|
||||
This->baseShader.limits.temporary = 32;
|
||||
This->baseShader.limits.constant_bool = 32;
|
||||
This->baseShader.limits.constant_int = 32;
|
||||
|
@ -727,7 +727,7 @@ static VOID IWineD3DVertexShaderImpl_GenerateShader(
|
|||
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
|
||||
|
||||
/* Unpack 3.0 outputs */
|
||||
if (This->baseShader.hex_version >= D3DVS_VERSION(3,0))
|
||||
if (This->baseShader.hex_version >= WINED3DVS_VERSION(3,0))
|
||||
vshader_glsl_output_unpack(&buffer, This->semantics_out);
|
||||
|
||||
/* Clamp the fog from 0 to 1 if it's used */
|
||||
|
@ -893,7 +893,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
|
|||
if (shader_is_vshader_version(*pToken)) { /** version */
|
||||
++pToken;
|
||||
}
|
||||
while (D3DVS_END() != *pToken) {
|
||||
while (WINED3DVS_END() != *pToken) {
|
||||
if (shader_is_comment(*pToken)) { /** comment */
|
||||
DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
|
||||
++pToken;
|
||||
|
|
|
@ -274,5 +274,14 @@ typedef enum _WINED3DSHADER_INSTRUCTION_OPCODE_TYPE {
|
|||
((((commentSize) << WINED3DSI_COMMENTSIZE_SHIFT) & WINED3DSI_COMMENTSIZE_MASK) | WINED3DSIO_COMMENT)
|
||||
|
||||
#define WINED3DSHADER_INSTRUCTION_PREDICATED (1 << 28)
|
||||
|
||||
/** Shader version tokens, and shader end tokens **/
|
||||
|
||||
#define WINED3DPS_VERSION(major, minor) (0xFFFF0000 | ((major) << 8) | (minor))
|
||||
#define WINED3DVS_VERSION(major, minor) (0xFFFE0000 | ((major) << 8) | (minor))
|
||||
#define WINED3DSHADER_VERSION_MAJOR(version) (((version) >> 8) & 0xFF)
|
||||
#define WINED3DSHADER_VERSION_MINOR(version) (((version) >> 0) & 0xFF)
|
||||
#define WINED3DPS_END() 0x0000FFFF
|
||||
#define WINED3DVS_END() 0x0000FFFF
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue