wined3d: Cleanup user clip distances defines and fields a bit.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e8bc4627fd
commit
a599109247
|
@ -822,7 +822,7 @@ static void shader_generate_arb_declarations(const struct wined3d_shader *shader
|
|||
if(use_nv_clip(gl_info) && ctx->target_version >= NV2)
|
||||
{
|
||||
if(ctx->cur_vs_args->super.clip_enabled)
|
||||
clip_limit = gl_info->limits.clipplanes;
|
||||
clip_limit = gl_info->limits.user_clip_distances;
|
||||
else
|
||||
clip_limit = 0;
|
||||
}
|
||||
|
@ -835,13 +835,16 @@ static void shader_generate_arb_declarations(const struct wined3d_shader *shader
|
|||
max_constantsF -= *num_clipplanes;
|
||||
if(*num_clipplanes < clip_limit)
|
||||
{
|
||||
WARN("Only %u clipplanes out of %u enabled\n", *num_clipplanes, gl_info->limits.clipplanes);
|
||||
WARN("Only %u clip planes out of %u enabled.\n", *num_clipplanes,
|
||||
gl_info->limits.user_clip_distances);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ctx->target_version >= NV2) *num_clipplanes = gl_info->limits.clipplanes;
|
||||
else *num_clipplanes = min(gl_info->limits.clipplanes, 4);
|
||||
if (ctx->target_version >= NV2)
|
||||
*num_clipplanes = gl_info->limits.user_clip_distances;
|
||||
else
|
||||
*num_clipplanes = min(gl_info->limits.user_clip_distances, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3232,7 +3235,7 @@ static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx,
|
|||
unsigned int cur_clip = 0;
|
||||
const char *zero = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_ZERO);
|
||||
|
||||
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
||||
for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
|
||||
{
|
||||
if (args->clip.boolclip.clipplane_mask & (1u << i))
|
||||
{
|
||||
|
|
|
@ -1853,7 +1853,7 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device,
|
|||
TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
|
||||
|
||||
/* Validate plane_idx. */
|
||||
if (plane_idx >= device->adapter->gl_info.limits.clipplanes)
|
||||
if (plane_idx >= device->adapter->gl_info.limits.user_clip_distances)
|
||||
{
|
||||
TRACE("Application has requested clipplane this device doesn't support.\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
@ -1882,7 +1882,7 @@ HRESULT CDECL wined3d_device_get_clip_plane(const struct wined3d_device *device,
|
|||
TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
|
||||
|
||||
/* Validate plane_idx. */
|
||||
if (plane_idx >= device->adapter->gl_info.limits.clipplanes)
|
||||
if (plane_idx >= device->adapter->gl_info.limits.user_clip_distances)
|
||||
{
|
||||
TRACE("Application has requested clipplane this device doesn't support.\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
|
|
@ -3302,8 +3302,8 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
|||
gl_info->limits.arb_ps_instructions = 0;
|
||||
gl_info->limits.arb_ps_temps = 0;
|
||||
|
||||
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
|
||||
gl_info->limits.clipplanes = min(WINED3DMAXUSERCLIPPLANES, gl_max);
|
||||
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_CLIP_DISTANCES, &gl_max);
|
||||
gl_info->limits.user_clip_distances = min(MAX_CLIP_DISTANCES, gl_max);
|
||||
TRACE("Clip plane support - max planes %d.\n", gl_max);
|
||||
|
||||
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
|
||||
|
|
|
@ -1407,7 +1407,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
|
|||
|
||||
if (update_mask & WINED3D_SHADER_CONST_VS_CLIP_PLANES)
|
||||
{
|
||||
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
||||
for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
|
||||
shader_glsl_clip_plane_uniform(context, state, i, prog);
|
||||
}
|
||||
|
||||
|
@ -1894,7 +1894,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
|||
* clipplane as well. */
|
||||
max_constantsF = gl_info->limits.glsl_vs_float_constants - 3;
|
||||
if (vs_args->clip_enabled)
|
||||
max_constantsF -= gl_info->limits.clipplanes;
|
||||
max_constantsF -= gl_info->limits.user_clip_distances;
|
||||
max_constantsF -= wined3d_popcount(reg_maps->integer_constants);
|
||||
/* Strictly speaking a bool only uses one scalar, but the nvidia(Linux) compiler doesn't pack them properly,
|
||||
* so each scalar requires a full vec4. We could work around this by packing the booleans ourselves, but
|
||||
|
@ -2097,7 +2097,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
|
|||
if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
|
||||
{
|
||||
if (vs_args->clip_enabled)
|
||||
shader_addline(buffer, "uniform vec4 clip_planes[%u];\n", gl_info->limits.clipplanes);
|
||||
shader_addline(buffer, "uniform vec4 clip_planes[%u];\n", gl_info->limits.user_clip_distances);
|
||||
|
||||
if (version->major < 3)
|
||||
{
|
||||
|
@ -6087,7 +6087,7 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
|
|||
if (legacy_context)
|
||||
shader_addline(buffer, "gl_ClipVertex = gl_Position;\n");
|
||||
else
|
||||
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
||||
for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
|
||||
shader_addline(buffer, "gl_ClipDistance[%u] = dot(gl_Position, clip_planes[%u]);\n", i, i);
|
||||
}
|
||||
|
||||
|
@ -6625,7 +6625,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
|||
else
|
||||
{
|
||||
if (settings->clipping)
|
||||
shader_addline(buffer, "uniform vec4 clip_planes[%u];\n", gl_info->limits.clipplanes);
|
||||
shader_addline(buffer, "uniform vec4 clip_planes[%u];\n", gl_info->limits.user_clip_distances);
|
||||
|
||||
declare_out_varying(gl_info, buffer, settings->flatshading, "vec4 ffp_varying_diffuse;\n");
|
||||
declare_out_varying(gl_info, buffer, settings->flatshading, "vec4 ffp_varying_specular;\n");
|
||||
|
@ -6674,7 +6674,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
|
|||
if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
|
||||
shader_addline(buffer, "gl_ClipVertex = ec_pos;\n");
|
||||
else
|
||||
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
||||
for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
|
||||
shader_addline(buffer, "gl_ClipDistance[%u] = dot(ec_pos, clip_planes[%u]);\n", i, i);
|
||||
}
|
||||
shader_addline(buffer, "ec_pos /= ec_pos.w;\n");
|
||||
|
@ -8943,7 +8943,7 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_gl_info *gl_info,
|
|||
| WINED3DVTXPCAPS_LOCALVIEWER
|
||||
| WINED3DVTXPCAPS_TEXGEN_SPHEREMAP;
|
||||
caps->fvf_caps = WINED3DFVFCAPS_PSIZE | 8; /* 8 texture coordinates. */
|
||||
caps->max_user_clip_planes = gl_info->limits.clipplanes;
|
||||
caps->max_user_clip_planes = gl_info->limits.user_clip_distances;
|
||||
caps->raster_caps = WINED3DPRASTERCAPS_FOGRANGE;
|
||||
}
|
||||
|
||||
|
@ -9032,7 +9032,7 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context,
|
|||
if (context->last_was_vshader)
|
||||
{
|
||||
if (legacy_context)
|
||||
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
||||
for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
|
||||
clipplane(context, state, STATE_CLIPPLANE(i));
|
||||
else
|
||||
context->constant_update_mask |= WINED3D_SHADER_CONST_VS_CLIP_PLANES;
|
||||
|
@ -9058,7 +9058,7 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context,
|
|||
{
|
||||
/* Vertex shader clipping ignores the view matrix. Update all clip planes. */
|
||||
if (legacy_context)
|
||||
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
||||
for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
|
||||
clipplane(context, state, STATE_CLIPPLANE(i));
|
||||
else
|
||||
context->constant_update_mask |= WINED3D_SHADER_CONST_VS_CLIP_PLANES;
|
||||
|
@ -9119,7 +9119,7 @@ static void glsl_vertex_pipe_view(struct wined3d_context *context, const struct
|
|||
|
||||
if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
|
||||
{
|
||||
for (k = 0; k < gl_info->limits.clipplanes; ++k)
|
||||
for (k = 0; k < gl_info->limits.user_clip_distances; ++k)
|
||||
{
|
||||
if (!isStateDirty(context, STATE_CLIPPLANE(k)))
|
||||
clipplane(context, state, STATE_CLIPPLANE(k));
|
||||
|
@ -9229,7 +9229,7 @@ static void glsl_vertex_pipe_clip_plane(struct wined3d_context *context,
|
|||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
UINT index = state_id - STATE_CLIPPLANE(0);
|
||||
|
||||
if (index >= gl_info->limits.clipplanes)
|
||||
if (index >= gl_info->limits.user_clip_distances)
|
||||
return;
|
||||
|
||||
context->constant_update_mask |= WINED3D_SHADER_CONST_VS_CLIP_PLANES;
|
||||
|
|
|
@ -609,7 +609,7 @@ void state_alpha_test(struct wined3d_context *context, const struct wined3d_stat
|
|||
void state_clipping(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
unsigned int clipplane_count = gl_info->limits.clipplanes;
|
||||
unsigned int clipplane_count = gl_info->limits.user_clip_distances;
|
||||
unsigned int i, enable_mask, disable_mask;
|
||||
|
||||
if (use_vs(state) && !context->d3d_info->vs_clipping)
|
||||
|
@ -3760,7 +3760,7 @@ void clipplane(struct wined3d_context *context, const struct wined3d_state *stat
|
|||
UINT index = state_id - STATE_CLIPPLANE(0);
|
||||
GLdouble plane[4];
|
||||
|
||||
if (isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_VIEW)) || index >= gl_info->limits.clipplanes)
|
||||
if (isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_VIEW)) || index >= gl_info->limits.user_clip_distances)
|
||||
return;
|
||||
|
||||
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
|
||||
|
@ -3914,7 +3914,7 @@ static void transform_view(struct wined3d_context *context, const struct wined3d
|
|||
}
|
||||
|
||||
/* Reset Clipping Planes */
|
||||
for (k = 0; k < gl_info->limits.clipplanes; ++k)
|
||||
for (k = 0; k < gl_info->limits.user_clip_distances; ++k)
|
||||
{
|
||||
if (!isStateDirty(context, STATE_CLIPPLANE(k)))
|
||||
clipplane(context, state, STATE_CLIPPLANE(k));
|
||||
|
@ -4531,7 +4531,7 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine
|
|||
state_clipping(context, state, STATE_RENDER(WINED3D_RS_CLIPPLANEENABLE));
|
||||
}
|
||||
|
||||
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
||||
for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
|
||||
{
|
||||
clipplane(context, state, STATE_CLIPPLANE(i));
|
||||
}
|
||||
|
@ -4548,7 +4548,7 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine
|
|||
/* Disable all clip planes to get defined results on all drivers. See comment in the
|
||||
* state_clipping state handler
|
||||
*/
|
||||
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
||||
for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
|
||||
{
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_CLIP_PLANE0 + i);
|
||||
checkGLcall("glDisable(GL_CLIP_PLANE0 + i)");
|
||||
|
@ -4580,7 +4580,7 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine
|
|||
* (Note: ARB shaders can read the clip planes for clipping emulation even if
|
||||
* device->vs_clipping is false.
|
||||
*/
|
||||
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
||||
for (i = 0; i < gl_info->limits.user_clip_distances; ++i)
|
||||
{
|
||||
clipplane(context, state, STATE_CLIPPLANE(i));
|
||||
}
|
||||
|
@ -5699,7 +5699,7 @@ static void vp_ffp_get_caps(const struct wined3d_gl_info *gl_info, struct wined3
|
|||
| WINED3DVTXPCAPS_TEXGEN
|
||||
| WINED3DVTXPCAPS_TEXGEN_SPHEREMAP;
|
||||
caps->fvf_caps = WINED3DFVFCAPS_PSIZE | 0x0008; /* 8 texture coords */
|
||||
caps->max_user_clip_planes = gl_info->limits.clipplanes;
|
||||
caps->max_user_clip_planes = gl_info->limits.user_clip_distances;
|
||||
caps->raster_caps = 0;
|
||||
if (gl_info->supported[NV_FOG_DISTANCE])
|
||||
caps->raster_caps |= WINED3DPRASTERCAPS_FOGRANGE;
|
||||
|
|
|
@ -180,7 +180,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
|
|||
#define MAX_VERTEX_SAMPLERS 4
|
||||
#define MAX_COMBINED_SAMPLERS (MAX_FRAGMENT_SAMPLERS + MAX_VERTEX_SAMPLERS)
|
||||
#define MAX_ACTIVE_LIGHTS 8
|
||||
#define MAX_CLIPPLANES WINED3DMAXUSERCLIPPLANES
|
||||
#define MAX_CLIP_DISTANCES WINED3DMAXUSERCLIPPLANES
|
||||
#define MAX_CONSTANT_BUFFERS 15
|
||||
#define MAX_SAMPLER_OBJECTS 16
|
||||
#define MAX_SHADER_RESOURCE_VIEWS 128
|
||||
|
@ -1333,9 +1333,9 @@ DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN;
|
|||
#define STATE_IS_SCISSORRECT(a) ((a) == STATE_SCISSORRECT)
|
||||
|
||||
#define STATE_CLIPPLANE(a) (STATE_SCISSORRECT + 1 + (a))
|
||||
#define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(MAX_CLIPPLANES - 1))
|
||||
#define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(MAX_CLIP_DISTANCES - 1))
|
||||
|
||||
#define STATE_MATERIAL (STATE_CLIPPLANE(MAX_CLIPPLANES))
|
||||
#define STATE_MATERIAL (STATE_CLIPPLANE(MAX_CLIP_DISTANCES))
|
||||
#define STATE_IS_MATERIAL(a) ((a) == STATE_MATERIAL)
|
||||
|
||||
#define STATE_FRONTFACE (STATE_MATERIAL + 1)
|
||||
|
@ -2057,7 +2057,7 @@ struct wined3d_gl_limits
|
|||
UINT vertex_samplers;
|
||||
UINT combined_samplers;
|
||||
UINT general_combiners;
|
||||
UINT clipplanes;
|
||||
UINT user_clip_distances;
|
||||
UINT texture_size;
|
||||
UINT texture3d_size;
|
||||
float pointsize_max;
|
||||
|
@ -2396,7 +2396,7 @@ struct wined3d_state
|
|||
DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
|
||||
|
||||
struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1];
|
||||
struct wined3d_vec4 clip_planes[MAX_CLIPPLANES];
|
||||
struct wined3d_vec4 clip_planes[MAX_CLIP_DISTANCES];
|
||||
struct wined3d_material material;
|
||||
struct wined3d_viewport viewport;
|
||||
RECT scissor_rect;
|
||||
|
|
Loading…
Reference in New Issue