wined3d: Get rid of ARB_vertex_blend support.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-03-23 15:14:32 +04:30 committed by Alexandre Julliard
parent 4aaf9ebe82
commit 1251fe6921
5 changed files with 8 additions and 177 deletions

View File

@ -2144,15 +2144,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
checkGLcall("glPixelStorei(GL_UNPACK_ALIGNMENT, 1);"); checkGLcall("glPixelStorei(GL_UNPACK_ALIGNMENT, 1);");
if (gl_info->supported[ARB_VERTEX_BLEND])
{
/* Direct3D always uses n-1 weights for n world matrices and uses
* 1 - sum for the last one this is equal to GL_WEIGHT_SUM_UNITY_ARB.
* Enabling it doesn't do anything unless GL_VERTEX_BLEND_ARB isn't
* enabled as well. */
gl_info->gl_ops.gl.p_glEnable(GL_WEIGHT_SUM_UNITY_ARB);
checkGLcall("glEnable(GL_WEIGHT_SUM_UNITY_ARB)");
}
if (gl_info->supported[NV_TEXTURE_SHADER2]) if (gl_info->supported[NV_TEXTURE_SHADER2])
{ {
/* Set up the previous texture input for all shader units. This applies to bump mapping, and in d3d /* Set up the previous texture input for all shader units. This applies to bump mapping, and in d3d

View File

@ -200,7 +200,6 @@ static const struct wined3d_extension_map gl_extension_map[] =
{"GL_ARB_transform_feedback3", ARB_TRANSFORM_FEEDBACK3 }, {"GL_ARB_transform_feedback3", ARB_TRANSFORM_FEEDBACK3 },
{"GL_ARB_uniform_buffer_object", ARB_UNIFORM_BUFFER_OBJECT }, {"GL_ARB_uniform_buffer_object", ARB_UNIFORM_BUFFER_OBJECT },
{"GL_ARB_vertex_array_bgra", ARB_VERTEX_ARRAY_BGRA }, {"GL_ARB_vertex_array_bgra", ARB_VERTEX_ARRAY_BGRA },
{"GL_ARB_vertex_blend", ARB_VERTEX_BLEND },
{"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT }, {"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT },
{"GL_ARB_vertex_program", ARB_VERTEX_PROGRAM }, {"GL_ARB_vertex_program", ARB_VERTEX_PROGRAM },
{"GL_ARB_vertex_shader", ARB_VERTEX_SHADER }, {"GL_ARB_vertex_shader", ARB_VERTEX_SHADER },
@ -2935,17 +2934,6 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
USE_GL_FUNC(glGetUniformBlockIndex) USE_GL_FUNC(glGetUniformBlockIndex)
USE_GL_FUNC(glGetUniformIndices) USE_GL_FUNC(glGetUniformIndices)
USE_GL_FUNC(glUniformBlockBinding) USE_GL_FUNC(glUniformBlockBinding)
/* GL_ARB_vertex_blend */
USE_GL_FUNC(glVertexBlendARB)
USE_GL_FUNC(glWeightPointerARB)
USE_GL_FUNC(glWeightbvARB)
USE_GL_FUNC(glWeightdvARB)
USE_GL_FUNC(glWeightfvARB)
USE_GL_FUNC(glWeightivARB)
USE_GL_FUNC(glWeightsvARB)
USE_GL_FUNC(glWeightubvARB)
USE_GL_FUNC(glWeightuivARB)
USE_GL_FUNC(glWeightusvARB)
/* GL_ARB_vertex_buffer_object */ /* GL_ARB_vertex_buffer_object */
USE_GL_FUNC(glBindBufferARB) USE_GL_FUNC(glBindBufferARB)
USE_GL_FUNC(glBufferDataARB) USE_GL_FUNC(glBufferDataARB)
@ -3464,7 +3452,6 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
GLfloat gl_floatv[2]; GLfloat gl_floatv[2];
GLint gl_max; GLint gl_max;
gl_info->limits.blends = 1;
gl_info->limits.buffers = 1; gl_info->limits.buffers = 1;
gl_info->limits.textures = 0; gl_info->limits.textures = 0;
gl_info->limits.texture_coords = 0; gl_info->limits.texture_coords = 0;
@ -3614,12 +3601,6 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
gl_info->limits.texture_coords = 1; gl_info->limits.texture_coords = 1;
} }
if (gl_info->supported[ARB_VERTEX_BLEND])
{
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max);
gl_info->limits.blends = gl_max;
TRACE("Max blends: %u.\n", gl_info->limits.blends);
}
if (gl_info->supported[EXT_TEXTURE3D]) if (gl_info->supported[EXT_TEXTURE3D])
{ {
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gl_max); gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gl_max);

