Commit 8b28ca72 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Use GL_EXT_gpu_program_parameters if available.

parent aeb0e43e
......@@ -90,10 +90,27 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, Win
GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, i, lcl_const));
}
} else {
for(i = 0; i < max_constants; i++) {
if(dirty_consts[i]) {
dirty_consts[i] = 0;
GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, i, constants + (i * 4)));
if(GL_SUPPORT(EXT_GPU_PROGRAM_PARAMETERS)) {
/* TODO: Benchmark if we're better of with finding the dirty constants ourselves,
* or just reloading *all* constants at once
*
GL_EXTCALL(glProgramEnvParameters4fvEXT(target_type, 0, max_constants, constants));
*/
for(i = 0; i < max_constants; i++) {
if(!dirty_consts[i]) continue;
/* Find the next block of dirty constants */
j = i;
for(i++; (i < max_constants) && dirty_consts[i]; i++);
GL_EXTCALL(glProgramEnvParameters4fvEXT(target_type, j, i - j, constants + (j * 4)));
}
} else {
for(i = 0; i < max_constants; i++) {
if(dirty_consts[i]) {
dirty_consts[i] = 0;
GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, i, constants + (i * 4)));
}
}
}
}
......
......@@ -107,6 +107,7 @@ static const struct {
{"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS, 0 },
{"GL_EXT_vertex_shader", EXT_VERTEX_SHADER, 0 },
{"GL_EXT_vertex_weighting", EXT_VERTEX_WEIGHTING, 0 },
{"GL_EXT_gpu_program_parameters", EXT_GPU_PROGRAM_PARAMETERS, 0 },
/* NV */
{"GL_NV_half_float", NV_HALF_FLOAT, 0 },
......
......@@ -2906,6 +2906,13 @@ typedef void (WINE_GLAPI * PGLFNFINISHRENDERAPPLEPROC) (void);
#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F
#endif
/* GL_EXT_gpu_program_parameters */
#ifndef GL_EXT_gpu_program_parameters
#define GL_EXT_gpu_program_parameters
typedef void (WINE_GLAPI * PGLFNPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const float *params);
typedef void (WINE_GLAPI * PGLFNPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const float *params);
#endif
/* GL_VERSION_2_0 */
#ifndef GL_VERSION_2_0
#define GL_VERSION_2_0 1
......@@ -3240,6 +3247,7 @@ typedef enum _GL_SupportedExt {
EXT_TEXTURE_ENV_DOT3,
EXT_TEXTURE_SRGB,
EXT_VERTEX_WEIGHTING,
EXT_GPU_PROGRAM_PARAMETERS,
/* NVIDIA */
NV_HALF_FLOAT,
NV_FOG_DISTANCE,
......@@ -3559,7 +3567,10 @@ typedef enum _GL_SupportedExt {
USE_GL_FUNC(PGLXFNWAITVIDEOSYNCSGIPROC, glXWaitVideoSyncSGI, SGI_VIDEO_SYNC, NULL );\
/* GL_APPLE_flush_render */ \
USE_GL_FUNC(PGLFNFLUSHRENDERAPPLEPROC, glFlushRenderApple, APPLE_FLUSH_RENDER, NULL );\
USE_GL_FUNC(PGLFNFINISHRENDERAPPLEPROC, glFinishRenderApple, APPLE_FLUSH_RENDER, NULL );
USE_GL_FUNC(PGLFNFINISHRENDERAPPLEPROC, glFinishRenderApple, APPLE_FLUSH_RENDER, NULL );\
/* GL_EXT_gpu_program_parameters */ \
USE_GL_FUNC(PGLFNPROGRAMENVPARAMETERS4FVEXTPROC, glProgramEnvParameters4fvEXT, EXT_GPU_PROGRAM_PARAMETERS,NULL );\
USE_GL_FUNC(PGLFNPROGRAMLOCALPARAMETERS4FVEXTPROC, glProgramLocalParameters4fvEXT, EXT_GPU_PROGRAM_PARAMETERS,NULL );
/****************************************************
* OpenGL WGL defines and functions pointer
......
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