d3d8: Only test pixel shaders if they are supported.
This commit is contained in:
parent
19c574b7e5
commit
e70adcd8b6
|
@ -854,6 +854,7 @@ static void test_shader(void)
|
||||||
DWORD hPixelShader = 0, hVertexShader = 0;
|
DWORD hPixelShader = 0, hVertexShader = 0;
|
||||||
DWORD hPixelShader2 = 0, hVertexShader2 = 0;
|
DWORD hPixelShader2 = 0, hVertexShader2 = 0;
|
||||||
DWORD hTempHandle;
|
DWORD hTempHandle;
|
||||||
|
D3DCAPS8 caps;
|
||||||
DWORD data_size;
|
DWORD data_size;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
@ -886,6 +887,7 @@ static void test_shader(void)
|
||||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
|
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
|
||||||
ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", DXGetErrorString8(hr));
|
ok(hr == D3D_OK, "IDirect3D8_CreateDevice failed with %s\n", DXGetErrorString8(hr));
|
||||||
if(!pDevice) goto cleanup;
|
if(!pDevice) goto cleanup;
|
||||||
|
IDirect3DDevice8_GetDeviceCaps(pDevice, &caps);
|
||||||
|
|
||||||
/* First create a vertex shader */
|
/* First create a vertex shader */
|
||||||
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, simple_vs, &hVertexShader, 0);
|
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, simple_vs, &hVertexShader, 0);
|
||||||
|
@ -940,42 +942,65 @@ static void test_shader(void)
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %s\n", DXGetErrorString8(hr));
|
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);
|
ok(hTempHandle == 0, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, 0);
|
||||||
|
|
||||||
/* The same with a pixel shader */
|
if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 0))
|
||||||
hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader);
|
{
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
|
/* The same with a pixel shader */
|
||||||
/* Msdn says that the new pixel shader is set immediately. This is wrong, apparently */
|
hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader);
|
||||||
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
|
ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
|
/* Msdn says that the new pixel shader is set immediately. This is wrong, apparently */
|
||||||
ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0);
|
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
|
||||||
/* Assign the shader, then verify that GetPixelShader works */
|
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader);
|
ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", DXGetErrorString8(hr));
|
/* Assign the shader, then verify that GetPixelShader works */
|
||||||
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
|
hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
|
ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader);
|
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
|
||||||
/* Verify that we can retrieve the shader function */
|
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, NULL, &data_size);
|
ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFucntion returned %s\n", DXGetErrorString8(hr));
|
/* Verify that we can retrieve the shader function */
|
||||||
ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size);
|
hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, NULL, &data_size);
|
||||||
data = HeapAlloc(GetProcessHeap(), 0, simple_ps_size);
|
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFucntion returned %s\n", DXGetErrorString8(hr));
|
||||||
data_size = 1;
|
ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size);
|
||||||
hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size);
|
data = HeapAlloc(GetProcessHeap(), 0, simple_ps_size);
|
||||||
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetPixelShaderFunction returned %s (0x%#x), "
|
data_size = 1;
|
||||||
"expected D3DERR_INVALIDCALL\n", DXGetErrorString8(hr), hr);
|
hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size);
|
||||||
ok(data_size == 1, "Got data_size %u, expected 1\n", data_size);
|
ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetPixelShaderFunction returned %s (0x%#x), "
|
||||||
data_size = simple_ps_size;
|
"expected D3DERR_INVALIDCALL\n", DXGetErrorString8(hr), hr);
|
||||||
hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size);
|
ok(data_size == 1, "Got data_size %u, expected 1\n", data_size);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFunction returned %s\n", DXGetErrorString8(hr));
|
data_size = simple_ps_size;
|
||||||
ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size);
|
hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size);
|
||||||
ok(!memcmp(data, simple_ps, simple_ps_size), "data not equal to shader function\n");
|
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFunction returned %s\n", DXGetErrorString8(hr));
|
||||||
HeapFree(GetProcessHeap(), 0, data);
|
ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size);
|
||||||
/* Delete the assigned shader. This is supposed to work */
|
ok(!memcmp(data, simple_ps, simple_ps_size), "data not equal to shader function\n");
|
||||||
hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader);
|
HeapFree(GetProcessHeap(), 0, data);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr));
|
/* Delete the assigned shader. This is supposed to work */
|
||||||
/* The shader should be unset now */
|
hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader);
|
||||||
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
|
ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
|
/* The shader should be unset now */
|
||||||
ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0);
|
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
|
||||||
|
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
|
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_CreatePixelShader(pDevice, simple_ps, &hPixelShader);
|
||||||
|
ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
|
hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader2);
|
||||||
|
ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
|
|
||||||
|
hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader);
|
||||||
|
ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
|
hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader2);
|
||||||
|
ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
|
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
|
||||||
|
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
|
||||||
|
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? */
|
/* What happens if a non-bound shader is deleted? */
|
||||||
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader, 0);
|
hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader, 0);
|
||||||
|
@ -993,22 +1018,6 @@ static void test_shader(void)
|
||||||
hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader);
|
hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %s\n", DXGetErrorString8(hr));
|
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);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %s\n", DXGetErrorString8(hr));
|
|
||||||
|
|
||||||
hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %s\n", DXGetErrorString8(hr));
|
|
||||||
hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader2);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %s\n", DXGetErrorString8(hr));
|
|
||||||
hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %s\n", DXGetErrorString8(hr));
|
|
||||||
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));
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if(pD3d) IDirect3D8_Release(pD3d);
|
if(pD3d) IDirect3D8_Release(pD3d);
|
||||||
if(pDevice) IDirect3D8_Release(pDevice);
|
if(pDevice) IDirect3D8_Release(pDevice);
|
||||||
|
|
Loading…
Reference in New Issue