Commit dc135648 authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

wined3d: Add NVDB support.

parent 8fdfc736
...@@ -105,6 +105,7 @@ static const struct { ...@@ -105,6 +105,7 @@ static const struct {
{"GL_EXT_blend_equation_separate", EXT_BLEND_EQUATION_SEPARATE, 0 }, {"GL_EXT_blend_equation_separate", EXT_BLEND_EQUATION_SEPARATE, 0 },
{"GL_EXT_blend_func_separate", EXT_BLEND_FUNC_SEPARATE, 0 }, {"GL_EXT_blend_func_separate", EXT_BLEND_FUNC_SEPARATE, 0 },
{"GL_EXT_blend_minmax", EXT_BLEND_MINMAX, 0 }, {"GL_EXT_blend_minmax", EXT_BLEND_MINMAX, 0 },
{"GL_EXT_depth_bounds_test", EXT_DEPTH_BOUNDS_TEST, 0 },
{"GL_EXT_draw_buffers2", EXT_DRAW_BUFFERS2, 0 }, {"GL_EXT_draw_buffers2", EXT_DRAW_BUFFERS2, 0 },
{"GL_EXT_fog_coord", EXT_FOG_COORD, 0 }, {"GL_EXT_fog_coord", EXT_FOG_COORD, 0 },
{"GL_EXT_framebuffer_blit", EXT_FRAMEBUFFER_BLIT, 0 }, {"GL_EXT_framebuffer_blit", EXT_FRAMEBUFFER_BLIT, 0 },
...@@ -3611,6 +3612,21 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct ...@@ -3611,6 +3612,21 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct
TRACE_(d3d_caps)("[FAILED]\n"); TRACE_(d3d_caps)("[FAILED]\n");
return FALSE; return FALSE;
/* Depth bound test. To query if the card supports it CheckDeviceFormat with the special
* format MAKEFOURCC('N','V','D','B') is used.
* It is enabled by setting D3DRS_ADAPTIVETESS_X render state to MAKEFOURCC('N','V','D','B') and
* then controlled by setting D3DRS_ADAPTIVETESS_Z (zMin) and D3DRS_ADAPTIVETESS_W (zMax)
* to test value.
*/
case WINED3DFMT_NVDB:
if (gl_info->supported[EXT_DEPTH_BOUNDS_TEST])
{
TRACE_(d3d_caps)("[OK]\n");
return TRUE;
}
TRACE_(d3d_caps)("[FAILED]\n");
return FALSE;
case WINED3DFMT_NVHU: case WINED3DFMT_NVHU:
case WINED3DFMT_NVHS: case WINED3DFMT_NVHS:
/* These formats seem to be similar to the HILO formats in GL_NV_texture_shader. NVHU /* These formats seem to be similar to the HILO formats in GL_NV_texture_shader. NVHU
......
...@@ -1880,6 +1880,42 @@ static void state_tessellation(DWORD state, IWineD3DStateBlockImpl *stateblock, ...@@ -1880,6 +1880,42 @@ static void state_tessellation(DWORD state, IWineD3DStateBlockImpl *stateblock,
stateblock->state.render_states[WINED3DRS_ENABLEADAPTIVETESSELLATION]); stateblock->state.render_states[WINED3DRS_ENABLEADAPTIVETESSELLATION]);
} }
static void state_nvdb(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
union {
DWORD d;
float f;
} zmin, zmax;
const struct wined3d_gl_info *gl_info = context->gl_info;
if (stateblock->state.render_states[WINED3DRS_ADAPTIVETESS_X] == WINED3DFMT_NVDB)
{
zmin.d = stateblock->state.render_states[WINED3DRS_ADAPTIVETESS_Z];
zmax.d = stateblock->state.render_states[WINED3DRS_ADAPTIVETESS_W];
/* If zmin is larger than zmax INVALID_VALUE error is generated.
* In d3d9 test is not performed in this case*/
if (zmin.f <= zmax.f)
{
glEnable(GL_DEPTH_BOUNDS_TEST_EXT);
checkGLcall("glEnable(GL_DEPTH_BOUNDS_TEST_EXT)");
GL_EXTCALL(glDepthBoundsEXT(zmin.f, zmax.f));
checkGLcall("glDepthBoundsEXT(...)");
}
else {
glDisable(GL_DEPTH_BOUNDS_TEST_EXT);
checkGLcall("glDisable(GL_DEPTH_BOUNDS_TEST_EXT)");
}
}
else {
glDisable(GL_DEPTH_BOUNDS_TEST_EXT);
checkGLcall("glDisable(GL_DEPTH_BOUNDS_TEST_EXT)");
}
state_tessellation(state, stateblock, context);
}
static void state_wrapu(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) static void state_wrapu(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{ {
if (stateblock->state.render_states[WINED3DRS_WRAPU]) if (stateblock->state.render_states[WINED3DRS_WRAPU])
...@@ -5078,6 +5114,7 @@ const struct StateEntryTemplate misc_state_template[] = { ...@@ -5078,6 +5114,7 @@ const struct StateEntryTemplate misc_state_template[] = {
{ STATE_RENDER(WINED3DRS_ADAPTIVETESS_Y), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_ADAPTIVETESS_Y), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3DRS_ADAPTIVETESS_Z), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_ADAPTIVETESS_Z), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3DRS_ADAPTIVETESS_W), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_ADAPTIVETESS_W), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_nvdb }, EXT_DEPTH_BOUNDS_TEST },
{ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa }, ARB_MULTISAMPLE }, { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa }, ARB_MULTISAMPLE },
{ STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa_w }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa_w }, WINED3D_GL_EXT_NONE },
......
...@@ -129,6 +129,7 @@ static const struct StaticPixelFormatDesc formats[] = ...@@ -129,6 +129,7 @@ static const struct StaticPixelFormatDesc formats[] =
{WINED3DFMT_R16G16B16A16_SNORM, 0x0, 0x0, 0x0, 0x0, 8, 0, 0}, {WINED3DFMT_R16G16B16A16_SNORM, 0x0, 0x0, 0x0, 0x0, 8, 0, 0},
/* Vendor-specific formats */ /* Vendor-specific formats */
{WINED3DFMT_ATI2N, 0x0, 0x0, 0x0, 0x0, 1, 0, 0}, {WINED3DFMT_ATI2N, 0x0, 0x0, 0x0, 0x0, 1, 0, 0},
{WINED3DFMT_NVDB, 0x0, 0x0, 0x0, 0x0, 0, 0, 0},
{WINED3DFMT_NVHU, 0x0, 0x0, 0x0, 0x0, 2, 0, 0}, {WINED3DFMT_NVHU, 0x0, 0x0, 0x0, 0x0, 2, 0, 0},
{WINED3DFMT_NVHS, 0x0, 0x0, 0x0, 0x0, 2, 0, 0}, {WINED3DFMT_NVHS, 0x0, 0x0, 0x0, 0x0, 2, 0, 0},
}; };
...@@ -167,6 +168,7 @@ static const struct wined3d_format_base_flags format_base_flags[] = ...@@ -167,6 +168,7 @@ static const struct wined3d_format_base_flags format_base_flags[] =
{WINED3DFMT_R8G8B8A8_UNORM, WINED3DFMT_FLAG_GETDC}, {WINED3DFMT_R8G8B8A8_UNORM, WINED3DFMT_FLAG_GETDC},
{WINED3DFMT_R8G8B8X8_UNORM, WINED3DFMT_FLAG_GETDC}, {WINED3DFMT_R8G8B8X8_UNORM, WINED3DFMT_FLAG_GETDC},
{WINED3DFMT_ATI2N, WINED3DFMT_FLAG_FOURCC | WINED3DFMT_FLAG_BROKEN_PITCH}, {WINED3DFMT_ATI2N, WINED3DFMT_FLAG_FOURCC | WINED3DFMT_FLAG_BROKEN_PITCH},
{WINED3DFMT_NVDB, WINED3DFMT_FLAG_FOURCC},
{WINED3DFMT_NVHU, WINED3DFMT_FLAG_FOURCC}, {WINED3DFMT_NVHU, WINED3DFMT_FLAG_FOURCC},
{WINED3DFMT_NVHS, WINED3DFMT_FLAG_FOURCC}, {WINED3DFMT_NVHS, WINED3DFMT_FLAG_FOURCC},
{WINED3DFMT_R32_FLOAT, WINED3DFMT_FLAG_FLOAT}, {WINED3DFMT_R32_FLOAT, WINED3DFMT_FLAG_FLOAT},
...@@ -1626,6 +1628,7 @@ const char *debug_d3dformat(enum wined3d_format_id format_id) ...@@ -1626,6 +1628,7 @@ const char *debug_d3dformat(enum wined3d_format_id format_id)
FMT_TO_STR(WINED3DFMT_VERTEXDATA); FMT_TO_STR(WINED3DFMT_VERTEXDATA);
FMT_TO_STR(WINED3DFMT_R8G8_SNORM_Cx); FMT_TO_STR(WINED3DFMT_R8G8_SNORM_Cx);
FMT_TO_STR(WINED3DFMT_ATI2N); FMT_TO_STR(WINED3DFMT_ATI2N);
FMT_TO_STR(WINED3DFMT_NVDB);
FMT_TO_STR(WINED3DFMT_NVHU); FMT_TO_STR(WINED3DFMT_NVHU);
FMT_TO_STR(WINED3DFMT_NVHS); FMT_TO_STR(WINED3DFMT_NVHS);
FMT_TO_STR(WINED3DFMT_R32G32B32A32_TYPELESS); FMT_TO_STR(WINED3DFMT_R32G32B32A32_TYPELESS);
......
...@@ -1787,6 +1787,7 @@ typedef enum wined3d_gl_extension ...@@ -1787,6 +1787,7 @@ typedef enum wined3d_gl_extension
EXT_BLEND_FUNC_SEPARATE, EXT_BLEND_FUNC_SEPARATE,
EXT_BLEND_MINMAX, EXT_BLEND_MINMAX,
EXT_DRAW_BUFFERS2, EXT_DRAW_BUFFERS2,
EXT_DEPTH_BOUNDS_TEST,
EXT_FOG_COORD, EXT_FOG_COORD,
EXT_FRAMEBUFFER_BLIT, EXT_FRAMEBUFFER_BLIT,
EXT_FRAMEBUFFER_MULTISAMPLE, EXT_FRAMEBUFFER_MULTISAMPLE,
...@@ -2982,6 +2983,14 @@ typedef void (WINE_GLAPI *PGLFNBLENDEQUATIONSEPARATEEXTPROC)(GLenum modeRGB, GLe ...@@ -2982,6 +2983,14 @@ typedef void (WINE_GLAPI *PGLFNBLENDEQUATIONSEPARATEEXTPROC)(GLenum modeRGB, GLe
typedef void (WINE_GLAPI *PGLFNBLENDFUNCSEPARATEEXTPROC)(GLenum sfactorRGB, GLenum dfactorRGB, typedef void (WINE_GLAPI *PGLFNBLENDFUNCSEPARATEEXTPROC)(GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorAlpha, GLenum dfactorAlpha); GLenum sfactorAlpha, GLenum dfactorAlpha);
/* GL_EXT_depth_bounds_test */
#ifndef GL_EXT_depth_bounds_test
#define GL_EXT_depth_bounds_test 1
#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890
#define GL_DEPTH_BOUNDS_EXT 0x8891
#endif
typedef void (WINE_GLAPI *PGLFNDEPTHBOUNDSEXTPROC)(GLclampd zmin, GLclampd zmax);
/* GL_EXT_draw_buffers2 */ /* GL_EXT_draw_buffers2 */
typedef GLvoid (WINE_GLAPI *PGLFNCOLORMASKINDEXEDEXTPROC)(GLuint buffer_idx, GLboolean r, GLboolean g, typedef GLvoid (WINE_GLAPI *PGLFNCOLORMASKINDEXEDEXTPROC)(GLuint buffer_idx, GLboolean r, GLboolean g,
GLboolean b, GLboolean a); GLboolean b, GLboolean a);
...@@ -4221,6 +4230,9 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelForma ...@@ -4221,6 +4230,9 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelForma
/* GL_EXT_blend_func_separate */ \ /* GL_EXT_blend_func_separate */ \
USE_GL_FUNC(PGLFNBLENDEQUATIONSEPARATEEXTPROC, \ USE_GL_FUNC(PGLFNBLENDEQUATIONSEPARATEEXTPROC, \
glBlendEquationSeparateEXT, EXT_BLEND_EQUATION_SEPARATE, NULL) \ glBlendEquationSeparateEXT, EXT_BLEND_EQUATION_SEPARATE, NULL) \
/* GL_EXT_depth_bounds_test */ \
USE_GL_FUNC(PGLFNDEPTHBOUNDSEXTPROC, \
glDepthBoundsEXT, EXT_DEPTH_BOUNDS_TEST, NULL) \
/* GL_EXT_draw_buffers2 */ \ /* GL_EXT_draw_buffers2 */ \
USE_GL_FUNC(PGLFNCOLORMASKINDEXEDEXTPROC, \ USE_GL_FUNC(PGLFNCOLORMASKINDEXEDEXTPROC, \
glColorMaskIndexedEXT, EXT_DRAW_BUFFERS2, NULL) \ glColorMaskIndexedEXT, EXT_DRAW_BUFFERS2, NULL) \
......
...@@ -271,6 +271,7 @@ enum wined3d_format_id ...@@ -271,6 +271,7 @@ enum wined3d_format_id
WINED3DFMT_R8G8_B8G8 = WINEMAKEFOURCC('R','G','B','G'), WINED3DFMT_R8G8_B8G8 = WINEMAKEFOURCC('R','G','B','G'),
WINED3DFMT_ATI2N = WINEMAKEFOURCC('A','T','I','2'), WINED3DFMT_ATI2N = WINEMAKEFOURCC('A','T','I','2'),
WINED3DFMT_INST = WINEMAKEFOURCC('I','N','S','T'), WINED3DFMT_INST = WINEMAKEFOURCC('I','N','S','T'),
WINED3DFMT_NVDB = WINEMAKEFOURCC('N','V','D','B'),
WINED3DFMT_NVHU = WINEMAKEFOURCC('N','V','H','U'), WINED3DFMT_NVHU = WINEMAKEFOURCC('N','V','H','U'),
WINED3DFMT_NVHS = WINEMAKEFOURCC('N','V','H','S'), WINED3DFMT_NVHS = WINEMAKEFOURCC('N','V','H','S'),
......
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