wined3d: Handle per-vertex point size in the GLSL FFP replacement.

This commit is contained in:
Matteo Bruni 2015-06-16 22:45:37 +02:00 committed by Alexandre Julliard
parent 3f3e2ba2c7
commit 170dca7741
6 changed files with 11 additions and 6 deletions

View File

@ -6475,7 +6475,7 @@ static void test_pointsize(void)
{decl, &vs1, &ps1, D3DFVF_XYZ, 32, 32},
{NULL, &novs, &ps1, D3DFVF_XYZ, 32, 62},
{decl, &vs1, &nops, D3DFVF_XYZ, 32, 32},
/* {NULL, &novs, &nops, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 48}, */
{NULL, &novs, &nops, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 48},
{decl_psize, &vs1_psize, &ps1, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 24},
};
static const struct

View File

@ -10325,7 +10325,7 @@ static void pointsize_test(void)
{&vs1, &ps2_zw, D3DFVF_XYZ, 32, 32, TRUE, FALSE},
{&vs3, &ps3, D3DFVF_XYZ, 32, 32, FALSE, TRUE},
{&vs3, &ps3_zw, D3DFVF_XYZ, 32, 32, TRUE, FALSE},
/* {&novs, &nops, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 48, FALSE, FALSE}, */
{&novs, &nops, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 48, FALSE, FALSE},
{&vs1_psize, &ps1, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 24, FALSE, FALSE},
{&vs3_psize, &ps3, D3DFVF_XYZ | D3DFVF_PSIZE, 48, 24, FALSE, TRUE},
};

View File

@ -2785,6 +2785,7 @@ void context_stream_info_from_declaration(struct wined3d_context *context,
/* We need to deal with frequency data! */
struct wined3d_vertex_declaration *declaration = state->vertex_declaration;
BOOL use_vshader = use_vs(state);
BOOL generic_attributes = context->d3d_info->ffp_generic_attributes;
unsigned int i;
stream_info->use_map = 0;
@ -2829,7 +2830,7 @@ void context_stream_info_from_declaration(struct wined3d_context *context,
}
else
{
if (!element->ffp_valid)
if (!generic_attributes && !element->ffp_valid)
{
WARN("Skipping unsupported fixed function element of format %s and usage %s.\n",
debug_d3dformat(element->format->id), debug_d3ddeclusage(element->usage));

View File

@ -5867,9 +5867,10 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct wined3d_string_buffe
if (settings->point_size)
{
shader_addline(buffer, "gl_PointSize = ffp_point.size / sqrt(ffp_point.c_att"
shader_addline(buffer, "gl_PointSize = %s / sqrt(ffp_point.c_att"
" + ffp_point.l_att * length(ec_pos.xyz)"
" + ffp_point.q_att * dot(ec_pos.xyz, ec_pos.xyz));\n");
" + ffp_point.q_att * dot(ec_pos.xyz, ec_pos.xyz));\n",
settings->per_vertex_point_size ? "ffp_attrib_psize" : "ffp_point.size");
shader_addline(buffer, "gl_PointSize = clamp(gl_PointSize, ffp_point.size_min, ffp_point.size_max);\n");
}

View File

@ -4514,6 +4514,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
settings->transformed = 1;
settings->point_size = state->gl_primitive_type == GL_POINTS;
settings->per_vertex_point_size = !!(si->use_map & 1 << WINED3D_FFP_PSIZE);
if (!state->render_states[WINED3D_RS_FOGENABLE])
settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
@ -4539,6 +4540,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
settings->lighting = !!state->render_states[WINED3D_RS_LIGHTING];
settings->localviewer = !!state->render_states[WINED3D_RS_LOCALVIEWER];
settings->point_size = state->gl_primitive_type == GL_POINTS;
settings->per_vertex_point_size = !!(si->use_map & 1 << WINED3D_FFP_PSIZE);
if (state->render_states[WINED3D_RS_COLORVERTEX] && (si->use_map & (1 << WINED3D_FFP_DIFFUSE)))
{

View File

@ -1894,10 +1894,11 @@ struct wined3d_ffp_vs_settings
DWORD lighting : 1;
DWORD localviewer : 1;
DWORD point_size : 1;
DWORD per_vertex_point_size : 1;
DWORD fog_mode : 2;
DWORD texcoords : 8; /* MAX_TEXTURES */
DWORD ortho_fog : 1;
DWORD padding : 14;
DWORD padding : 13;
DWORD texgen[MAX_TEXTURES];
};