3282{
3286#if 0
3288{
3289 return float4(
pos, 1.0);
3290}
3291#endif
3292 static const DWORD shader_code[] =
3293 {
3294 0x54580100, 0x0015fffe, 0x42415443, 0x0000001c, 0x0000001f, 0x54580100, 0x00000000, 0x00000000,
3295 0x00000100, 0x0000001c, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
3296 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x000afffe,
3297 0x54494c43, 0x00000004, 0x00000000, 0x3ff00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3298 0x00000000, 0x00000000, 0x0014fffe, 0x434c5846, 0x00000002, 0x10000003, 0x00000001, 0x00000000,
3299 0x00000003, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x10000001, 0x00000001, 0x00000000,
3300 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
3301 };
3302#if 0
3303float f1[2] = { 0.4f, 0.1f };
3307
3309{
3314 int i2;
3315};
3316
3318
3320{
3322 return float4(
pos,
f1[0] +
f1[1] +
b1 * 0.6f +
t);
3323}
3324#endif
3325 static const DWORD shader_code2[] =
3326 {
3327 0x54580100, 0x0074fffe, 0x42415443, 0x0000001c, 0x000001a3, 0x54580100, 0x00000005, 0x0000001c,
3328 0x00000100, 0x000001a0, 0x00000080, 0x00090002, 0x00000001, 0x00000084, 0x00000094, 0x000000a4,
3329 0x00070002, 0x00000002, 0x000000a8, 0x00000000, 0x000000b8, 0x00050002, 0x00000002, 0x000000bc,
3330 0x000000cc, 0x000000ec, 0x000a0002, 0x00000001, 0x000000f0, 0x00000000, 0x00000100, 0x00000002,
3331 0x00000005, 0x00000190, 0x00000000, 0xab003162, 0x00010000, 0x00010001, 0x00000001, 0x00000000,
3332 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xab003262, 0x00010000, 0x00010001, 0x00000002,
3333 0x00000000, 0xab003166, 0x00030000, 0x00010001, 0x00000002, 0x00000000, 0x3ecccccd, 0x00000000,
3334 0x00000000, 0x00000000, 0x3dcccccd, 0x00000000, 0x00000000, 0x00000000, 0xab003266, 0x00030001,
3335 0x00040001, 0x00000001, 0x00000000, 0x62003173, 0xabab0033, 0x00010000, 0x00010001, 0x00000001,
3336 0x00000000, 0xab003366, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab003466, 0x00030001,
3337 0x00040001, 0x00000001, 0x00000000, 0xab003169, 0x00020000, 0x00010001, 0x00000001, 0x00000000,
3338 0xab003269, 0x00020000, 0x00010001, 0x00000001, 0x00000000, 0x00000103, 0x00000108, 0x00000118,
3339 0x0000011c, 0x0000012c, 0x00000130, 0x00000140, 0x00000144, 0x00000154, 0x00000158, 0x00000005,
3340 0x00080001, 0x00050001, 0x00000168, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
3341 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x0062fffe, 0x54494c43,
3342 0x00000030, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3343 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3344 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3345 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3346 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3347 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3348 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3349 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3350 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3351 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3352 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3353 0x00000000, 0x40000000, 0x3fe33333, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3354 0x00000000, 0x0059fffe, 0x434c5846, 0x00000008, 0xa0500001, 0x00000002, 0x00000000, 0x00000002,
3355 0x0000001c, 0x00000000, 0x00000002, 0x00000020, 0x00000000, 0x00000007, 0x00000000, 0xa0500001,
3356 0x00000002, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000002, 0x00000028, 0x00000000,
3357 0x00000007, 0x00000004, 0xa0400001, 0x00000002, 0x00000000, 0x00000007, 0x00000004, 0x00000000,
3358 0x00000002, 0x00000010, 0x00000000, 0x00000007, 0x00000000, 0xa0400001, 0x00000002, 0x00000000,
3359 0x00000002, 0x00000014, 0x00000000, 0x00000002, 0x00000018, 0x00000000, 0x00000007, 0x00000001,
3360 0xa0500001, 0x00000002, 0x00000000, 0x00000002, 0x00000024, 0x00000000, 0x00000001, 0x0000002c,
3361 0x00000000, 0x00000007, 0x00000002, 0xa0400001, 0x00000002, 0x00000000, 0x00000007, 0x00000002,
3362 0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000007, 0x00000004, 0xa0400001, 0x00000002,
3363 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000004,
3364 0x00000003, 0x10000003, 0x00000001, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000004,
3365 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
3366 };
3367 IDirect3DVolumeTexture9 *volume_texture;
3368 IDirect3DCubeTexture9 *cube_texture;
3376 ID3DXTextureShader *tx;
3381 IDirect3D9 *d3d;
3386
3389
3390 tx = (void *)0xdeadbeef;
3393 ok(tx == (
void *)0xdeadbeef,
"Unexpected pointer %p.\n", tx);
3394
3395 tx = (void *)0xdeadbeef;
3398 ok(tx == (
void *)0xdeadbeef,
"Unexpected pointer %p.\n", tx);
3399
3400 tx = (void *)0xdeadbeef;
3403 ok(tx == (
void *)0xdeadbeef,
"Unexpected pointer %p.\n", tx);
3404
3405 tx = (void *)0xdeadbeef;
3408 ok(tx == (
void *)0xdeadbeef,
"Unexpected pointer %p.\n", tx);
3409
3412
3413 hr = tx->lpVtbl->GetFunction(tx, &
buffer);
3415
3416 hr = tx->lpVtbl->GetFunction(tx, &buffer2);
3418 ok(buffer2 ==
buffer,
"Unexpected buffer object.\n");
3420
3422 ok(
size == 224,
"Unexpected buffer size %lu.\n",
size);
3423
3425
3426
3427 hr = tx->lpVtbl->GetConstantBuffer(tx, &
buffer);
3429 ok(
SUCCEEDED(
hr),
"Failed to get texture shader constant buffer.\n");
3430
3432 {
3434 ok(!
size,
"Unexpected buffer size %lu.\n",
size);
3435
3437 }
3438
3439 hr = tx->lpVtbl->GetDesc(tx, &ctab_desc);
3441 ok(
hr ==
S_OK,
"Failed to get constant description, hr %#lx.\n",
hr);
3444
3445
3446 h = tx->lpVtbl->GetConstant(tx,
NULL, 0);
3447 ok(!
h,
"Unexpected handle %p.\n",
h);
3448
3451 {
3452 skip(
"Couldn't create application window.\n");
3453 IUnknown_Release(tx);
3454 return;
3455 }
3457 if (!d3d)
3458 {
3459 skip(
"Couldn't create IDirect3D9 object.\n");
3461 IUnknown_Release(tx);
3462 return;
3463 }
3464
3471 {
3472 skip(
"Failed to create IDirect3DDevice9 object, hr %#lx.\n",
hr);
3475 IUnknown_Release(tx);
3476 return;
3477 }
3478
3480
3484
3487
3491 for (
y = 0;
y < 256; ++
y)
3492 {
3493 for (
x = 0;
x < 256; ++
x)
3494 {
3495 unsigned int expected = 0xff000000 |
x << 16 |
y << 8;
3496
3498
3500 }
3501 }
3504
3506
3508 {
3509 skip(
"Cube textures not supported, skipping tests.\n");
3511 }
3512
3514 &cube_texture,
NULL);
3516
3521
3523 {
3524 skip(
"Volume textures not supported, skipping test.\n");
3526 }
3530
3534
3538 for (
z = 0;
z < 64; ++
z)
3539 {
3540 for (
y = 0;
y < 64; ++
y)
3541 {
3542 for (
x = 0;
x < 64; ++
x)
3543 {
3544 unsigned int expected = 0xff000000 | ((
x * 4 + 2) << 16) | ((
y * 4 + 2) << 8) | (
z * 4 + 2);
3546
3550 }
3551 }
3552 }
3555
3557
3558 IUnknown_Release(tx);
3559
3560
3567
3568 hr = tx->lpVtbl->GetConstantBuffer(tx, &
buffer);
3570 ok(
SUCCEEDED(
hr),
"Failed to get texture shader constant buffer.\n");
3572 {
3573 skip(
"Texture shaders not supported, skipping further tests.\n");
3574 IUnknown_Release(tx);
3575 return;
3576 }
3577
3579 ok(
size == 176,
"Unexpected buffer size %lu.\n",
size);
3580
3581 hr = tx->lpVtbl->GetDesc(tx, &ctab_desc);
3582 ok(
hr ==
S_OK,
"Failed to get constant description, hr %#lx.\n",
hr);
3584
3585 h = tx->lpVtbl->GetConstant(tx,
NULL, 0);
3586 ok(!!
h,
"Unexpected handle %p.\n",
h);
3587 hr = tx->lpVtbl->GetConstantDesc(tx,
h, &const_desc, &
count);
3589 ok(!
strcmp(const_desc.
Name,
"b1"),
"Unexpected name %s.\n", const_desc.
Name);
3593
3594 h = tx->lpVtbl->GetConstant(tx,
NULL, 1);
3595 ok(!!
h,
"Unexpected handle %p.\n",
h);
3596 hr = tx->lpVtbl->GetConstantDesc(tx,
h, &const_desc, &
count);
3598 ok(!
strcmp(const_desc.
Name,
"b2"),
"Unexpected name %s.\n", const_desc.
Name);
3602
3603 h = tx->lpVtbl->GetConstant(tx,
NULL, 2);
3604 ok(!!
h,
"Unexpected handle %p.\n",
h);
3605 hr = tx->lpVtbl->GetConstantDesc(tx,
h, &const_desc, &
count);
3607 ok(!
strcmp(const_desc.
Name,
"f1"),
"Unexpected name %s.\n", const_desc.
Name);
3611 ok(const_desc.
Elements == 2,
"Unexpected elements count %u.\n", const_desc.
Elements);
3612
3613
3614 h2 = tx->lpVtbl->GetConstantElement(tx,
h, 0);
3615 ok(!!h2,
"Unexpected handle %p.\n",
h);
3616 hr = tx->lpVtbl->GetConstantDesc(tx, h2, &const_desc, &
count);
3618 ok(!
strcmp(const_desc.
Name,
"f1"),
"Unexpected name %s.\n", const_desc.
Name);
3622 ok(const_desc.
Elements == 1,
"Unexpected elements count %u.\n", const_desc.
Elements);
3623
3624 h2 = tx->lpVtbl->GetConstantElement(tx,
h, 1);
3625 ok(!!h2,
"Unexpected handle %p.\n",
h);
3626 hr = tx->lpVtbl->GetConstantDesc(tx, h2, &const_desc, &
count);
3628 ok(!
strcmp(const_desc.
Name,
"f1"),
"Unexpected name %s.\n", const_desc.
Name);
3632 ok(const_desc.
Elements == 1,
"Unexpected elements count %u.\n", const_desc.
Elements);
3633
3634 h2 = tx->lpVtbl->GetConstantElement(tx,
h, 2);
3635 ok(!h2,
"Unexpected handle %p.\n",
h);
3636
3637 h = tx->lpVtbl->GetConstant(tx,
NULL, 3);
3638 ok(!!
h,
"Unexpected handle %p.\n",
h);
3639 hr = tx->lpVtbl->GetConstantDesc(tx,
h, &const_desc, &
count);
3641 ok(!
strcmp(const_desc.
Name,
"f2"),
"Unexpected name %s.\n", const_desc.
Name);
3645
3646
3647 h = tx->lpVtbl->GetConstant(tx,
NULL, 4);
3648 ok(!!
h,
"Unexpected handle %p.\n",
h);
3649 hr = tx->lpVtbl->GetConstantDesc(tx,
h, &const_desc, &
count);
3651 ok(!
strcmp(const_desc.
Name,
"s1"),
"Unexpected name %s.\n", const_desc.
Name);
3657
3658 h2 = tx->lpVtbl->GetConstant(tx,
h, 0);
3659 ok(!!h2,
"Unexpected handle %p.\n",
h);
3660 hr = tx->lpVtbl->GetConstantDesc(tx, h2, &const_desc, &
count);
3662 ok(!
strcmp(const_desc.
Name,
"b3"),
"Unexpected name %s.\n", const_desc.
Name);
3666 ok(const_desc.
Elements == 1,
"Unexpected elements count %u.\n", const_desc.
Elements);
3667
3668 h2 = tx->lpVtbl->GetConstant(tx,
h, 1);
3669 ok(!!h2,
"Unexpected handle %p.\n",
h);
3670 hr = tx->lpVtbl->GetConstantDesc(tx, h2, &const_desc, &
count);
3672 ok(!
strcmp(const_desc.
Name,
"f3"),
"Unexpected name %s.\n", const_desc.
Name);
3676 ok(const_desc.
Elements == 1,
"Unexpected elements count %u.\n", const_desc.
Elements);
3677
3678 h2 = tx->lpVtbl->GetConstant(tx,
h, 10);
3679 ok(!h2,
"Unexpected handle %p.\n",
h);
3680
3682
3687 if (tx)
3688 IUnknown_Release(tx);
3689}
HRESULT WINAPI D3DXFillCubeTextureTX(struct IDirect3DCubeTexture9 *cube, ID3DXTextureShader *texture_shader)
HRESULT WINAPI D3DXFillTextureTX(struct IDirect3DTexture9 *texture, ID3DXTextureShader *texture_shader)
HRESULT WINAPI D3DXCreateTextureShader(const DWORD *function, ID3DXTextureShader **texture_shader)
HRESULT WINAPI D3DXFillVolumeTextureTX(struct IDirect3DVolumeTexture9 *texture, ID3DXTextureShader *texture_shader)
static void cleanup(void)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLfloat GLfloat GLfloat GLfloat h
static CRYPT_DATA_BLOB b3[]
static CRYPT_DATA_BLOB b2[]
static CRYPT_DATA_BLOB b1[]
static const DWORD shader_invalid[]
static const DWORD shader_empty[]
static const DWORD shader_zero[]
D3DXPARAMETER_CLASS Class
D3DXREGISTER_SET RegisterSet