Removing extension checks from state tables and moving checks to called functions.
From: Max Figura maxfigura5061@gmail.com
--- dlls/wined3d/glsl_shader.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7dc0de1b596..3cc9750363c 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11868,6 +11868,12 @@ static void glsl_vertex_pipe_clip_plane(struct wined3d_context *context, const struct wined3d_gl_info *gl_info = context_gl->gl_info; UINT index = state_id - STATE_CLIPPLANE(0);
+ if (!gl_info->supported[WINED3D_GLSL_130]) + { + clipplane(context, state, state_id); + return; + } + if (index >= gl_info->limits.user_clip_distances) return;
@@ -11884,22 +11890,14 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = {STATE_MATERIAL, {STATE_RENDER(WINED3D_RS_SPECULARENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_SPECULARENABLE), {STATE_RENDER(WINED3D_RS_SPECULARENABLE), glsl_vertex_pipe_material}, WINED3D_GL_EXT_NONE }, /* Clip planes */ - {STATE_CLIPPLANE(0), {STATE_CLIPPLANE(0), glsl_vertex_pipe_clip_plane}, WINED3D_GLSL_130 }, - {STATE_CLIPPLANE(0), {STATE_CLIPPLANE(0), clipplane }, WINED3D_GL_EXT_NONE }, - {STATE_CLIPPLANE(1), {STATE_CLIPPLANE(1), glsl_vertex_pipe_clip_plane}, WINED3D_GLSL_130 }, - {STATE_CLIPPLANE(1), {STATE_CLIPPLANE(1), clipplane }, WINED3D_GL_EXT_NONE }, - {STATE_CLIPPLANE(2), {STATE_CLIPPLANE(2), glsl_vertex_pipe_clip_plane}, WINED3D_GLSL_130 }, - {STATE_CLIPPLANE(2), {STATE_CLIPPLANE(2), clipplane }, WINED3D_GL_EXT_NONE }, - {STATE_CLIPPLANE(3), {STATE_CLIPPLANE(3), glsl_vertex_pipe_clip_plane}, WINED3D_GLSL_130 }, - {STATE_CLIPPLANE(3), {STATE_CLIPPLANE(3), clipplane }, WINED3D_GL_EXT_NONE }, - {STATE_CLIPPLANE(4), {STATE_CLIPPLANE(4), glsl_vertex_pipe_clip_plane}, WINED3D_GLSL_130 }, - {STATE_CLIPPLANE(4), {STATE_CLIPPLANE(4), clipplane }, WINED3D_GL_EXT_NONE }, - {STATE_CLIPPLANE(5), {STATE_CLIPPLANE(5), glsl_vertex_pipe_clip_plane}, WINED3D_GLSL_130 }, - {STATE_CLIPPLANE(5), {STATE_CLIPPLANE(5), clipplane }, WINED3D_GL_EXT_NONE }, - {STATE_CLIPPLANE(6), {STATE_CLIPPLANE(6), glsl_vertex_pipe_clip_plane}, WINED3D_GLSL_130 }, - {STATE_CLIPPLANE(6), {STATE_CLIPPLANE(6), clipplane }, WINED3D_GL_EXT_NONE }, - {STATE_CLIPPLANE(7), {STATE_CLIPPLANE(7), glsl_vertex_pipe_clip_plane}, WINED3D_GLSL_130 }, - {STATE_CLIPPLANE(7), {STATE_CLIPPLANE(7), clipplane }, WINED3D_GL_EXT_NONE }, + {STATE_CLIPPLANE(0), {STATE_CLIPPLANE(0), glsl_vertex_pipe_clip_plane}, WINED3D_GL_EXT_NONE }, + {STATE_CLIPPLANE(1), {STATE_CLIPPLANE(1), glsl_vertex_pipe_clip_plane}, WINED3D_GL_EXT_NONE }, + {STATE_CLIPPLANE(2), {STATE_CLIPPLANE(2), glsl_vertex_pipe_clip_plane}, WINED3D_GL_EXT_NONE }, + {STATE_CLIPPLANE(3), {STATE_CLIPPLANE(3), glsl_vertex_pipe_clip_plane}, WINED3D_GL_EXT_NONE }, + {STATE_CLIPPLANE(4), {STATE_CLIPPLANE(4), glsl_vertex_pipe_clip_plane}, WINED3D_GL_EXT_NONE }, + {STATE_CLIPPLANE(5), {STATE_CLIPPLANE(5), glsl_vertex_pipe_clip_plane}, WINED3D_GL_EXT_NONE }, + {STATE_CLIPPLANE(6), {STATE_CLIPPLANE(6), glsl_vertex_pipe_clip_plane}, WINED3D_GL_EXT_NONE }, + {STATE_CLIPPLANE(7), {STATE_CLIPPLANE(7), glsl_vertex_pipe_clip_plane}, WINED3D_GL_EXT_NONE }, /* Lights */ {STATE_LIGHT_TYPE, {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_ACTIVELIGHT(0), {STATE_ACTIVELIGHT(0), glsl_vertex_pipe_light }, WINED3D_GL_EXT_NONE },
From: Max Figura maxfigura5061@gmail.com
--- dlls/wined3d/glsl_shader.c | 3 +-- dlls/wined3d/state.c | 20 ++++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 3cc9750363c..815711b868a 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11960,8 +11960,7 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = {STATE_RENDER(WINED3D_RS_VERTEXBLEND), {STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSIZE), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), glsl_vertex_pipe_pointsize}, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), state_pointsprite }, ARB_POINT_SPRITE }, - {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), state_pointsprite_w }, WINED3D_GL_LEGACY_CONTEXT }, + {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), state_pointsprite }, WINED3D_GL_LEGACY_CONTEXT }, {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), glsl_vertex_pointsprite_core}, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), {STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), glsl_vertex_pipe_pointscale}, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSCALE_A), {STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 6262df2090d..8b82ec4a64e 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1782,22 +1782,19 @@ static void state_localviewer(struct wined3d_context *context, const struct wine } }
-void state_pointsprite_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +void state_pointsprite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - static BOOL warned; + const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + + static bool warned;
/* TODO: NV_POINT_SPRITE */ - if (!warned && state->render_states[WINED3D_RS_POINTSPRITEENABLE]) + if (!warned && state->render_states[WINED3D_RS_POINTSPRITEENABLE] && !gl_info->supported[ARB_POINT_SPRITE]) { /* A FIXME, not a WARN because point sprites should be software emulated if not supported by HW */ - FIXME("Point sprites not supported\n"); - warned = TRUE; + FIXME("Point sprites not supported.\n"); + warned = true; } -} - -void state_pointsprite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) -{ - const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
if (state->render_states[WINED3D_RS_POINTSPRITEENABLE]) { @@ -4947,8 +4944,7 @@ static const struct wined3d_state_entry_template vp_ffp_states[] = { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), state_psizemin_arb }, ARB_POINT_PARAMETERS }, { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), state_psizemin_ext }, EXT_POINT_PARAMETERS }, { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), state_psizemin_w }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), { STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), state_pointsprite }, ARB_POINT_SPRITE }, - { STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), { STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), state_pointsprite_w }, WINED3D_GL_EXT_NONE }, + { STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), { STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), state_pointsprite }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), state_pscale }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_POINTSCALE_A), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_POINTSCALE_B), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
From: Max Figura maxfigura5061@gmail.com
--- dlls/wined3d/glsl_shader.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 815711b868a..a5332945436 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11848,8 +11848,15 @@ static void glsl_vertex_pipe_pointscale(struct wined3d_context *context, static void glsl_vertex_pointsprite_core(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { + const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; static unsigned int once;
+ if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]) + { + state_pointsprite(context, state, state_id); + return; + } + if (state->primitive_type == WINED3D_PT_POINTLIST && !state->render_states[WINED3D_RS_POINTSPRITEENABLE] && !once++) FIXME("Non-point sprite points not supported in core profile.\n"); @@ -11960,7 +11967,6 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = {STATE_RENDER(WINED3D_RS_VERTEXBLEND), {STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSIZE), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), glsl_vertex_pipe_pointsize}, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), state_pointsprite }, WINED3D_GL_LEGACY_CONTEXT }, {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), {STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), glsl_vertex_pointsprite_core}, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), {STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), glsl_vertex_pipe_pointscale}, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSCALE_A), {STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
From: Max Figura maxfigura5061@gmail.com
--- dlls/wined3d/glsl_shader.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index a5332945436..6a8029602f1 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11599,9 +11599,6 @@ static void glsl_vertex_pipe_vp_free(struct wined3d_device *device, struct wined wine_rb_destroy(&priv->ffp_vertex_shaders, shader_glsl_free_ffp_vertex_shader, &ctx); }
-static void glsl_vertex_pipe_nop(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) {} - static void glsl_vertex_pipe_shader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -11865,6 +11862,13 @@ static void glsl_vertex_pointsprite_core(struct wined3d_context *context, static void glsl_vertex_pipe_shademode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { + const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + + if(!gl_info->supported[WINED3D_GLSL_130]) + { + return; + } + context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX; }
@@ -12002,8 +12006,7 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = {STATE_SAMPLER(7), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, {STATE_SAMPLER(7), {STATE_SAMPLER(7), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, {STATE_POINT_ENABLE, {STATE_POINT_ENABLE, glsl_vertex_pipe_shader}, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_SHADEMODE), {STATE_RENDER(WINED3D_RS_SHADEMODE), glsl_vertex_pipe_shademode}, WINED3D_GLSL_130 }, - {STATE_RENDER(WINED3D_RS_SHADEMODE), {STATE_RENDER(WINED3D_RS_SHADEMODE), glsl_vertex_pipe_nop }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_SHADEMODE), {STATE_RENDER(WINED3D_RS_SHADEMODE), glsl_vertex_pipe_shademode}, WINED3D_GL_EXT_NONE }, {0 /* Terminate */, {0, NULL }, WINED3D_GL_EXT_NONE }, };
From: Max Figura maxfigura5061@gmail.com
--- dlls/wined3d/glsl_shader.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 6a8029602f1..bd21e859364 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11798,6 +11798,12 @@ static void glsl_vertex_pipe_texmatrix_np2(struct wined3d_context *context, DWORD sampler = state_id - STATE_SAMPLER(0); const struct wined3d_texture *texture = state->textures[sampler]; BOOL np2; + const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + + if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) + { + return; + }
if (!texture) return; @@ -11981,29 +11987,13 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = * GL_ARB_texture_non_power_of_two is supported. Otherwise, register * glsl_vertex_pipe_texmatrix(), which takes care of updating the texture * matrix. */ - {STATE_SAMPLER(0), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(0), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, {STATE_SAMPLER(0), {STATE_SAMPLER(0), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(1), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(1), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, {STATE_SAMPLER(1), {STATE_SAMPLER(1), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(2), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(2), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, {STATE_SAMPLER(2), {STATE_SAMPLER(2), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(3), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(3), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, {STATE_SAMPLER(3), {STATE_SAMPLER(3), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(4), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(4), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, {STATE_SAMPLER(4), {STATE_SAMPLER(4), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(5), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(5), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, {STATE_SAMPLER(5), {STATE_SAMPLER(5), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(6), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(6), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, {STATE_SAMPLER(6), {STATE_SAMPLER(6), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(7), {0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO }, - {STATE_SAMPLER(7), {0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT}, {STATE_SAMPLER(7), {STATE_SAMPLER(7), glsl_vertex_pipe_texmatrix_np2}, WINED3D_GL_EXT_NONE }, {STATE_POINT_ENABLE, {STATE_POINT_ENABLE, glsl_vertex_pipe_shader}, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_SHADEMODE), {STATE_RENDER(WINED3D_RS_SHADEMODE), glsl_vertex_pipe_shademode}, WINED3D_GL_EXT_NONE },
What's the goal with these? The original idea here was to do these checks once at device creation time instead of during the performance critical draw preparation calls, making use of the fact that we have an indirect call anyway.
I suspect you plan to transition to more d3d10-like state objects, which make these fine grained state callbacks impossible. Is this correct?
What's the goal with these? The original idea here was to do these checks once at device creation time instead of during the performance critical draw preparation calls, making use of the fact that we have an indirect call anyway.
I suspect you plan to transition to more d3d10-like state objects, which make these fine grained state callbacks impossible. Is this correct?
Partly applying the state in coarser chunks, yes, but perhaps more saliently trying to get rid of the indirect calls themselves. I had originally written an explanation in this patches, which seems to have gotten lost:
The state table originally took advantage of indirect calls to avoid checking for extensions more than once. However, with modern CPUs indirect calls themselves are a bottleneck, and accordingly we would like to get rid of the state table entirely.
Moreover, the state table is currently used in all backends, but the use of extensions makes it tied to the GL backend. As an intermediate step to getting rid of the state table, consolidate multiple state handlers into one, thereby allowing us to get rid of the "extension" field.
Moreover, the state table is currently used in all backends, but the use of extensions makes it tied to the GL backend.
That's not quite true. Vulkan has extensions too, and adapter_vk_create_device() will pass the supported Vulkan extensions to wined3d_device_init(), which in turn will pass them to compile_state_table().
Of course that's not to say the broader point is invalid; wined3d_context_vk_apply_draw_state() simply doesn't use the state_table[], and ultimately I think we'd like the equivalent GL function to use the same basic structure.
That's not quite true. Vulkan has extensions too, and adapter_vk_create_device() will pass the supported Vulkan extensions to wined3d_device_init(), which in turn will pass them to compile_state_table().
Yes, that was sloppy wording on my part. I should have said that it's tied to wined3d_gl_extension. Granted, that's self-contained and doesn't really rely on anything else about the GL backend, but it's still conceptually kind of ugly, and I was hoping to fully segregate the GL and Vulkan code [which was the real motivation for this].
Of course that's not to say the broader point is invalid; wined3d_context_vk_apply_draw_state() simply doesn't use the state_table[], and ultimately I think we'd like the equivalent GL function to use the same basic structure.
Right, that.
I suppose the question eventually becomes: do we want these patches, or do we want to do this differently? E.g. if our ultimate goal is "get rid of the state table entirely", perhaps it makes sense to just pull state handlers out of the state table one at a time, and basically turn extension selection into a conditional while doing so. The idea of this patch is to do that in two steps instead of one, but it does have the disadvantage that it hypothetically makes performance worse in the meantime.
I suppose the question eventually becomes: do we want these patches, or do we want to do this differently? E.g. if our ultimate goal is "get rid of the state table entirely", perhaps it makes sense to just pull state handlers out of the state table one at a time, and basically turn extension selection into a conditional while doing so. The idea of this patch is to do that in two steps instead of one, but it does have the disadvantage that it hypothetically makes performance worse in the meantime.
The performance impact doesn't seem too concerning at first sight, but it never hurts to run some benchmarks when making these kinds of changes...
As an aside, note that some of these state handlers end up being somewhat poorly named by these changes. E.g., glsl_vertex_pipe_texmatrix_np2() doesn't really cover the purpose of the function if we're making it the general STATE_SAMPLER handler for glsl_vertex_pipe_vp_states[].