diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 6c7416996df..7e561758200 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -86,6 +86,14 @@ struct shader_arb_priv { struct shader_arb_ctx_priv { char addr_reg[20]; + enum { + /* plain GL_ARB_vertex_program or GL_ARB_fragment_program */ + ARB, + /* GL_NV_vertex_progam2_option or GL_NV_fragment_program_option */ + NV2, + /* GL_NV_vertex_program3 or GL_NV_fragment_program2 */ + NV3 + } target_version; }; /******************************************************** @@ -1979,9 +1987,17 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, GLuint retval; const char *fragcolor; DWORD *lconst_map = local_const_mapping((IWineD3DBaseShaderImpl *) This); + struct shader_arb_ctx_priv priv_ctx; /* Create the hw ARB shader */ + memset(&priv_ctx, 0, sizeof(priv_ctx)); shader_addline(buffer, "!!ARBfp1.0\n"); + if(GL_SUPPORT(NV_FRAGMENT_PROGRAM_OPTION)) { + shader_addline(buffer, "OPTION NV_fragment_program;\n"); + priv_ctx.target_version = NV2; + } else { + priv_ctx.target_version = ARB; + } if (reg_maps->shader_version.major < 3) { @@ -2023,7 +2039,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, shader_generate_arb_declarations( (IWineD3DBaseShader*) This, reg_maps, buffer, &GLINFO_LOCATION, lconst_map); /* Base Shader Body */ - shader_generate_main((IWineD3DBaseShader *)This, buffer, reg_maps, function, NULL); + shader_generate_main((IWineD3DBaseShader *)This, buffer, reg_maps, function, &priv_ctx); if(args->srgb_correction) { arbfp_add_sRGB_correction(buffer, fragcolor, "TA", "TB", "TC"); @@ -2083,6 +2099,13 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShader *iface, /* Create the hw ARB shader */ shader_addline(buffer, "!!ARBvp1.0\n"); + if(GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION)) { + shader_addline(buffer, "OPTION NV_vertex_program2;\n"); + priv_ctx.target_version = NV2; + } else { + priv_ctx.target_version = ARB; + } + if(need_helper_const(gl_info)) { shader_addline(buffer, "PARAM helper_const = { 2.0, -1.0, %d.0, 0.0 };\n", This->rel_offset); } diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 94c5f6a5b39..46c1556653d 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -140,7 +140,9 @@ static const struct { {"GL_NV_vertex_program", NV_VERTEX_PROGRAM, 0 }, {"GL_NV_vertex_program1_1", NV_VERTEX_PROGRAM1_1, 0 }, {"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2, 0 }, + {"GL_NV_vertex_program2_option", NV_VERTEX_PROGRAM2_OPTION, 0 }, {"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3, 0 }, + {"GL_NV_fragment_program_option", NV_FRAGMENT_PROGRAM_OPTION, 0 }, {"GL_NV_depth_clamp", NV_DEPTH_CLAMP, 0 }, {"GL_NV_light_max_exponent", NV_LIGHT_MAX_EXPONENT, 0 }, diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 1a615c17675..a36d9c57103 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -3080,6 +3080,13 @@ typedef void (WINE_GLAPI *PGLFNSETFRAGMENTSHADERCONSTANTATI) (GLuint dst, const #define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE #endif +/* GL_NV_vertex_program2_option */ +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#endif + /* GL_VERSION_2_0 */ #ifndef GL_VERSION_2_0 #define GL_VERSION_2_0 1 @@ -3450,7 +3457,9 @@ typedef enum _GL_SupportedExt { NV_VERTEX_PROGRAM, NV_VERTEX_PROGRAM1_1, NV_VERTEX_PROGRAM2, + NV_VERTEX_PROGRAM2_OPTION, NV_VERTEX_PROGRAM3, + NV_FRAGMENT_PROGRAM_OPTION, NV_FENCE, NV_DEPTH_CLAMP, NV_LIGHT_MAX_EXPONENT,