wined3d: Cleanup shader constants code a little bit.
Improved bounds checking.
This commit is contained in:
parent
5c6311688c
commit
4e7b2557b5
|
@ -3796,146 +3796,142 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface, IWineD3
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GET_SHADER_CONSTANT(_vertexshaderconstant, _count, _sizecount) \
|
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstant(IWineD3DDevice *iface, void *dstData, const void *srcData, UINT type, UINT start, UINT count, UINT registersize) {
|
||||||
count = min(_count, MAX_VSHADER_CONSTANTS - (StartRegister + 1)); \
|
|
||||||
if (NULL == pConstantData || count < 0 /* || _count != count */ ) \
|
|
||||||
return D3DERR_INVALIDCALL; \
|
|
||||||
memcpy(pConstantData, This->updateStateBlock->_vertexshaderconstant + (StartRegister * _sizecount), count * (sizeof(*pConstantData) * _sizecount));
|
|
||||||
|
|
||||||
#define SET_SHADER_CONSTANT(_vertexshaderconstant, _count, _sizecount) \
|
|
||||||
int count = min(_count, MAX_VSHADER_CONSTANTS - (StartRegister + 1)); \
|
|
||||||
if (NULL == pConstantData || count < 0 /* || _count != count */ ) \
|
|
||||||
return D3DERR_INVALIDCALL; \
|
|
||||||
memcpy(This->updateStateBlock->_vertexshaderconstant + (StartRegister * _sizecount), pConstantData, count * (sizeof(*pConstantData) * _sizecount)); \
|
|
||||||
This->updateStateBlock->changed.vertexShader = TRUE; \
|
|
||||||
This->updateStateBlock->set.vertexShader = TRUE;
|
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, CONST BOOL *pConstantData, UINT BoolCount){
|
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i;
|
|
||||||
SET_SHADER_CONSTANT(vertexShaderConstantB, BoolCount, 1);
|
|
||||||
|
|
||||||
/* populate the bitmap that says which constant type we should load */
|
int i;
|
||||||
for (i = StartRegister; i < BoolCount + StartRegister; ++i) {
|
int cnt = min(count, MAX_VSHADER_CONSTANTS - (start + 1));
|
||||||
|
|
||||||
|
TRACE("(iface %p, dstData %p, srcData %p, type %d, start %d, count %d, registersize %d)\n",
|
||||||
|
iface, dstData, srcData, type, start, count, registersize);
|
||||||
|
|
||||||
|
if (type != WINESHADERCNST_NONE) {
|
||||||
|
if (srcData == NULL || cnt < 0) {
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CopyMemory((char *)dstData + (start * registersize), srcData, cnt * registersize);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = start; i < cnt + start; ++i) {
|
||||||
This->updateStateBlock->changed.vertexShaderConstants[i] = TRUE;
|
This->updateStateBlock->changed.vertexShaderConstants[i] = TRUE;
|
||||||
This->updateStateBlock->set.vertexShaderConstants[i] = TRUE;
|
This->updateStateBlock->set.vertexShaderConstants[i] = TRUE;
|
||||||
This->updateStateBlock->vertexShaderConstantT[i] = WINESHADERCNST_BOOL;
|
This->updateStateBlock->vertexShaderConstantT[i] = type;
|
||||||
TRACE("(%p) : Setting vsb %d to %d\n", This->updateStateBlock, i, pConstantData[i - StartRegister]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstant(IWineD3DDevice *iface, void *dstData, const void *srcData, UINT type, UINT start, UINT count, UINT registersize) {
|
||||||
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
int cnt = min(count, MAX_VSHADER_CONSTANTS - (start + 1));
|
||||||
|
|
||||||
|
TRACE("(iface %p, dstData %p, srcData %p, type %d, start %d, count %d, registersize %d)\n",
|
||||||
|
iface, dstData, srcData, type, start, count, registersize);
|
||||||
|
|
||||||
|
/* Verify that the requested shader constant was populated with the correct type */
|
||||||
|
for (i = start; i < cnt + start; ++i) {
|
||||||
|
if (This->updateStateBlock->vertexShaderConstantT[i] != type) {
|
||||||
|
TRACE("(%p) : Caller requested 0x%x while type is 0x%x. Returning D3DERR_INVALIDCALL\n",
|
||||||
|
This, type, This->updateStateBlock->vertexShaderConstantT[i]);
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dstData == NULL || cnt < 0) {
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CopyMemory(dstData, (char *)srcData + (start * registersize), cnt * registersize);
|
||||||
|
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, CONST BOOL *pConstantData, UINT BoolCount){
|
||||||
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
|
||||||
|
return IWineD3DDeviceImpl_SetVertexShaderConstant(iface,
|
||||||
|
This->updateStateBlock->vertexShaderConstantB,
|
||||||
|
pConstantData,
|
||||||
|
WINESHADERCNST_BOOL,
|
||||||
|
StartRegister,
|
||||||
|
BoolCount,
|
||||||
|
sizeof(*pConstantData));
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, BOOL *pConstantData, UINT BoolCount){
|
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, BOOL *pConstantData, UINT BoolCount){
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i, count;
|
|
||||||
|
return IWineD3DDeviceImpl_GetVertexShaderConstant(iface,
|
||||||
/* verify that the requested shader constant was populated with a boolean */
|
pConstantData,
|
||||||
for (i = StartRegister; i < BoolCount; ++i) {
|
This->updateStateBlock->vertexShaderConstantB,
|
||||||
if (This->updateStateBlock->vertexShaderConstantT[i] != WINESHADERCNST_BOOL) {
|
WINESHADERCNST_BOOL,
|
||||||
|
StartRegister,
|
||||||
/* the constant for this register isn't a boolean */
|
BoolCount,
|
||||||
WARN("(%p) : Caller requested a boolean where stateblock (%p) entry is a %s. Returning D3DERR_INVALIDCALL\n", This,This->updateStateBlock,
|
sizeof(*pConstantData));
|
||||||
This->updateStateBlock->vertexShaderConstantT[i] == WINESHADERCNST_INTEGER ? "integer" : "float");
|
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GET_SHADER_CONSTANT(vertexShaderConstantB, BoolCount, 1);
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, CONST int *pConstantData, UINT Vector4iCount){
|
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, CONST int *pConstantData, UINT Vector4iCount){
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i;
|
|
||||||
|
return IWineD3DDeviceImpl_SetVertexShaderConstant(iface,
|
||||||
SET_SHADER_CONSTANT(vertexShaderConstantI, Vector4iCount, 4);
|
This->updateStateBlock->vertexShaderConstantI,
|
||||||
|
pConstantData,
|
||||||
/* populate the bitmap that says which constant type we should load */
|
WINESHADERCNST_INTEGER,
|
||||||
for (i = StartRegister; i < StartRegister + Vector4iCount; ++i) {
|
StartRegister,
|
||||||
This->updateStateBlock->changed.vertexShaderConstants[i] = TRUE;
|
Vector4iCount,
|
||||||
This->updateStateBlock->set.vertexShaderConstants[i] = TRUE;
|
4 * sizeof(*pConstantData));
|
||||||
This->updateStateBlock->vertexShaderConstantT[i] = WINESHADERCNST_INTEGER;
|
|
||||||
TRACE("(%p) : Setting vsi %d to %d\n", This->updateStateBlock, i, pConstantData[i - StartRegister]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, int *pConstantData, UINT Vector4iCount){
|
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, int *pConstantData, UINT Vector4iCount){
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i, count;
|
|
||||||
|
return IWineD3DDeviceImpl_GetVertexShaderConstant(iface,
|
||||||
/* verify that the requested shader constant was populated with a integer */
|
pConstantData,
|
||||||
for (i = StartRegister; i < Vector4iCount; ++i) {
|
This->updateStateBlock->vertexShaderConstantI,
|
||||||
if (This->updateStateBlock->vertexShaderConstantT[i] != WINESHADERCNST_INTEGER) {
|
WINESHADERCNST_INTEGER,
|
||||||
|
StartRegister,
|
||||||
/* the constant for this register isn't a integer */
|
Vector4iCount,
|
||||||
WARN("(%p) : Caller requested a integer where stateblock (%p) entry is a %s. Returning D3DERR_INVALIDCALL\n", This, This->updateStateBlock,
|
4 * sizeof(*pConstantData));
|
||||||
This->updateStateBlock->vertexShaderConstantT[i] == WINESHADERCNST_BOOL ? "boolean" : "float");
|
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GET_SHADER_CONSTANT(vertexShaderConstantI, Vector4iCount, 4);
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, CONST float *pConstantData, UINT Vector4fCount){
|
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, CONST float *pConstantData, UINT Vector4fCount){
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i;
|
|
||||||
|
|
||||||
SET_SHADER_CONSTANT(vertexShaderConstantF, Vector4fCount, 4);
|
return IWineD3DDeviceImpl_SetVertexShaderConstant(iface,
|
||||||
|
This->updateStateBlock->vertexShaderConstantF,
|
||||||
/* populate the bitmap that says which constant type we should load */
|
pConstantData,
|
||||||
for (i = StartRegister; i < StartRegister + Vector4fCount; ++i) {
|
WINESHADERCNST_FLOAT,
|
||||||
This->updateStateBlock->changed.vertexShaderConstants[i] = TRUE;
|
StartRegister,
|
||||||
This->updateStateBlock->set.vertexShaderConstants[i] = TRUE;
|
Vector4fCount,
|
||||||
This->updateStateBlock->vertexShaderConstantT[i] = WINESHADERCNST_FLOAT;
|
4 * sizeof(*pConstantData));
|
||||||
TRACE("(%p) : Setting vsf %d to %f\n", This->updateStateBlock, i, pConstantData[i - StartRegister]);
|
|
||||||
}
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, float *pConstantData, UINT Vector4fCount){
|
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, float *pConstantData, UINT Vector4fCount){
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i, count;
|
|
||||||
|
|
||||||
/* verify that the requested shader constant was populated with a float */
|
return IWineD3DDeviceImpl_GetVertexShaderConstant(iface,
|
||||||
for (i = StartRegister; i < Vector4fCount; ++i) {
|
pConstantData,
|
||||||
if (This->updateStateBlock->vertexShaderConstantT[i] != WINESHADERCNST_FLOAT) {
|
This->updateStateBlock->vertexShaderConstantF,
|
||||||
|
WINESHADERCNST_FLOAT,
|
||||||
/* the constant for this register isn't a float */
|
StartRegister,
|
||||||
WARN("(%p) : Caller requested a float where stateblock (%p) entry is a %s. Returning D3DERR_INVALIDCALL\n", This, This->updateStateBlock,
|
Vector4fCount,
|
||||||
This->updateStateBlock->vertexShaderConstantT[i] == WINESHADERCNST_BOOL ? "boolean" : "integer");
|
4 * sizeof(*pConstantData));
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GET_SHADER_CONSTANT(vertexShaderConstantF, Vector4fCount, 4);
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantN(IWineD3DDevice *iface, UINT StartRegister, UINT VectorNCount){
|
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantN(IWineD3DDevice *iface, UINT StartRegister, UINT VectorNCount){
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
return IWineD3DDeviceImpl_SetVertexShaderConstant(iface,
|
||||||
int i;
|
NULL,
|
||||||
/* populate the bitmap that says which constant type we should load */
|
NULL,
|
||||||
for (i = StartRegister; i < StartRegister + VectorNCount; ++i) {
|
WINESHADERCNST_NONE,
|
||||||
This->updateStateBlock->changed.vertexShaderConstants[i] = TRUE;
|
StartRegister,
|
||||||
This->updateStateBlock->set.vertexShaderConstants[i] = TRUE;
|
VectorNCount,
|
||||||
This->updateStateBlock->vertexShaderConstantT[i] = WINESHADERCNST_NONE;
|
0);
|
||||||
TRACE("(%p) : Setting vsf %d\n", This, i);
|
|
||||||
}
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SET_SHADER_CONSTANT
|
|
||||||
#undef GET_SHADER_CONSTANT
|
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader *pShader) {
|
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader *pShader) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
IWineD3DPixelShader *oldShader = This->updateStateBlock->pixelShader;
|
IWineD3DPixelShader *oldShader = This->updateStateBlock->pixelShader;
|
||||||
|
@ -3979,150 +3975,141 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface, IWineD3D
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GET_SHADER_CONSTANT(_pixelshaderconstant, _count, _sizecount) \
|
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstant(IWineD3DDevice *iface, void *dstData, const void *srcData, UINT type, UINT start, UINT count, UINT registersize) {
|
||||||
count = min(_count, MAX_PSHADER_CONSTANTS - (StartRegister + 1)); \
|
|
||||||
if (NULL == pConstantData || count < 0 /* || _count != count */ ) \
|
|
||||||
return D3DERR_INVALIDCALL; \
|
|
||||||
memcpy(pConstantData, This->updateStateBlock->_pixelshaderconstant + (StartRegister * _sizecount), count * (sizeof(*pConstantData) * _sizecount)); \
|
|
||||||
|
|
||||||
|
|
||||||
#define SET_SHADER_CONSTANT(_pixelshaderconstant, _count, _sizecount) \
|
|
||||||
int count = min(_count, MAX_PSHADER_CONSTANTS - (StartRegister + 1)); \
|
|
||||||
if (NULL == pConstantData || count < 0 /* || _count != count */ ) \
|
|
||||||
return D3DERR_INVALIDCALL; \
|
|
||||||
memcpy(This->updateStateBlock->_pixelshaderconstant + (StartRegister * _sizecount), pConstantData, count * (sizeof(*pConstantData) * _sizecount));
|
|
||||||
|
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, CONST BOOL *pConstantData, UINT BoolCount) {
|
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
int cnt = min(count, MAX_PSHADER_CONSTANTS - (start + 1));
|
||||||
|
|
||||||
SET_SHADER_CONSTANT(pixelShaderConstantB, BoolCount, 1);
|
TRACE("(iface %p, dstData %p, srcData %p, type %d, start %d, count %d, registersize %d)\n",
|
||||||
|
iface, dstData, srcData, type, start, count, registersize);
|
||||||
|
|
||||||
/* populate the bitmap that says which constant type we should load */
|
if (type != WINESHADERCNST_NONE) {
|
||||||
for (i = StartRegister; i < BoolCount + StartRegister; ++i) {
|
if (srcData == NULL || cnt < 0) {
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CopyMemory((char *)dstData + (start * registersize), srcData, cnt * registersize);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = start; i < cnt + start; ++i) {
|
||||||
This->updateStateBlock->changed.pixelShaderConstants[i] = TRUE;
|
This->updateStateBlock->changed.pixelShaderConstants[i] = TRUE;
|
||||||
This->updateStateBlock->set.pixelShaderConstants[i] = TRUE;
|
This->updateStateBlock->set.pixelShaderConstants[i] = TRUE;
|
||||||
This->updateStateBlock->pixelShaderConstantT[i] = WINESHADERCNST_BOOL;
|
This->updateStateBlock->pixelShaderConstantT[i] = type;
|
||||||
TRACE("(%p) : Setting psb %d to %d\n", This->updateStateBlock, i, pConstantData[i - StartRegister]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstant(IWineD3DDevice *iface, void *dstData, const void *srcData, UINT type, UINT start, UINT count, UINT registersize) {
|
||||||
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
int cnt = min(count, MAX_PSHADER_CONSTANTS - (start + 1));
|
||||||
|
|
||||||
|
TRACE("(iface %p, dstData %p, srcData %p, type %d, start %d, count %d, registersize %d)\n",
|
||||||
|
iface, dstData, srcData, type, start, count, registersize);
|
||||||
|
|
||||||
|
/* Verify that the requested shader constant was populated with the correct type */
|
||||||
|
for (i = start; i < cnt + start; ++i) {
|
||||||
|
if (This->updateStateBlock->pixelShaderConstantT[i] != type) {
|
||||||
|
TRACE("(%p) : Caller requested 0x%x while type is 0x%x. Returning D3DERR_INVALIDCALL\n",
|
||||||
|
This, type, This->updateStateBlock->pixelShaderConstantT[i]);
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dstData == NULL || cnt < 0) {
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CopyMemory(dstData, (char *)srcData + (start * registersize), cnt * registersize);
|
||||||
|
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, CONST BOOL *pConstantData, UINT BoolCount) {
|
||||||
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
|
||||||
|
return IWineD3DDeviceImpl_SetPixelShaderConstant(iface,
|
||||||
|
This->updateStateBlock->pixelShaderConstantB,
|
||||||
|
pConstantData,
|
||||||
|
WINESHADERCNST_BOOL,
|
||||||
|
StartRegister,
|
||||||
|
BoolCount,
|
||||||
|
sizeof(*pConstantData));
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, BOOL *pConstantData, UINT BoolCount) {
|
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, BOOL *pConstantData, UINT BoolCount) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i, count;
|
|
||||||
|
|
||||||
/* verify that the requested shader constant was populated with a integer */
|
return IWineD3DDeviceImpl_GetPixelShaderConstant(iface,
|
||||||
for (i = StartRegister; i < BoolCount; ++i) {
|
pConstantData,
|
||||||
if (WINESHADERCNST_BOOL != This->updateStateBlock->pixelShaderConstantT[i]) {
|
This->updateStateBlock->pixelShaderConstantB,
|
||||||
|
WINESHADERCNST_BOOL,
|
||||||
/* the constant for this register isn't a boolean */
|
StartRegister,
|
||||||
WARN("(%p) : Caller requested a integer where stateblock (%p) entry is a %s. Returning D3DERR_INVALIDCALL\n", This, This->updateStateBlock,
|
BoolCount,
|
||||||
WINESHADERCNST_INTEGER == This->updateStateBlock->vertexShaderConstantT[i] ? "integer" : "float");
|
sizeof(*pConstantData));
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GET_SHADER_CONSTANT(pixelShaderConstantB, BoolCount, 1);
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, CONST int *pConstantData, UINT Vector4iCount) {
|
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, CONST int *pConstantData, UINT Vector4iCount) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i;
|
|
||||||
|
|
||||||
SET_SHADER_CONSTANT(pixelShaderConstantI, Vector4iCount, 4);
|
return IWineD3DDeviceImpl_SetPixelShaderConstant(iface,
|
||||||
|
This->updateStateBlock->pixelShaderConstantI,
|
||||||
/* populate the bitmap that says which constant type we should load */
|
pConstantData,
|
||||||
for (i = StartRegister; i < Vector4iCount + StartRegister; ++i) {
|
WINESHADERCNST_INTEGER,
|
||||||
This->updateStateBlock->changed.pixelShaderConstants[i] = TRUE;
|
StartRegister,
|
||||||
This->updateStateBlock->set.pixelShaderConstants[i] = TRUE;
|
Vector4iCount,
|
||||||
This->updateStateBlock->pixelShaderConstantT[i] = WINESHADERCNST_INTEGER;
|
4 * sizeof(*pConstantData));
|
||||||
TRACE("(%p) : Setting psb %d to %d\n", This->updateStateBlock, i, pConstantData[i - StartRegister]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, int *pConstantData, UINT Vector4iCount) {
|
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, int *pConstantData, UINT Vector4iCount) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i, count;
|
|
||||||
|
return IWineD3DDeviceImpl_GetPixelShaderConstant(iface,
|
||||||
/* verify that the requested shader constant was populated with a integer */
|
pConstantData,
|
||||||
for (i = StartRegister; i < Vector4iCount; ++i) {
|
This->updateStateBlock->pixelShaderConstantI,
|
||||||
if (WINESHADERCNST_INTEGER != This->updateStateBlock->pixelShaderConstantT[i]) {
|
WINESHADERCNST_INTEGER,
|
||||||
|
StartRegister,
|
||||||
/* the constant for this register isn't a integer */
|
Vector4iCount,
|
||||||
WARN("(%p) : Caller requested a integer where stateblock (%p) entry is a %s. Returning D3DERR_INVALIDCALL\n", This, This->updateStateBlock,
|
4 * sizeof(*pConstantData));
|
||||||
WINESHADERCNST_BOOL == This->updateStateBlock->vertexShaderConstantT[i] ? "boolean" : "float");
|
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GET_SHADER_CONSTANT(pixelShaderConstantI, Vector4iCount, 4);
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, CONST float *pConstantData, UINT Vector4fCount) {
|
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, CONST float *pConstantData, UINT Vector4fCount) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i;
|
|
||||||
SET_SHADER_CONSTANT(pixelShaderConstantF, Vector4fCount, 4);
|
return IWineD3DDeviceImpl_SetPixelShaderConstant(iface,
|
||||||
|
This->updateStateBlock->pixelShaderConstantF,
|
||||||
/* populate the bitmap that says which constant type we should load */
|
pConstantData,
|
||||||
for (i = StartRegister; i < Vector4fCount + StartRegister; ++i) {
|
WINESHADERCNST_FLOAT,
|
||||||
This->updateStateBlock->changed.pixelShaderConstants[i] = TRUE;
|
StartRegister,
|
||||||
This->updateStateBlock->set.pixelShaderConstants[i] = TRUE;
|
Vector4fCount,
|
||||||
This->updateStateBlock->pixelShaderConstantT[i] = WINESHADERCNST_FLOAT;
|
4 * sizeof(*pConstantData));
|
||||||
TRACE("(%p) : Setting psb %d to %f\n", This->updateStateBlock, i, pConstantData[i - StartRegister]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, float *pConstantData, UINT Vector4fCount) {
|
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, float *pConstantData, UINT Vector4fCount) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
int i, count;
|
|
||||||
|
|
||||||
/* verify that the requested shader constant was populated with a integer */
|
return IWineD3DDeviceImpl_GetPixelShaderConstant(iface,
|
||||||
for (i = StartRegister; i < Vector4fCount; ++i) {
|
pConstantData,
|
||||||
if (WINESHADERCNST_FLOAT != This->updateStateBlock->pixelShaderConstantT[i]) {
|
This->updateStateBlock->pixelShaderConstantF,
|
||||||
|
WINESHADERCNST_FLOAT,
|
||||||
/* the constant for this register isn't a float */
|
StartRegister,
|
||||||
WARN("(%p) : Caller requested a integer where stateblock (%p) entry is a %s. Returning D3DERR_INVALIDCALL\n", This, This->updateStateBlock,
|
Vector4fCount,
|
||||||
WINESHADERCNST_BOOL == This->updateStateBlock->vertexShaderConstantT[i] ? "boolean" : "integer");
|
4 * sizeof(*pConstantData));
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GET_SHADER_CONSTANT(pixelShaderConstantF, Vector4fCount, 4);
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantN(IWineD3DDevice *iface, UINT StartRegister, UINT VectorNCount){
|
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantN(IWineD3DDevice *iface, UINT StartRegister, UINT VectorNCount){
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
return IWineD3DDeviceImpl_SetPixelShaderConstant(iface,
|
||||||
int i;
|
NULL,
|
||||||
|
NULL,
|
||||||
/* populate the bitmap that says which constant type we should load */
|
WINESHADERCNST_NONE,
|
||||||
for (i = StartRegister; i < StartRegister + VectorNCount; ++i) {
|
StartRegister,
|
||||||
This->updateStateBlock->changed.pixelShaderConstants[i] = TRUE;
|
VectorNCount,
|
||||||
This->updateStateBlock->set.pixelShaderConstants[i] = TRUE;
|
0);
|
||||||
This->updateStateBlock->pixelShaderConstantT[i] = WINESHADERCNST_NONE;
|
|
||||||
TRACE("(%p) : Setting vsf %d\n", This, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SET_SHADER_CONSTANT
|
|
||||||
#undef GET_SHADER_CONSTANT
|
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IWineD3DVertexBuffer* pDestBuffer, IWineD3DVertexBuffer* pVertexDecl, DWORD Flags) {
|
HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IWineD3DVertexBuffer* pDestBuffer, IWineD3DVertexBuffer* pVertexDecl, DWORD Flags) {
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
FIXME("(%p) : stub\n", This);
|
FIXME("(%p) : stub\n", This);
|
||||||
|
@ -6456,6 +6443,8 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
|
||||||
IWineD3DDeviceImpl_GetPaletteEntries,
|
IWineD3DDeviceImpl_GetPaletteEntries,
|
||||||
IWineD3DDeviceImpl_SetPixelShader,
|
IWineD3DDeviceImpl_SetPixelShader,
|
||||||
IWineD3DDeviceImpl_GetPixelShader,
|
IWineD3DDeviceImpl_GetPixelShader,
|
||||||
|
IWineD3DDeviceImpl_SetPixelShaderConstant,
|
||||||
|
IWineD3DDeviceImpl_GetPixelShaderConstant,
|
||||||
IWineD3DDeviceImpl_SetPixelShaderConstantB,
|
IWineD3DDeviceImpl_SetPixelShaderConstantB,
|
||||||
IWineD3DDeviceImpl_GetPixelShaderConstantB,
|
IWineD3DDeviceImpl_GetPixelShaderConstantB,
|
||||||
IWineD3DDeviceImpl_SetPixelShaderConstantI,
|
IWineD3DDeviceImpl_SetPixelShaderConstantI,
|
||||||
|
@ -6487,6 +6476,8 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
|
||||||
IWineD3DDeviceImpl_GetVertexDeclaration,
|
IWineD3DDeviceImpl_GetVertexDeclaration,
|
||||||
IWineD3DDeviceImpl_SetVertexShader,
|
IWineD3DDeviceImpl_SetVertexShader,
|
||||||
IWineD3DDeviceImpl_GetVertexShader,
|
IWineD3DDeviceImpl_GetVertexShader,
|
||||||
|
IWineD3DDeviceImpl_SetVertexShaderConstant,
|
||||||
|
IWineD3DDeviceImpl_GetVertexShaderConstant,
|
||||||
IWineD3DDeviceImpl_SetVertexShaderConstantB,
|
IWineD3DDeviceImpl_SetVertexShaderConstantB,
|
||||||
IWineD3DDeviceImpl_GetVertexShaderConstantB,
|
IWineD3DDeviceImpl_GetVertexShaderConstantB,
|
||||||
IWineD3DDeviceImpl_SetVertexShaderConstantI,
|
IWineD3DDeviceImpl_SetVertexShaderConstantI,
|
||||||
|
|
|
@ -326,6 +326,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
|
||||||
STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE;
|
STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE;
|
||||||
STDMETHOD(SetPixelShader)(THIS_ struct IWineD3DPixelShader *pShader) PURE;
|
STDMETHOD(SetPixelShader)(THIS_ struct IWineD3DPixelShader *pShader) PURE;
|
||||||
STDMETHOD(GetPixelShader)(THIS_ struct IWineD3DPixelShader **ppShader) PURE;
|
STDMETHOD(GetPixelShader)(THIS_ struct IWineD3DPixelShader **ppShader) PURE;
|
||||||
|
STDMETHOD(SetPixelShaderConstant)(THIS_ void *dstData, const void *srcData, UINT type, UINT start, UINT count, UINT countsize);
|
||||||
|
STDMETHOD(GetPixelShaderConstant)(THIS_ void *dstData, const void *srcData, UINT type, UINT start, UINT count, UINT countsize);
|
||||||
STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) PURE;
|
STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) PURE;
|
||||||
STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister, BOOL* pConstantData, UINT BoolCount) PURE;
|
STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister, BOOL* pConstantData, UINT BoolCount) PURE;
|
||||||
STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) PURE;
|
STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) PURE;
|
||||||
|
@ -357,6 +359,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
|
||||||
STDMETHOD(GetVertexDeclaration)(THIS_ struct IWineD3DVertexDeclaration** ppDecl) PURE;
|
STDMETHOD(GetVertexDeclaration)(THIS_ struct IWineD3DVertexDeclaration** ppDecl) PURE;
|
||||||
STDMETHOD(SetVertexShader)(THIS_ struct IWineD3DVertexShader* pShader) PURE;
|
STDMETHOD(SetVertexShader)(THIS_ struct IWineD3DVertexShader* pShader) PURE;
|
||||||
STDMETHOD(GetVertexShader)(THIS_ struct IWineD3DVertexShader** ppShader) PURE;
|
STDMETHOD(GetVertexShader)(THIS_ struct IWineD3DVertexShader** ppShader) PURE;
|
||||||
|
STDMETHOD(SetVertexShaderConstant)(THIS_ void *dstData, const void *srcData, UINT type, UINT start, UINT count, UINT countsize);
|
||||||
|
STDMETHOD(GetVertexShaderConstant)(THIS_ void *dstData, const void *srcData, UINT type, UINT start, UINT count, UINT countsize);
|
||||||
STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) PURE;
|
STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) PURE;
|
||||||
STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister, BOOL* pConstantData, UINT BoolCount) PURE;
|
STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister, BOOL* pConstantData, UINT BoolCount) PURE;
|
||||||
STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) PURE;
|
STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) PURE;
|
||||||
|
@ -456,6 +460,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
|
||||||
#define IWineD3DDevice_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b)
|
#define IWineD3DDevice_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b)
|
||||||
#define IWineD3DDevice_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a)
|
#define IWineD3DDevice_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a)
|
||||||
#define IWineD3DDevice_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a)
|
#define IWineD3DDevice_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a)
|
||||||
|
#define IWineD3DDevice_SetPixelShaderConstant(p,a,b,c,d,e,f); (p)->lpVtbl->SetPixelShaderConstant(p,a,b,c,d,e,f)
|
||||||
|
#define IWineD3DDevice_GetPixelShaderConstant(p,a,b,c,d,e,f); (p)->lpVtbl->GetPixelShaderConstant(p,a,b,c,d,e,f)
|
||||||
#define IWineD3DDevice_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c)
|
#define IWineD3DDevice_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c)
|
||||||
#define IWineD3DDevice_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c)
|
#define IWineD3DDevice_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c)
|
||||||
#define IWineD3DDevice_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c)
|
#define IWineD3DDevice_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c)
|
||||||
|
@ -489,6 +495,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
|
||||||
#define IWineD3DDevice_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a)
|
#define IWineD3DDevice_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a)
|
||||||
#define IWineD3DDevice_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a)
|
#define IWineD3DDevice_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a)
|
||||||
#define IWineD3DDevice_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a)
|
#define IWineD3DDevice_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a)
|
||||||
|
#define IWineD3DDevice_SetVertexShaderConstant(p,a,b,c,d,e,f); (p)->lpVtbl->SetVertexShaderConstant(p,a,b,c,d,e,f)
|
||||||
|
#define IWineD3DDevice_GetVertexShaderConstant(p,a,b,c,d,e,f); (p)->lpVtbl->GetVertexShaderConstant(p,a,b,c,d,e,f)
|
||||||
#define IWineD3DDevice_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c)
|
#define IWineD3DDevice_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c)
|
||||||
#define IWineD3DDevice_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c)
|
#define IWineD3DDevice_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c)
|
||||||
#define IWineD3DDevice_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c)
|
#define IWineD3DDevice_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c)
|
||||||
|
|
Loading…
Reference in New Issue