2006-05-08 21:44:25 +02:00
|
|
|
|
/*
|
|
|
|
|
* shaders implementation
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2002-2003 Jason Edmeades
|
|
|
|
|
* Copyright 2002-2003 Raphael Junqueira
|
2006-07-17 20:35:14 +02:00
|
|
|
|
* Copyright 2004 Christian Costa
|
2006-05-08 21:44:25 +02:00
|
|
|
|
* Copyright 2005 Oliver Stieber
|
2006-05-17 08:04:30 +02:00
|
|
|
|
* Copyright 2006 Ivan Gyurdiev
|
2008-03-29 02:36:13 +01:00
|
|
|
|
* Copyright 2007-2008 Stefan D<EFBFBD>singer for CodeWeavers
|
2006-05-08 21:44:25 +02:00
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-05-08 21:44:25 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "wined3d_private.h"
|
|
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
|
|
|
|
|
2006-05-10 04:32:34 +02:00
|
|
|
|
#define GLNAME_REQUIRE_GLSL ((const char *)1)
|
2006-05-21 23:16:17 +02:00
|
|
|
|
|
2007-03-17 11:39:40 +01:00
|
|
|
|
static inline BOOL shader_is_version_token(DWORD token) {
|
2006-05-14 15:43:31 +02:00
|
|
|
|
return shader_is_pshader_version(token) ||
|
|
|
|
|
shader_is_vshader_version(token);
|
2006-05-10 00:03:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-05-08 21:44:25 +02:00
|
|
|
|
int shader_addline(
|
|
|
|
|
SHADER_BUFFER* buffer,
|
|
|
|
|
const char *format, ...) {
|
|
|
|
|
|
|
|
|
|
char* base = buffer->buffer + buffer->bsize;
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
va_list args;
|
|
|
|
|
va_start(args, format);
|
|
|
|
|
rc = vsnprintf(base, SHADER_PGMSIZE - 1 - buffer->bsize, format, args);
|
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
|
|
if (rc < 0 || /* C89 */
|
|
|
|
|
rc > SHADER_PGMSIZE - 1 - buffer->bsize) { /* C99 */
|
|
|
|
|
|
|
|
|
|
ERR("The buffer allocated for the shader program string "
|
|
|
|
|
"is too small at %d bytes.\n", SHADER_PGMSIZE);
|
|
|
|
|
buffer->bsize = SHADER_PGMSIZE - 1;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-15 19:30:41 +01:00
|
|
|
|
if (buffer->newline) {
|
|
|
|
|
TRACE("GL HW (%u, %u) : %s", buffer->lineNo + 1, buffer->bsize, base);
|
|
|
|
|
buffer->newline = FALSE;
|
|
|
|
|
} else {
|
2007-01-18 23:41:27 +01:00
|
|
|
|
TRACE("%s", base);
|
2007-01-15 19:30:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-05-08 21:44:25 +02:00
|
|
|
|
buffer->bsize += rc;
|
2007-01-15 19:30:41 +01:00
|
|
|
|
if (buffer->buffer[buffer->bsize-1] == '\n') {
|
|
|
|
|
buffer->lineNo++;
|
|
|
|
|
buffer->newline = TRUE;
|
|
|
|
|
}
|
2006-05-08 21:44:25 +02:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-09 13:57:36 +02:00
|
|
|
|
const SHADER_OPCODE* shader_get_opcode(
|
|
|
|
|
IWineD3DBaseShader *iface, const DWORD code) {
|
|
|
|
|
|
|
|
|
|
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl*) iface;
|
|
|
|
|
|
|
|
|
|
DWORD i = 0;
|
|
|
|
|
DWORD hex_version = This->baseShader.hex_version;
|
|
|
|
|
const SHADER_OPCODE *shader_ins = This->baseShader.shader_ins;
|
|
|
|
|
|
|
|
|
|
/** TODO: use dichotomic search */
|
|
|
|
|
while (NULL != shader_ins[i].name) {
|
2006-10-13 05:34:13 +02:00
|
|
|
|
if (((code & WINED3DSI_OPCODE_MASK) == shader_ins[i].opcode) &&
|
2006-05-09 13:57:36 +02:00
|
|
|
|
(((hex_version >= shader_ins[i].min_version) && (hex_version <= shader_ins[i].max_version)) ||
|
|
|
|
|
((shader_ins[i].min_version == 0) && (shader_ins[i].max_version == 0)))) {
|
|
|
|
|
return &shader_ins[i];
|
|
|
|
|
}
|
|
|
|
|
++i;
|
|
|
|
|
}
|
2006-10-01 05:20:10 +02:00
|
|
|
|
FIXME("Unsupported opcode %#x(%d) masked %#x, shader version %#x\n",
|
2006-10-13 05:34:13 +02:00
|
|
|
|
code, code, code & WINED3DSI_OPCODE_MASK, hex_version);
|
2006-05-09 13:57:36 +02:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-17 08:02:36 +02:00
|
|
|
|
/* Read a parameter opcode from the input stream,
|
|
|
|
|
* and possibly a relative addressing token.
|
|
|
|
|
* Return the number of tokens read */
|
|
|
|
|
int shader_get_param(
|
|
|
|
|
IWineD3DBaseShader* iface,
|
|
|
|
|
const DWORD* pToken,
|
|
|
|
|
DWORD* param,
|
|
|
|
|
DWORD* addr_token) {
|
|
|
|
|
|
|
|
|
|
/* PS >= 3.0 have relative addressing (with token)
|
|
|
|
|
* VS >= 2.0 have relative addressing (with token)
|
|
|
|
|
* VS >= 1.0 < 2.0 have relative addressing (without token)
|
|
|
|
|
* The version check below should work in general */
|
|
|
|
|
|
|
|
|
|
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
2006-10-13 05:36:41 +02:00
|
|
|
|
char rel_token = WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2 &&
|
2006-10-13 05:35:03 +02:00
|
|
|
|
((*pToken & WINED3DSHADER_ADDRESSMODE_MASK) == WINED3DSHADER_ADDRMODE_RELATIVE);
|
2006-05-17 08:02:36 +02:00
|
|
|
|
|
|
|
|
|
*param = *pToken;
|
|
|
|
|
*addr_token = rel_token? *(pToken + 1): 0;
|
|
|
|
|
return rel_token? 2:1;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-17 08:00:47 +02:00
|
|
|
|
/* Return the number of parameters to skip for an opcode */
|
|
|
|
|
static inline int shader_skip_opcode(
|
|
|
|
|
IWineD3DBaseShaderImpl* This,
|
|
|
|
|
const SHADER_OPCODE* curOpcode,
|
|
|
|
|
DWORD opcode_token) {
|
|
|
|
|
|
|
|
|
|
/* Shaders >= 2.0 may contain address tokens, but fortunately they
|
2008-01-09 20:37:05 +01:00
|
|
|
|
* have a useful length mask - use it here. Shaders 1.0 contain no such tokens */
|
2006-05-17 08:00:47 +02:00
|
|
|
|
|
2006-10-13 05:36:41 +02:00
|
|
|
|
return (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2)?
|
2006-10-13 05:34:13 +02:00
|
|
|
|
((opcode_token & WINED3DSI_INSTLENGTH_MASK) >> WINED3DSI_INSTLENGTH_SHIFT):
|
2006-05-17 08:00:47 +02:00
|
|
|
|
curOpcode->num_params;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-17 08:02:36 +02:00
|
|
|
|
/* Read the parameters of an unrecognized opcode from the input stream
|
|
|
|
|
* Return the number of tokens read.
|
|
|
|
|
*
|
|
|
|
|
* 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 */
|
|
|
|
|
|
|
|
|
|
int shader_skip_unrecognized(
|
|
|
|
|
IWineD3DBaseShader* iface,
|
|
|
|
|
const DWORD* pToken) {
|
|
|
|
|
|
|
|
|
|
int tokens_read = 0;
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
/* TODO: Think of a good name for 0x80000000 and replace it with a constant */
|
|
|
|
|
while (*pToken & 0x80000000) {
|
|
|
|
|
|
|
|
|
|
DWORD param, addr_token;
|
|
|
|
|
tokens_read += shader_get_param(iface, pToken, ¶m, &addr_token);
|
|
|
|
|
pToken += tokens_read;
|
|
|
|
|
|
2008-07-15 23:54:37 +02:00
|
|
|
|
FIXME("Unrecognized opcode param: token=0x%08x "
|
|
|
|
|
"addr_token=0x%08x name=", param, addr_token);
|
2006-05-17 08:05:49 +02:00
|
|
|
|
shader_dump_param(iface, param, addr_token, i);
|
2006-05-17 08:02:36 +02:00
|
|
|
|
FIXME("\n");
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
return tokens_read;
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-06 08:40:08 +02:00
|
|
|
|
/* Convert floating point offset relative
|
|
|
|
|
* to a register file to an absolute offset for float constants */
|
|
|
|
|
|
|
|
|
|
unsigned int shader_get_float_offset(const DWORD reg) {
|
|
|
|
|
|
2006-10-10 01:47:12 +02:00
|
|
|
|
unsigned int regnum = reg & WINED3DSP_REGNUM_MASK;
|
2006-06-06 08:40:08 +02:00
|
|
|
|
int regtype = shader_get_regtype(reg);
|
|
|
|
|
|
|
|
|
|
switch (regtype) {
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_CONST: return regnum;
|
|
|
|
|
case WINED3DSPR_CONST2: return 2048 + regnum;
|
|
|
|
|
case WINED3DSPR_CONST3: return 4096 + regnum;
|
|
|
|
|
case WINED3DSPR_CONST4: return 6144 + regnum;
|
2006-06-06 08:40:08 +02:00
|
|
|
|
default:
|
|
|
|
|
FIXME("Unsupported register type: %d\n", regtype);
|
|
|
|
|
return regnum;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-08 22:31:24 +01:00
|
|
|
|
static void shader_delete_constant_list(struct list* clist) {
|
|
|
|
|
|
|
|
|
|
struct list *ptr;
|
|
|
|
|
struct local_constant* constant;
|
|
|
|
|
|
|
|
|
|
ptr = list_head(clist);
|
|
|
|
|
while (ptr) {
|
|
|
|
|
constant = LIST_ENTRY(ptr, struct local_constant, entry);
|
|
|
|
|
ptr = list_next(clist, ptr);
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, constant);
|
|
|
|
|
}
|
|
|
|
|
list_init(clist);
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-21 23:16:17 +02:00
|
|
|
|
/* Note that this does not count the loop register
|
|
|
|
|
* as an address register. */
|
2006-05-10 00:03:09 +02:00
|
|
|
|
|
2006-07-10 06:51:03 +02:00
|
|
|
|
HRESULT shader_get_registers_used(
|
2006-05-10 00:03:09 +02:00
|
|
|
|
IWineD3DBaseShader *iface,
|
2006-05-21 23:16:17 +02:00
|
|
|
|
shader_reg_maps* reg_maps,
|
2006-07-07 08:27:38 +02:00
|
|
|
|
semantic* semantics_in,
|
|
|
|
|
semantic* semantics_out,
|
2006-08-27 19:16:01 +02:00
|
|
|
|
CONST DWORD* pToken,
|
|
|
|
|
IWineD3DStateBlockImpl *stateBlock) {
|
2006-05-10 04:31:09 +02:00
|
|
|
|
|
|
|
|
|
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
2007-09-14 13:21:52 +02:00
|
|
|
|
unsigned int cur_loop_depth = 0, max_loop_depth = 0;
|
2006-05-10 00:03:09 +02:00
|
|
|
|
|
2006-06-12 08:55:30 +02:00
|
|
|
|
/* There are some minor differences between pixel and vertex shaders */
|
|
|
|
|
char pshader = shader_is_pshader_version(This->baseShader.hex_version);
|
|
|
|
|
|
2008-03-05 03:18:55 +01:00
|
|
|
|
memset(reg_maps->bumpmat, 0, sizeof(reg_maps->bumpmat));
|
|
|
|
|
memset(reg_maps->luminanceparams, 0, sizeof(reg_maps->luminanceparams));
|
2007-03-26 23:34:32 +02:00
|
|
|
|
|
2006-05-10 00:03:09 +02:00
|
|
|
|
if (pToken == NULL)
|
2006-07-10 06:51:03 +02:00
|
|
|
|
return WINED3D_OK;
|
2006-05-10 00:03:09 +02:00
|
|
|
|
|
2008-01-08 22:31:24 +01:00
|
|
|
|
/* get_registers_used is called on every compile on some 1.x shaders, which can result
|
|
|
|
|
* in stacking up a collection of local constants. Delete the old constants if existing
|
|
|
|
|
*/
|
|
|
|
|
shader_delete_constant_list(&This->baseShader.constantsF);
|
|
|
|
|
shader_delete_constant_list(&This->baseShader.constantsB);
|
|
|
|
|
shader_delete_constant_list(&This->baseShader.constantsI);
|
|
|
|
|
|
2006-10-13 05:36:41 +02:00
|
|
|
|
while (WINED3DVS_END() != *pToken) {
|
2006-05-10 00:03:09 +02:00
|
|
|
|
CONST SHADER_OPCODE* curOpcode;
|
2006-05-18 03:09:56 +02:00
|
|
|
|
DWORD opcode_token;
|
2006-05-10 00:03:09 +02:00
|
|
|
|
|
|
|
|
|
/* Skip version */
|
|
|
|
|
if (shader_is_version_token(*pToken)) {
|
|
|
|
|
++pToken;
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Skip comments */
|
2006-05-14 15:43:31 +02:00
|
|
|
|
} else if (shader_is_comment(*pToken)) {
|
2006-10-13 05:34:13 +02:00
|
|
|
|
DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
|
2006-05-10 00:03:09 +02:00
|
|
|
|
++pToken;
|
|
|
|
|
pToken += comment_len;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fetch opcode */
|
2006-05-18 03:09:56 +02:00
|
|
|
|
opcode_token = *pToken++;
|
|
|
|
|
curOpcode = shader_get_opcode(iface, opcode_token);
|
2006-05-10 00:03:09 +02:00
|
|
|
|
|
|
|
|
|
/* Unhandled opcode, and its parameters */
|
|
|
|
|
if (NULL == curOpcode) {
|
|
|
|
|
while (*pToken & 0x80000000)
|
|
|
|
|
++pToken;
|
|
|
|
|
|
2006-06-12 08:53:32 +02:00
|
|
|
|
/* Handle declarations */
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (WINED3DSIO_DCL == curOpcode->opcode) {
|
2006-06-12 08:53:32 +02:00
|
|
|
|
|
|
|
|
|
DWORD usage = *pToken++;
|
|
|
|
|
DWORD param = *pToken++;
|
|
|
|
|
DWORD regtype = shader_get_regtype(param);
|
2006-10-10 01:47:12 +02:00
|
|
|
|
unsigned int regnum = param & WINED3DSP_REGNUM_MASK;
|
2006-06-12 08:53:32 +02:00
|
|
|
|
|
2006-06-12 08:59:16 +02:00
|
|
|
|
/* Vshader: mark attributes used
|
|
|
|
|
Pshader: mark 3.0 input registers used, save token */
|
2006-10-10 01:45:55 +02:00
|
|
|
|
if (WINED3DSPR_INPUT == regtype) {
|
2006-06-12 08:55:30 +02:00
|
|
|
|
|
|
|
|
|
if (!pshader)
|
|
|
|
|
reg_maps->attributes[regnum] = 1;
|
2006-06-12 08:57:07 +02:00
|
|
|
|
else
|
|
|
|
|
reg_maps->packed_input[regnum] = 1;
|
2006-06-12 08:55:30 +02:00
|
|
|
|
|
2006-07-07 08:27:38 +02:00
|
|
|
|
semantics_in[regnum].usage = usage;
|
|
|
|
|
semantics_in[regnum].reg = param;
|
2006-06-12 08:53:32 +02:00
|
|
|
|
|
2006-06-12 08:59:16 +02:00
|
|
|
|
/* Vshader: mark 3.0 output registers used, save token */
|
2006-10-10 01:45:55 +02:00
|
|
|
|
} else if (WINED3DSPR_OUTPUT == regtype) {
|
2006-06-12 08:57:07 +02:00
|
|
|
|
reg_maps->packed_output[regnum] = 1;
|
2006-07-07 08:27:38 +02:00
|
|
|
|
semantics_out[regnum].usage = usage;
|
|
|
|
|
semantics_out[regnum].reg = param;
|
2007-04-12 19:08:51 +02:00
|
|
|
|
if (usage & (WINED3DDECLUSAGE_FOG << WINED3DSP_DCL_USAGE_SHIFT))
|
|
|
|
|
reg_maps->fog = 1;
|
2006-06-12 08:53:32 +02:00
|
|
|
|
|
2006-06-12 08:59:16 +02:00
|
|
|
|
/* Save sampler usage token */
|
2006-10-10 01:45:55 +02:00
|
|
|
|
} else if (WINED3DSPR_SAMPLER == regtype)
|
2006-06-12 08:59:16 +02:00
|
|
|
|
reg_maps->samplers[regnum] = usage;
|
2006-05-10 00:03:09 +02:00
|
|
|
|
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (WINED3DSIO_DEF == curOpcode->opcode) {
|
2006-07-10 06:51:03 +02:00
|
|
|
|
|
|
|
|
|
local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
|
|
|
|
if (!lconst) return E_OUTOFMEMORY;
|
2006-10-10 01:47:12 +02:00
|
|
|
|
lconst->idx = *pToken & WINED3DSP_REGNUM_MASK;
|
2008-07-11 22:58:34 +02:00
|
|
|
|
memcpy(lconst->value, pToken + 1, 4 * sizeof(DWORD));
|
2007-09-13 13:34:29 +02:00
|
|
|
|
|
|
|
|
|
/* In pixel shader 1.X shaders, the constants are clamped between [-1;1] */
|
|
|
|
|
if(WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 && pshader) {
|
|
|
|
|
float *value = (float *) lconst->value;
|
|
|
|
|
if(value[0] < -1.0) value[0] = -1.0;
|
|
|
|
|
else if(value[0] > 1.0) value[0] = 1.0;
|
|
|
|
|
if(value[1] < -1.0) value[1] = -1.0;
|
|
|
|
|
else if(value[1] > 1.0) value[1] = 1.0;
|
|
|
|
|
if(value[2] < -1.0) value[2] = -1.0;
|
|
|
|
|
else if(value[2] > 1.0) value[2] = 1.0;
|
|
|
|
|
if(value[3] < -1.0) value[3] = -1.0;
|
|
|
|
|
else if(value[3] > 1.0) value[3] = 1.0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-07-10 06:51:03 +02:00
|
|
|
|
list_add_head(&This->baseShader.constantsF, &lconst->entry);
|
|
|
|
|
pToken += curOpcode->num_params;
|
|
|
|
|
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (WINED3DSIO_DEFI == curOpcode->opcode) {
|
2006-07-10 06:51:03 +02:00
|
|
|
|
|
|
|
|
|
local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
|
|
|
|
if (!lconst) return E_OUTOFMEMORY;
|
2006-10-10 01:47:12 +02:00
|
|
|
|
lconst->idx = *pToken & WINED3DSP_REGNUM_MASK;
|
2008-07-11 22:58:34 +02:00
|
|
|
|
memcpy(lconst->value, pToken + 1, 4 * sizeof(DWORD));
|
2006-07-10 06:51:03 +02:00
|
|
|
|
list_add_head(&This->baseShader.constantsI, &lconst->entry);
|
|
|
|
|
pToken += curOpcode->num_params;
|
|
|
|
|
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (WINED3DSIO_DEFB == curOpcode->opcode) {
|
2006-07-10 06:51:03 +02:00
|
|
|
|
|
|
|
|
|
local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
|
|
|
|
if (!lconst) return E_OUTOFMEMORY;
|
2006-10-10 01:47:12 +02:00
|
|
|
|
lconst->idx = *pToken & WINED3DSP_REGNUM_MASK;
|
2008-07-11 22:58:34 +02:00
|
|
|
|
memcpy(lconst->value, pToken + 1, 1 * sizeof(DWORD));
|
2006-07-10 06:51:03 +02:00
|
|
|
|
list_add_head(&This->baseShader.constantsB, &lconst->entry);
|
2006-05-10 00:03:09 +02:00
|
|
|
|
pToken += curOpcode->num_params;
|
|
|
|
|
|
2006-06-16 22:13:01 +02:00
|
|
|
|
/* If there's a loop in the shader */
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (WINED3DSIO_LOOP == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_REP == curOpcode->opcode) {
|
2007-09-14 13:21:52 +02:00
|
|
|
|
cur_loop_depth++;
|
|
|
|
|
if(cur_loop_depth > max_loop_depth)
|
|
|
|
|
max_loop_depth = cur_loop_depth;
|
2006-06-16 22:13:01 +02:00
|
|
|
|
pToken += curOpcode->num_params;
|
2007-09-14 13:21:52 +02:00
|
|
|
|
|
|
|
|
|
} else if (WINED3DSIO_ENDLOOP == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_ENDREP == curOpcode->opcode) {
|
|
|
|
|
cur_loop_depth--;
|
|
|
|
|
|
2006-07-10 12:35:15 +02:00
|
|
|
|
/* For subroutine prototypes */
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (WINED3DSIO_LABEL == curOpcode->opcode) {
|
2006-07-10 12:35:15 +02:00
|
|
|
|
|
2006-10-10 01:47:12 +02:00
|
|
|
|
DWORD snum = *pToken & WINED3DSP_REGNUM_MASK;
|
2006-07-10 12:35:15 +02:00
|
|
|
|
reg_maps->labels[snum] = 1;
|
|
|
|
|
pToken += curOpcode->num_params;
|
2007-03-26 23:34:32 +02:00
|
|
|
|
|
2006-06-12 08:59:16 +02:00
|
|
|
|
/* Set texture, address, temporary registers */
|
2006-05-10 00:03:09 +02:00
|
|
|
|
} else {
|
2006-05-18 03:09:56 +02:00
|
|
|
|
int i, limit;
|
2006-05-10 00:03:09 +02:00
|
|
|
|
|
2006-06-12 08:59:16 +02:00
|
|
|
|
/* Declare 1.X samplers implicitly, based on the destination reg. number */
|
2008-03-05 03:18:55 +01:00
|
|
|
|
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
|
|
|
|
|
pshader /* Filter different instructions with the same enum values in VS */ &&
|
2006-10-10 01:45:12 +02:00
|
|
|
|
(WINED3DSIO_TEX == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_TEXBEM == curOpcode->opcode ||
|
2006-12-28 03:14:28 +01:00
|
|
|
|
WINED3DSIO_TEXBEML == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_TEXDP3TEX == curOpcode->opcode ||
|
2006-10-10 01:45:12 +02:00
|
|
|
|
WINED3DSIO_TEXM3x2TEX == curOpcode->opcode ||
|
2006-12-28 03:14:28 +01:00
|
|
|
|
WINED3DSIO_TEXM3x3SPEC == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_TEXM3x3TEX == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_TEXM3x3VSPEC == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_TEXREG2AR == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_TEXREG2GB == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_TEXREG2RGB == curOpcode->opcode)) {
|
2006-06-12 08:59:16 +02:00
|
|
|
|
|
|
|
|
|
/* Fake sampler usage, only set reserved bit and ttype */
|
2006-10-10 01:47:12 +02:00
|
|
|
|
DWORD sampler_code = *pToken & WINED3DSP_REGNUM_MASK;
|
2006-08-27 19:16:01 +02:00
|
|
|
|
|
|
|
|
|
if(!stateBlock->textures[sampler_code]) {
|
2006-10-01 05:20:10 +02:00
|
|
|
|
ERR("No texture bound to sampler %d\n", sampler_code);
|
2006-08-27 19:16:01 +02:00
|
|
|
|
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_2D;
|
|
|
|
|
} else {
|
|
|
|
|
int texType = IWineD3DBaseTexture_GetTextureDimensions(stateBlock->textures[sampler_code]);
|
|
|
|
|
switch(texType) {
|
2007-11-27 22:25:07 +01:00
|
|
|
|
/* We have to select between texture rectangles and 2D textures later because 2.0 and
|
|
|
|
|
* 3.0 shaders only have WINED3DSTT_2D as well
|
|
|
|
|
*/
|
|
|
|
|
case GL_TEXTURE_RECTANGLE_ARB:
|
2006-08-27 19:16:01 +02:00
|
|
|
|
case GL_TEXTURE_2D:
|
|
|
|
|
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_2D;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GL_TEXTURE_3D:
|
|
|
|
|
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_VOLUME;
|
|
|
|
|
break;
|
|
|
|
|
|
2006-11-18 17:07:32 +01:00
|
|
|
|
case GL_TEXTURE_CUBE_MAP_ARB:
|
2006-08-27 19:16:01 +02:00
|
|
|
|
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_CUBE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ERR("Unexpected gl texture type found: %d\n", texType);
|
|
|
|
|
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_2D;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-02-15 03:05:17 +01:00
|
|
|
|
|
|
|
|
|
/* texbem is only valid with < 1.4 pixel shaders */
|
2007-09-01 20:11:17 +02:00
|
|
|
|
if(WINED3DSIO_TEXBEM == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_TEXBEML == curOpcode->opcode) {
|
2008-03-05 03:18:55 +01:00
|
|
|
|
reg_maps->bumpmat[sampler_code] = TRUE;
|
|
|
|
|
if(WINED3DSIO_TEXBEML == curOpcode->opcode) {
|
|
|
|
|
reg_maps->luminanceparams[sampler_code] = TRUE;
|
2007-02-15 03:05:17 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2006-06-12 08:59:16 +02:00
|
|
|
|
}
|
2007-09-05 20:09:06 +02:00
|
|
|
|
if(WINED3DSIO_NRM == curOpcode->opcode) {
|
|
|
|
|
reg_maps->usesnrm = 1;
|
2008-03-05 03:18:55 +01:00
|
|
|
|
} else if(WINED3DSIO_BEM == curOpcode->opcode && pshader) {
|
2007-09-05 20:12:06 +02:00
|
|
|
|
DWORD regnum = *pToken & WINED3DSP_REGNUM_MASK;
|
2008-03-05 03:18:55 +01:00
|
|
|
|
reg_maps->bumpmat[regnum] = TRUE;
|
2007-10-13 13:03:56 +02:00
|
|
|
|
} else if(WINED3DSIO_DSY == curOpcode->opcode) {
|
|
|
|
|
reg_maps->usesdsy = 1;
|
2007-09-05 20:09:06 +02:00
|
|
|
|
}
|
2006-06-12 08:59:16 +02:00
|
|
|
|
|
2006-05-18 03:09:56 +02:00
|
|
|
|
/* This will loop over all the registers and try to
|
|
|
|
|
* make a bitmask of the ones we're interested in.
|
|
|
|
|
*
|
|
|
|
|
* Relative addressing tokens are ignored, but that's
|
|
|
|
|
* okay, since we'll catch any address registers when
|
|
|
|
|
* they are initialized (required by spec) */
|
|
|
|
|
|
2006-10-13 05:34:13 +02:00
|
|
|
|
limit = (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED)?
|
2006-05-18 03:09:56 +02:00
|
|
|
|
curOpcode->num_params + 1: curOpcode->num_params;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < limit; ++i) {
|
2006-05-17 08:04:30 +02:00
|
|
|
|
|
|
|
|
|
DWORD param, addr_token, reg, regtype;
|
|
|
|
|
pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
|
|
|
|
|
|
2006-07-03 03:28:25 +02:00
|
|
|
|
regtype = shader_get_regtype(param);
|
2006-10-10 01:47:12 +02:00
|
|
|
|
reg = param & WINED3DSP_REGNUM_MASK;
|
2006-05-17 08:04:30 +02:00
|
|
|
|
|
2006-10-10 01:45:55 +02:00
|
|
|
|
if (WINED3DSPR_TEXTURE == regtype) { /* vs: WINED3DSPR_ADDR */
|
2006-05-21 23:16:17 +02:00
|
|
|
|
|
2006-06-12 08:55:30 +02:00
|
|
|
|
if (pshader)
|
|
|
|
|
reg_maps->texcoord[reg] = 1;
|
2006-05-21 23:16:17 +02:00
|
|
|
|
else
|
2006-06-12 08:55:30 +02:00
|
|
|
|
reg_maps->address[reg] = 1;
|
2006-05-21 23:16:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-10 01:45:55 +02:00
|
|
|
|
else if (WINED3DSPR_TEMP == regtype)
|
2006-06-12 08:55:30 +02:00
|
|
|
|
reg_maps->temporary[reg] = 1;
|
|
|
|
|
|
2007-11-06 12:34:22 +01:00
|
|
|
|
else if (WINED3DSPR_INPUT == regtype) {
|
|
|
|
|
if( !pshader)
|
|
|
|
|
reg_maps->attributes[reg] = 1;
|
|
|
|
|
else {
|
|
|
|
|
if(param & WINED3DSHADER_ADDRMODE_RELATIVE) {
|
|
|
|
|
/* If relative addressing is used, we must assume that all registers
|
|
|
|
|
* are used. Even if it is a construct like v3[aL], we can't assume
|
|
|
|
|
* that v0, v1 and v2 aren't read because aL can be negative
|
|
|
|
|
*/
|
|
|
|
|
unsigned int i;
|
|
|
|
|
for(i = 0; i < MAX_REG_INPUT; i++) {
|
|
|
|
|
((IWineD3DPixelShaderImpl *) This)->input_reg_used[i] = TRUE;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
((IWineD3DPixelShaderImpl *) This)->input_reg_used[reg] = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-07-17 07:41:53 +02:00
|
|
|
|
|
2006-10-10 01:45:55 +02:00
|
|
|
|
else if (WINED3DSPR_RASTOUT == regtype && reg == 1)
|
2006-07-17 07:41:53 +02:00
|
|
|
|
reg_maps->fog = 1;
|
2007-09-14 13:11:00 +02:00
|
|
|
|
|
|
|
|
|
else if (WINED3DSPR_MISCTYPE == regtype && reg == 0 && pshader)
|
|
|
|
|
reg_maps->vpos = 1;
|
2007-11-07 19:57:49 +01:00
|
|
|
|
|
2007-11-09 14:48:47 +01:00
|
|
|
|
else if(WINED3DSPR_CONST == regtype) {
|
|
|
|
|
if(param & WINED3DSHADER_ADDRMODE_RELATIVE) {
|
|
|
|
|
if(!pshader) {
|
|
|
|
|
if(reg <= ((IWineD3DVertexShaderImpl *) This)->min_rel_offset) {
|
|
|
|
|
((IWineD3DVertexShaderImpl *) This)->min_rel_offset = reg;
|
|
|
|
|
} else if(reg >= ((IWineD3DVertexShaderImpl *) This)->max_rel_offset) {
|
|
|
|
|
((IWineD3DVertexShaderImpl *) This)->max_rel_offset = reg;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
reg_maps->usesrelconstF = TRUE;
|
2007-11-07 19:57:49 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-12-06 22:10:11 +01:00
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
*/
|
|
|
|
|
else if(WINED3DSPR_TEXCRDOUT == regtype && i == 0 /* Only look at writes */ &&
|
|
|
|
|
!pshader && WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) < 3) {
|
|
|
|
|
reg_maps->texcoord_mask[reg] |= shader_get_writemask(param);
|
|
|
|
|
}
|
2007-09-05 20:09:06 +02:00
|
|
|
|
}
|
2006-05-10 00:03:09 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-14 13:21:52 +02:00
|
|
|
|
reg_maps->loop_depth = max_loop_depth;
|
2006-07-10 06:51:03 +02:00
|
|
|
|
|
|
|
|
|
return WINED3D_OK;
|
2006-05-10 00:03:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-12 08:54:30 +02:00
|
|
|
|
static void shader_dump_decl_usage(
|
2006-07-03 08:03:47 +02:00
|
|
|
|
IWineD3DBaseShaderImpl* This,
|
2006-05-10 04:26:05 +02:00
|
|
|
|
DWORD decl,
|
|
|
|
|
DWORD param) {
|
|
|
|
|
|
|
|
|
|
DWORD regtype = shader_get_regtype(param);
|
2006-07-03 08:03:47 +02:00
|
|
|
|
|
|
|
|
|
TRACE("dcl");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
|
2006-10-10 01:45:55 +02:00
|
|
|
|
if (regtype == WINED3DSPR_SAMPLER) {
|
2006-07-28 21:34:39 +02:00
|
|
|
|
DWORD ttype = decl & WINED3DSP_TEXTURETYPE_MASK;
|
2006-05-10 04:26:05 +02:00
|
|
|
|
|
|
|
|
|
switch (ttype) {
|
2006-07-28 21:34:39 +02:00
|
|
|
|
case WINED3DSTT_2D: TRACE("_2d"); break;
|
|
|
|
|
case WINED3DSTT_CUBE: TRACE("_cube"); break;
|
|
|
|
|
case WINED3DSTT_VOLUME: TRACE("_volume"); break;
|
2008-07-15 23:54:37 +02:00
|
|
|
|
default: TRACE("_unknown_ttype(0x%08x)", ttype);
|
2006-05-10 04:26:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
2006-10-10 01:46:35 +02:00
|
|
|
|
DWORD usage = decl & WINED3DSP_DCL_USAGE_MASK;
|
|
|
|
|
DWORD idx = (decl & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
2006-05-10 04:26:05 +02:00
|
|
|
|
|
2006-07-03 08:03:47 +02:00
|
|
|
|
/* Pixel shaders 3.0 don't have usage semantics */
|
|
|
|
|
char pshader = shader_is_pshader_version(This->baseShader.hex_version);
|
2006-10-13 05:36:41 +02:00
|
|
|
|
if (pshader && This->baseShader.hex_version < WINED3DPS_VERSION(3,0))
|
2006-07-03 08:03:47 +02:00
|
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
TRACE("_");
|
|
|
|
|
|
2006-05-10 04:26:05 +02:00
|
|
|
|
switch(usage) {
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_POSITION:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("position%d", idx);
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_BLENDINDICES:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("blend");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_BLENDWEIGHT:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("weight");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_NORMAL:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("normal%d", idx);
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_PSIZE:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("psize");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_COLOR:
|
2006-05-10 04:26:05 +02:00
|
|
|
|
if(idx == 0) {
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("color");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
} else {
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("specular%d", (idx - 1));
|
2006-05-10 04:26:05 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_TEXCOORD:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("texture%d", idx);
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_TANGENT:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("tangent");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_BINORMAL:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("binormal");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_TESSFACTOR:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("tessfactor");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_POSITIONT:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("positionT%d", idx);
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_FOG:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("fog");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_DEPTH:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("depth");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
2007-02-13 23:12:14 +01:00
|
|
|
|
case WINED3DDECLUSAGE_SAMPLE:
|
2006-10-10 19:23:01 +02:00
|
|
|
|
TRACE("sample");
|
2006-05-10 04:26:05 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2008-07-15 23:54:37 +02:00
|
|
|
|
FIXME("unknown_semantics(0x%08x)", usage);
|
2006-05-10 04:26:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-17 08:05:49 +02:00
|
|
|
|
static void shader_dump_arr_entry(
|
|
|
|
|
IWineD3DBaseShader *iface,
|
|
|
|
|
const DWORD param,
|
|
|
|
|
const DWORD addr_token,
|
2006-06-06 08:40:08 +02:00
|
|
|
|
unsigned int reg,
|
2006-05-17 08:05:49 +02:00
|
|
|
|
int input) {
|
|
|
|
|
|
|
|
|
|
char relative =
|
2006-10-13 05:35:03 +02:00
|
|
|
|
((param & WINED3DSHADER_ADDRESSMODE_MASK) == WINED3DSHADER_ADDRMODE_RELATIVE);
|
2006-05-17 08:05:49 +02:00
|
|
|
|
|
|
|
|
|
if (relative) {
|
2006-06-06 08:40:08 +02:00
|
|
|
|
TRACE("[");
|
2006-05-17 08:05:49 +02:00
|
|
|
|
if (addr_token)
|
|
|
|
|
shader_dump_param(iface, addr_token, 0, input);
|
|
|
|
|
else
|
|
|
|
|
TRACE("a0.x");
|
|
|
|
|
TRACE(" + ");
|
|
|
|
|
}
|
2006-06-06 08:40:08 +02:00
|
|
|
|
TRACE("%u", reg);
|
|
|
|
|
if (relative)
|
|
|
|
|
TRACE("]");
|
2006-05-17 08:05:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-05-14 15:43:31 +02:00
|
|
|
|
void shader_dump_param(
|
|
|
|
|
IWineD3DBaseShader *iface,
|
|
|
|
|
const DWORD param,
|
2006-05-17 08:05:49 +02:00
|
|
|
|
const DWORD addr_token,
|
2006-05-14 15:43:31 +02:00
|
|
|
|
int input) {
|
|
|
|
|
|
|
|
|
|
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
2006-12-14 15:47:59 +01:00
|
|
|
|
static const char * const rastout_reg_names[] = { "oPos", "oFog", "oPts" };
|
2007-05-03 21:01:09 +02:00
|
|
|
|
static const char * const misctype_reg_names[] = { "vPos", "vFace"};
|
2006-05-14 15:43:31 +02:00
|
|
|
|
char swizzle_reg_chars[4];
|
|
|
|
|
|
2006-10-10 01:47:12 +02:00
|
|
|
|
DWORD reg = param & WINED3DSP_REGNUM_MASK;
|
2006-05-14 15:43:31 +02:00
|
|
|
|
DWORD regtype = shader_get_regtype(param);
|
2006-10-10 01:47:42 +02:00
|
|
|
|
DWORD modifier = param & WINED3DSP_SRCMOD_MASK;
|
2006-05-14 15:43:31 +02:00
|
|
|
|
|
|
|
|
|
/* There are some minor differences between pixel and vertex shaders */
|
2006-06-12 08:59:16 +02:00
|
|
|
|
char pshader = shader_is_pshader_version(This->baseShader.hex_version);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
|
|
|
|
|
/* For one, we'd prefer color components to be shown for pshaders.
|
|
|
|
|
* FIXME: use the swizzle function for this */
|
|
|
|
|
|
|
|
|
|
swizzle_reg_chars[0] = pshader? 'r': 'x';
|
|
|
|
|
swizzle_reg_chars[1] = pshader? 'g': 'y';
|
|
|
|
|
swizzle_reg_chars[2] = pshader? 'b': 'z';
|
|
|
|
|
swizzle_reg_chars[3] = pshader? 'a': 'w';
|
|
|
|
|
|
|
|
|
|
if (input) {
|
2006-10-10 01:47:42 +02:00
|
|
|
|
if ( (modifier == WINED3DSPSM_NEG) ||
|
|
|
|
|
(modifier == WINED3DSPSM_BIASNEG) ||
|
|
|
|
|
(modifier == WINED3DSPSM_SIGNNEG) ||
|
|
|
|
|
(modifier == WINED3DSPSM_X2NEG) ||
|
|
|
|
|
(modifier == WINED3DSPSM_ABSNEG) )
|
2006-05-14 15:43:31 +02:00
|
|
|
|
TRACE("-");
|
2006-10-10 01:47:42 +02:00
|
|
|
|
else if (modifier == WINED3DSPSM_COMP)
|
2006-05-14 15:43:31 +02:00
|
|
|
|
TRACE("1-");
|
2006-10-10 01:47:42 +02:00
|
|
|
|
else if (modifier == WINED3DSPSM_NOT)
|
2006-05-18 03:09:56 +02:00
|
|
|
|
TRACE("!");
|
2006-07-07 08:29:39 +02:00
|
|
|
|
|
2006-10-10 01:47:42 +02:00
|
|
|
|
if (modifier == WINED3DSPSM_ABS || modifier == WINED3DSPSM_ABSNEG)
|
2006-07-07 08:29:39 +02:00
|
|
|
|
TRACE("abs(");
|
2006-05-14 15:43:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (regtype) {
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_TEMP:
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("r%u", reg);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_INPUT:
|
2006-06-06 08:40:08 +02:00
|
|
|
|
TRACE("v");
|
|
|
|
|
shader_dump_arr_entry(iface, param, addr_token, reg, input);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_CONST:
|
|
|
|
|
case WINED3DSPR_CONST2:
|
|
|
|
|
case WINED3DSPR_CONST3:
|
|
|
|
|
case WINED3DSPR_CONST4:
|
2006-05-17 08:05:49 +02:00
|
|
|
|
TRACE("c");
|
2006-06-06 08:40:08 +02:00
|
|
|
|
shader_dump_arr_entry(iface, param, addr_token, shader_get_float_offset(param), input);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("%c%u", (pshader? 't':'a'), reg);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_RASTOUT:
|
2006-05-14 15:43:31 +02:00
|
|
|
|
TRACE("%s", rastout_reg_names[reg]);
|
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_COLOROUT:
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("oC%u", reg);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_DEPTHOUT:
|
2006-05-14 15:43:31 +02:00
|
|
|
|
TRACE("oDepth");
|
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_ATTROUT:
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("oD%u", reg);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_TEXCRDOUT:
|
2006-05-18 03:08:29 +02:00
|
|
|
|
|
|
|
|
|
/* Vertex shaders >= 3.0 use general purpose output registers
|
2006-10-10 01:45:55 +02:00
|
|
|
|
* (WINED3DSPR_OUTPUT), which can include an address token */
|
2006-05-18 03:08:29 +02:00
|
|
|
|
|
2006-10-13 05:36:41 +02:00
|
|
|
|
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) {
|
2006-05-18 03:08:29 +02:00
|
|
|
|
TRACE("o");
|
2006-06-06 08:40:08 +02:00
|
|
|
|
shader_dump_arr_entry(iface, param, addr_token, reg, input);
|
2006-05-18 03:08:29 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("oT%u", reg);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_CONSTINT:
|
2006-05-17 08:05:49 +02:00
|
|
|
|
TRACE("i");
|
2006-06-06 08:40:08 +02:00
|
|
|
|
shader_dump_arr_entry(iface, param, addr_token, reg, input);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_CONSTBOOL:
|
2006-05-17 08:05:49 +02:00
|
|
|
|
TRACE("b");
|
2006-06-06 08:40:08 +02:00
|
|
|
|
shader_dump_arr_entry(iface, param, addr_token, reg, input);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_LABEL:
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("l%u", reg);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_LOOP:
|
2006-05-17 08:05:49 +02:00
|
|
|
|
TRACE("aL");
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_SAMPLER:
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("s%u", reg);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
2007-05-03 21:01:09 +02:00
|
|
|
|
case WINED3DSPR_MISCTYPE:
|
|
|
|
|
if (reg > 1) {
|
|
|
|
|
FIXME("Unhandled misctype register %d\n", reg);
|
|
|
|
|
} else {
|
|
|
|
|
TRACE("%s", misctype_reg_names[reg]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2006-10-10 01:45:55 +02:00
|
|
|
|
case WINED3DSPR_PREDICATE:
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("p%u", reg);
|
2006-05-18 03:08:29 +02:00
|
|
|
|
break;
|
2006-05-14 15:43:31 +02:00
|
|
|
|
default:
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("unhandled_rtype(%#x)", regtype);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!input) {
|
|
|
|
|
/* operand output (for modifiers and shift, see dump_ins_modifiers) */
|
|
|
|
|
|
2006-10-10 01:48:12 +02:00
|
|
|
|
if ((param & WINED3DSP_WRITEMASK_ALL) != WINED3DSP_WRITEMASK_ALL) {
|
2006-05-14 15:43:31 +02:00
|
|
|
|
TRACE(".");
|
2006-10-10 01:48:12 +02:00
|
|
|
|
if (param & WINED3DSP_WRITEMASK_0) TRACE("%c", swizzle_reg_chars[0]);
|
|
|
|
|
if (param & WINED3DSP_WRITEMASK_1) TRACE("%c", swizzle_reg_chars[1]);
|
|
|
|
|
if (param & WINED3DSP_WRITEMASK_2) TRACE("%c", swizzle_reg_chars[2]);
|
|
|
|
|
if (param & WINED3DSP_WRITEMASK_3) TRACE("%c", swizzle_reg_chars[3]);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
/** operand input */
|
2006-10-10 01:47:42 +02:00
|
|
|
|
DWORD swizzle = (param & WINED3DSP_SWIZZLE_MASK) >> WINED3DSP_SWIZZLE_SHIFT;
|
2006-05-14 15:43:31 +02:00
|
|
|
|
DWORD swizzle_r = swizzle & 0x03;
|
|
|
|
|
DWORD swizzle_g = (swizzle >> 2) & 0x03;
|
|
|
|
|
DWORD swizzle_b = (swizzle >> 4) & 0x03;
|
|
|
|
|
DWORD swizzle_a = (swizzle >> 6) & 0x03;
|
|
|
|
|
|
2006-07-07 08:29:39 +02:00
|
|
|
|
if (0 != modifier) {
|
|
|
|
|
switch (modifier) {
|
2006-10-10 01:47:42 +02:00
|
|
|
|
case WINED3DSPSM_NONE: break;
|
|
|
|
|
case WINED3DSPSM_NEG: break;
|
|
|
|
|
case WINED3DSPSM_NOT: break;
|
|
|
|
|
case WINED3DSPSM_BIAS: TRACE("_bias"); break;
|
|
|
|
|
case WINED3DSPSM_BIASNEG: TRACE("_bias"); break;
|
|
|
|
|
case WINED3DSPSM_SIGN: TRACE("_bx2"); break;
|
|
|
|
|
case WINED3DSPSM_SIGNNEG: TRACE("_bx2"); break;
|
|
|
|
|
case WINED3DSPSM_COMP: break;
|
|
|
|
|
case WINED3DSPSM_X2: TRACE("_x2"); break;
|
|
|
|
|
case WINED3DSPSM_X2NEG: TRACE("_x2"); break;
|
|
|
|
|
case WINED3DSPSM_DZ: TRACE("_dz"); break;
|
|
|
|
|
case WINED3DSPSM_DW: TRACE("_dw"); break;
|
|
|
|
|
case WINED3DSPSM_ABSNEG: TRACE(")"); break;
|
|
|
|
|
case WINED3DSPSM_ABS: TRACE(")"); break;
|
2006-05-14 15:43:31 +02:00
|
|
|
|
default:
|
2006-10-10 01:47:42 +02:00
|
|
|
|
TRACE("_unknown_modifier(%#x)", modifier >> WINED3DSP_SRCMOD_SHIFT);
|
2006-05-14 15:43:31 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* swizzle bits fields:
|
|
|
|
|
* RRGGBBAA
|
|
|
|
|
*/
|
2006-10-10 01:47:42 +02:00
|
|
|
|
if ((WINED3DVS_NOSWIZZLE >> WINED3DVS_SWIZZLE_SHIFT) != swizzle) {
|
2006-05-14 15:43:31 +02:00
|
|
|
|
if (swizzle_r == swizzle_g &&
|
|
|
|
|
swizzle_r == swizzle_b &&
|
|
|
|
|
swizzle_r == swizzle_a) {
|
|
|
|
|
TRACE(".%c", swizzle_reg_chars[swizzle_r]);
|
|
|
|
|
} else {
|
|
|
|
|
TRACE(".%c%c%c%c",
|
|
|
|
|
swizzle_reg_chars[swizzle_r],
|
|
|
|
|
swizzle_reg_chars[swizzle_g],
|
|
|
|
|
swizzle_reg_chars[swizzle_b],
|
|
|
|
|
swizzle_reg_chars[swizzle_a]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-10 04:32:34 +02:00
|
|
|
|
/** Shared code in order to generate the bulk of the shader string.
|
|
|
|
|
Use the shader_header_fct & shader_footer_fct to add strings
|
|
|
|
|
that are specific to pixel or vertex functions
|
2008-03-01 05:34:39 +01:00
|
|
|
|
NOTE: A description of how to parse tokens can be found on msdn */
|
2006-06-12 08:53:32 +02:00
|
|
|
|
void shader_generate_main(
|
2006-05-10 04:32:34 +02:00
|
|
|
|
IWineD3DBaseShader *iface,
|
|
|
|
|
SHADER_BUFFER* buffer,
|
2006-06-12 08:53:32 +02:00
|
|
|
|
shader_reg_maps* reg_maps,
|
2006-05-10 04:32:34 +02:00
|
|
|
|
CONST DWORD* pFunction) {
|
|
|
|
|
|
|
|
|
|
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
|
2007-09-21 23:53:57 +02:00
|
|
|
|
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; /* To access shader backend callbacks */
|
2006-05-10 04:32:34 +02:00
|
|
|
|
const DWORD *pToken = pFunction;
|
|
|
|
|
const SHADER_OPCODE *curOpcode = NULL;
|
2006-05-18 19:43:32 +02:00
|
|
|
|
SHADER_HANDLER hw_fct = NULL;
|
2006-05-10 04:32:34 +02:00
|
|
|
|
DWORD i;
|
2006-06-09 09:33:33 +02:00
|
|
|
|
SHADER_OPCODE_ARG hw_arg;
|
|
|
|
|
|
2006-05-10 04:32:34 +02:00
|
|
|
|
/* Initialize current parsing state */
|
2006-06-07 05:40:16 +02:00
|
|
|
|
hw_arg.shader = iface;
|
|
|
|
|
hw_arg.buffer = buffer;
|
2006-06-12 08:53:32 +02:00
|
|
|
|
hw_arg.reg_maps = reg_maps;
|
2006-05-10 04:32:34 +02:00
|
|
|
|
This->baseShader.parse_state.current_row = 0;
|
|
|
|
|
|
|
|
|
|
/* Second pass, process opcodes */
|
|
|
|
|
if (NULL != pToken) {
|
2006-10-13 05:36:41 +02:00
|
|
|
|
while (WINED3DPS_END() != *pToken) {
|
2006-05-10 04:32:34 +02:00
|
|
|
|
|
|
|
|
|
/* Skip version token */
|
|
|
|
|
if (shader_is_version_token(*pToken)) {
|
|
|
|
|
++pToken;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Skip comment tokens */
|
2006-05-14 15:43:31 +02:00
|
|
|
|
if (shader_is_comment(*pToken)) {
|
2006-10-13 05:34:13 +02:00
|
|
|
|
DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
|
2006-05-10 04:32:34 +02:00
|
|
|
|
++pToken;
|
2006-11-24 15:14:56 +01:00
|
|
|
|
TRACE("#%s\n", (const char*)pToken);
|
2006-05-10 04:32:34 +02:00
|
|
|
|
pToken += comment_len;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read opcode */
|
wined3d: More flow control instructions
- Implement if, else, endif, rep, endrep, break
- Implement ifc, breakc, using undocumented comparison bits in the instruction token
- Fix bug in main loop processing of codes with no dst token
- Fix bug in GLSL output modifier processing of codes with no dst token
- Fix bug in loop implementation (src1 contains the integer data, src0 is aL)
- Add versioning for all the instructions above, and remove
GLSL_REQUIRED thing, which is useless and should be removed from all
opcodes in general.
2006-07-10 11:11:35 +02:00
|
|
|
|
hw_arg.opcode_token = *pToken++;
|
|
|
|
|
curOpcode = shader_get_opcode(iface, hw_arg.opcode_token);
|
wined3d: Rework shader mode selection.
- currently half the shader selection code (GLSL vs ARB) is in
fillGLcaps. The parts that check for software shaders are in
GetDeviceCaps. That placement, will work, but is definitely not optimal.
FillGLcaps should detect support - it should not make decision as to
what's used, because that's not what the purpose of the function is.
GetDeviceCaps should report support as it has already been selected.
Instead, select shader mode in its own function, called in the
appropriate places.
- unifying pixel and vertex shaders into a single selection is a
mistake. A software vertex shader can be coupled with a hardware arb or
glsl pixel shader, or no shader at all. Split them back into two and add
a SHADER_NONE variant.
- drawprim is doing support checks for ARB_PROGRAM, and making shader
decisions based on that - that's wrong, support has already been
checked, and decided upon, and shaders can be implemented via software,
ARB_PROGRAm or GLSL, so that support check isn't valid.
- Store the shader selected mode into the shader itself. Different types
of shaders can be combined, so this is an improvement. In fact, storing
the mode into the settings globally is a mistake as well - it should be
done per device, since different cards have different capabilities.
2006-07-04 09:21:53 +02:00
|
|
|
|
|
|
|
|
|
/* Select handler */
|
|
|
|
|
if (curOpcode == NULL)
|
|
|
|
|
hw_fct = NULL;
|
|
|
|
|
else if (This->baseShader.shader_mode == SHADER_GLSL)
|
|
|
|
|
hw_fct = curOpcode->hw_glsl_fct;
|
|
|
|
|
else if (This->baseShader.shader_mode == SHADER_ARB)
|
|
|
|
|
hw_fct = curOpcode->hw_fct;
|
2006-05-10 04:32:34 +02:00
|
|
|
|
|
|
|
|
|
/* Unknown opcode and its parameters */
|
2006-06-07 05:40:16 +02:00
|
|
|
|
if (NULL == curOpcode) {
|
2008-07-15 23:54:37 +02:00
|
|
|
|
FIXME("Unrecognized opcode: token=0x%08x\n", hw_arg.opcode_token);
|
2006-06-07 05:40:16 +02:00
|
|
|
|
pToken += shader_skip_unrecognized(iface, pToken);
|
2006-05-10 04:32:34 +02:00
|
|
|
|
|
2006-06-12 08:51:58 +02:00
|
|
|
|
/* Nothing to do */
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (WINED3DSIO_DCL == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_NOP == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_DEF == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_DEFI == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_DEFB == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_PHASE == curOpcode->opcode ||
|
|
|
|
|
WINED3DSIO_RET == curOpcode->opcode) {
|
2006-06-12 08:51:58 +02:00
|
|
|
|
|
wined3d: More flow control instructions
- Implement if, else, endif, rep, endrep, break
- Implement ifc, breakc, using undocumented comparison bits in the instruction token
- Fix bug in main loop processing of codes with no dst token
- Fix bug in GLSL output modifier processing of codes with no dst token
- Fix bug in loop implementation (src1 contains the integer data, src0 is aL)
- Add versioning for all the instructions above, and remove
GLSL_REQUIRED thing, which is useless and should be removed from all
opcodes in general.
2006-07-10 11:11:35 +02:00
|
|
|
|
pToken += shader_skip_opcode(This, curOpcode, hw_arg.opcode_token);
|
2006-06-12 08:51:58 +02:00
|
|
|
|
|
2006-05-10 04:47:35 +02:00
|
|
|
|
/* If a generator function is set for current shader target, use it */
|
2006-05-18 19:43:32 +02:00
|
|
|
|
} else if (hw_fct != NULL) {
|
2006-05-10 04:32:34 +02:00
|
|
|
|
|
|
|
|
|
hw_arg.opcode = curOpcode;
|
2006-05-17 08:04:30 +02:00
|
|
|
|
|
2006-06-12 12:57:04 +02:00
|
|
|
|
/* Destination token */
|
|
|
|
|
if (curOpcode->dst_token) {
|
2006-05-10 04:32:34 +02:00
|
|
|
|
|
2006-05-17 08:04:30 +02:00
|
|
|
|
DWORD param, addr_token = 0;
|
2006-06-12 08:51:58 +02:00
|
|
|
|
pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
|
2006-05-17 08:04:30 +02:00
|
|
|
|
hw_arg.dst = param;
|
|
|
|
|
hw_arg.dst_addr = addr_token;
|
2006-06-12 12:57:04 +02:00
|
|
|
|
}
|
2006-05-17 08:04:30 +02:00
|
|
|
|
|
2006-06-12 12:57:04 +02:00
|
|
|
|
/* Predication token */
|
2006-10-13 05:34:13 +02:00
|
|
|
|
if (hw_arg.opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED)
|
2006-06-12 12:57:04 +02:00
|
|
|
|
hw_arg.predicate = *pToken++;
|
2006-05-18 03:09:56 +02:00
|
|
|
|
|
2006-06-12 12:57:04 +02:00
|
|
|
|
/* Other source tokens */
|
wined3d: More flow control instructions
- Implement if, else, endif, rep, endrep, break
- Implement ifc, breakc, using undocumented comparison bits in the instruction token
- Fix bug in main loop processing of codes with no dst token
- Fix bug in GLSL output modifier processing of codes with no dst token
- Fix bug in loop implementation (src1 contains the integer data, src0 is aL)
- Add versioning for all the instructions above, and remove
GLSL_REQUIRED thing, which is useless and should be removed from all
opcodes in general.
2006-07-10 11:11:35 +02:00
|
|
|
|
for (i = 0; i < (curOpcode->num_params - curOpcode->dst_token); i++) {
|
2006-05-17 08:04:30 +02:00
|
|
|
|
|
2006-06-12 12:57:04 +02:00
|
|
|
|
DWORD param, addr_token = 0;
|
2006-07-10 06:51:03 +02:00
|
|
|
|
pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
|
wined3d: More flow control instructions
- Implement if, else, endif, rep, endrep, break
- Implement ifc, breakc, using undocumented comparison bits in the instruction token
- Fix bug in main loop processing of codes with no dst token
- Fix bug in GLSL output modifier processing of codes with no dst token
- Fix bug in loop implementation (src1 contains the integer data, src0 is aL)
- Add versioning for all the instructions above, and remove
GLSL_REQUIRED thing, which is useless and should be removed from all
opcodes in general.
2006-07-10 11:11:35 +02:00
|
|
|
|
hw_arg.src[i] = param;
|
|
|
|
|
hw_arg.src_addr[i] = addr_token;
|
2006-05-10 04:32:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-05-10 04:47:35 +02:00
|
|
|
|
/* Call appropriate function for output target */
|
2006-05-18 19:43:32 +02:00
|
|
|
|
hw_fct(&hw_arg);
|
2006-05-10 04:47:35 +02:00
|
|
|
|
|
2007-09-21 23:53:57 +02:00
|
|
|
|
/* Add color correction if needed */
|
|
|
|
|
device->shader_backend->shader_color_correction(&hw_arg);
|
|
|
|
|
|
2006-06-14 04:32:14 +02:00
|
|
|
|
/* Process instruction modifiers for GLSL apps ( _sat, etc. ) */
|
wined3d: Rework shader mode selection.
- currently half the shader selection code (GLSL vs ARB) is in
fillGLcaps. The parts that check for software shaders are in
GetDeviceCaps. That placement, will work, but is definitely not optimal.
FillGLcaps should detect support - it should not make decision as to
what's used, because that's not what the purpose of the function is.
GetDeviceCaps should report support as it has already been selected.
Instead, select shader mode in its own function, called in the
appropriate places.
- unifying pixel and vertex shaders into a single selection is a
mistake. A software vertex shader can be coupled with a hardware arb or
glsl pixel shader, or no shader at all. Split them back into two and add
a SHADER_NONE variant.
- drawprim is doing support checks for ARB_PROGRAM, and making shader
decisions based on that - that's wrong, support has already been
checked, and decided upon, and shaders can be implemented via software,
ARB_PROGRAm or GLSL, so that support check isn't valid.
- Store the shader selected mode into the shader itself. Different types
of shaders can be combined, so this is an improvement. In fact, storing
the mode into the settings globally is a mistake as well - it should be
done per device, since different cards have different capabilities.
2006-07-04 09:21:53 +02:00
|
|
|
|
if (This->baseShader.shader_mode == SHADER_GLSL)
|
2006-06-14 04:32:14 +02:00
|
|
|
|
shader_glsl_add_instruction_modifiers(&hw_arg);
|
|
|
|
|
|
2006-06-12 08:51:58 +02:00
|
|
|
|
/* Unhandled opcode */
|
2006-05-10 04:32:34 +02:00
|
|
|
|
} else {
|
|
|
|
|
|
2006-06-12 08:51:58 +02:00
|
|
|
|
FIXME("Can't handle opcode %s in hwShader\n", curOpcode->name);
|
wined3d: More flow control instructions
- Implement if, else, endif, rep, endrep, break
- Implement ifc, breakc, using undocumented comparison bits in the instruction token
- Fix bug in main loop processing of codes with no dst token
- Fix bug in GLSL output modifier processing of codes with no dst token
- Fix bug in loop implementation (src1 contains the integer data, src0 is aL)
- Add versioning for all the instructions above, and remove
GLSL_REQUIRED thing, which is useless and should be removed from all
opcodes in general.
2006-07-10 11:11:35 +02:00
|
|
|
|
pToken += shader_skip_opcode(This, curOpcode, hw_arg.opcode_token);
|
2006-05-10 04:32:34 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* TODO: What about result.depth? */
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-10 19:53:07 +02:00
|
|
|
|
void shader_dump_ins_modifiers(const DWORD output) {
|
|
|
|
|
|
2006-10-10 01:48:12 +02:00
|
|
|
|
DWORD shift = (output & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT;
|
|
|
|
|
DWORD mmask = output & WINED3DSP_DSTMOD_MASK;
|
2006-05-10 19:53:07 +02:00
|
|
|
|
|
|
|
|
|
switch (shift) {
|
|
|
|
|
case 0: break;
|
|
|
|
|
case 13: TRACE("_d8"); break;
|
|
|
|
|
case 14: TRACE("_d4"); break;
|
|
|
|
|
case 15: TRACE("_d2"); break;
|
|
|
|
|
case 1: TRACE("_x2"); break;
|
|
|
|
|
case 2: TRACE("_x4"); break;
|
|
|
|
|
case 3: TRACE("_x8"); break;
|
2006-10-01 05:20:10 +02:00
|
|
|
|
default: TRACE("_unhandled_shift(%d)", shift); break;
|
2006-05-10 19:53:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-10 01:48:12 +02:00
|
|
|
|
if (mmask & WINED3DSPDM_SATURATE) TRACE("_sat");
|
|
|
|
|
if (mmask & WINED3DSPDM_PARTIALPRECISION) TRACE("_pp");
|
|
|
|
|
if (mmask & WINED3DSPDM_MSAMPCENTROID) TRACE("_centroid");
|
2006-05-17 07:58:19 +02:00
|
|
|
|
|
2006-10-10 01:48:12 +02:00
|
|
|
|
mmask &= ~(WINED3DSPDM_SATURATE | WINED3DSPDM_PARTIALPRECISION | WINED3DSPDM_MSAMPCENTROID);
|
2006-05-17 07:58:19 +02:00
|
|
|
|
if (mmask)
|
2006-10-10 01:48:12 +02:00
|
|
|
|
FIXME("_unrecognized_modifier(%#x)", mmask >> WINED3DSP_DSTMOD_SHIFT);
|
2006-05-10 19:53:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-12 08:54:30 +02:00
|
|
|
|
/* First pass: trace shader, initialize length and version */
|
|
|
|
|
void shader_trace_init(
|
|
|
|
|
IWineD3DBaseShader *iface,
|
|
|
|
|
const DWORD* pFunction) {
|
|
|
|
|
|
|
|
|
|
IWineD3DBaseShaderImpl *This =(IWineD3DBaseShaderImpl *)iface;
|
|
|
|
|
|
|
|
|
|
const DWORD* pToken = pFunction;
|
|
|
|
|
const SHADER_OPCODE* curOpcode = NULL;
|
|
|
|
|
DWORD opcode_token;
|
|
|
|
|
unsigned int len = 0;
|
|
|
|
|
DWORD i;
|
|
|
|
|
|
|
|
|
|
TRACE("(%p) : Parsing programme\n", This);
|
|
|
|
|
|
|
|
|
|
if (NULL != pToken) {
|
2006-10-13 05:36:41 +02:00
|
|
|
|
while (WINED3DVS_END() != *pToken) {
|
2006-06-12 08:54:30 +02:00
|
|
|
|
if (shader_is_version_token(*pToken)) { /** version */
|
|
|
|
|
This->baseShader.hex_version = *pToken;
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("%s_%u_%u\n", shader_is_pshader_version(This->baseShader.hex_version)? "ps": "vs",
|
2006-10-13 05:36:41 +02:00
|
|
|
|
WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version),
|
|
|
|
|
WINED3DSHADER_VERSION_MINOR(This->baseShader.hex_version));
|
2006-06-12 08:54:30 +02:00
|
|
|
|
++pToken;
|
|
|
|
|
++len;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (shader_is_comment(*pToken)) { /** comment */
|
2006-10-13 05:34:13 +02:00
|
|
|
|
DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
|
2006-06-12 08:54:30 +02:00
|
|
|
|
++pToken;
|
2006-11-24 15:14:56 +01:00
|
|
|
|
TRACE("//%s\n", (const char*)pToken);
|
2006-06-12 08:54:30 +02:00
|
|
|
|
pToken += comment_len;
|
|
|
|
|
len += comment_len + 1;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
opcode_token = *pToken++;
|
|
|
|
|
curOpcode = shader_get_opcode(iface, opcode_token);
|
|
|
|
|
len++;
|
|
|
|
|
|
|
|
|
|
if (NULL == curOpcode) {
|
|
|
|
|
int tokens_read;
|
2008-07-15 23:54:37 +02:00
|
|
|
|
FIXME("Unrecognized opcode: token=0x%08x\n", opcode_token);
|
2006-06-12 08:54:30 +02:00
|
|
|
|
tokens_read = shader_skip_unrecognized(iface, pToken);
|
|
|
|
|
pToken += tokens_read;
|
|
|
|
|
len += tokens_read;
|
|
|
|
|
|
|
|
|
|
} else {
|
2006-10-10 01:45:12 +02:00
|
|
|
|
if (curOpcode->opcode == WINED3DSIO_DCL) {
|
2006-06-12 08:54:30 +02:00
|
|
|
|
|
|
|
|
|
DWORD usage = *pToken;
|
|
|
|
|
DWORD param = *(pToken + 1);
|
|
|
|
|
|
2006-07-03 08:03:47 +02:00
|
|
|
|
shader_dump_decl_usage(This, usage, param);
|
2006-06-12 08:54:30 +02:00
|
|
|
|
shader_dump_ins_modifiers(param);
|
|
|
|
|
TRACE(" ");
|
|
|
|
|
shader_dump_param(iface, param, 0, 0);
|
|
|
|
|
pToken += 2;
|
|
|
|
|
len += 2;
|
|
|
|
|
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (curOpcode->opcode == WINED3DSIO_DEF) {
|
2006-06-12 08:54:30 +02:00
|
|
|
|
|
|
|
|
|
unsigned int offset = shader_get_float_offset(*pToken);
|
|
|
|
|
|
|
|
|
|
TRACE("def c%u = %f, %f, %f, %f", offset,
|
2006-11-24 15:14:56 +01:00
|
|
|
|
*(const float *)(pToken + 1),
|
|
|
|
|
*(const float *)(pToken + 2),
|
|
|
|
|
*(const float *)(pToken + 3),
|
|
|
|
|
*(const float *)(pToken + 4));
|
2006-06-12 08:54:30 +02:00
|
|
|
|
|
|
|
|
|
pToken += 5;
|
|
|
|
|
len += 5;
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (curOpcode->opcode == WINED3DSIO_DEFI) {
|
2006-06-12 08:54:30 +02:00
|
|
|
|
|
2006-10-10 01:47:12 +02:00
|
|
|
|
TRACE("defi i%u = %d, %d, %d, %d", *pToken & WINED3DSP_REGNUM_MASK,
|
2006-10-01 05:20:10 +02:00
|
|
|
|
*(pToken + 1),
|
|
|
|
|
*(pToken + 2),
|
|
|
|
|
*(pToken + 3),
|
|
|
|
|
*(pToken + 4));
|
2006-06-12 08:54:30 +02:00
|
|
|
|
|
|
|
|
|
pToken += 5;
|
|
|
|
|
len += 5;
|
|
|
|
|
|
2006-10-10 01:45:12 +02:00
|
|
|
|
} else if (curOpcode->opcode == WINED3DSIO_DEFB) {
|
2006-06-12 08:54:30 +02:00
|
|
|
|
|
2006-10-10 01:47:12 +02:00
|
|
|
|
TRACE("defb b%u = %s", *pToken & WINED3DSP_REGNUM_MASK,
|
2006-06-12 08:54:30 +02:00
|
|
|
|
*(pToken + 1)? "true": "false");
|
|
|
|
|
|
|
|
|
|
pToken += 2;
|
|
|
|
|
len += 2;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
DWORD param, addr_token;
|
|
|
|
|
int tokens_read;
|
|
|
|
|
|
|
|
|
|
/* Print out predication source token first - it follows
|
|
|
|
|
* the destination token. */
|
2006-10-13 05:34:13 +02:00
|
|
|
|
if (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED) {
|
2006-06-12 08:54:30 +02:00
|
|
|
|
TRACE("(");
|
|
|
|
|
shader_dump_param(iface, *(pToken + 2), 0, 1);
|
|
|
|
|
TRACE(") ");
|
|
|
|
|
}
|
2007-09-13 14:48:57 +02:00
|
|
|
|
if (opcode_token & WINED3DSI_COISSUE) {
|
|
|
|
|
/* PixWin marks instructions with the coissue flag with a '+' */
|
|
|
|
|
TRACE("+");
|
|
|
|
|
}
|
2006-06-12 08:54:30 +02:00
|
|
|
|
|
|
|
|
|
TRACE("%s", curOpcode->name);
|
2006-06-12 12:57:04 +02:00
|
|
|
|
|
2006-10-10 01:45:12 +02:00
|
|
|
|
if (curOpcode->opcode == WINED3DSIO_IFC ||
|
|
|
|
|
curOpcode->opcode == WINED3DSIO_BREAKC) {
|
wined3d: More flow control instructions
- Implement if, else, endif, rep, endrep, break
- Implement ifc, breakc, using undocumented comparison bits in the instruction token
- Fix bug in main loop processing of codes with no dst token
- Fix bug in GLSL output modifier processing of codes with no dst token
- Fix bug in loop implementation (src1 contains the integer data, src0 is aL)
- Add versioning for all the instructions above, and remove
GLSL_REQUIRED thing, which is useless and should be removed from all
opcodes in general.
2006-07-10 11:11:35 +02:00
|
|
|
|
|
|
|
|
|
DWORD op = (opcode_token & INST_CONTROLS_MASK) >> INST_CONTROLS_SHIFT;
|
|
|
|
|
switch (op) {
|
|
|
|
|
case COMPARISON_GT: TRACE("_gt"); break;
|
|
|
|
|
case COMPARISON_EQ: TRACE("_eq"); break;
|
|
|
|
|
case COMPARISON_GE: TRACE("_ge"); break;
|
|
|
|
|
case COMPARISON_LT: TRACE("_lt"); break;
|
|
|
|
|
case COMPARISON_NE: TRACE("_ne"); break;
|
|
|
|
|
case COMPARISON_LE: TRACE("_le"); break;
|
|
|
|
|
default:
|
2006-10-01 05:20:10 +02:00
|
|
|
|
TRACE("_(%u)", op);
|
wined3d: More flow control instructions
- Implement if, else, endif, rep, endrep, break
- Implement ifc, breakc, using undocumented comparison bits in the instruction token
- Fix bug in main loop processing of codes with no dst token
- Fix bug in GLSL output modifier processing of codes with no dst token
- Fix bug in loop implementation (src1 contains the integer data, src0 is aL)
- Add versioning for all the instructions above, and remove
GLSL_REQUIRED thing, which is useless and should be removed from all
opcodes in general.
2006-07-10 11:11:35 +02:00
|
|
|
|
}
|
2007-03-29 18:44:57 +02:00
|
|
|
|
} else if (curOpcode->opcode == WINED3DSIO_TEX &&
|
|
|
|
|
This->baseShader.hex_version >= WINED3DPS_VERSION(2,0)) {
|
|
|
|
|
if(opcode_token & WINED3DSI_TEXLD_PROJECT) TRACE("p");
|
wined3d: More flow control instructions
- Implement if, else, endif, rep, endrep, break
- Implement ifc, breakc, using undocumented comparison bits in the instruction token
- Fix bug in main loop processing of codes with no dst token
- Fix bug in GLSL output modifier processing of codes with no dst token
- Fix bug in loop implementation (src1 contains the integer data, src0 is aL)
- Add versioning for all the instructions above, and remove
GLSL_REQUIRED thing, which is useless and should be removed from all
opcodes in general.
2006-07-10 11:11:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-06-12 12:57:04 +02:00
|
|
|
|
/* Destination token */
|
|
|
|
|
if (curOpcode->dst_token) {
|
2006-06-12 08:54:30 +02:00
|
|
|
|
|
|
|
|
|
/* Destination token */
|
|
|
|
|
tokens_read = shader_get_param(iface, pToken, ¶m, &addr_token);
|
|
|
|
|
pToken += tokens_read;
|
|
|
|
|
len += tokens_read;
|
|
|
|
|
|
|
|
|
|
shader_dump_ins_modifiers(param);
|
|
|
|
|
TRACE(" ");
|
|
|
|
|
shader_dump_param(iface, param, addr_token, 0);
|
2006-06-12 12:57:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Predication token - already printed out, just skip it */
|
2006-10-13 05:34:13 +02:00
|
|
|
|
if (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED) {
|
2006-06-12 12:57:04 +02:00
|
|
|
|
pToken++;
|
|
|
|
|
len++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Other source tokens */
|
|
|
|
|
for (i = curOpcode->dst_token; i < curOpcode->num_params; ++i) {
|
|
|
|
|
|
|
|
|
|
tokens_read = shader_get_param(iface, pToken, ¶m, &addr_token);
|
|
|
|
|
pToken += tokens_read;
|
|
|
|
|
len += tokens_read;
|
2006-06-12 08:54:30 +02:00
|
|
|
|
|
2006-06-12 12:57:04 +02:00
|
|
|
|
TRACE((i == 0)? " " : ", ");
|
|
|
|
|
shader_dump_param(iface, param, addr_token, 1);
|
2006-06-12 08:54:30 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
This->baseShader.functionLength = (len + 1) * sizeof(DWORD);
|
|
|
|
|
} else {
|
|
|
|
|
This->baseShader.functionLength = 1; /* no Function defined use fixed function vertex processing */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-27 20:50:37 +01:00
|
|
|
|
static void shader_none_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {}
|
|
|
|
|
static void shader_none_select_depth_blt(IWineD3DDevice *iface) {}
|
2008-07-10 17:57:35 +02:00
|
|
|
|
static void shader_none_deselect_depth_blt(IWineD3DDevice *iface) {}
|
2006-11-27 20:50:37 +01:00
|
|
|
|
static void shader_none_load_constants(IWineD3DDevice *iface, char usePS, char useVS) {}
|
2007-02-08 22:31:01 +01:00
|
|
|
|
static void shader_none_cleanup(IWineD3DDevice *iface) {}
|
2007-11-20 17:40:54 +01:00
|
|
|
|
static void shader_none_color_correction(SHADER_OPCODE_ARG* arg) {}
|
|
|
|
|
static void shader_none_destroy(IWineD3DBaseShader *iface) {}
|
2008-02-24 11:23:53 +01:00
|
|
|
|
static HRESULT shader_none_alloc(IWineD3DDevice *iface) {return WINED3D_OK;}
|
|
|
|
|
static void shader_none_free(IWineD3DDevice *iface) {}
|
2008-03-04 02:30:23 +01:00
|
|
|
|
static BOOL shader_none_dirty_const(IWineD3DDevice *iface) {return FALSE;}
|
2008-03-18 19:19:16 +01:00
|
|
|
|
static void shader_none_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
|
|
|
|
|
FIXME("NONE shader backend asked to generate a pixel shader\n");
|
|
|
|
|
}
|
|
|
|
|
static void shader_none_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer) {
|
|
|
|
|
FIXME("NONE shader backend asked to generate a vertex shader\n");
|
|
|
|
|
}
|
2006-11-27 20:50:37 +01:00
|
|
|
|
|
2008-03-18 19:39:26 +01:00
|
|
|
|
#define GLINFO_LOCATION (*gl_info)
|
|
|
|
|
static void shader_none_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct shader_caps *pCaps) {
|
2008-03-22 14:27:53 +01:00
|
|
|
|
/* Set the shader caps to 0 for the none shader backend */
|
|
|
|
|
pCaps->VertexShaderVersion = 0;
|
|
|
|
|
pCaps->PixelShaderVersion = 0;
|
|
|
|
|
pCaps->PixelShader1xMaxValue = 0.0;
|
2008-03-18 19:39:26 +01:00
|
|
|
|
}
|
2008-04-11 08:19:04 +02:00
|
|
|
|
|
2008-03-18 19:39:26 +01:00
|
|
|
|
#undef GLINFO_LOCATION
|
|
|
|
|
|
2006-11-27 20:50:37 +01:00
|
|
|
|
const shader_backend_t none_shader_backend = {
|
2008-07-06 14:00:52 +02:00
|
|
|
|
shader_none_select,
|
|
|
|
|
shader_none_select_depth_blt,
|
2008-07-10 17:57:35 +02:00
|
|
|
|
shader_none_deselect_depth_blt,
|
2008-07-06 14:00:52 +02:00
|
|
|
|
shader_none_load_constants,
|
|
|
|
|
shader_none_cleanup,
|
|
|
|
|
shader_none_color_correction,
|
|
|
|
|
shader_none_destroy,
|
|
|
|
|
shader_none_alloc,
|
|
|
|
|
shader_none_free,
|
|
|
|
|
shader_none_dirty_const,
|
|
|
|
|
shader_none_generate_pshader,
|
|
|
|
|
shader_none_generate_vshader,
|
|
|
|
|
shader_none_get_caps,
|
2006-11-27 20:50:37 +01:00
|
|
|
|
};
|
2007-11-16 21:01:33 +01:00
|
|
|
|
|
|
|
|
|
/* *******************************************
|
|
|
|
|
IWineD3DPixelShader IUnknown parts follow
|
|
|
|
|
******************************************* */
|
|
|
|
|
HRESULT WINAPI IWineD3DBaseShaderImpl_QueryInterface(IWineD3DBaseShader *iface, REFIID riid, LPVOID *ppobj)
|
|
|
|
|
{
|
|
|
|
|
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)iface;
|
|
|
|
|
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
|
|
|
|
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|
|
|
|
|
|| IsEqualGUID(riid, &IID_IWineD3DBaseShader)
|
|
|
|
|
|| IsEqualGUID(riid, &IID_IWineD3DPixelShader)) {
|
|
|
|
|
IUnknown_AddRef(iface);
|
|
|
|
|
*ppobj = This;
|
|
|
|
|
return S_OK;
|
|
|
|
|
}
|
|
|
|
|
*ppobj = NULL;
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ULONG WINAPI IWineD3DBaseShaderImpl_AddRef(IWineD3DBaseShader *iface) {
|
|
|
|
|
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
|
|
|
|
TRACE("(%p) : AddRef increasing from %d\n", This, This->baseShader.ref);
|
|
|
|
|
return InterlockedIncrement(&This->baseShader.ref);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ULONG WINAPI IWineD3DBaseShaderImpl_Release(IWineD3DBaseShader *iface) {
|
|
|
|
|
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)iface;
|
2007-11-20 17:40:54 +01:00
|
|
|
|
IWineD3DDeviceImpl *deviceImpl = (IWineD3DDeviceImpl *) This->baseShader.device;
|
2007-11-16 21:01:33 +01:00
|
|
|
|
ULONG ref;
|
|
|
|
|
TRACE("(%p) : Releasing from %d\n", This, This->baseShader.ref);
|
|
|
|
|
ref = InterlockedDecrement(&This->baseShader.ref);
|
|
|
|
|
if (ref == 0) {
|
2007-11-20 17:40:54 +01:00
|
|
|
|
deviceImpl->shader_backend->shader_destroy(iface);
|
2007-11-16 21:02:29 +01:00
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->baseShader.function);
|
2007-11-16 21:01:33 +01:00
|
|
|
|
shader_delete_constant_list(&This->baseShader.constantsF);
|
|
|
|
|
shader_delete_constant_list(&This->baseShader.constantsB);
|
|
|
|
|
shader_delete_constant_list(&This->baseShader.constantsI);
|
2008-01-08 20:45:59 +01:00
|
|
|
|
list_remove(&This->baseShader.shader_list_entry);
|
2007-11-20 17:40:54 +01:00
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2007-11-16 21:01:33 +01:00
|
|
|
|
}
|
|
|
|
|
return ref;
|
|
|
|
|
}
|