Commit 86bc7dd1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3dx9: Partially implement D3DXFillTextureTX().

parent bd2a787d
......@@ -1728,16 +1728,20 @@ HRESULT d3dx_evaluate_parameter(struct d3dx_param_eval *peval, const struct d3dx
HRESULT hr;
unsigned int i;
unsigned int elements, elements_param, elements_table;
BOOL is_dirty;
float *oc;
TRACE("peval %p, param %p, param_value %p.\n", peval, param, param_value);
if (is_const_tab_input_dirty(&peval->pres.inputs, ULONG64_MAX))
if ((is_dirty = is_const_tab_input_dirty(&peval->pres.inputs, ULONG64_MAX)))
{
set_constants(&peval->pres.regs, &peval->pres.inputs,
next_update_version(peval->version_counter),
NULL, NULL, peval->param_type, FALSE, FALSE);
next_update_version(peval->version_counter), NULL, NULL,
peval->param_type, FALSE, FALSE);
}
if (is_dirty || peval->pres.regs.table_sizes[PRES_REGTAB_INPUT])
{
if (FAILED(hr = execute_preshader(&peval->pres)))
return hr;
}
......
......@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "d3dx9_private.h"
#include "d3dcommon.h"
......@@ -2615,6 +2616,15 @@ static const struct ID3DXTextureShaderVtbl d3dx9_texture_shader_vtbl =
d3dx9_texture_shader_SetMatrixTransposePointerArray
};
static inline struct d3dx9_texture_shader *unsafe_impl_from_ID3DXTextureShader(ID3DXTextureShader *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3dx9_texture_shader_vtbl);
return impl_from_ID3DXTextureShader(iface);
}
HRESULT WINAPI D3DXCreateTextureShader(const DWORD *function, ID3DXTextureShader **texture_shader)
{
struct d3dx9_texture_shader *object;
......@@ -2660,6 +2670,39 @@ HRESULT WINAPI D3DXCreateTextureShader(const DWORD *function, ID3DXTextureShader
return D3D_OK;
}
void WINAPI texture_shader_fill_2d(D3DXVECTOR4 *out, const D3DXVECTOR2 *texcoord,
const D3DXVECTOR2 *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++) = 0.0f;
*(inputs++) = 0.0f;
*(inputs++) = texelsize->x;
*(inputs++) = texelsize->y;
*(inputs++) = 0.0f;
*(inputs++) = 0.0f;
param.type = D3DXPT_FLOAT;
param.bytes = 4 * sizeof(float);
d3dx_evaluate_parameter(shader->eval, &param, out);
}
HRESULT WINAPI D3DXFillTextureTX(struct IDirect3DTexture9 *texture, ID3DXTextureShader *texture_shader)
{
struct d3dx9_texture_shader *shader = unsafe_impl_from_ID3DXTextureShader(texture_shader);
TRACE("texture %p, texture_shader %p.\n", texture, texture_shader);
return D3DXFillTexture(texture, texture_shader_fill_2d, shader);
}
static unsigned int get_instr_length(const DWORD *byte_code, unsigned int major, unsigned int minor)
{
DWORD opcode = *byte_code & 0xffff;
......
......@@ -2527,7 +2527,6 @@ float4 main(float3 pos : POSITION, float3 size : PSIZE) : COLOR
ok(SUCCEEDED(hr), "Got unexpected hr %#lx.\n", hr);
hr = D3DXFillTextureTX(texture, tx);
todo_wine
ok(SUCCEEDED(hr), "Got unexpected hr %#lx.\n", hr);
hr = IDirect3DTexture9_LockRect(texture, 0, &lr, NULL, D3DLOCK_READONLY);
......@@ -2541,7 +2540,6 @@ float4 main(float3 pos : POSITION, float3 size : PSIZE) : COLOR
/* The third position coordinate is apparently undefined for 2D textures. */
unsigned int color = data[y * lr.Pitch / sizeof(*data) + x] & 0xffffff00;
todo_wine
ok(compare_color(color, expected, 1), "Unexpected color %08x at (%u, %u).\n", color, x, y);
}
}
......
......@@ -1382,12 +1382,6 @@ HRESULT WINAPI D3DXFillTexture(struct IDirect3DTexture9 *texture, LPD3DXFILL2D f
return D3D_OK;
}
HRESULT WINAPI D3DXFillTextureTX(struct IDirect3DTexture9 *texture, ID3DXTextureShader *texture_shader)
{
FIXME("texture %p, texture_shader %p stub.\n", texture, texture_shader);
return E_NOTIMPL;
}
HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *src_data,
UINT src_data_size, UINT size, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool,
DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *src_info,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment