2 * Fixed function pipeline replacement using GL_NV_register_combiners
3 * and GL_NV_texture_shader
5 * Copyright 2006 Henri Verbeet
6 * Copyright 2008 Stefan Dösinger(for CodeWeavers)
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wined3d_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
31 #define GLINFO_LOCATION (*gl_info)
32 static void nvrc_enable(IWineD3DDevice
*iface
, BOOL enable
) { }
34 static void nvts_enable(IWineD3DDevice
*iface
, BOOL enable
) {
36 glEnable(GL_TEXTURE_SHADER_NV
);
37 checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
39 glDisable(GL_TEXTURE_SHADER_NV
);
40 checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)");
44 static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype
, WineD3D_GL_Info
*gl_info
, struct fragment_caps
*pCaps
) {
45 pCaps
->TextureOpCaps
= WINED3DTEXOPCAPS_ADD
|
46 WINED3DTEXOPCAPS_ADDSIGNED
|
47 WINED3DTEXOPCAPS_ADDSIGNED2X
|
48 WINED3DTEXOPCAPS_MODULATE
|
49 WINED3DTEXOPCAPS_MODULATE2X
|
50 WINED3DTEXOPCAPS_MODULATE4X
|
51 WINED3DTEXOPCAPS_SELECTARG1
|
52 WINED3DTEXOPCAPS_SELECTARG2
|
53 WINED3DTEXOPCAPS_DISABLE
|
54 WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA
|
55 WINED3DTEXOPCAPS_BLENDTEXTUREALPHA
|
56 WINED3DTEXOPCAPS_BLENDFACTORALPHA
|
57 WINED3DTEXOPCAPS_BLENDCURRENTALPHA
|
58 WINED3DTEXOPCAPS_LERP
|
59 WINED3DTEXOPCAPS_SUBTRACT
|
60 WINED3DTEXOPCAPS_ADDSMOOTH
|
61 WINED3DTEXOPCAPS_MULTIPLYADD
|
62 WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
|
63 WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
|
64 WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM
|
65 WINED3DTEXOPCAPS_DOTPRODUCT3
|
66 WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR
|
67 WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA
;
69 if(GL_SUPPORT(NV_TEXTURE_SHADER2
)) {
70 /* Bump mapping is supported already in NV_TEXTURE_SHADER, but that extension does
71 * not support 3D textures. This asks for trouble if an app uses both bump mapping
72 * and 3D textures. It also allows us to keep the code simpler by having texture
73 * shaders constantly enabled.
75 pCaps
->TextureOpCaps
|= WINED3DTEXOPCAPS_BUMPENVMAP
;
76 /* TODO: Luminance bump map? */
81 pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE
82 WINED3DTEXOPCAPS_PREMODULATE */
85 pCaps
->MaxTextureBlendStages
= GL_LIMITS(texture_stages
);
86 pCaps
->MaxSimultaneousTextures
= GL_LIMITS(textures
);
88 pCaps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_TSSARGTEMP
;
90 /* The caps below can be supported but aren't handled yet in utils.c 'd3dta_to_combiner_input', disable them until support is fixed */
92 if (GL_SUPPORT(NV_REGISTER_COMBINERS2
))
93 pCaps
->PrimitiveMiscCaps
|= WINED3DPMISCCAPS_PERSTAGECONSTANT
;
97 static HRESULT
nvrc_fragment_alloc(IWineD3DDevice
*iface
) { return WINED3D_OK
; }
98 static void nvrc_fragment_free(IWineD3DDevice
*iface
) {}
100 /* Two fixed function pipeline implementations using GL_NV_register_combiners and
101 * GL_NV_texture_shader. The nvts_fragment_pipeline assumes that both extensions
102 * are available(geforce 3 and newer), while nvrc_fragment_pipeline uses only the
103 * register combiners extension(Pre-GF3).
105 const struct fragment_pipeline nvts_fragment_pipeline
= {
107 nvrc_fragment_get_caps
,
110 ffp_fragmentstate_template
113 const struct fragment_pipeline nvrc_fragment_pipeline
= {
115 nvrc_fragment_get_caps
,
118 ffp_fragmentstate_template