Commit 4d37754a authored by Zebediah Figura's avatar Zebediah Figura Committed by Vitaly Lipatov

nvapi: Implement NvAPI_D3D11_SetDepthBoundsTest().

parent d89547e1
......@@ -27,8 +27,10 @@
#include "wine/list.h"
#include "nvapi.h"
#include "d3d9.h"
#include "initguid.h"
#include "wine/wined3d.h"
#include "wine/winedxgi.h"
WINE_DEFAULT_DEBUG_CHANNEL(nvapi);
......@@ -680,6 +682,32 @@ static NvAPI_Status CDECL NvAPI_GPU_GetGpuCoreCount(NvPhysicalGpuHandle hPhysica
return NVAPI_OK;
}
static NvAPI_Status CDECL NvAPI_D3D11_SetDepthBoundsTest(IUnknown *unk, NvU32 enable, float min, float max)
{
struct wined3d_device_context *wined3d_context;
IWineD3DDeviceContext *context;
HRESULT hr;
TRACE("unk %p, enable %u, min %.8e, max %.8e.\n", unk, enable, min, max);
if (!unk)
return NVAPI_INVALID_ARGUMENT;
if (FAILED(hr = IUnknown_QueryInterface(unk, &IID_IWineD3DDeviceContext, (void **)&context)))
{
ERR("Failed to retrieve IWineD3DDeviceContext interface, hr %#x.\n", hr);
return NVAPI_ERROR;
}
wined3d_context = IWineD3DDeviceContext_get_wined3d_device_context(context);
wined3d_mutex_lock();
wined3d_device_context_set_depth_bounds(wined3d_context, enable, min, max);
wined3d_mutex_unlock();
IWineD3DDeviceContext_Release(context);
return NVAPI_OK;
}
void* CDECL nvapi_QueryInterface(unsigned int offset)
{
static const struct
......@@ -725,6 +753,7 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
{0x46fbeb03, NvAPI_GPU_GetPhysicalFrameBufferSize},
{0x5a04b644, NvAPI_GPU_GetVirtualFrameBufferSize},
{0xc7026a87, NvAPI_GPU_GetGpuCoreCount},
{0x7aaf7a04, NvAPI_D3D11_SetDepthBoundsTest},
};
unsigned int i;
TRACE("(%x)\n", offset);
......
......@@ -45,6 +45,7 @@ static NvAPI_Status (CDECL* pNvAPI_EnumNvidiaDisplayHandle)(NvU32 thisEnum, NvDi
static NvAPI_Status (CDECL* pNvAPI_SYS_GetDriverAndBranchVersion)(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString);
static NvAPI_Status (CDECL* pNvAPI_D3D_GetCurrentSLIState)(IUnknown *pDevice, NV_GET_CURRENT_SLI_STATE *pSliState);
static NvAPI_Status (CDECL* pNvAPI_GetLogicalGPUFromDisplay)(NvDisplayHandle hNvDisp, NvLogicalGpuHandle *pLogicalGPU);
static NvAPI_Status (CDECL* pNvAPI_D3D11_SetDepthBoundsTest)(IUnknown *unk, NvU32 enable, float min, float max);
static const struct
{
......@@ -68,6 +69,7 @@ function_list[] =
{0x2926aaad, (void**) &pNvAPI_SYS_GetDriverAndBranchVersion},
{0x4b708b54, (void**) &pNvAPI_D3D_GetCurrentSLIState},
{0xee1370cf, (void**) &pNvAPI_GetLogicalGPUFromDisplay},
{0x7aaf7a04, (void**) &pNvAPI_D3D11_SetDepthBoundsTest},
};
static BOOL init(void)
......@@ -705,6 +707,20 @@ cleanup:
if (window) DestroyWindow(window);
}
static void test_NvAPI_D3D11_SetDepthBoundsTest(void)
{
NvAPI_Status status;
if (!pNvAPI_D3D11_SetDepthBoundsTest)
{
win_skip("NvAPI_D3D11_SetDepthBoundsTest export not found.\n");
return;
}
status = pNvAPI_D3D11_SetDepthBoundsTest(NULL, 0, 0.0, 0.0);
ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
}
START_TEST( nvapi )
{
WNDCLASSA wc = {0};
......@@ -724,6 +740,7 @@ START_TEST( nvapi )
test_NvAPI_EnumNvidiaDisplayHandle();
test_NvAPI_SYS_GetDriverAndBranchVersion();
test_NvAPI_GetLogicalGPUFromDisplay();
test_NvAPI_D3D11_SetDepthBoundsTest();
/* d3d9 tests */
wc.lpfnWndProc = DefWindowProcA;
......
......@@ -2162,7 +2162,7 @@ out:
wined3d_device_context_unlock(context);
}
static void wined3d_device_context_set_depth_bounds(struct wined3d_device_context *context,
void CDECL wined3d_device_context_set_depth_bounds(struct wined3d_device_context *context,
BOOL enable, float min, float max)
{
TRACE("context %p, enable %d, min %.8e, max %.8e.\n", context, enable, min, max);
......
......@@ -127,6 +127,7 @@
@ cdecl wined3d_device_context_resolve_sub_resource(ptr ptr long ptr long long)
@ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
@ cdecl wined3d_device_context_set_constant_buffers(ptr long long long ptr)
@ cdecl wined3d_device_context_set_depth_bounds(ptr long float float)
@ cdecl wined3d_device_context_set_depth_stencil_state(ptr ptr long)
@ cdecl wined3d_device_context_set_depth_stencil_view(ptr ptr)
@ cdecl wined3d_device_context_set_index_buffer(ptr ptr long long)
......
......@@ -2541,6 +2541,8 @@ void __cdecl wined3d_device_context_set_blend_state(struct wined3d_device_contex
void __cdecl wined3d_device_context_set_constant_buffers(struct wined3d_device_context *context,
enum wined3d_shader_type type, unsigned int start_idx, unsigned int count,
const struct wined3d_constant_buffer_state *buffers);
void __cdecl wined3d_device_context_set_depth_bounds(struct wined3d_device_context *context,
BOOL enable, float min, float max);
void __cdecl wined3d_device_context_set_depth_stencil_state(struct wined3d_device_context *context,
struct wined3d_depth_stencil_state *depth_stencil_state, unsigned int stencil_ref);
HRESULT __cdecl wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context,
......
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