d3d8: Only test pixel shaders if they are supported.

This commit is contained in:
Stefan Dösinger 2007-07-24 15:43:23 +02:00 committed by Alexandre Julliard
parent 19c574b7e5
commit e70adcd8b6
1 changed files with 61 additions and 52 deletions

View File

@ -854,6 +854,7 @@ static void test_shader(void)
DWORD hPixelShader = 0, hVertexShader = 0;
DWORD hPixelShader2 = 0, hVertexShader2 = 0;
DWORD hTempHandle;
D3DCAPS8 caps;
DWORD data_size;
void *data;
@ -886,6 +887,7 @@ static void test_shader(void)
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", DXGetErrorString8(hr));
if(!pDevice) goto cleanup;
IDirect3DDevice8_GetDeviceCaps(pDevice, &caps);
/* First create a vertex shader */
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, simple_vs, &hVertexShader, 0);
@ -940,6 +942,8 @@ static void test_shader(void)
ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr));
ok(hTempHandle == 0, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, 0);
if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 0))
{
/* The same with a pixel shader */
hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader);
ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
@ -978,22 +982,6 @@ static void test_shader(void)
ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0);
/* What happens if a non-bound shader is deleted? */
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader, 0);
ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader2, 0);
ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_SetVertexShader(pDevice, hVertexShader);
ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader2);
ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr));
ok(hTempHandle == hVertexShader, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, hVertexShader);
hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader);
ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr));
/* Now for pixel shaders */
hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader);
ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader2);
@ -1008,6 +996,27 @@ static void test_shader(void)
ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader);
hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader);
ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr));
}
else
{
skip("Pixel shaders not supported\n");
}
/* What happens if a non-bound shader is deleted? */
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader, 0);
ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader2, 0);
ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_SetVertexShader(pDevice, hVertexShader);
ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader2);
ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr));
hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle);
ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr));
ok(hTempHandle == hVertexShader, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, hVertexShader);
hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader);
ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr));
cleanup:
if(pD3d) IDirect3D8_Release(pD3d);