mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:50:49 +00:00
d3dx9: Partially implement D3DXFillCubeTextureTX().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
1908d0b385
commit
94da4fc44e
|
@ -2694,6 +2694,30 @@ void WINAPI texture_shader_fill_2d(D3DXVECTOR4 *out, const D3DXVECTOR2 *texcoord
|
|||
d3dx_evaluate_parameter(shader->eval, ¶m, out);
|
||||
}
|
||||
|
||||
void WINAPI texture_shader_fill_3d(D3DXVECTOR4 *out, const D3DXVECTOR3 *texcoord,
|
||||
const D3DXVECTOR3 *texelsize, void *data)
|
||||
{
|
||||
struct d3dx9_texture_shader *shader = data;
|
||||
struct d3dx_parameter param = { 0 };
|
||||
float *inputs;
|
||||
|
||||
inputs = (float *)shader->eval->pres.regs.tables[PRES_REGTAB_INPUT];
|
||||
|
||||
*(inputs++) = texcoord->x;
|
||||
*(inputs++) = texcoord->y;
|
||||
*(inputs++) = texcoord->z;
|
||||
*(inputs++) = 0.0f;
|
||||
|
||||
*(inputs++) = texelsize->x;
|
||||
*(inputs++) = texelsize->y;
|
||||
*(inputs++) = texelsize->z;
|
||||
*(inputs++) = 0.0f;
|
||||
|
||||
param.type = D3DXPT_FLOAT;
|
||||
param.bytes = 4 * sizeof(float);
|
||||
d3dx_evaluate_parameter(shader->eval, ¶m, out);
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DXFillTextureTX(struct IDirect3DTexture9 *texture, ID3DXTextureShader *texture_shader)
|
||||
{
|
||||
struct d3dx9_texture_shader *shader = unsafe_impl_from_ID3DXTextureShader(texture_shader);
|
||||
|
@ -2703,6 +2727,15 @@ HRESULT WINAPI D3DXFillTextureTX(struct IDirect3DTexture9 *texture, ID3DXTexture
|
|||
return D3DXFillTexture(texture, texture_shader_fill_2d, shader);
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DXFillCubeTextureTX(struct IDirect3DCubeTexture9 *cube, ID3DXTextureShader *texture_shader)
|
||||
{
|
||||
struct d3dx9_texture_shader *shader = unsafe_impl_from_ID3DXTextureShader(texture_shader);
|
||||
|
||||
TRACE("cube %p, texture_shader %p.\n", cube, texture_shader);
|
||||
|
||||
return D3DXFillCubeTexture(cube, texture_shader_fill_3d, shader);
|
||||
}
|
||||
|
||||
static unsigned int get_instr_length(const DWORD *byte_code, unsigned int major, unsigned int minor)
|
||||
{
|
||||
DWORD opcode = *byte_code & 0xffff;
|
||||
|
|
|
@ -2595,55 +2595,8 @@ float4 main(float3 pos : POSITION, float3 size : PSIZE) : COLOR
|
|||
ok(SUCCEEDED(hr), "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
hr = D3DXFillCubeTextureTX(cube_texture, tx);
|
||||
todo_wine
|
||||
ok(SUCCEEDED(hr), "Got unexpected hr %#lx.\n", hr);
|
||||
|
||||
for (z = 0; z < 6; ++z)
|
||||
{
|
||||
static const char * const mapping[6][3] =
|
||||
{
|
||||
{"-x", "-y", "1"},
|
||||
{"+x", "-y", "0"},
|
||||
{"+y", "1", "+x"},
|
||||
{"-y", "0", "+x"},
|
||||
{"1", "-y", "+x"},
|
||||
{"0", "-y", "-x"},
|
||||
};
|
||||
|
||||
hr = IDirect3DCubeTexture9_LockRect(cube_texture, z, 0, &lr, NULL, D3DLOCK_READONLY);
|
||||
ok(SUCCEEDED(hr), "Locking texture failed, hr %#lx.\n", hr);
|
||||
data = lr.pBits;
|
||||
for (y = 0; y < 256; ++y)
|
||||
{
|
||||
for (x = 0; x < 256; ++x)
|
||||
{
|
||||
unsigned int color = data[y * lr.Pitch / sizeof(*data) + x];
|
||||
unsigned int expected = 0xff000000;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
int component;
|
||||
|
||||
if (mapping[z][i][0] == '0')
|
||||
component = 0;
|
||||
else if (mapping[z][i][0] == '1')
|
||||
component = 255;
|
||||
else
|
||||
component = mapping[z][i][1] == 'x' ? x * 2 - 255 : y * 2 - 255;
|
||||
if (mapping[z][i][0] == '-')
|
||||
component = -component;
|
||||
expected |= max(component, 0) << i * 8;
|
||||
}
|
||||
todo_wine
|
||||
ok(compare_color(color, expected, 1), "Unexpected color %08x at (%u, %u, %u).\n",
|
||||
color, x, y, z);
|
||||
}
|
||||
}
|
||||
hr = IDirect3DCubeTexture9_UnlockRect(cube_texture, z, 0);
|
||||
ok(SUCCEEDED(hr), "Unlocking texture failed, hr %#lx.\n", hr);
|
||||
}
|
||||
|
||||
compare_cube_texture(cube_texture, fillfunc_cube_coord, 1);
|
||||
IDirect3DCubeTexture9_Release(cube_texture);
|
||||
|
||||
if (!(caps.TextureCaps & D3DPTEXTURECAPS_VOLUMEMAP) || caps.MaxVolumeExtent < 64)
|
||||
|
|
|
@ -1723,12 +1723,6 @@ HRESULT WINAPI D3DXFillCubeTexture(struct IDirect3DCubeTexture9 *texture, LPD3DX
|
|||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DXFillCubeTextureTX(struct IDirect3DCubeTexture9 *texture, ID3DXTextureShader *texture_shader)
|
||||
{
|
||||
FIXME("texture %p, texture_shader %p stub.\n", texture, texture_shader);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DXFillVolumeTexture(struct IDirect3DVolumeTexture9 *texture, LPD3DXFILL3D function, void *funcdata)
|
||||
{
|
||||
DWORD miplevels;
|
||||
|
|
Loading…
Reference in a new issue