View File

@ -3834,41 +3834,9 @@ void clipplane(struct wined3d_context *context, const struct wined3d_state *stat
static void transform_worldex(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) static void transform_worldex(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{ {
UINT matrix = state_id - STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)); unsigned int matrix = state_id - STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0));
const struct wined3d_gl_info *gl_info = context->gl_info;
GLenum glMat;
TRACE("Setting world matrix %d\n", matrix); WARN("Unsupported world matrix %u set.\n", matrix);
if (matrix >= gl_info->limits.blends)
{
WARN("Unsupported blend matrix set\n");
return;
}
if (isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_VIEW)))
return;
/* GL_MODELVIEW0_ARB: 0x1700
* GL_MODELVIEW1_ARB: 0x850a
* GL_MODELVIEW2_ARB: 0x8722
* GL_MODELVIEW3_ARB: 0x8723
* etc
* GL_MODELVIEW31_ARB: 0x873f
*/
if(matrix == 1) glMat = GL_MODELVIEW1_ARB;
else glMat = GL_MODELVIEW2_ARB - 2 + matrix;
gl_info->gl_ops.gl.p_glMatrixMode(glMat);
checkGLcall("glMatrixMode(glMat)");
/* World matrix 0 is multiplied with the view matrix because d3d uses 3
* matrices while gl uses only 2. To avoid weighting the view matrix
* incorrectly it has to be multiplied into every GL modelview matrix. */
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW]._11);
checkGLcall("glLoadMatrixf");
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(matrix)]._11);
checkGLcall("glMultMatrixf");
} }
static void state_vertexblend_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) static void state_vertexblend_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@ -3883,50 +3851,6 @@ static void state_vertexblend_w(struct wined3d_context *context, const struct wi
else WARN("Vertex blend flags %#x not supported.\n", f); else WARN("Vertex blend flags %#x not supported.\n", f);
} }
static void state_vertexblend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
enum wined3d_vertex_blend_flags val = state->render_states[WINED3D_RS_VERTEXBLEND];
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_device *device = context->device;
static unsigned int once;
switch (val)
{
case WINED3D_VBF_1WEIGHTS:
case WINED3D_VBF_2WEIGHTS:
case WINED3D_VBF_3WEIGHTS:
gl_info->gl_ops.gl.p_glEnable(GL_VERTEX_BLEND_ARB);
checkGLcall("glEnable(GL_VERTEX_BLEND_ARB)");
/* D3D adds one more matrix which has weight (1 - sum(weights)).
* This is enabled at context creation with enabling
* GL_WEIGHT_SUM_UNITY_ARB. */
GL_EXTCALL(glVertexBlendARB(state->render_states[WINED3D_RS_VERTEXBLEND] + 1));
if (!device->vertexBlendUsed)
{
unsigned int i;
for (i = 1; i < gl_info->limits.blends; ++i)
{
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(i))))
transform_worldex(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(i)));
}
device->vertexBlendUsed = TRUE;
}
break;
case WINED3D_VBF_TWEENING:
case WINED3D_VBF_0WEIGHTS: /* Indexed vertex blending, not supported. */
if (!once++) FIXME("Vertex blend flags %#x not supported.\n", val);
else WARN("Vertex blend flags %#x not supported.\n", val);
/* Fall through. */
case WINED3D_VBF_DISABLE:
gl_info->gl_ops.gl.p_glDisable(GL_VERTEX_BLEND_ARB);
checkGLcall("glDisable(GL_VERTEX_BLEND_ARB)");
break;
}
}
static void transform_view(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) static void transform_view(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
@ -3977,16 +3901,6 @@ static void transform_view(struct wined3d_context *context, const struct wined3d
* No need to do it here if the state is scheduled for update. */ * No need to do it here if the state is scheduled for update. */
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)))) if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0))))
transform_world(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0))); transform_world(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)));
/* Avoid looping over a number of matrices if the app never used the functionality */
if (context->device->vertexBlendUsed)
{
for (k = 1; k < gl_info->limits.blends; ++k)
{
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(k))))
transform_worldex(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(k)));
}
}
} }
static void transform_projection(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) static void transform_projection(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@ -4011,8 +3925,6 @@ static void unload_vertex_data(const struct wined3d_gl_info *gl_info)
gl_info->gl_ops.gl.p_glDisableClientState(GL_COLOR_ARRAY); gl_info->gl_ops.gl.p_glDisableClientState(GL_COLOR_ARRAY);
if (gl_info->supported[EXT_SECONDARY_COLOR]) if (gl_info->supported[EXT_SECONDARY_COLOR])
gl_info->gl_ops.gl.p_glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); gl_info->gl_ops.gl.p_glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
if (gl_info->supported[ARB_VERTEX_BLEND])
gl_info->gl_ops.gl.p_glDisableClientState(GL_WEIGHT_ARRAY_ARB);
unload_tex_coords(gl_info); unload_tex_coords(gl_info);
} }
@ -4256,60 +4168,11 @@ static void load_vertex_data(struct wined3d_context *context,
{ {
e = &si->elements[WINED3D_FFP_BLENDWEIGHT]; e = &si->elements[WINED3D_FFP_BLENDWEIGHT];
if (gl_info->supported[ARB_VERTEX_BLEND]) /* TODO: Support vertex blending in immediate mode draws. No need to
{ * write a FIXME here, this is done after the general vertex
TRACE("Blend %u %p %u\n", e->format->component_count,
e->data.addr + state->load_base_vertex_index * e->stride, e->stride);
gl_info->gl_ops.gl.p_glEnableClientState(GL_WEIGHT_ARRAY_ARB);
checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)");
GL_EXTCALL(glVertexBlendARB(e->format->component_count + 1));
if (curVBO != e->data.buffer_object)
{
GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, e->data.buffer_object));
checkGLcall("glBindBuffer");
curVBO = e->data.buffer_object;
}
TRACE("glWeightPointerARB(%#x, %#x, %#x, %p);\n",
e->format->gl_vtx_format,
e->format->gl_vtx_type,
e->stride,
e->data.addr + state->load_base_vertex_index * e->stride);
GL_EXTCALL(glWeightPointerARB(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
e->data.addr + state->load_base_vertex_index * e->stride));
checkGLcall("glWeightPointerARB");
if (si->use_map & (1u << WINED3D_FFP_BLENDINDICES))
{
static BOOL warned;
if (!warned)
{
FIXME("blendMatrixIndices support\n");
warned = TRUE;
}
}
}
else
{
/* TODO: Support vertex blending in immediate mode draws. No need
* to write a FIXME here, this is done after the general vertex
* declaration decoding. */ * declaration decoding. */
WARN("Vertex blending not supported.\n"); WARN("Vertex blending not supported.\n");
} }
}
else
{
if (gl_info->supported[ARB_VERTEX_BLEND])
{
static const GLbyte one = 1;
GL_EXTCALL(glWeightbvARB(1, &one));
checkGLcall("glWeightbvARB(gl_info->max_blends, weights)");
}
}
/* Point Size ----------------------------------------------*/ /* Point Size ----------------------------------------------*/
if (si->use_map & (1u << WINED3D_FFP_PSIZE)) if (si->use_map & (1u << WINED3D_FFP_PSIZE))
@ -5605,7 +5468,6 @@ static const struct StateEntryTemplate vp_ffp_states[] =
{ STATE_RENDER(WINED3D_RS_SPECULARMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_SPECULARMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_AMBIENTMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_AMBIENTMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_EMISSIVEMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_EMISSIVEMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_VERTEXBLEND), { STATE_RENDER(WINED3D_RS_VERTEXBLEND), state_vertexblend }, ARB_VERTEX_BLEND },
{ STATE_RENDER(WINED3D_RS_VERTEXBLEND), { STATE_RENDER(WINED3D_RS_VERTEXBLEND), state_vertexblend_w }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_VERTEXBLEND), { STATE_RENDER(WINED3D_RS_VERTEXBLEND), state_vertexblend_w }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_POINTSIZE), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_POINTSIZE), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
{ 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_arb }, ARB_POINT_PARAMETERS },
@ -5778,7 +5640,7 @@ static void vp_ffp_get_caps(const struct wined3d_gl_info *gl_info, struct wined3
caps->xyzrhw = FALSE; caps->xyzrhw = FALSE;
caps->ffp_generic_attributes = FALSE; caps->ffp_generic_attributes = FALSE;
caps->max_active_lights = gl_info->limits.lights; caps->max_active_lights = gl_info->limits.lights;
caps->max_vertex_blend_matrices = gl_info->limits.blends; caps->max_vertex_blend_matrices = 1;
caps->max_vertex_blend_matrix_index = 0; caps->max_vertex_blend_matrix_index = 0;
caps->vertex_processing_caps = WINED3DVTXPCAPS_DIRECTIONALLIGHTS caps->vertex_processing_caps = WINED3DVTXPCAPS_DIRECTIONALLIGHTS
| WINED3DVTXPCAPS_MATERIALSOURCE7 | WINED3DVTXPCAPS_MATERIALSOURCE7

View File

@ -133,7 +133,6 @@ enum wined3d_gl_extension
ARB_TRANSFORM_FEEDBACK3, ARB_TRANSFORM_FEEDBACK3,
ARB_UNIFORM_BUFFER_OBJECT, ARB_UNIFORM_BUFFER_OBJECT,
ARB_VERTEX_ARRAY_BGRA, ARB_VERTEX_ARRAY_BGRA,
ARB_VERTEX_BLEND,
ARB_VERTEX_BUFFER_OBJECT, ARB_VERTEX_BUFFER_OBJECT,
ARB_VERTEX_PROGRAM, ARB_VERTEX_PROGRAM,
ARB_VERTEX_SHADER, ARB_VERTEX_SHADER,

View File

@ -2531,7 +2531,6 @@ struct wined3d_gl_limits
UINT texture3d_size; UINT texture3d_size;
float pointsize_max; float pointsize_max;
float pointsize_min; float pointsize_min;
UINT blends;
UINT anisotropy; UINT anisotropy;
float shininess; float shininess;
UINT samples; UINT samples;
@ -2899,13 +2898,12 @@ struct wined3d_device
APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1]; APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1];
struct wined3d_blitter *blitter; struct wined3d_blitter *blitter;
BYTE vertexBlendUsed : 1; /* To avoid needless setting of the blend matrices */
BYTE bCursorVisible : 1; BYTE bCursorVisible : 1;
BYTE d3d_initialized : 1; BYTE d3d_initialized : 1;
BYTE inScene : 1; /* A flag to check for proper BeginScene / EndScene call pairs */ BYTE inScene : 1; /* A flag to check for proper BeginScene / EndScene call pairs */
BYTE softwareVertexProcessing : 1; /* process vertex shaders using software or hardware */ BYTE softwareVertexProcessing : 1; /* process vertex shaders using software or hardware */
BYTE filter_messages : 1; BYTE filter_messages : 1;
BYTE padding : 2; BYTE padding : 3;
unsigned char surface_alignment; /* Line Alignment of surfaces */ unsigned char surface_alignment; /* Line Alignment of surfaces */