mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
wined3d: Create a struct wined3d_shader_version to store version information.
The version tokens in SM1-3 and SM4 are similar, but not the same.
This commit is contained in:
parent
5c63d93e18
commit
65622a052c
@ -81,7 +81,6 @@ struct shader_arb_priv {
|
||||
static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, const WineD3D_GL_Info *gl_info,
|
||||
GLuint target_type, unsigned int max_constants, const float *constants, char *dirty_consts)
|
||||
{
|
||||
DWORD shader_version = This->baseShader.reg_maps.shader_version;
|
||||
local_constant* lconst;
|
||||
DWORD i, j;
|
||||
unsigned int ret;
|
||||
@ -95,7 +94,7 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, con
|
||||
}
|
||||
}
|
||||
/* In 1.X pixel shaders constants are implicitly clamped in the range [-1;1] */
|
||||
if (target_type == GL_FRAGMENT_PROGRAM_ARB && WINED3DSHADER_VERSION_MAJOR(shader_version) == 1)
|
||||
if (target_type == GL_FRAGMENT_PROGRAM_ARB && This->baseShader.reg_maps.shader_version.major == 1)
|
||||
{
|
||||
float lcl_const[4];
|
||||
for(i = 0; i < max_constants; i++) {
|
||||
@ -297,7 +296,7 @@ static void shader_generate_arb_declarations(IWineD3DBaseShader *iface, const sh
|
||||
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
||||
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device;
|
||||
DWORD i, cur;
|
||||
char pshader = shader_is_pshader_version(reg_maps->shader_version);
|
||||
char pshader = shader_is_pshader_version(reg_maps->shader_version.type);
|
||||
unsigned max_constantsF = min(This->baseShader.limits.constant_float,
|
||||
(pshader ? GL_LIMITS(pshader_constantsF) - ARB_SHADER_RESERVED_PS_CONSTS :
|
||||
GL_LIMITS(vshader_constantsF) - ARB_SHADER_RESERVED_VS_CONSTS));
|
||||
@ -422,7 +421,7 @@ static void shader_arb_get_write_mask(const struct wined3d_shader_instruction *i
|
||||
const struct wined3d_shader_dst_param *dst, char *write_mask)
|
||||
{
|
||||
char *ptr = write_mask;
|
||||
char vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version);
|
||||
char vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type);
|
||||
|
||||
if (vshader && dst->register_type == WINED3DSPR_ADDR)
|
||||
{
|
||||
@ -480,8 +479,7 @@ static void shader_arb_get_register_name(IWineD3DBaseShader *iface, WINED3DSHADE
|
||||
/* oPos, oFog and oPts in D3D */
|
||||
static const char * const rastout_reg_names[] = {"TMP_OUT", "result.fogcoord", "result.pointsize"};
|
||||
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)iface;
|
||||
DWORD shader_version = This->baseShader.reg_maps.shader_version;
|
||||
BOOL pshader = shader_is_pshader_version(shader_version);
|
||||
BOOL pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type);
|
||||
|
||||
*is_color = FALSE;
|
||||
|
||||
@ -690,7 +688,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
|
||||
} else {
|
||||
tex_type = "2D";
|
||||
}
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version))
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type))
|
||||
{
|
||||
const IWineD3DPixelShaderImpl* const ps = (const IWineD3DPixelShaderImpl*)This;
|
||||
if(ps->cur_args->np2_fixup & (1 << sampler_idx)) {
|
||||
@ -723,7 +721,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
|
||||
shader_addline(buffer, "TEX %s, %s, texture[%u], %s;\n", dst_str, coord_reg, sampler_idx, tex_type);
|
||||
}
|
||||
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version))
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type))
|
||||
{
|
||||
IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
|
||||
gen_color_correction(buffer, dst_str, ins->dst[0].write_mask,
|
||||
@ -858,6 +856,8 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins)
|
||||
BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
|
||||
DWORD shift = dst->shift;
|
||||
BOOL is_color;
|
||||
DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major,
|
||||
ins->ctx->reg_maps->shader_version.minor);
|
||||
|
||||
/* FIXME: support output modifiers */
|
||||
|
||||
@ -872,7 +872,7 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins)
|
||||
pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->src[2], 2, src_name[2]);
|
||||
|
||||
/* The coissue flag changes the semantic of the cnd instruction in <= 1.3 shaders */
|
||||
if (ins->ctx->reg_maps->shader_version <= WINED3DPS_VERSION(1, 3) && ins->coissue)
|
||||
if (shader_version <= WINED3D_SHADER_VERSION(1, 3) && ins->coissue)
|
||||
{
|
||||
shader_addline(buffer, "MOV%s %s%s, %s;\n", sat ? "_SAT" : "", dst_name, dst_wmask, src_name[1]);
|
||||
} else {
|
||||
@ -983,7 +983,7 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins)
|
||||
break;
|
||||
}
|
||||
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version))
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type))
|
||||
{
|
||||
/* Output token related */
|
||||
const struct wined3d_shader_dst_param *dst;
|
||||
@ -1067,8 +1067,8 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
|
||||
{
|
||||
IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader;
|
||||
|
||||
if ((WINED3DSHADER_VERSION_MAJOR(ins->ctx->reg_maps->shader_version) == 1
|
||||
&& !shader_is_pshader_version(ins->ctx->reg_maps->shader_version)
|
||||
if ((ins->ctx->reg_maps->shader_version.major == 1
|
||||
&& !shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type)
|
||||
&& ins->dst[0].register_type == WINED3DSPR_ADDR)
|
||||
|| ins->handler_idx == WINED3DSIH_MOVA)
|
||||
{
|
||||
@ -1105,7 +1105,6 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
|
||||
static void pshader_hw_texkill(const struct wined3d_shader_instruction *ins)
|
||||
{
|
||||
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
|
||||
DWORD shader_version = ins->ctx->reg_maps->shader_version;
|
||||
SHADER_BUFFER *buffer = ins->ctx->buffer;
|
||||
char reg_dest[40];
|
||||
BOOL is_color;
|
||||
@ -1116,7 +1115,7 @@ static void pshader_hw_texkill(const struct wined3d_shader_instruction *ins)
|
||||
shader_arb_get_register_name(ins->ctx->shader, dst->register_type,
|
||||
dst->register_idx, !!dst->rel_addr, reg_dest, &is_color);
|
||||
|
||||
if (shader_version >= WINED3DPS_VERSION(2,0))
|
||||
if (ins->ctx->reg_maps->shader_version.major >= 2)
|
||||
{
|
||||
/* The arb backend doesn't claim ps 2.0 support, but try to eat what the app feeds to us */
|
||||
shader_addline(buffer, "KIL %s;\n", reg_dest);
|
||||
@ -1137,7 +1136,8 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
|
||||
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
|
||||
BOOL is_color;
|
||||
SHADER_BUFFER *buffer = ins->ctx->buffer;
|
||||
DWORD shader_version = ins->ctx->reg_maps->shader_version;
|
||||
DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major,
|
||||
ins->ctx->reg_maps->shader_version.minor);
|
||||
BOOL projected = FALSE, bias = FALSE;
|
||||
|
||||
char reg_dest[40];
|
||||
@ -1150,14 +1150,14 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
|
||||
|
||||
/* 1.0-1.3: Use destination register as coordinate source.
|
||||
1.4+: Use provided coordinate source register. */
|
||||
if (shader_version < WINED3DPS_VERSION(1,4))
|
||||
if (shader_version < WINED3D_SHADER_VERSION(1,4))
|
||||
strcpy(reg_coord, reg_dest);
|
||||
else
|
||||
pshader_gen_input_modifier_line(ins->ctx->shader, buffer, &ins->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 (shader_version < WINED3DPS_VERSION(2,0))
|
||||
if (shader_version < WINED3D_SHADER_VERSION(2,0))
|
||||
reg_sampler_code = dst->register_idx;
|
||||
else
|
||||
reg_sampler_code = ins->src[1].register_idx;
|
||||
@ -1167,7 +1167,7 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
|
||||
* 1.4: Use WINED3DSPSM_DZ or WINED3DSPSM_DW on src[0]
|
||||
* 2.0+: Use WINED3DSI_TEXLD_PROJECT on the opcode
|
||||
*/
|
||||
if (shader_version < WINED3DPS_VERSION(1,4))
|
||||
if (shader_version < WINED3D_SHADER_VERSION(1,4))
|
||||
{
|
||||
DWORD flags = 0;
|
||||
if(reg_sampler_code < MAX_TEXTURES) {
|
||||
@ -1177,7 +1177,7 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins)
|
||||
projected = TRUE;
|
||||
}
|
||||
}
|
||||
else if (shader_version < WINED3DPS_VERSION(2,0))
|
||||
else if (shader_version < WINED3D_SHADER_VERSION(2,0))
|
||||
{
|
||||
DWORD src_mod = ins->src[0].modifiers;
|
||||
if (src_mod == WINED3DSPSM_DZ) {
|
||||
@ -1196,10 +1196,12 @@ static void pshader_hw_texcoord(const struct wined3d_shader_instruction *ins)
|
||||
{
|
||||
const struct wined3d_shader_dst_param *dst = &ins->dst[0];
|
||||
SHADER_BUFFER *buffer = ins->ctx->buffer;
|
||||
DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major,
|
||||
ins->ctx->reg_maps->shader_version.minor);
|
||||
|
||||
char tmp[20];
|
||||
shader_arb_get_write_mask(ins, dst, tmp);
|
||||
if (ins->ctx->reg_maps->shader_version != WINED3DPS_VERSION(1,4))
|
||||
if (shader_version != WINED3D_SHADER_VERSION(1,4))
|
||||
{
|
||||
DWORD reg = dst->register_idx;
|
||||
shader_addline(buffer, "MOV_SAT T%u%s, fragment.texcoord[%u];\n", reg, tmp, reg);
|
||||
@ -1907,7 +1909,7 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
|
||||
IWineD3DBaseShaderImpl *baseShader = (IWineD3DBaseShaderImpl *) iface;
|
||||
const WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)baseShader->baseShader.device)->adapter->gl_info;
|
||||
|
||||
if (shader_is_pshader_version(baseShader->baseShader.reg_maps.shader_version))
|
||||
if (shader_is_pshader_version(baseShader->baseShader.reg_maps.shader_version.type))
|
||||
{
|
||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *) iface;
|
||||
UINT i;
|
||||
@ -1995,7 +1997,6 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface,
|
||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
||||
const shader_reg_maps* reg_maps = &This->baseShader.reg_maps;
|
||||
CONST DWORD *function = This->baseShader.function;
|
||||
DWORD shader_version = reg_maps->shader_version;
|
||||
const WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info;
|
||||
const local_constant *lconst;
|
||||
GLuint retval;
|
||||
@ -2005,7 +2006,8 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface,
|
||||
/* Create the hw ARB shader */
|
||||
shader_addline(buffer, "!!ARBfp1.0\n");
|
||||
|
||||
if (shader_version < WINED3DPS_VERSION(3,0)) {
|
||||
if (reg_maps->shader_version.major < 3)
|
||||
{
|
||||
switch(args->fog) {
|
||||
case FOG_OFF:
|
||||
break;
|
||||
@ -2030,7 +2032,8 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface,
|
||||
shader_addline(buffer, "PARAM coefmul = { 2, 4, 8, 16 };\n");
|
||||
shader_addline(buffer, "PARAM one = { 1.0, 1.0, 1.0, 1.0 };\n");
|
||||
|
||||
if (shader_version < WINED3DPS_VERSION(2,0)) {
|
||||
if (reg_maps->shader_version.major < 2)
|
||||
{
|
||||
fragcolor = "R0";
|
||||
} else {
|
||||
shader_addline(buffer, "TEMP TMP_COLOR;\n");
|
||||
|
@ -318,7 +318,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
|
||||
{
|
||||
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
||||
void *fe_data = This->baseShader.frontend_data;
|
||||
DWORD shader_version;
|
||||
struct wined3d_shader_version shader_version;
|
||||
unsigned int cur_loop_depth = 0, max_loop_depth = 0;
|
||||
const DWORD* pToken = byte_code;
|
||||
char pshader;
|
||||
@ -336,7 +336,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
|
||||
|
||||
fe->shader_read_header(fe_data, &pToken, &shader_version);
|
||||
reg_maps->shader_version = shader_version;
|
||||
pshader = shader_is_pshader_version(shader_version);
|
||||
pshader = shader_is_pshader_version(shader_version.type);
|
||||
|
||||
while (!fe->shader_is_end(fe_data, &pToken))
|
||||
{
|
||||
@ -408,7 +408,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
|
||||
pToken += 4;
|
||||
|
||||
/* In pixel shader 1.X shaders, the constants are clamped between [-1;1] */
|
||||
if (WINED3DSHADER_VERSION_MAJOR(shader_version) == 1 && pshader)
|
||||
if (shader_version.major == 1 && pshader)
|
||||
{
|
||||
float *value = (float *) lconst->value;
|
||||
if(value[0] < -1.0) value[0] = -1.0;
|
||||
@ -513,8 +513,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
|
||||
/* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and
|
||||
* is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel
|
||||
* shaders because TECRDOUT isn't used in them, but future register types might cause issues */
|
||||
if (!pshader && WINED3DSHADER_VERSION_MAJOR(shader_version) < 3
|
||||
&& dst_param.register_type == WINED3DSPR_TEXCRDOUT)
|
||||
if (!pshader && shader_version.major < 3 && dst_param.register_type == WINED3DSPR_TEXCRDOUT)
|
||||
{
|
||||
reg_maps->texcoord_mask[dst_param.register_type] |= dst_param.write_mask;
|
||||
}
|
||||
@ -525,7 +524,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
|
||||
}
|
||||
|
||||
/* Declare 1.X samplers implicitly, based on the destination reg. number */
|
||||
if (WINED3DSHADER_VERSION_MAJOR(shader_version) == 1
|
||||
if (shader_version.major == 1
|
||||
&& pshader /* Filter different instructions with the same enum values in VS */
|
||||
&& (ins.handler_idx == WINED3DSIH_TEX
|
||||
|| ins.handler_idx == WINED3DSIH_TEXBEM
|
||||
@ -593,7 +592,8 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semantic, DWORD shader_version)
|
||||
static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semantic,
|
||||
const struct wined3d_shader_version *shader_version)
|
||||
{
|
||||
TRACE("dcl");
|
||||
|
||||
@ -610,7 +610,7 @@ static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semanti
|
||||
else
|
||||
{
|
||||
/* Pixel shaders 3.0 don't have usage semantics */
|
||||
if (shader_is_pshader_version(shader_version) && shader_version < WINED3DPS_VERSION(3,0))
|
||||
if (shader_is_pshader_version(shader_version->type) && shader_version->major < 3)
|
||||
return;
|
||||
else
|
||||
TRACE("_");
|
||||
@ -667,7 +667,7 @@ static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semanti
|
||||
}
|
||||
|
||||
static void shader_dump_register(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx,
|
||||
const struct wined3d_shader_src_param *rel_addr, DWORD shader_version)
|
||||
const struct wined3d_shader_src_param *rel_addr, const struct wined3d_shader_version *shader_version)
|
||||
{
|
||||
static const char * const rastout_reg_names[] = {"oPos", "oFog", "oPts"};
|
||||
static const char * const misctype_reg_names[] = {"vPos", "vFace"};
|
||||
@ -692,7 +692,7 @@ static void shader_dump_register(WINED3DSHADER_PARAM_REGISTER_TYPE register_type
|
||||
break;
|
||||
|
||||
case WINED3DSPR_TEXTURE: /* vs: case WINED3DSPR_ADDR */
|
||||
TRACE("%c", shader_is_pshader_version(shader_version) ? 't' : 'a');
|
||||
TRACE("%c", shader_is_pshader_version(shader_version->type) ? 't' : 'a');
|
||||
break;
|
||||
|
||||
case WINED3DSPR_RASTOUT:
|
||||
@ -714,7 +714,7 @@ static void shader_dump_register(WINED3DSHADER_PARAM_REGISTER_TYPE register_type
|
||||
case WINED3DSPR_TEXCRDOUT:
|
||||
/* Vertex shaders >= 3.0 use general purpose output registers
|
||||
* (WINED3DSPR_OUTPUT), which can include an address token */
|
||||
if (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 3) TRACE("o");
|
||||
if (shader_version->major >= 3) TRACE("o");
|
||||
else TRACE("oT");
|
||||
break;
|
||||
|
||||
@ -765,7 +765,8 @@ static void shader_dump_register(WINED3DSHADER_PARAM_REGISTER_TYPE register_type
|
||||
}
|
||||
}
|
||||
|
||||
void shader_dump_dst_param(const struct wined3d_shader_dst_param *param, DWORD shader_version)
|
||||
void shader_dump_dst_param(const struct wined3d_shader_dst_param *param,
|
||||
const struct wined3d_shader_version *shader_version)
|
||||
{
|
||||
DWORD write_mask = param->write_mask;
|
||||
|
||||
@ -783,7 +784,8 @@ void shader_dump_dst_param(const struct wined3d_shader_dst_param *param, DWORD s
|
||||
}
|
||||
}
|
||||
|
||||
void shader_dump_src_param(const struct wined3d_shader_src_param *param, DWORD shader_version)
|
||||
void shader_dump_src_param(const struct wined3d_shader_src_param *param,
|
||||
const struct wined3d_shader_version *shader_version)
|
||||
{
|
||||
DWORD src_modifier = param->modifiers;
|
||||
DWORD swizzle = param->swizzle;
|
||||
@ -861,13 +863,13 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
|
||||
void *fe_data = This->baseShader.frontend_data;
|
||||
struct wined3d_shader_src_param src_rel_addr[4];
|
||||
struct wined3d_shader_src_param src_param[4];
|
||||
struct wined3d_shader_version shader_version;
|
||||
struct wined3d_shader_src_param dst_rel_addr;
|
||||
struct wined3d_shader_dst_param dst_param;
|
||||
struct wined3d_shader_instruction ins;
|
||||
struct wined3d_shader_context ctx;
|
||||
const DWORD *pToken = pFunction;
|
||||
SHADER_HANDLER hw_fct;
|
||||
DWORD shader_version;
|
||||
DWORD i;
|
||||
|
||||
/* Initialize current parsing state */
|
||||
@ -975,16 +977,16 @@ static void shader_dump_ins_modifiers(const struct wined3d_shader_dst_param *dst
|
||||
|
||||
void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data, const DWORD *pFunction)
|
||||
{
|
||||
struct wined3d_shader_version shader_version;
|
||||
const DWORD* pToken = pFunction;
|
||||
DWORD shader_version;
|
||||
DWORD i;
|
||||
|
||||
TRACE("Parsing %p\n", pFunction);
|
||||
|
||||
fe->shader_read_header(fe_data, &pToken, &shader_version);
|
||||
|
||||
TRACE("%s_%u_%u\n", shader_is_pshader_version(shader_version) ? "ps": "vs",
|
||||
WINED3DSHADER_VERSION_MAJOR(shader_version), WINED3DSHADER_VERSION_MINOR(shader_version));
|
||||
TRACE("%s_%u_%u\n", shader_is_pshader_version(shader_version.type) ? "ps": "vs",
|
||||
shader_version.major, shader_version.minor);
|
||||
|
||||
while (!fe->shader_is_end(fe_data, &pToken))
|
||||
{
|
||||
@ -1014,10 +1016,10 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
|
||||
|
||||
fe->shader_read_semantic(&pToken, &semantic);
|
||||
|
||||
shader_dump_decl_usage(&semantic, shader_version);
|
||||
shader_dump_decl_usage(&semantic, &shader_version);
|
||||
shader_dump_ins_modifiers(&semantic.reg);
|
||||
TRACE(" ");
|
||||
shader_dump_dst_param(&semantic.reg, shader_version);
|
||||
shader_dump_dst_param(&semantic.reg, &shader_version);
|
||||
}
|
||||
else if (ins.handler_idx == WINED3DSIH_DEF)
|
||||
{
|
||||
@ -1074,7 +1076,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
|
||||
{
|
||||
fe->shader_read_src_param(fe_data, &pToken, &src_param, &src_rel_addr);
|
||||
TRACE("(");
|
||||
shader_dump_src_param(&src_param, shader_version);
|
||||
shader_dump_src_param(&src_param, &shader_version);
|
||||
TRACE(") ");
|
||||
}
|
||||
|
||||
@ -1098,7 +1100,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
|
||||
}
|
||||
}
|
||||
else if (ins.handler_idx == WINED3DSIH_TEX
|
||||
&& shader_version >= WINED3DPS_VERSION(2,0)
|
||||
&& shader_version.major >= 2
|
||||
&& (ins.flags & WINED3DSI_TEXLD_PROJECT))
|
||||
{
|
||||
TRACE("p");
|
||||
@ -1109,7 +1111,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
|
||||
{
|
||||
shader_dump_ins_modifiers(&dst_param);
|
||||
TRACE(" ");
|
||||
shader_dump_dst_param(&dst_param, shader_version);
|
||||
shader_dump_dst_param(&dst_param, &shader_version);
|
||||
}
|
||||
|
||||
/* Other source tokens */
|
||||
@ -1117,7 +1119,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
|
||||
{
|
||||
fe->shader_read_src_param(fe_data, &pToken, &src_param, &src_rel_addr);
|
||||
TRACE(!i ? " " : ", ");
|
||||
shader_dump_src_param(&src_param, shader_version);
|
||||
shader_dump_src_param(&src_param, &shader_version);
|
||||
}
|
||||
}
|
||||
TRACE("\n");
|
||||
|
@ -369,8 +369,8 @@ static void shader_glsl_load_constantsF(IWineD3DBaseShaderImpl *This, const Wine
|
||||
const local_constant *lconst;
|
||||
|
||||
/* 1.X pshaders have the constants clamped to [-1;1] implicitly. */
|
||||
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.reg_maps.shader_version) == 1
|
||||
&& shader_is_pshader_version(This->baseShader.reg_maps.shader_version))
|
||||
if (This->baseShader.reg_maps.shader_version.major == 1
|
||||
&& shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type))
|
||||
walk_constant_heap_clamped(gl_info, constants, constant_locations, heap, stack, version);
|
||||
else
|
||||
walk_constant_heap(gl_info, constants, constant_locations, heap, stack, version);
|
||||
@ -434,7 +434,7 @@ static void shader_glsl_load_constantsB(IWineD3DBaseShaderImpl *This, const Wine
|
||||
GLint tmp_loc;
|
||||
unsigned int i;
|
||||
char tmp_name[8];
|
||||
char is_pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version);
|
||||
char is_pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type);
|
||||
const char* prefix = is_pshader? "PB":"VB";
|
||||
struct list* ptr;
|
||||
|
||||
@ -700,12 +700,11 @@ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const s
|
||||
{
|
||||
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
||||
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device;
|
||||
DWORD shader_version = reg_maps->shader_version;
|
||||
unsigned int i, extra_constants_needed = 0;
|
||||
const local_constant *lconst;
|
||||
|
||||
/* There are some minor differences between pixel and vertex shaders */
|
||||
char pshader = shader_is_pshader_version(shader_version);
|
||||
char pshader = shader_is_pshader_version(reg_maps->shader_version.type);
|
||||
char prefix = pshader ? 'P' : 'V';
|
||||
|
||||
/* Prototype the subroutines */
|
||||
@ -778,7 +777,7 @@ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const s
|
||||
* out. The nvidia driver only does that if the parameter is inout instead of out, hence the
|
||||
* inout.
|
||||
*/
|
||||
if (shader_version >= WINED3DVS_VERSION(3, 0))
|
||||
if (reg_maps->shader_version.major >= 3)
|
||||
{
|
||||
shader_addline(buffer, "void order_ps_input(in vec4[%u]);\n", MAX_REG_OUTPUT);
|
||||
} else {
|
||||
@ -888,7 +887,7 @@ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const s
|
||||
/* Declare input register varyings. Only pixel shader, vertex shaders have that declared in the
|
||||
* helper function shader that is linked in at link time
|
||||
*/
|
||||
if (pshader && shader_version >= WINED3DPS_VERSION(3, 0))
|
||||
if (pshader && reg_maps->shader_version.major >= 3)
|
||||
{
|
||||
if (use_vs(device->stateBlock))
|
||||
{
|
||||
@ -1053,8 +1052,7 @@ static void shader_glsl_get_register_name(WINED3DSHADER_PARAM_REGISTER_TYPE regi
|
||||
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)ins->ctx->shader;
|
||||
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
|
||||
const WineD3D_GL_Info* gl_info = &deviceImpl->adapter->gl_info;
|
||||
DWORD shader_version = This->baseShader.reg_maps.shader_version;
|
||||
char pshader = shader_is_pshader_version(shader_version);
|
||||
char pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type);
|
||||
|
||||
*is_color = FALSE;
|
||||
|
||||
@ -1066,7 +1064,7 @@ static void shader_glsl_get_register_name(WINED3DSHADER_PARAM_REGISTER_TYPE regi
|
||||
case WINED3DSPR_INPUT:
|
||||
if (pshader) {
|
||||
/* Pixel shaders >= 3.0 */
|
||||
if (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 3)
|
||||
if (This->baseShader.reg_maps.shader_version.major >= 3)
|
||||
{
|
||||
DWORD in_count = GL_LIMITS(glsl_varyings) / 4;
|
||||
|
||||
@ -1198,7 +1196,7 @@ static void shader_glsl_get_register_name(WINED3DSHADER_PARAM_REGISTER_TYPE regi
|
||||
break;
|
||||
case WINED3DSPR_TEXCRDOUT:
|
||||
/* Vertex shaders >= 3.0: WINED3DSPR_OUTPUT */
|
||||
if (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 3) sprintf(register_name, "OUT[%u]", register_idx);
|
||||
if (This->baseShader.reg_maps.shader_version.major >= 3) sprintf(register_name, "OUT[%u]", register_idx);
|
||||
else sprintf(register_name, "gl_TexCoord[%u]", register_idx);
|
||||
break;
|
||||
case WINED3DSPR_MISCTYPE:
|
||||
@ -1579,7 +1577,7 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s
|
||||
|
||||
shader_glsl_swizzle_to_str(swizzle, FALSE, ins->dst[0].write_mask, dst_swizzle);
|
||||
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version))
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type))
|
||||
{
|
||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
|
||||
fixup = This->cur_args->color_fixup[sampler];
|
||||
@ -1667,9 +1665,9 @@ static void shader_glsl_mov(const struct wined3d_shader_instruction *ins)
|
||||
|
||||
/* In vs_1_1 WINED3DSIO_MOV can write to the address register. In later
|
||||
* shader versions WINED3DSIO_MOVA is used for this. */
|
||||
if ((WINED3DSHADER_VERSION_MAJOR(ins->ctx->reg_maps->shader_version) == 1
|
||||
&& !shader_is_pshader_version(ins->ctx->reg_maps->shader_version)
|
||||
&& ins->dst[0].register_type == WINED3DSPR_ADDR))
|
||||
if (ins->ctx->reg_maps->shader_version.major == 1
|
||||
&& !shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type)
|
||||
&& ins->dst[0].register_type == WINED3DSPR_ADDR)
|
||||
{
|
||||
/* This is a simple floor() */
|
||||
unsigned int mask_size = shader_glsl_get_write_mask_size(write_mask);
|
||||
@ -1845,7 +1843,7 @@ static void shader_glsl_expp(const struct wined3d_shader_instruction *ins)
|
||||
|
||||
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src_param);
|
||||
|
||||
if (ins->ctx->reg_maps->shader_version < WINED3DPS_VERSION(2,0))
|
||||
if (ins->ctx->reg_maps->shader_version.major < 2)
|
||||
{
|
||||
char dst_mask[6];
|
||||
|
||||
@ -2047,8 +2045,10 @@ static void shader_glsl_cnd(const struct wined3d_shader_instruction *ins)
|
||||
DWORD write_mask, cmp_channel = 0;
|
||||
unsigned int i, j;
|
||||
DWORD dst_mask;
|
||||
DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major,
|
||||
ins->ctx->reg_maps->shader_version.minor);
|
||||
|
||||
if (ins->ctx->reg_maps->shader_version < WINED3DPS_VERSION(1, 4))
|
||||
if (shader_version < WINED3D_SHADER_VERSION(1, 4))
|
||||
{
|
||||
write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins);
|
||||
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src0_param);
|
||||
@ -2472,7 +2472,8 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins)
|
||||
{
|
||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)ins->ctx->shader;
|
||||
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
|
||||
DWORD shader_version = ins->ctx->reg_maps->shader_version;
|
||||
DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major,
|
||||
ins->ctx->reg_maps->shader_version.minor);
|
||||
glsl_sample_function_t sample_function;
|
||||
DWORD sample_flags = 0;
|
||||
WINED3DSAMPLER_TEXTURE_TYPE sampler_type;
|
||||
@ -2481,11 +2482,11 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins)
|
||||
|
||||
/* 1.0-1.4: Use destination register as sampler source.
|
||||
* 2.0+: Use provided sampler source. */
|
||||
if (shader_version < WINED3DPS_VERSION(2,0)) sampler_idx = ins->dst[0].register_idx;
|
||||
if (shader_version < WINED3D_SHADER_VERSION(2,0)) sampler_idx = ins->dst[0].register_idx;
|
||||
else sampler_idx = ins->src[1].register_idx;
|
||||
sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx];
|
||||
|
||||
if (shader_version < WINED3DPS_VERSION(1,4))
|
||||
if (shader_version < WINED3D_SHADER_VERSION(1,4))
|
||||
{
|
||||
DWORD flags = deviceImpl->stateBlock->textureState[sampler_idx][WINED3DTSS_TEXTURETRANSFORMFLAGS];
|
||||
|
||||
@ -2501,7 +2502,7 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (shader_version < WINED3DPS_VERSION(2,0))
|
||||
else if (shader_version < WINED3D_SHADER_VERSION(2,0))
|
||||
{
|
||||
DWORD src_mod = ins->src[0].modifiers;
|
||||
|
||||
@ -2529,12 +2530,12 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins)
|
||||
shader_glsl_get_sample_function(sampler_type, sample_flags, &sample_function);
|
||||
mask |= sample_function.coord_mask;
|
||||
|
||||
if (shader_version < WINED3DPS_VERSION(2,0)) swizzle = WINED3DSP_NOSWIZZLE;
|
||||
if (shader_version < WINED3D_SHADER_VERSION(2,0)) swizzle = WINED3DSP_NOSWIZZLE;
|
||||
else swizzle = ins->src[1].swizzle;
|
||||
|
||||
/* 1.0-1.3: Use destination register as coordinate source.
|
||||
1.4+: Use provided coordinate source register. */
|
||||
if (shader_version < WINED3DPS_VERSION(1,4))
|
||||
if (shader_version < WINED3D_SHADER_VERSION(1,4))
|
||||
{
|
||||
char coord_mask[6];
|
||||
shader_glsl_write_mask_to_str(mask, coord_mask);
|
||||
@ -2611,7 +2612,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins)
|
||||
|
||||
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_3, &lod_param);
|
||||
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version))
|
||||
if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type))
|
||||
{
|
||||
/* The GLSL spec claims the Lod sampling functions are only supported in vertex shaders.
|
||||
* However, they seem to work just fine in fragment shaders as well. */
|
||||
@ -2627,7 +2628,7 @@ static void pshader_glsl_texcoord(const struct wined3d_shader_instruction *ins)
|
||||
SHADER_BUFFER *buffer = ins->ctx->buffer;
|
||||
DWORD write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins);
|
||||
|
||||
if (ins->ctx->reg_maps->shader_version != WINED3DPS_VERSION(1,4))
|
||||
if (!(ins->ctx->reg_maps->shader_version.major == 1 && ins->ctx->reg_maps->shader_version.minor == 4))
|
||||
{
|
||||
char dst_mask[6];
|
||||
|
||||
@ -3055,7 +3056,7 @@ static void pshader_glsl_texkill(const struct wined3d_shader_instruction *ins)
|
||||
|
||||
/* The argument is a destination parameter, and no writemasks are allowed */
|
||||
shader_glsl_add_dst_param(ins, &ins->dst[0], &dst_param);
|
||||
if ((ins->ctx->reg_maps->shader_version >= WINED3DPS_VERSION(2,0)))
|
||||
if (ins->ctx->reg_maps->shader_version.major >= 2)
|
||||
{
|
||||
/* 2.0 shaders compare all 4 components in texkill */
|
||||
shader_addline(ins->ctx->buffer, "if (any(lessThan(%s.xyzw, vec4(0.0)))) discard;\n", dst_param.reg_name);
|
||||
@ -3346,8 +3347,8 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
|
||||
IWineD3DVertexShaderImpl *vs = (IWineD3DVertexShaderImpl *) vertexshader;
|
||||
IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *) pixelshader;
|
||||
IWineD3DDeviceImpl *device;
|
||||
DWORD vs_major = WINED3DSHADER_VERSION_MAJOR(vs->baseShader.reg_maps.shader_version);
|
||||
DWORD ps_major = ps ? WINED3DSHADER_VERSION_MAJOR(ps->baseShader.reg_maps.shader_version) : 0;
|
||||
DWORD vs_major = vs->baseShader.reg_maps.shader_version.major;
|
||||
DWORD ps_major = ps ? ps->baseShader.reg_maps.shader_version.major : 0;
|
||||
unsigned int i;
|
||||
SHADER_BUFFER buffer;
|
||||
DWORD usage, usage_idx, writemask;
|
||||
@ -3672,7 +3673,7 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use
|
||||
checkGLcall("Find glsl program uniform locations");
|
||||
|
||||
if (pshader
|
||||
&& WINED3DSHADER_VERSION_MAJOR(((IWineD3DPixelShaderImpl *)pshader)->baseShader.reg_maps.shader_version) >= 3
|
||||
&& ((IWineD3DPixelShaderImpl *)pshader)->baseShader.reg_maps.shader_version.major >= 3
|
||||
&& ((IWineD3DPixelShaderImpl *)pshader)->declared_in_count > GL_LIMITS(glsl_varyings) / 4)
|
||||
{
|
||||
TRACE("Shader %d needs vertex color clamping disabled\n", programId);
|
||||
@ -3859,7 +3860,7 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
|
||||
/* Note: Do not use QueryInterface here to find out which shader type this is because this code
|
||||
* can be called from IWineD3DBaseShader::Release
|
||||
*/
|
||||
char pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version);
|
||||
char pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type);
|
||||
|
||||
if(pshader) {
|
||||
ps = (IWineD3DPixelShaderImpl *) This;
|
||||
@ -4066,7 +4067,8 @@ static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface,
|
||||
shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, buffer, &GLINFO_LOCATION, args);
|
||||
|
||||
/* Pack 3.0 inputs */
|
||||
if (reg_maps->shader_version >= WINED3DPS_VERSION(3,0) && args->vp_mode != vertexshader) {
|
||||
if (reg_maps->shader_version.major >= 3 && args->vp_mode != vertexshader)
|
||||
{
|
||||
pshader_glsl_input_pack(iface, buffer, This->semantics_in, reg_maps, args->vp_mode);
|
||||
}
|
||||
|
||||
@ -4074,7 +4076,7 @@ static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface,
|
||||
shader_generate_main((IWineD3DBaseShader *)This, buffer, reg_maps, function);
|
||||
|
||||
/* Pixel shaders < 2.0 place the resulting color in R0 implicitly */
|
||||
if (reg_maps->shader_version < WINED3DPS_VERSION(2,0))
|
||||
if (reg_maps->shader_version.major < 2)
|
||||
{
|
||||
/* Some older cards like GeforceFX ones don't support multiple buffers, so also not gl_FragData */
|
||||
if(GL_SUPPORT(ARB_DRAW_BUFFERS))
|
||||
@ -4104,7 +4106,8 @@ static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface,
|
||||
* NOTE: gl_Fog.start and gl_Fog.end don't hold fog start s and end e but
|
||||
* -1/(e-s) and e/(e-s) respectively.
|
||||
*/
|
||||
if(reg_maps->shader_version < WINED3DPS_VERSION(3,0)) {
|
||||
if (reg_maps->shader_version.major < 3)
|
||||
{
|
||||
switch(args->fog) {
|
||||
case FOG_OFF: break;
|
||||
case FOG_LINEAR:
|
||||
@ -4159,7 +4162,7 @@ static GLuint shader_glsl_generate_vshader(IWineD3DVertexShader *iface,
|
||||
shader_generate_main((IWineD3DBaseShader*)This, buffer, reg_maps, function);
|
||||
|
||||
/* Unpack 3.0 outputs */
|
||||
if (reg_maps->shader_version >= WINED3DVS_VERSION(3,0)) shader_addline(buffer, "order_ps_input(OUT);\n");
|
||||
if (reg_maps->shader_version.major >= 3) shader_addline(buffer, "order_ps_input(OUT);\n");
|
||||
else shader_addline(buffer, "order_ps_input();\n");
|
||||
|
||||
/* The D3DRS_FOGTABLEMODE render state defines if the shader-generated fog coord is used
|
||||
|
@ -122,16 +122,19 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_GetFunction(IWineD3DPixelShader*
|
||||
|
||||
static void pshader_set_limits(IWineD3DPixelShaderImpl *This)
|
||||
{
|
||||
DWORD shader_version = WINED3D_SHADER_VERSION(This->baseShader.reg_maps.shader_version.major,
|
||||
This->baseShader.reg_maps.shader_version.minor);
|
||||
|
||||
This->baseShader.limits.attributes = 0;
|
||||
This->baseShader.limits.address = 0;
|
||||
This->baseShader.limits.packed_output = 0;
|
||||
|
||||
switch (This->baseShader.reg_maps.shader_version)
|
||||
switch (shader_version)
|
||||
{
|
||||
case WINED3DPS_VERSION(1,0):
|
||||
case WINED3DPS_VERSION(1,1):
|
||||
case WINED3DPS_VERSION(1,2):
|
||||
case WINED3DPS_VERSION(1,3):
|
||||
case WINED3D_SHADER_VERSION(1,0):
|
||||
case WINED3D_SHADER_VERSION(1,1):
|
||||
case WINED3D_SHADER_VERSION(1,2):
|
||||
case WINED3D_SHADER_VERSION(1,3):
|
||||
This->baseShader.limits.temporary = 2;
|
||||
This->baseShader.limits.constant_float = 8;
|
||||
This->baseShader.limits.constant_int = 0;
|
||||
@ -142,7 +145,7 @@ static void pshader_set_limits(IWineD3DPixelShaderImpl *This)
|
||||
This->baseShader.limits.label = 0;
|
||||
break;
|
||||
|
||||
case WINED3DPS_VERSION(1,4):
|
||||
case WINED3D_SHADER_VERSION(1,4):
|
||||
This->baseShader.limits.temporary = 6;
|
||||
This->baseShader.limits.constant_float = 8;
|
||||
This->baseShader.limits.constant_int = 0;
|
||||
@ -154,7 +157,7 @@ static void pshader_set_limits(IWineD3DPixelShaderImpl *This)
|
||||
break;
|
||||
|
||||
/* FIXME: temporaries must match D3DPSHADERCAPS2_0.NumTemps */
|
||||
case WINED3DPS_VERSION(2,0):
|
||||
case WINED3D_SHADER_VERSION(2,0):
|
||||
This->baseShader.limits.temporary = 32;
|
||||
This->baseShader.limits.constant_float = 32;
|
||||
This->baseShader.limits.constant_int = 16;
|
||||
@ -164,7 +167,7 @@ static void pshader_set_limits(IWineD3DPixelShaderImpl *This)
|
||||
This->baseShader.limits.packed_input = 0;
|
||||
break;
|
||||
|
||||
case WINED3DPS_VERSION(2,1):
|
||||
case WINED3D_SHADER_VERSION(2,1):
|
||||
This->baseShader.limits.temporary = 32;
|
||||
This->baseShader.limits.constant_float = 32;
|
||||
This->baseShader.limits.constant_int = 16;
|
||||
@ -175,7 +178,7 @@ static void pshader_set_limits(IWineD3DPixelShaderImpl *This)
|
||||
This->baseShader.limits.label = 16;
|
||||
break;
|
||||
|
||||
case WINED3DPS_VERSION(3,0):
|
||||
case WINED3D_SHADER_VERSION(3,0):
|
||||
This->baseShader.limits.temporary = 32;
|
||||
This->baseShader.limits.constant_float = 224;
|
||||
This->baseShader.limits.constant_int = 16;
|
||||
@ -195,8 +198,9 @@ static void pshader_set_limits(IWineD3DPixelShaderImpl *This)
|
||||
This->baseShader.limits.sampler = 16;
|
||||
This->baseShader.limits.packed_input = 0;
|
||||
This->baseShader.limits.label = 0;
|
||||
FIXME("Unrecognized pixel shader version %#x\n",
|
||||
This->baseShader.reg_maps.shader_version);
|
||||
FIXME("Unrecognized pixel shader version %u.%u\n",
|
||||
This->baseShader.reg_maps.shader_version.major,
|
||||
This->baseShader.reg_maps.shader_version.minor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,11 +297,10 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
|
||||
|
||||
static void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseTexture * const *textures)
|
||||
{
|
||||
DWORD shader_version = reg_maps->shader_version;
|
||||
WINED3DSAMPLER_TEXTURE_TYPE *sampler_type = reg_maps->sampler_type;
|
||||
unsigned int i;
|
||||
|
||||
if (WINED3DSHADER_VERSION_MAJOR(shader_version) != 1) return;
|
||||
if (reg_maps->shader_version.major != 1) return;
|
||||
|
||||
for (i = 0; i < max(MAX_FRAGMENT_SAMPLERS, MAX_VERTEX_SAMPLERS); ++i)
|
||||
{
|
||||
@ -396,7 +399,7 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImp
|
||||
args->np2_fixup |= (1 << i);
|
||||
}
|
||||
}
|
||||
if (shader->baseShader.reg_maps.shader_version >= WINED3DPS_VERSION(3,0))
|
||||
if (shader->baseShader.reg_maps.shader_version.major >= 3)
|
||||
{
|
||||
if (((IWineD3DDeviceImpl *)shader->baseShader.device)->strided_streams.position_transformed)
|
||||
{
|
||||
|
@ -90,6 +90,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
||||
|
||||
#define WINED3DSP_END 0x0000ffff
|
||||
|
||||
#define WINED3D_SM1_VERSION_MAJOR(version) (((version) >> 8) & 0xff)
|
||||
#define WINED3D_SM1_VERSION_MINOR(version) (((version) >> 0) & 0xff)
|
||||
|
||||
enum WINED3DSHADER_ADDRESSMODE_TYPE
|
||||
{
|
||||
WINED3DSHADER_ADDRMODE_ABSOLUTE = 0 << WINED3DSHADER_ADDRESSMODE_SHIFT,
|
||||
@ -108,7 +111,7 @@ struct wined3d_sm1_opcode_info
|
||||
|
||||
struct wined3d_sm1_data
|
||||
{
|
||||
DWORD shader_version;
|
||||
struct wined3d_shader_version shader_version;
|
||||
const struct wined3d_sm1_opcode_info *opcode_table;
|
||||
};
|
||||
|
||||
@ -116,169 +119,169 @@ struct wined3d_sm1_data
|
||||
static const struct wined3d_sm1_opcode_info vs_opcode_table[] =
|
||||
{
|
||||
/* Arithmetic */
|
||||
{WINED3DSIO_NOP, 0, 0, WINED3DSIH_NOP, 0, 0 },
|
||||
{WINED3DSIO_MOV, 1, 2, WINED3DSIH_MOV, 0, 0 },
|
||||
{WINED3DSIO_MOVA, 1, 2, WINED3DSIH_MOVA, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_ADD, 1, 3, WINED3DSIH_ADD, 0, 0 },
|
||||
{WINED3DSIO_SUB, 1, 3, WINED3DSIH_SUB, 0, 0 },
|
||||
{WINED3DSIO_MAD, 1, 4, WINED3DSIH_MAD, 0, 0 },
|
||||
{WINED3DSIO_MUL, 1, 3, WINED3DSIH_MUL, 0, 0 },
|
||||
{WINED3DSIO_RCP, 1, 2, WINED3DSIH_RCP, 0, 0 },
|
||||
{WINED3DSIO_RSQ, 1, 2, WINED3DSIH_RSQ, 0, 0 },
|
||||
{WINED3DSIO_DP3, 1, 3, WINED3DSIH_DP3, 0, 0 },
|
||||
{WINED3DSIO_DP4, 1, 3, WINED3DSIH_DP4, 0, 0 },
|
||||
{WINED3DSIO_MIN, 1, 3, WINED3DSIH_MIN, 0, 0 },
|
||||
{WINED3DSIO_MAX, 1, 3, WINED3DSIH_MAX, 0, 0 },
|
||||
{WINED3DSIO_SLT, 1, 3, WINED3DSIH_SLT, 0, 0 },
|
||||
{WINED3DSIO_SGE, 1, 3, WINED3DSIH_SGE, 0, 0 },
|
||||
{WINED3DSIO_ABS, 1, 2, WINED3DSIH_ABS, 0, 0 },
|
||||
{WINED3DSIO_EXP, 1, 2, WINED3DSIH_EXP, 0, 0 },
|
||||
{WINED3DSIO_LOG, 1, 2, WINED3DSIH_LOG, 0, 0 },
|
||||
{WINED3DSIO_EXPP, 1, 2, WINED3DSIH_EXPP, 0, 0 },
|
||||
{WINED3DSIO_LOGP, 1, 2, WINED3DSIH_LOGP, 0, 0 },
|
||||
{WINED3DSIO_LIT, 1, 2, WINED3DSIH_LIT, 0, 0 },
|
||||
{WINED3DSIO_DST, 1, 3, WINED3DSIH_DST, 0, 0 },
|
||||
{WINED3DSIO_LRP, 1, 4, WINED3DSIH_LRP, 0, 0 },
|
||||
{WINED3DSIO_FRC, 1, 2, WINED3DSIH_FRC, 0, 0 },
|
||||
{WINED3DSIO_POW, 1, 3, WINED3DSIH_POW, 0, 0 },
|
||||
{WINED3DSIO_CRS, 1, 3, WINED3DSIH_CRS, 0, 0 },
|
||||
{WINED3DSIO_SGN, 1, 2, WINED3DSIH_SGN, 0, 0 },
|
||||
{WINED3DSIO_NRM, 1, 2, WINED3DSIH_NRM, 0, 0 },
|
||||
{WINED3DSIO_SINCOS, 1, 4, WINED3DSIH_SINCOS, WINED3DVS_VERSION(2,0), WINED3DVS_VERSION(2,1)},
|
||||
{WINED3DSIO_SINCOS, 1, 2, WINED3DSIH_SINCOS, WINED3DVS_VERSION(3,0), -1 },
|
||||
{WINED3DSIO_NOP, 0, 0, WINED3DSIH_NOP, 0, 0 },
|
||||
{WINED3DSIO_MOV, 1, 2, WINED3DSIH_MOV, 0, 0 },
|
||||
{WINED3DSIO_MOVA, 1, 2, WINED3DSIH_MOVA, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_ADD, 1, 3, WINED3DSIH_ADD, 0, 0 },
|
||||
{WINED3DSIO_SUB, 1, 3, WINED3DSIH_SUB, 0, 0 },
|
||||
{WINED3DSIO_MAD, 1, 4, WINED3DSIH_MAD, 0, 0 },
|
||||
{WINED3DSIO_MUL, 1, 3, WINED3DSIH_MUL, 0, 0 },
|
||||
{WINED3DSIO_RCP, 1, 2, WINED3DSIH_RCP, 0, 0 },
|
||||
{WINED3DSIO_RSQ, 1, 2, WINED3DSIH_RSQ, 0, 0 },
|
||||
{WINED3DSIO_DP3, 1, 3, WINED3DSIH_DP3, 0, 0 },
|
||||
{WINED3DSIO_DP4, 1, 3, WINED3DSIH_DP4, 0, 0 },
|
||||
{WINED3DSIO_MIN, 1, 3, WINED3DSIH_MIN, 0, 0 },
|
||||
{WINED3DSIO_MAX, 1, 3, WINED3DSIH_MAX, 0, 0 },
|
||||
{WINED3DSIO_SLT, 1, 3, WINED3DSIH_SLT, 0, 0 },
|
||||
{WINED3DSIO_SGE, 1, 3, WINED3DSIH_SGE, 0, 0 },
|
||||
{WINED3DSIO_ABS, 1, 2, WINED3DSIH_ABS, 0, 0 },
|
||||
{WINED3DSIO_EXP, 1, 2, WINED3DSIH_EXP, 0, 0 },
|
||||
{WINED3DSIO_LOG, 1, 2, WINED3DSIH_LOG, 0, 0 },
|
||||
{WINED3DSIO_EXPP, 1, 2, WINED3DSIH_EXPP, 0, 0 },
|
||||
{WINED3DSIO_LOGP, 1, 2, WINED3DSIH_LOGP, 0, 0 },
|
||||
{WINED3DSIO_LIT, 1, 2, WINED3DSIH_LIT, 0, 0 },
|
||||
{WINED3DSIO_DST, 1, 3, WINED3DSIH_DST, 0, 0 },
|
||||
{WINED3DSIO_LRP, 1, 4, WINED3DSIH_LRP, 0, 0 },
|
||||
{WINED3DSIO_FRC, 1, 2, WINED3DSIH_FRC, 0, 0 },
|
||||
{WINED3DSIO_POW, 1, 3, WINED3DSIH_POW, 0, 0 },
|
||||
{WINED3DSIO_CRS, 1, 3, WINED3DSIH_CRS, 0, 0 },
|
||||
{WINED3DSIO_SGN, 1, 2, WINED3DSIH_SGN, 0, 0 },
|
||||
{WINED3DSIO_NRM, 1, 2, WINED3DSIH_NRM, 0, 0 },
|
||||
{WINED3DSIO_SINCOS, 1, 4, WINED3DSIH_SINCOS, WINED3D_SHADER_VERSION(2,0), WINED3D_SHADER_VERSION(2,1)},
|
||||
{WINED3DSIO_SINCOS, 1, 2, WINED3DSIH_SINCOS, WINED3D_SHADER_VERSION(3,0), -1 },
|
||||
/* Matrix */
|
||||
{WINED3DSIO_M4x4, 1, 3, WINED3DSIH_M4x4, 0, 0 },
|
||||
{WINED3DSIO_M4x3, 1, 3, WINED3DSIH_M4x3, 0, 0 },
|
||||
{WINED3DSIO_M3x4, 1, 3, WINED3DSIH_M3x4, 0, 0 },
|
||||
{WINED3DSIO_M3x3, 1, 3, WINED3DSIH_M3x3, 0, 0 },
|
||||
{WINED3DSIO_M3x2, 1, 3, WINED3DSIH_M3x2, 0, 0 },
|
||||
{WINED3DSIO_M4x4, 1, 3, WINED3DSIH_M4x4, 0, 0 },
|
||||
{WINED3DSIO_M4x3, 1, 3, WINED3DSIH_M4x3, 0, 0 },
|
||||
{WINED3DSIO_M3x4, 1, 3, WINED3DSIH_M3x4, 0, 0 },
|
||||
{WINED3DSIO_M3x3, 1, 3, WINED3DSIH_M3x3, 0, 0 },
|
||||
{WINED3DSIO_M3x2, 1, 3, WINED3DSIH_M3x2, 0, 0 },
|
||||
/* Declare registers */
|
||||
{WINED3DSIO_DCL, 0, 2, WINED3DSIH_DCL, 0, 0 },
|
||||
{WINED3DSIO_DCL, 0, 2, WINED3DSIH_DCL, 0, 0 },
|
||||
/* Constant definitions */
|
||||
{WINED3DSIO_DEF, 1, 5, WINED3DSIH_DEF, 0, 0 },
|
||||
{WINED3DSIO_DEFB, 1, 2, WINED3DSIH_DEFB, 0, 0 },
|
||||
{WINED3DSIO_DEFI, 1, 5, WINED3DSIH_DEFI, 0, 0 },
|
||||
{WINED3DSIO_DEF, 1, 5, WINED3DSIH_DEF, 0, 0 },
|
||||
{WINED3DSIO_DEFB, 1, 2, WINED3DSIH_DEFB, 0, 0 },
|
||||
{WINED3DSIO_DEFI, 1, 5, WINED3DSIH_DEFI, 0, 0 },
|
||||
/* Flow control */
|
||||
{WINED3DSIO_REP, 0, 1, WINED3DSIH_REP, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_ENDREP, 0, 0, WINED3DSIH_ENDREP, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_IF, 0, 1, WINED3DSIH_IF, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_IFC, 0, 2, WINED3DSIH_IFC, WINED3DVS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ELSE, 0, 0, WINED3DSIH_ELSE, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_ENDIF, 0, 0, WINED3DSIH_ENDIF, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_BREAK, 0, 0, WINED3DSIH_BREAK, WINED3DVS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAKC, 0, 2, WINED3DSIH_BREAKC, WINED3DVS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAKP, 0, 1, WINED3DSIH_BREAKP, 0, 0 },
|
||||
{WINED3DSIO_CALL, 0, 1, WINED3DSIH_CALL, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_CALLNZ, 0, 2, WINED3DSIH_CALLNZ, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_LOOP, 0, 2, WINED3DSIH_LOOP, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_RET, 0, 0, WINED3DSIH_RET, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_ENDLOOP, 0, 0, WINED3DSIH_ENDLOOP, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_LABEL, 0, 1, WINED3DSIH_LABEL, WINED3DVS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_REP, 0, 1, WINED3DSIH_REP, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_ENDREP, 0, 0, WINED3DSIH_ENDREP, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_IF, 0, 1, WINED3DSIH_IF, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_IFC, 0, 2, WINED3DSIH_IFC, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ELSE, 0, 0, WINED3DSIH_ELSE, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_ENDIF, 0, 0, WINED3DSIH_ENDIF, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_BREAK, 0, 0, WINED3DSIH_BREAK, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAKC, 0, 2, WINED3DSIH_BREAKC, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAKP, 0, 1, WINED3DSIH_BREAKP, 0, 0 },
|
||||
{WINED3DSIO_CALL, 0, 1, WINED3DSIH_CALL, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_CALLNZ, 0, 2, WINED3DSIH_CALLNZ, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_LOOP, 0, 2, WINED3DSIH_LOOP, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_RET, 0, 0, WINED3DSIH_RET, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_ENDLOOP, 0, 0, WINED3DSIH_ENDLOOP, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_LABEL, 0, 1, WINED3DSIH_LABEL, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
|
||||
{WINED3DSIO_SETP, 1, 3, WINED3DSIH_SETP, 0, 0 },
|
||||
{WINED3DSIO_TEXLDL, 1, 3, WINED3DSIH_TEXLDL, WINED3DVS_VERSION(3,0), -1 },
|
||||
{0, 0, 0, WINED3DSIH_TABLE_SIZE, 0, 0 },
|
||||
{WINED3DSIO_SETP, 1, 3, WINED3DSIH_SETP, 0, 0 },
|
||||
{WINED3DSIO_TEXLDL, 1, 3, WINED3DSIH_TEXLDL, WINED3D_SHADER_VERSION(3,0), -1 },
|
||||
{0, 0, 0, WINED3DSIH_TABLE_SIZE, 0, 0 },
|
||||
};
|
||||
|
||||
static const struct wined3d_sm1_opcode_info ps_opcode_table[] =
|
||||
{
|
||||
/* Arithmetic */
|
||||
{WINED3DSIO_NOP, 0, 0, WINED3DSIH_NOP, 0, 0 },
|
||||
{WINED3DSIO_MOV, 1, 2, WINED3DSIH_MOV, 0, 0 },
|
||||
{WINED3DSIO_ADD, 1, 3, WINED3DSIH_ADD, 0, 0 },
|
||||
{WINED3DSIO_SUB, 1, 3, WINED3DSIH_SUB, 0, 0 },
|
||||
{WINED3DSIO_MAD, 1, 4, WINED3DSIH_MAD, 0, 0 },
|
||||
{WINED3DSIO_MUL, 1, 3, WINED3DSIH_MUL, 0, 0 },
|
||||
{WINED3DSIO_RCP, 1, 2, WINED3DSIH_RCP, 0, 0 },
|
||||
{WINED3DSIO_RSQ, 1, 2, WINED3DSIH_RSQ, 0, 0 },
|
||||
{WINED3DSIO_DP3, 1, 3, WINED3DSIH_DP3, 0, 0 },
|
||||
{WINED3DSIO_DP4, 1, 3, WINED3DSIH_DP4, 0, 0 },
|
||||
{WINED3DSIO_MIN, 1, 3, WINED3DSIH_MIN, 0, 0 },
|
||||
{WINED3DSIO_MAX, 1, 3, WINED3DSIH_MAX, 0, 0 },
|
||||
{WINED3DSIO_SLT, 1, 3, WINED3DSIH_SLT, 0, 0 },
|
||||
{WINED3DSIO_SGE, 1, 3, WINED3DSIH_SGE, 0, 0 },
|
||||
{WINED3DSIO_ABS, 1, 2, WINED3DSIH_ABS, 0, 0 },
|
||||
{WINED3DSIO_EXP, 1, 2, WINED3DSIH_EXP, 0, 0 },
|
||||
{WINED3DSIO_LOG, 1, 2, WINED3DSIH_LOG, 0, 0 },
|
||||
{WINED3DSIO_EXPP, 1, 2, WINED3DSIH_EXPP, 0, 0 },
|
||||
{WINED3DSIO_LOGP, 1, 2, WINED3DSIH_LOGP, 0, 0 },
|
||||
{WINED3DSIO_DST, 1, 3, WINED3DSIH_DST, 0, 0 },
|
||||
{WINED3DSIO_LRP, 1, 4, WINED3DSIH_LRP, 0, 0 },
|
||||
{WINED3DSIO_FRC, 1, 2, WINED3DSIH_FRC, 0, 0 },
|
||||
{WINED3DSIO_CND, 1, 4, WINED3DSIH_CND, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_CMP, 1, 4, WINED3DSIH_CMP, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(3,0)},
|
||||
{WINED3DSIO_POW, 1, 3, WINED3DSIH_POW, 0, 0 },
|
||||
{WINED3DSIO_CRS, 1, 3, WINED3DSIH_CRS, 0, 0 },
|
||||
{WINED3DSIO_NRM, 1, 2, WINED3DSIH_NRM, 0, 0 },
|
||||
{WINED3DSIO_SINCOS, 1, 4, WINED3DSIH_SINCOS, WINED3DPS_VERSION(2,0), WINED3DPS_VERSION(2,1)},
|
||||
{WINED3DSIO_SINCOS, 1, 2, WINED3DSIH_SINCOS, WINED3DPS_VERSION(3,0), -1 },
|
||||
{WINED3DSIO_DP2ADD, 1, 4, WINED3DSIH_DP2ADD, WINED3DPS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_NOP, 0, 0, WINED3DSIH_NOP, 0, 0 },
|
||||
{WINED3DSIO_MOV, 1, 2, WINED3DSIH_MOV, 0, 0 },
|
||||
{WINED3DSIO_ADD, 1, 3, WINED3DSIH_ADD, 0, 0 },
|
||||
{WINED3DSIO_SUB, 1, 3, WINED3DSIH_SUB, 0, 0 },
|
||||
{WINED3DSIO_MAD, 1, 4, WINED3DSIH_MAD, 0, 0 },
|
||||
{WINED3DSIO_MUL, 1, 3, WINED3DSIH_MUL, 0, 0 },
|
||||
{WINED3DSIO_RCP, 1, 2, WINED3DSIH_RCP, 0, 0 },
|
||||
{WINED3DSIO_RSQ, 1, 2, WINED3DSIH_RSQ, 0, 0 },
|
||||
{WINED3DSIO_DP3, 1, 3, WINED3DSIH_DP3, 0, 0 },
|
||||
{WINED3DSIO_DP4, 1, 3, WINED3DSIH_DP4, 0, 0 },
|
||||
{WINED3DSIO_MIN, 1, 3, WINED3DSIH_MIN, 0, 0 },
|
||||
{WINED3DSIO_MAX, 1, 3, WINED3DSIH_MAX, 0, 0 },
|
||||
{WINED3DSIO_SLT, 1, 3, WINED3DSIH_SLT, 0, 0 },
|
||||
{WINED3DSIO_SGE, 1, 3, WINED3DSIH_SGE, 0, 0 },
|
||||
{WINED3DSIO_ABS, 1, 2, WINED3DSIH_ABS, 0, 0 },
|
||||
{WINED3DSIO_EXP, 1, 2, WINED3DSIH_EXP, 0, 0 },
|
||||
{WINED3DSIO_LOG, 1, 2, WINED3DSIH_LOG, 0, 0 },
|
||||
{WINED3DSIO_EXPP, 1, 2, WINED3DSIH_EXPP, 0, 0 },
|
||||
{WINED3DSIO_LOGP, 1, 2, WINED3DSIH_LOGP, 0, 0 },
|
||||
{WINED3DSIO_DST, 1, 3, WINED3DSIH_DST, 0, 0 },
|
||||
{WINED3DSIO_LRP, 1, 4, WINED3DSIH_LRP, 0, 0 },
|
||||
{WINED3DSIO_FRC, 1, 2, WINED3DSIH_FRC, 0, 0 },
|
||||
{WINED3DSIO_CND, 1, 4, WINED3DSIH_CND, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,4)},
|
||||
{WINED3DSIO_CMP, 1, 4, WINED3DSIH_CMP, WINED3D_SHADER_VERSION(1,2), WINED3D_SHADER_VERSION(3,0)},
|
||||
{WINED3DSIO_POW, 1, 3, WINED3DSIH_POW, 0, 0 },
|
||||
{WINED3DSIO_CRS, 1, 3, WINED3DSIH_CRS, 0, 0 },
|
||||
{WINED3DSIO_NRM, 1, 2, WINED3DSIH_NRM, 0, 0 },
|
||||
{WINED3DSIO_SINCOS, 1, 4, WINED3DSIH_SINCOS, WINED3D_SHADER_VERSION(2,0), WINED3D_SHADER_VERSION(2,1)},
|
||||
{WINED3DSIO_SINCOS, 1, 2, WINED3DSIH_SINCOS, WINED3D_SHADER_VERSION(3,0), -1 },
|
||||
{WINED3DSIO_DP2ADD, 1, 4, WINED3DSIH_DP2ADD, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
/* Matrix */
|
||||
{WINED3DSIO_M4x4, 1, 3, WINED3DSIH_M4x4, 0, 0 },
|
||||
{WINED3DSIO_M4x3, 1, 3, WINED3DSIH_M4x3, 0, 0 },
|
||||
{WINED3DSIO_M3x4, 1, 3, WINED3DSIH_M3x4, 0, 0 },
|
||||
{WINED3DSIO_M3x3, 1, 3, WINED3DSIH_M3x3, 0, 0 },
|
||||
{WINED3DSIO_M3x2, 1, 3, WINED3DSIH_M3x2, 0, 0 },
|
||||
{WINED3DSIO_M4x4, 1, 3, WINED3DSIH_M4x4, 0, 0 },
|
||||
{WINED3DSIO_M4x3, 1, 3, WINED3DSIH_M4x3, 0, 0 },
|
||||
{WINED3DSIO_M3x4, 1, 3, WINED3DSIH_M3x4, 0, 0 },
|
||||
{WINED3DSIO_M3x3, 1, 3, WINED3DSIH_M3x3, 0, 0 },
|
||||
{WINED3DSIO_M3x2, 1, 3, WINED3DSIH_M3x2, 0, 0 },
|
||||
/* Register declarations */
|
||||
{WINED3DSIO_DCL, 0, 2, WINED3DSIH_DCL, 0, 0 },
|
||||
{WINED3DSIO_DCL, 0, 2, WINED3DSIH_DCL, 0, 0 },
|
||||
/* Flow control */
|
||||
{WINED3DSIO_REP, 0, 1, WINED3DSIH_REP, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ENDREP, 0, 0, WINED3DSIH_ENDREP, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_IF, 0, 1, WINED3DSIH_IF, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_IFC, 0, 2, WINED3DSIH_IFC, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ELSE, 0, 0, WINED3DSIH_ELSE, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ENDIF, 0, 0, WINED3DSIH_ENDIF, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAK, 0, 0, WINED3DSIH_BREAK, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAKC, 0, 2, WINED3DSIH_BREAKC, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAKP, 0, 1, WINED3DSIH_BREAKP, 0, 0 },
|
||||
{WINED3DSIO_CALL, 0, 1, WINED3DSIH_CALL, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_CALLNZ, 0, 2, WINED3DSIH_CALLNZ, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_LOOP, 0, 2, WINED3DSIH_LOOP, WINED3DPS_VERSION(3,0), -1 },
|
||||
{WINED3DSIO_RET, 0, 0, WINED3DSIH_RET, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ENDLOOP, 0, 0, WINED3DSIH_ENDLOOP, WINED3DPS_VERSION(3,0), -1 },
|
||||
{WINED3DSIO_LABEL, 0, 1, WINED3DSIH_LABEL, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_REP, 0, 1, WINED3DSIH_REP, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ENDREP, 0, 0, WINED3DSIH_ENDREP, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_IF, 0, 1, WINED3DSIH_IF, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_IFC, 0, 2, WINED3DSIH_IFC, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ELSE, 0, 0, WINED3DSIH_ELSE, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ENDIF, 0, 0, WINED3DSIH_ENDIF, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAK, 0, 0, WINED3DSIH_BREAK, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAKC, 0, 2, WINED3DSIH_BREAKC, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_BREAKP, 0, 1, WINED3DSIH_BREAKP, 0, 0 },
|
||||
{WINED3DSIO_CALL, 0, 1, WINED3DSIH_CALL, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_CALLNZ, 0, 2, WINED3DSIH_CALLNZ, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_LOOP, 0, 2, WINED3DSIH_LOOP, WINED3D_SHADER_VERSION(3,0), -1 },
|
||||
{WINED3DSIO_RET, 0, 0, WINED3DSIH_RET, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_ENDLOOP, 0, 0, WINED3DSIH_ENDLOOP, WINED3D_SHADER_VERSION(3,0), -1 },
|
||||
{WINED3DSIO_LABEL, 0, 1, WINED3DSIH_LABEL, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
/* Constant definitions */
|
||||
{WINED3DSIO_DEF, 1, 5, WINED3DSIH_DEF, 0, 0 },
|
||||
{WINED3DSIO_DEFB, 1, 2, WINED3DSIH_DEFB, 0, 0 },
|
||||
{WINED3DSIO_DEFI, 1, 5, WINED3DSIH_DEFI, 0, 0 },
|
||||
{WINED3DSIO_DEF, 1, 5, WINED3DSIH_DEF, 0, 0 },
|
||||
{WINED3DSIO_DEFB, 1, 2, WINED3DSIH_DEFB, 0, 0 },
|
||||
{WINED3DSIO_DEFI, 1, 5, WINED3DSIH_DEFI, 0, 0 },
|
||||
/* Texture */
|
||||
{WINED3DSIO_TEXCOORD, 1, 1, WINED3DSIH_TEXCOORD, 0, WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXCOORD, 1, 2, WINED3DSIH_TEXCOORD, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_TEXKILL, 1, 1, WINED3DSIH_TEXKILL, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(3,0)},
|
||||
{WINED3DSIO_TEX, 1, 1, WINED3DSIH_TEX, 0, WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEX, 1, 2, WINED3DSIH_TEX, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_TEX, 1, 3, WINED3DSIH_TEX, WINED3DPS_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_TEXBEM, 1, 2, WINED3DSIH_TEXBEM, 0, WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXBEML, 1, 2, WINED3DSIH_TEXBEML, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2AR, 1, 2, WINED3DSIH_TEXREG2AR, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2GB, 1, 2, WINED3DSIH_TEXREG2GB, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2RGB, 1, 2, WINED3DSIH_TEXREG2RGB, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2PAD, 1, 2, WINED3DSIH_TEXM3x2PAD, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2TEX, 1, 2, WINED3DSIH_TEXM3x2TEX, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3PAD, 1, 2, WINED3DSIH_TEXM3x3PAD, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3DIFF, 1, 2, WINED3DSIH_TEXM3x3DIFF, WINED3DPS_VERSION(0,0), WINED3DPS_VERSION(0,0)},
|
||||
{WINED3DSIO_TEXM3x3SPEC, 1, 3, WINED3DSIH_TEXM3x3SPEC, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3VSPEC, 1, 2, WINED3DSIH_TEXM3x3VSPEC, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3TEX, 1, 2, WINED3DSIH_TEXM3x3TEX, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDP3TEX, 1, 2, WINED3DSIH_TEXDP3TEX, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2DEPTH, 1, 2, WINED3DSIH_TEXM3x2DEPTH, WINED3DPS_VERSION(1,3), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDP3, 1, 2, WINED3DSIH_TEXDP3, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3, 1, 2, WINED3DSIH_TEXM3x3, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDEPTH, 1, 1, WINED3DSIH_TEXDEPTH, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_BEM, 1, 3, WINED3DSIH_BEM, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
|
||||
{WINED3DSIO_DSX, 1, 2, WINED3DSIH_DSX, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_DSY, 1, 2, WINED3DSIH_DSY, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_TEXLDD, 1, 5, WINED3DSIH_TEXLDD, WINED3DPS_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_SETP, 1, 3, WINED3DSIH_SETP, 0, 0 },
|
||||
{WINED3DSIO_TEXLDL, 1, 3, WINED3DSIH_TEXLDL, WINED3DPS_VERSION(3,0), -1 },
|
||||
{WINED3DSIO_PHASE, 0, 0, WINED3DSIH_PHASE, 0, 0 },
|
||||
{0, 0, 0, WINED3DSIH_TABLE_SIZE, 0, 0 },
|
||||
{WINED3DSIO_TEXCOORD, 1, 1, WINED3DSIH_TEXCOORD, 0, WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXCOORD, 1, 2, WINED3DSIH_TEXCOORD, WINED3D_SHADER_VERSION(1,4), WINED3D_SHADER_VERSION(1,4)},
|
||||
{WINED3DSIO_TEXKILL, 1, 1, WINED3DSIH_TEXKILL, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(3,0)},
|
||||
{WINED3DSIO_TEX, 1, 1, WINED3DSIH_TEX, 0, WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEX, 1, 2, WINED3DSIH_TEX, WINED3D_SHADER_VERSION(1,4), WINED3D_SHADER_VERSION(1,4)},
|
||||
{WINED3DSIO_TEX, 1, 3, WINED3DSIH_TEX, WINED3D_SHADER_VERSION(2,0), -1 },
|
||||
{WINED3DSIO_TEXBEM, 1, 2, WINED3DSIH_TEXBEM, 0, WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXBEML, 1, 2, WINED3DSIH_TEXBEML, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2AR, 1, 2, WINED3DSIH_TEXREG2AR, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2GB, 1, 2, WINED3DSIH_TEXREG2GB, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXREG2RGB, 1, 2, WINED3DSIH_TEXREG2RGB, WINED3D_SHADER_VERSION(1,2), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2PAD, 1, 2, WINED3DSIH_TEXM3x2PAD, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2TEX, 1, 2, WINED3DSIH_TEXM3x2TEX, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3PAD, 1, 2, WINED3DSIH_TEXM3x3PAD, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3DIFF, 1, 2, WINED3DSIH_TEXM3x3DIFF, WINED3D_SHADER_VERSION(0,0), WINED3D_SHADER_VERSION(0,0)},
|
||||
{WINED3DSIO_TEXM3x3SPEC, 1, 3, WINED3DSIH_TEXM3x3SPEC, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3VSPEC, 1, 2, WINED3DSIH_TEXM3x3VSPEC, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3TEX, 1, 2, WINED3DSIH_TEXM3x3TEX, WINED3D_SHADER_VERSION(1,0), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDP3TEX, 1, 2, WINED3DSIH_TEXDP3TEX, WINED3D_SHADER_VERSION(1,2), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x2DEPTH, 1, 2, WINED3DSIH_TEXM3x2DEPTH, WINED3D_SHADER_VERSION(1,3), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDP3, 1, 2, WINED3DSIH_TEXDP3, WINED3D_SHADER_VERSION(1,2), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXM3x3, 1, 2, WINED3DSIH_TEXM3x3, WINED3D_SHADER_VERSION(1,2), WINED3D_SHADER_VERSION(1,3)},
|
||||
{WINED3DSIO_TEXDEPTH, 1, 1, WINED3DSIH_TEXDEPTH, WINED3D_SHADER_VERSION(1,4), WINED3D_SHADER_VERSION(1,4)},
|
||||
{WINED3DSIO_BEM, 1, 3, WINED3DSIH_BEM, WINED3D_SHADER_VERSION(1,4), WINED3D_SHADER_VERSION(1,4)},
|
||||
{WINED3DSIO_DSX, 1, 2, WINED3DSIH_DSX, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_DSY, 1, 2, WINED3DSIH_DSY, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_TEXLDD, 1, 5, WINED3DSIH_TEXLDD, WINED3D_SHADER_VERSION(2,1), -1 },
|
||||
{WINED3DSIO_SETP, 1, 3, WINED3DSIH_SETP, 0, 0 },
|
||||
{WINED3DSIO_TEXLDL, 1, 3, WINED3DSIH_TEXLDL, WINED3D_SHADER_VERSION(3,0), -1 },
|
||||
{WINED3DSIO_PHASE, 0, 0, WINED3DSIH_PHASE, 0, 0 },
|
||||
{0, 0, 0, WINED3DSIH_TABLE_SIZE, 0, 0 },
|
||||
};
|
||||
|
||||
/* Read a parameter opcode from the input stream,
|
||||
* and possibly a relative addressing token.
|
||||
* Return the number of tokens read */
|
||||
static int shader_get_param(const DWORD *ptr, DWORD shader_version, DWORD *token, DWORD *addr_token)
|
||||
static int shader_get_param(const struct wined3d_sm1_data *priv, const DWORD *ptr, DWORD *token, DWORD *addr_token)
|
||||
{
|
||||
UINT count = 1;
|
||||
|
||||
@ -290,7 +293,7 @@ static int shader_get_param(const DWORD *ptr, DWORD shader_version, DWORD *token
|
||||
* The version check below should work in general */
|
||||
if (*ptr & WINED3DSHADER_ADDRMODE_RELATIVE)
|
||||
{
|
||||
if (WINED3DSHADER_VERSION_MAJOR(shader_version) < 2)
|
||||
if (priv->shader_version.major < 2)
|
||||
{
|
||||
*addr_token = (1 << 31)
|
||||
| ((WINED3DSPR_ADDR << WINED3DSP_REGTYPE_SHIFT2) & WINED3DSP_REGTYPE_MASK2)
|
||||
@ -307,9 +310,10 @@ static int shader_get_param(const DWORD *ptr, DWORD shader_version, DWORD *token
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct wined3d_sm1_opcode_info *shader_get_opcode(const struct wined3d_sm1_opcode_info *opcode_table,
|
||||
DWORD shader_version, DWORD code)
|
||||
static const struct wined3d_sm1_opcode_info *shader_get_opcode(const struct wined3d_sm1_data *priv, DWORD code)
|
||||
{
|
||||
DWORD shader_version = WINED3D_SHADER_VERSION(priv->shader_version.major, priv->shader_version.minor);
|
||||
const struct wined3d_sm1_opcode_info *opcode_table = priv->opcode_table;
|
||||
DWORD i = 0;
|
||||
|
||||
while (opcode_table[i].handler_idx != WINED3DSIH_TABLE_SIZE)
|
||||
@ -330,12 +334,12 @@ static const struct wined3d_sm1_opcode_info *shader_get_opcode(const struct wine
|
||||
}
|
||||
|
||||
/* Return the number of parameters to skip for an opcode */
|
||||
static int shader_skip_opcode(const struct wined3d_sm1_opcode_info *opcode_info,
|
||||
DWORD opcode_token, DWORD shader_version)
|
||||
static int shader_skip_opcode(const struct wined3d_sm1_data *priv,
|
||||
const struct wined3d_sm1_opcode_info *opcode_info, DWORD opcode_token)
|
||||
{
|
||||
/* Shaders >= 2.0 may contain address tokens, but fortunately they
|
||||
* have a useful length mask - use it here. Shaders 1.0 contain no such tokens */
|
||||
return (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 2)
|
||||
return (priv->shader_version.major >= 2)
|
||||
? ((opcode_token & WINED3DSI_INSTLENGTH_MASK) >> WINED3DSI_INSTLENGTH_SHIFT) : opcode_info->param_count;
|
||||
}
|
||||
|
||||
@ -368,7 +372,7 @@ static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_
|
||||
* Note: This function assumes source or destination token format.
|
||||
* It will not work with specially-formatted tokens like DEF or DCL,
|
||||
* but hopefully those would be recognized */
|
||||
static int shader_skip_unrecognized(const DWORD *ptr, DWORD shader_version)
|
||||
static int shader_skip_unrecognized(const struct wined3d_sm1_data *priv, const DWORD *ptr)
|
||||
{
|
||||
int tokens_read = 0;
|
||||
int i = 0;
|
||||
@ -379,7 +383,7 @@ static int shader_skip_unrecognized(const DWORD *ptr, DWORD shader_version)
|
||||
DWORD token, addr_token = 0;
|
||||
struct wined3d_shader_src_param rel_addr;
|
||||
|
||||
tokens_read += shader_get_param(ptr, shader_version, &token, &addr_token);
|
||||
tokens_read += shader_get_param(priv, ptr, &token, &addr_token);
|
||||
ptr += tokens_read;
|
||||
|
||||
FIXME("Unrecognized opcode param: token=0x%08x addr_token=0x%08x name=", token, addr_token);
|
||||
@ -391,14 +395,14 @@ static int shader_skip_unrecognized(const DWORD *ptr, DWORD shader_version)
|
||||
struct wined3d_shader_dst_param dst;
|
||||
|
||||
shader_parse_dst_param(token, token & WINED3DSHADER_ADDRMODE_RELATIVE ? &rel_addr : NULL, &dst);
|
||||
shader_dump_dst_param(&dst, shader_version);
|
||||
shader_dump_dst_param(&dst, &priv->shader_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct wined3d_shader_src_param src;
|
||||
|
||||
shader_parse_src_param(token, token & WINED3DSHADER_ADDRMODE_RELATIVE ? &rel_addr : NULL, &src);
|
||||
shader_dump_src_param(&src, shader_version);
|
||||
shader_dump_src_param(&src, &priv->shader_version);
|
||||
}
|
||||
FIXME("\n");
|
||||
++i;
|
||||
@ -418,10 +422,12 @@ static void *shader_sm1_init(const DWORD *byte_code)
|
||||
switch (*byte_code >> 16)
|
||||
{
|
||||
case WINED3D_SM1_VS:
|
||||
priv->shader_version.type = WINED3D_SHADER_TYPE_VERTEX;
|
||||
priv->opcode_table = vs_opcode_table;
|
||||
break;
|
||||
|
||||
case WINED3D_SM1_PS:
|
||||
priv->shader_version.type = WINED3D_SHADER_TYPE_PIXEL;
|
||||
priv->opcode_table = ps_opcode_table;
|
||||
break;
|
||||
|
||||
@ -439,14 +445,17 @@ static void shader_sm1_free(void *data)
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
}
|
||||
|
||||
static void shader_sm1_read_header(void *data, const DWORD **ptr, DWORD *shader_version)
|
||||
static void shader_sm1_read_header(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version)
|
||||
{
|
||||
struct wined3d_sm1_data *priv = data;
|
||||
DWORD version_token;
|
||||
|
||||
TRACE("version: 0x%08x\n", **ptr);
|
||||
*shader_version = *(*ptr)++;
|
||||
version_token = *(*ptr)++;
|
||||
TRACE("version: 0x%08x\n", version_token);
|
||||
|
||||
priv->shader_version = *shader_version;
|
||||
priv->shader_version.major = WINED3D_SM1_VERSION_MAJOR(version_token);
|
||||
priv->shader_version.minor = WINED3D_SM1_VERSION_MINOR(version_token);
|
||||
*shader_version = priv->shader_version;
|
||||
}
|
||||
|
||||
static void shader_sm1_read_opcode(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins,
|
||||
@ -457,12 +466,12 @@ static void shader_sm1_read_opcode(void *data, const DWORD **ptr, struct wined3d
|
||||
DWORD opcode_token;
|
||||
|
||||
opcode_token = *(*ptr)++;
|
||||
opcode_info = shader_get_opcode(priv->opcode_table, priv->shader_version, opcode_token);
|
||||
opcode_info = shader_get_opcode(priv, opcode_token);
|
||||
if (!opcode_info)
|
||||
{
|
||||
FIXME("Unrecognized opcode: token=0x%08x\n", opcode_token);
|
||||
ins->handler_idx = WINED3DSIH_TABLE_SIZE;
|
||||
*param_size = shader_skip_unrecognized(*ptr, priv->shader_version);
|
||||
*param_size = shader_skip_unrecognized(priv, *ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -472,7 +481,7 @@ static void shader_sm1_read_opcode(void *data, const DWORD **ptr, struct wined3d
|
||||
ins->predicate = opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED;
|
||||
ins->dst_count = opcode_info->dst_count ? 1 : 0;
|
||||
ins->src_count = opcode_info->param_count - opcode_info->dst_count;
|
||||
*param_size = shader_skip_opcode(opcode_info, opcode_token, priv->shader_version);
|
||||
*param_size = shader_skip_opcode(priv, opcode_info, opcode_token);
|
||||
}
|
||||
|
||||
static void shader_sm1_read_src_param(void *data, const DWORD **ptr, struct wined3d_shader_src_param *src_param,
|
||||
@ -481,7 +490,7 @@ static void shader_sm1_read_src_param(void *data, const DWORD **ptr, struct wine
|
||||
struct wined3d_sm1_data *priv = data;
|
||||
DWORD token, addr_token;
|
||||
|
||||
*ptr += shader_get_param(*ptr, priv->shader_version, &token, &addr_token);
|
||||
*ptr += shader_get_param(priv, *ptr, &token, &addr_token);
|
||||
if (token & WINED3DSHADER_ADDRMODE_RELATIVE)
|
||||
{
|
||||
shader_parse_src_param(addr_token, NULL, src_rel_addr);
|
||||
@ -499,7 +508,7 @@ static void shader_sm1_read_dst_param(void *data, const DWORD **ptr, struct wine
|
||||
struct wined3d_sm1_data *priv = data;
|
||||
DWORD token, addr_token;
|
||||
|
||||
*ptr += shader_get_param(*ptr, priv->shader_version, &token, &addr_token);
|
||||
*ptr += shader_get_param(priv, *ptr, &token, &addr_token);
|
||||
if (token & WINED3DSHADER_ADDRMODE_RELATIVE)
|
||||
{
|
||||
shader_parse_src_param(addr_token, NULL, dst_rel_addr);
|
||||
|
@ -40,6 +40,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
||||
#define WINED3D_SM4_SWIZZLE_SHIFT 4
|
||||
#define WINED3D_SM4_SWIZZLE_MASK (0xff << WINED3D_SM4_SWIZZLE_SHIFT)
|
||||
|
||||
#define WINED3D_SM4_VERSION_MAJOR(version) (((version) >> 4) & 0xf)
|
||||
#define WINED3D_SM4_VERSION_MINOR(version) (((version) >> 0) & 0xf)
|
||||
|
||||
enum wined3d_sm4_opcode
|
||||
{
|
||||
WINED3D_SM4_OP_ADD = 0x00,
|
||||
@ -66,7 +69,7 @@ enum wined3d_sm4_immconst_type
|
||||
|
||||
struct wined3d_sm4_data
|
||||
{
|
||||
DWORD shader_version;
|
||||
struct wined3d_shader_version shader_version;
|
||||
const DWORD *end;
|
||||
};
|
||||
|
||||
@ -126,17 +129,40 @@ static void shader_sm4_free(void *data)
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
}
|
||||
|
||||
static void shader_sm4_read_header(void *data, const DWORD **ptr, DWORD *shader_version)
|
||||
static void shader_sm4_read_header(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version)
|
||||
{
|
||||
struct wined3d_sm4_data *priv = data;
|
||||
DWORD version_token;
|
||||
|
||||
priv->end = *ptr;
|
||||
|
||||
TRACE("version: 0x%08x\n", **ptr);
|
||||
*shader_version = *(*ptr)++;
|
||||
version_token = *(*ptr)++;
|
||||
TRACE("version: 0x%08x\n", version_token);
|
||||
|
||||
TRACE("token count: %u\n", **ptr);
|
||||
priv->end += *(*ptr)++;
|
||||
|
||||
priv->shader_version = *shader_version;
|
||||
switch (version_token >> 16)
|
||||
{
|
||||
case WINED3D_SM4_PS:
|
||||
priv->shader_version.type = WINED3D_SHADER_TYPE_PIXEL;
|
||||
break;
|
||||
|
||||
case WINED3D_SM4_VS:
|
||||
priv->shader_version.type = WINED3D_SHADER_TYPE_VERTEX;
|
||||
break;
|
||||
|
||||
case WINED3D_SM4_GS:
|
||||
priv->shader_version.type = WINED3D_SHADER_TYPE_GEOMETRY;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unrecognized shader type %#x\n", version_token >> 16);
|
||||
}
|
||||
priv->shader_version.major = WINED3D_SM4_VERSION_MAJOR(version_token);
|
||||
priv->shader_version.minor = WINED3D_SM4_VERSION_MINOR(version_token);
|
||||
|
||||
*shader_version = priv->shader_version;
|
||||
}
|
||||
|
||||
static void shader_sm4_read_opcode(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins,
|
||||
|
@ -36,14 +36,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
||||
|
||||
static void vshader_set_limits(IWineD3DVertexShaderImpl *This)
|
||||
{
|
||||
DWORD shader_version = WINED3D_SHADER_VERSION(This->baseShader.reg_maps.shader_version.major,
|
||||
This->baseShader.reg_maps.shader_version.minor);
|
||||
|
||||
This->baseShader.limits.texcoord = 0;
|
||||
This->baseShader.limits.attributes = 16;
|
||||
This->baseShader.limits.packed_input = 0;
|
||||
|
||||
switch (This->baseShader.reg_maps.shader_version)
|
||||
switch (shader_version)
|
||||
{
|
||||
case WINED3DVS_VERSION(1,0):
|
||||
case WINED3DVS_VERSION(1,1):
|
||||
case WINED3D_SHADER_VERSION(1,0):
|
||||
case WINED3D_SHADER_VERSION(1,1):
|
||||
This->baseShader.limits.temporary = 12;
|
||||
This->baseShader.limits.constant_bool = 0;
|
||||
This->baseShader.limits.constant_int = 0;
|
||||
@ -56,8 +59,8 @@ static void vshader_set_limits(IWineD3DVertexShaderImpl *This)
|
||||
This->baseShader.limits.constant_float = min(256, GL_LIMITS(vshader_constantsF));
|
||||
break;
|
||||
|
||||
case WINED3DVS_VERSION(2,0):
|
||||
case WINED3DVS_VERSION(2,1):
|
||||
case WINED3D_SHADER_VERSION(2,0):
|
||||
case WINED3D_SHADER_VERSION(2,1):
|
||||
This->baseShader.limits.temporary = 12;
|
||||
This->baseShader.limits.constant_bool = 16;
|
||||
This->baseShader.limits.constant_int = 16;
|
||||
@ -68,7 +71,7 @@ static void vshader_set_limits(IWineD3DVertexShaderImpl *This)
|
||||
This->baseShader.limits.constant_float = min(256, GL_LIMITS(vshader_constantsF));
|
||||
break;
|
||||
|
||||
case WINED3DVS_VERSION(3,0):
|
||||
case WINED3D_SHADER_VERSION(3,0):
|
||||
This->baseShader.limits.temporary = 32;
|
||||
This->baseShader.limits.constant_bool = 32;
|
||||
This->baseShader.limits.constant_int = 32;
|
||||
@ -92,8 +95,9 @@ static void vshader_set_limits(IWineD3DVertexShaderImpl *This)
|
||||
This->baseShader.limits.sampler = 0;
|
||||
This->baseShader.limits.label = 16;
|
||||
This->baseShader.limits.constant_float = min(256, GL_LIMITS(vshader_constantsF));
|
||||
FIXME("Unrecognized vertex shader version %#x\n",
|
||||
This->baseShader.reg_maps.shader_version);
|
||||
FIXME("Unrecognized vertex shader version %u.%u\n",
|
||||
This->baseShader.reg_maps.shader_version.major,
|
||||
This->baseShader.reg_maps.shader_version.minor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -486,8 +486,6 @@ typedef enum COMPARISON_TYPE
|
||||
/* Shader version tokens, and shader end tokens */
|
||||
#define WINED3DPS_VERSION(major, minor) ((WINED3D_SM1_PS << 16) | ((major) << 8) | (minor))
|
||||
#define WINED3DVS_VERSION(major, minor) ((WINED3D_SM1_VS << 16) | ((major) << 8) | (minor))
|
||||
#define WINED3DSHADER_VERSION_MAJOR(version) (((version) >> 8) & 0xff)
|
||||
#define WINED3DSHADER_VERSION_MINOR(version) (((version) >> 0) & 0xff)
|
||||
|
||||
/* Shader backends */
|
||||
|
||||
@ -601,9 +599,25 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
|
||||
WINED3DSIH_TABLE_SIZE
|
||||
};
|
||||
|
||||
enum wined3d_shader_type
|
||||
{
|
||||
WINED3D_SHADER_TYPE_PIXEL,
|
||||
WINED3D_SHADER_TYPE_VERTEX,
|
||||
WINED3D_SHADER_TYPE_GEOMETRY,
|
||||
};
|
||||
|
||||
struct wined3d_shader_version
|
||||
{
|
||||
enum wined3d_shader_type type;
|
||||
BYTE major;
|
||||
BYTE minor;
|
||||
};
|
||||
|
||||
#define WINED3D_SHADER_VERSION(major, minor) (((major) << 8) | (minor))
|
||||
|
||||
typedef struct shader_reg_maps
|
||||
{
|
||||
DWORD shader_version;
|
||||
struct wined3d_shader_version shader_version;
|
||||
char texcoord[MAX_REG_TEXCRD]; /* pixel < 3.0 */
|
||||
char temporary[MAX_REG_TEMP]; /* pixel, vertex */
|
||||
char address[MAX_REG_ADDR]; /* vertex */
|
||||
@ -681,7 +695,7 @@ struct wined3d_shader_frontend
|
||||
{
|
||||
void *(*shader_init)(const DWORD *ptr);
|
||||
void (*shader_free)(void *data);
|
||||
void (*shader_read_header)(void *data, const DWORD **ptr, DWORD *shader_version);
|
||||
void (*shader_read_header)(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version);
|
||||
void (*shader_read_opcode)(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins, UINT *param_size);
|
||||
void (*shader_read_src_param)(void *data, const DWORD **ptr, struct wined3d_shader_src_param *src_param,
|
||||
struct wined3d_shader_src_param *src_rel_addr);
|
||||
@ -2554,8 +2568,10 @@ typedef struct IWineD3DBaseShaderImpl {
|
||||
void shader_buffer_init(struct SHADER_BUFFER *buffer);
|
||||
void shader_buffer_free(struct SHADER_BUFFER *buffer);
|
||||
void shader_cleanup(IWineD3DBaseShader *iface);
|
||||
void shader_dump_src_param(const struct wined3d_shader_src_param *param, DWORD shader_version);
|
||||
void shader_dump_dst_param(const struct wined3d_shader_dst_param *param, DWORD shader_version);
|
||||
void shader_dump_src_param(const struct wined3d_shader_src_param *param,
|
||||
const struct wined3d_shader_version *shader_version);
|
||||
void shader_dump_dst_param(const struct wined3d_shader_dst_param *param,
|
||||
const struct wined3d_shader_version *shader_version);
|
||||
void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
|
||||
const shader_reg_maps *reg_maps, const DWORD *pFunction);
|
||||
HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3d_shader_frontend *fe,
|
||||
@ -2565,12 +2581,14 @@ void shader_init(struct IWineD3DBaseShaderClass *shader, IWineD3DDevice *device)
|
||||
const struct wined3d_shader_frontend *shader_select_frontend(DWORD version_token);
|
||||
void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data, const DWORD *pFunction);
|
||||
|
||||
static inline BOOL shader_is_pshader_version(DWORD token) {
|
||||
return 0xFFFF0000 == (token & 0xFFFF0000);
|
||||
static inline BOOL shader_is_pshader_version(enum wined3d_shader_type type)
|
||||
{
|
||||
return type == WINED3D_SHADER_TYPE_PIXEL;
|
||||
}
|
||||
|
||||
static inline BOOL shader_is_vshader_version(DWORD token) {
|
||||
return 0xFFFE0000 == (token & 0xFFFF0000);
|
||||
static inline BOOL shader_is_vshader_version(enum wined3d_shader_type type)
|
||||
{
|
||||
return type == WINED3D_SHADER_TYPE_VERTEX;
|
||||
}
|
||||
|
||||
static inline BOOL shader_is_scalar(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx)
|
||||
|
Loading…
Reference in New Issue
Block a user