wined3d: Use COLOROUT/DEPTHOUT for pixel shaders 2.0+.

As previously mentioned, RASTOUT is invalid on pixel shaders.
On shaders 1.x, r0 is treated as the color output register:
http://www.gamedev.net/columns/hardcore/dxshader3/page2.asp
That's what we currently do in all cases, change it not to do so
for shaders >= 2.0. Support COLOROUT/DEPTHOUT instead.
This commit is contained in:
Ivan Gyurdiev 2006-05-17 02:09:25 -04:00 committed by Alexandre Julliard
parent 174734e4a2
commit c65a86828c
1 changed files with 13 additions and 5 deletions

View File

@ -745,7 +745,6 @@ CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = {
};
inline static void get_register_name(const DWORD param, char* regstr, char constants[WINED3D_PSHADER_MAX_CONSTANTS]) {
static const char* rastout_reg_names[] = { "oC0", "oC1", "oC2", "oC3", "oDepth" };
DWORD reg = param & D3DSP_REGNUM_MASK;
DWORD regtype = shader_get_regtype(param);
@ -770,8 +769,17 @@ inline static void get_register_name(const DWORD param, char* regstr, char const
case D3DSPR_TEXTURE: /* case D3DSPR_ADDR: */
sprintf(regstr,"T%lu", reg);
break;
case D3DSPR_RASTOUT:
sprintf(regstr, "%s", rastout_reg_names[reg]);
case D3DSPR_COLOROUT:
if (reg == 0)
sprintf(regstr, "result.color");
else {
/* TODO: See GL_ARB_draw_buffers */
FIXME("Unsupported write to render target %lu\n", reg);
sprintf(regstr, "unsupported_register");
}
break;
case D3DSPR_DEPTHOUT:
sprintf(regstr, "result.depth");
break;
case D3DSPR_ATTROUT:
sprintf(regstr, "oD[%lu]", reg);
@ -1341,7 +1349,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateShader(
of the pixel shader string for us */
generate_base_shader( (IWineD3DBaseShader*) This, &buffer, pFunction);
/*FIXME: This next line isn't valid for certain pixel shader versions */
if (This->baseShader.hex_version < D3DPS_VERSION(2,0))
shader_addline(&buffer, "MOV result.color, R0;\n");
shader_addline(&buffer, "END\n\0");