wined3d: Move the vshader_ins and pshader_ins arrays into their respective objects.
This commit is contained in:
parent
3ee642bb09
commit
d4132cf7d7
|
@ -1620,6 +1620,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, CONS
|
|||
IWineD3DVertexShaderImpl *object; /* NOTE: impl usage is ok, this is a create */
|
||||
HRESULT hr = D3D_OK;
|
||||
D3DCREATEOBJECTINSTANCE(object, VertexShader)
|
||||
object->shader_ins = IWineD3DVertexShaderImpl_shader_ins;
|
||||
|
||||
TRACE("(%p) : Created Vertex shader %p\n", This, *ppVertexShader);
|
||||
|
||||
|
@ -1664,6 +1665,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, CONST
|
|||
HRESULT hr = D3D_OK;
|
||||
|
||||
D3DCREATEOBJECTINSTANCE(object, PixelShader)
|
||||
object->shader_ins = IWineD3DPixelShaderImpl_shader_ins;
|
||||
hr = IWineD3DPixelShader_SetFunction(*ppPixelShader, pFunction);
|
||||
if (D3D_OK == hr) {
|
||||
TRACE("(%p) : Created Pixel shader %p\n", This, *ppPixelShader);
|
||||
|
|
|
@ -629,7 +629,7 @@ void pshader_breakp(WINED3DSHADERVECTOR* d) {
|
|||
/**
|
||||
* log, exp, frc, m*x* seems to be macros ins ... to see
|
||||
*/
|
||||
static CONST SHADER_OPCODE pshader_ins [] = {
|
||||
CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = {
|
||||
{D3DSIO_NOP, "nop", "NOP", 0, pshader_nop, 0, 0},
|
||||
{D3DSIO_MOV, "mov", "MOV", 2, pshader_mov, 0, 0},
|
||||
{D3DSIO_ADD, "add", "ADD", 3, pshader_add, 0, 0},
|
||||
|
@ -746,12 +746,14 @@ inline static const SHADER_OPCODE* pshader_program_get_opcode(IWineD3DPixelShade
|
|||
DWORD i = 0;
|
||||
DWORD version = This->version;
|
||||
DWORD hex_version = D3DPS_VERSION(version/10, version%10);
|
||||
const SHADER_OPCODE *shader_ins = This->shader_ins;
|
||||
|
||||
/** TODO: use dichotomic search */
|
||||
while (NULL != pshader_ins[i].name) {
|
||||
if (((code & D3DSI_OPCODE_MASK) == pshader_ins[i].opcode) &&
|
||||
(((hex_version >= pshader_ins[i].min_version) && (hex_version <= pshader_ins[i].max_version)) ||
|
||||
((pshader_ins[i].min_version == 0) && (pshader_ins[i].max_version == 0)))) {
|
||||
return &pshader_ins[i];
|
||||
while (NULL != shader_ins[i].name) {
|
||||
if (((code & D3DSI_OPCODE_MASK) == shader_ins[i].opcode) &&
|
||||
(((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;
|
||||
}
|
||||
|
|
|
@ -582,7 +582,7 @@ void vshader_breakp(WINED3DSHADERVECTOR* d) {
|
|||
/**
|
||||
* log, exp, frc, m*x* seems to be macros ins ... to see
|
||||
*/
|
||||
static CONST SHADER_OPCODE vshader_ins [] = {
|
||||
CONST SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[] = {
|
||||
{D3DSIO_NOP, "nop", "NOP", 0, vshader_nop, 0, 0},
|
||||
{D3DSIO_MOV, "mov", "MOV", 2, vshader_mov, 0, 0},
|
||||
{D3DSIO_ADD, "add", "ADD", 3, vshader_add, 0, 0},
|
||||
|
@ -691,12 +691,14 @@ static CONST SHADER_OPCODE vshader_ins [] = {
|
|||
};
|
||||
|
||||
|
||||
inline static const SHADER_OPCODE* vshader_program_get_opcode(const DWORD code) {
|
||||
inline static const SHADER_OPCODE* vshader_program_get_opcode(IWineD3DVertexShaderImpl *This, const DWORD code) {
|
||||
DWORD i = 0;
|
||||
const SHADER_OPCODE *shader_ins = This->shader_ins;
|
||||
|
||||
/** TODO: use dichotomic search or hash table */
|
||||
while (NULL != vshader_ins[i].name) {
|
||||
if ((code & D3DSI_OPCODE_MASK) == vshader_ins[i].opcode) {
|
||||
return &vshader_ins[i];
|
||||
while (NULL != shader_ins[i].name) {
|
||||
if ((code & D3DSI_OPCODE_MASK) == shader_ins[i].opcode) {
|
||||
return &shader_ins[i];
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
@ -1305,7 +1307,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
|
|||
pToken += comment_len;
|
||||
continue;
|
||||
}
|
||||
curOpcode = vshader_program_get_opcode(*pToken);
|
||||
curOpcode = vshader_program_get_opcode(This, *pToken);
|
||||
++pToken;
|
||||
/* TODO: dcl's */
|
||||
/* TODO: Consts */
|
||||
|
@ -1485,7 +1487,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
|
|||
continue;
|
||||
}
|
||||
|
||||
curOpcode = vshader_program_get_opcode(*pToken);
|
||||
curOpcode = vshader_program_get_opcode(This, *pToken);
|
||||
++pToken;
|
||||
if (NULL == curOpcode) {
|
||||
/* unknown current opcode ... (shouldn't be any!) */
|
||||
|
@ -1781,7 +1783,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
|
|||
pToken += comment_len;
|
||||
continue ;
|
||||
}
|
||||
curOpcode = vshader_program_get_opcode(*pToken);
|
||||
curOpcode = vshader_program_get_opcode(This, *pToken);
|
||||
++pToken;
|
||||
if (NULL == curOpcode) {
|
||||
i = 0;
|
||||
|
@ -2129,7 +2131,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
|
|||
len += comment_len + 1;
|
||||
continue;
|
||||
}
|
||||
curOpcode = vshader_program_get_opcode(*pToken);
|
||||
curOpcode = vshader_program_get_opcode(This, *pToken);
|
||||
++pToken;
|
||||
++len;
|
||||
if (NULL == curOpcode) {
|
||||
|
|
|
@ -1181,6 +1181,7 @@ typedef struct IWineD3DVertexShaderImpl {
|
|||
IWineD3DDeviceImpl *wineD3DDevice;
|
||||
|
||||
/* IWineD3DVertexShaderImpl */
|
||||
CONST SHADER_OPCODE *shader_ins;
|
||||
CONST DWORD *function;
|
||||
UINT functionLength;
|
||||
|
||||
|
@ -1204,6 +1205,7 @@ typedef struct IWineD3DVertexShaderImpl {
|
|||
VSHADEROUTPUTDATA output;
|
||||
#endif
|
||||
} IWineD3DVertexShaderImpl;
|
||||
extern const SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[];
|
||||
extern const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl;
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1218,6 +1220,7 @@ typedef struct IWineD3DPixelShaderImpl {
|
|||
IWineD3DDeviceImpl *wineD3DDevice;
|
||||
|
||||
/* IWineD3DPixelShaderImpl */
|
||||
const SHADER_OPCODE *shader_ins;
|
||||
CONST DWORD *function;
|
||||
UINT functionLength;
|
||||
DWORD version;
|
||||
|
@ -1233,5 +1236,6 @@ typedef struct IWineD3DPixelShaderImpl {
|
|||
#endif
|
||||
} IWineD3DPixelShaderImpl;
|
||||
|
||||
extern const SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[];
|
||||
extern const IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue