Commit 129ad9cb authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10core: Update the MipLevels field after texture creation.

parent 1440b252
......@@ -127,6 +127,19 @@ static void test_create_texture2d(ID3D10Device *device)
hr = ID3D10Device_CreateTexture2D(device, &desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x\n", hr);
ID3D10Texture2D_GetDesc(texture, &desc);
ok(desc.Width == 512, "Got unexpected Width %u.\n", desc.Width);
ok(desc.Height == 512, "Got unexpected Height %u.\n", desc.Height);
ok(desc.MipLevels == 10, "Got unexpected MipLevels %u.\n", desc.MipLevels);
ok(desc.ArraySize == 1, "Got unexpected ArraySize %u.\n", desc.ArraySize);
ok(desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected Format %#x.\n", desc.Format);
ok(desc.SampleDesc.Count == 1, "Got unexpected SampleDesc.Count %u.\n", desc.SampleDesc.Count);
ok(desc.SampleDesc.Quality == 0, "Got unexpected SampleDesc.Quality %u.\n", desc.SampleDesc.Quality);
ok(desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected MipLevels %u.\n", desc.Usage);
ok(desc.BindFlags == D3D10_BIND_RENDER_TARGET, "Got unexpected BindFlags %u.\n", desc.BindFlags);
ok(desc.CPUAccessFlags == 0, "Got unexpected CPUAccessFlags %u.\n", desc.CPUAccessFlags);
ok(desc.MiscFlags == 0, "Got unexpected MiscFlags %u.\n", desc.MiscFlags);
hr = ID3D10Texture2D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
ok(FAILED(hr), "Texture should not implement IDXGISurface\n");
if (SUCCEEDED(hr)) IDXGISurface_Release(surface);
......@@ -172,6 +185,17 @@ static void test_create_texture3d(ID3D10Device *device)
hr = ID3D10Device_CreateTexture3D(device, &desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create a 3d texture, hr %#x.\n", hr);
ID3D10Texture3D_GetDesc(texture, &desc);
ok(desc.Width == 64, "Got unexpected Width %u.\n", desc.Width);
ok(desc.Height == 64, "Got unexpected Height %u.\n", desc.Height);
ok(desc.Depth == 64, "Got unexpected Depth %u.\n", desc.Depth);
ok(desc.MipLevels == 7, "Got unexpected MipLevels %u.\n", desc.MipLevels);
ok(desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected Format %#x.\n", desc.Format);
ok(desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected MipLevels %u.\n", desc.Usage);
ok(desc.BindFlags == D3D10_BIND_RENDER_TARGET, "Got unexpected BindFlags %u.\n", desc.BindFlags);
ok(desc.CPUAccessFlags == 0, "Got unexpected CPUAccessFlags %u.\n", desc.CPUAccessFlags);
ok(desc.MiscFlags == 0, "Got unexpected MiscFlags %u.\n", desc.MiscFlags);
hr = ID3D10Texture3D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
ok(FAILED(hr), "Texture should not implement IDXGISurface.\n");
if (SUCCEEDED(hr)) IDXGISurface_Release(surface);
......
......@@ -273,6 +273,7 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
IUnknown_Release(texture->dxgi_surface);
return hr;
}
texture->desc.MipLevels = wined3d_texture_get_level_count(texture->wined3d_texture);
return S_OK;
}
......@@ -480,6 +481,7 @@ HRESULT d3d10_texture3d_init(struct d3d10_texture3d *texture, struct d3d10_devic
WARN("Failed to create wined3d texture, hr %#x.\n", hr);
return hr;
}
texture->desc.MipLevels = wined3d_texture_get_level_count(texture->wined3d_texture);
return S_OK;
}
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