Commit faea4679 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Rename MAX_FRAGMENT_SAMPLERS to WINED3D_MAX_FRAGMENT_SAMPLERS.

parent 0be165a7
......@@ -497,7 +497,7 @@ static unsigned int shader_arb_load_constants_f(const struct wined3d_shader *sha
static void shader_arb_load_np2fixup_constants(const struct arb_ps_np2fixup_info *fixup,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
{
GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
GLfloat np2fixup_constants[4 * WINED3D_MAX_FRAGMENT_SAMPLERS];
WORD active = fixup->super.active;
UINT i;
......@@ -1421,7 +1421,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
struct color_fixup_masks masks;
/* D3D vertex shader sampler IDs are vertex samplers(0-3), not global d3d samplers */
if(!pshader) sampler_idx += MAX_FRAGMENT_SAMPLERS;
if(!pshader) sampler_idx += WINED3D_MAX_FRAGMENT_SAMPLERS;
switch (resource_type)
{
......@@ -1465,9 +1465,9 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
else mod = "";
/* Fragment samplers always have indentity mapping */
if(sampler_idx >= MAX_FRAGMENT_SAMPLERS)
if(sampler_idx >= WINED3D_MAX_FRAGMENT_SAMPLERS)
{
sampler_idx = priv->cur_vs_args->vertex.samplers[sampler_idx - MAX_FRAGMENT_SAMPLERS];
sampler_idx = priv->cur_vs_args->vertex.samplers[sampler_idx - WINED3D_MAX_FRAGMENT_SAMPLERS];
}
if (pshader)
......@@ -3749,7 +3749,7 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
/* Load constants to fixup NP2 texcoords if there are still free constants left:
* Constants (texture dimensions) for the NP2 fixup are loaded as local program parameters. This will consume
* at most 8 (MAX_FRAGMENT_SAMPLERS / 2) parameters, which is highly unlikely, since the application had to
* at most 8 (WINED3D_MAX_FRAGMENT_SAMPLERS / 2) parameters, which is highly unlikely, since the application had to
* use 16 NP2 textures at the same time. In case that we run out of constants the fixup is simply not
* applied / activated. This will probably result in wrong rendering of the texture, but will save us from
* shader compilation errors and the subsequent errors when drawing with this shader. */
......@@ -3763,7 +3763,7 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
fixup->offset = next_local;
fixup->super.active = 0;
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
for (i = 0; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i)
{
if (!(map & (1u << i)))
continue;
......@@ -4518,9 +4518,9 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state,
args->clip.boolclip.bools |= (1u << i);
}
args->vertex.samplers[0] = context->tex_unit_map[MAX_FRAGMENT_SAMPLERS + 0];
args->vertex.samplers[1] = context->tex_unit_map[MAX_FRAGMENT_SAMPLERS + 1];
args->vertex.samplers[2] = context->tex_unit_map[MAX_FRAGMENT_SAMPLERS + 2];
args->vertex.samplers[0] = context->tex_unit_map[WINED3D_MAX_FRAGMENT_SAMPLERS + 0];
args->vertex.samplers[1] = context->tex_unit_map[WINED3D_MAX_FRAGMENT_SAMPLERS + 1];
args->vertex.samplers[2] = context->tex_unit_map[WINED3D_MAX_FRAGMENT_SAMPLERS + 2];
args->vertex.samplers[3] = 0;
/* Skip if unused or local */
......
......@@ -2024,12 +2024,12 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
unsigned int base, count;
wined3d_gl_limits_get_texture_unit_range(&gl_info->limits, WINED3D_SHADER_TYPE_PIXEL, &base, &count);
if (base + MAX_FRAGMENT_SAMPLERS > ARRAY_SIZE(context->rev_tex_unit_map))
if (base + WINED3D_MAX_FRAGMENT_SAMPLERS > ARRAY_SIZE(context->rev_tex_unit_map))
{
ERR("Unexpected texture unit base index %u.\n", base);
return FALSE;
}
for (i = 0; i < min(count, MAX_FRAGMENT_SAMPLERS); ++i)
for (i = 0; i < min(count, WINED3D_MAX_FRAGMENT_SAMPLERS); ++i)
{
context->tex_unit_map[i] = base + i;
context->rev_tex_unit_map[base + i] = i;
......@@ -2043,8 +2043,8 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
}
for (i = 0; i < min(count, MAX_VERTEX_SAMPLERS); ++i)
{
context->tex_unit_map[MAX_FRAGMENT_SAMPLERS + i] = base + i;
context->rev_tex_unit_map[base + i] = MAX_FRAGMENT_SAMPLERS + i;
context->tex_unit_map[WINED3D_MAX_FRAGMENT_SAMPLERS + i] = base + i;
context->rev_tex_unit_map[base + i] = WINED3D_MAX_FRAGMENT_SAMPLERS + i;
}
}
......@@ -2364,10 +2364,10 @@ const DWORD *context_get_tex_unit_mapping(const struct wined3d_context *context,
{
case WINED3D_SHADER_TYPE_PIXEL:
*base = 0;
*count = MAX_FRAGMENT_SAMPLERS;
*count = WINED3D_MAX_FRAGMENT_SAMPLERS;
break;
case WINED3D_SHADER_TYPE_VERTEX:
*base = MAX_FRAGMENT_SAMPLERS;
*base = WINED3D_MAX_FRAGMENT_SAMPLERS;
*count = MAX_VERTEX_SAMPLERS;
break;
default:
......@@ -3363,7 +3363,7 @@ static void context_map_psamplers(struct wined3d_context *context, const struct
state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.resource_info;
unsigned int i;
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
for (i = 0; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i)
{
if (resource_info[i].type && context->tex_unit_map[i] != i)
{
......@@ -3384,7 +3384,7 @@ static BOOL context_unit_free_for_vs(const struct wined3d_context *context,
if (current_mapping == WINED3D_UNMAPPED_STAGE)
return TRUE;
if (current_mapping < MAX_FRAGMENT_SAMPLERS)
if (current_mapping < WINED3D_MAX_FRAGMENT_SAMPLERS)
{
/* Used by a fragment sampler */
......@@ -3418,7 +3418,7 @@ static void context_map_vsamplers(struct wined3d_context *context, BOOL ps, cons
for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i)
{
DWORD vsampler_idx = i + MAX_FRAGMENT_SAMPLERS;
DWORD vsampler_idx = i + WINED3D_MAX_FRAGMENT_SAMPLERS;
if (vs_resource_info[i].type)
{
while (start >= 0)
......@@ -3732,13 +3732,13 @@ static void context_preload_textures(struct wined3d_context *context, const stru
for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i)
{
if (state->shader[WINED3D_SHADER_TYPE_VERTEX]->reg_maps.resource_info[i].type)
context_preload_texture(context, state, MAX_FRAGMENT_SAMPLERS + i);
context_preload_texture(context, state, WINED3D_MAX_FRAGMENT_SAMPLERS + i);
}
}
if (use_ps(state))
{
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
for (i = 0; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i)
{
if (state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.resource_info[i].type)
context_preload_texture(context, state, i);
......
......@@ -2124,7 +2124,7 @@ void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device,
device, sampler_idx, debug_d3dsamplerstate(state), value);
if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
if (sampler_idx >= ARRAY_SIZE(device->state.sampler_states))
{
......@@ -2159,7 +2159,7 @@ DWORD CDECL wined3d_device_get_sampler_state(const struct wined3d_device *device
device, sampler_idx, debug_d3dsamplerstate(state));
if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
if (sampler_idx >= ARRAY_SIZE(device->state.sampler_states))
{
......@@ -3541,7 +3541,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
TRACE("device %p, stage %u, texture %p.\n", device, stage, texture);
if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3)
stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
/* Windows accepts overflowing this array... we do not. */
if (stage >= ARRAY_SIZE(device->state.textures))
......@@ -3588,7 +3588,7 @@ struct wined3d_texture * CDECL wined3d_device_get_texture(const struct wined3d_d
TRACE("device %p, stage %u.\n", device, stage);
if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3)
stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
if (stage >= ARRAY_SIZE(device->state.textures))
{
......
......@@ -1244,7 +1244,7 @@ static void shader_glsl_load_np2fixup_constants(const struct glsl_ps_program *ps
{
float sx, sy;
}
np2fixup_constants[MAX_FRAGMENT_SAMPLERS];
np2fixup_constants[WINED3D_MAX_FRAGMENT_SAMPLERS];
UINT fixup = ps->np2_fixup_info->active;
UINT i;
......
......@@ -4018,13 +4018,13 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
{
/* In SM4+ we use dcl_sampler in order to determine if we should use shadow sampler. */
args->shadow = 0;
for (i = 0 ; i < MAX_FRAGMENT_SAMPLERS; ++i)
for (i = 0 ; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i)
args->color_fixup[i] = COLOR_FIXUP_IDENTITY;
args->np2_fixup = 0;
}
else
{
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
for (i = 0; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i)
{
if (!shader->reg_maps.resource_info[i].type)
continue;
......
......@@ -3328,7 +3328,7 @@ static void tex_coordindex(struct wined3d_context *context, const struct wined3d
return;
}
if (mapped_stage >= min(gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL], MAX_FRAGMENT_SAMPLERS))
if (mapped_stage >= min(gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL], WINED3D_MAX_FRAGMENT_SAMPLERS))
{
WARN("stage %u not mapped to a valid texture unit (%u)\n", stage, mapped_stage);
return;
......@@ -3673,7 +3673,7 @@ void apply_pixelshader(struct wined3d_context *context, const struct wined3d_sta
/* Former draw without a pixel shader, some samplers may be
* disabled because of WINED3D_TSS_COLOR_OP = WINED3DTOP_DISABLE
* make sure to enable them. */
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
for (i = 0; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i)
{
if (!isStateDirty(context, STATE_SAMPLER(i)))
sampler(context, state, STATE_SAMPLER(i));
......
......@@ -1137,7 +1137,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
DWORD value = stateblock->stateblock_state.sampler_states[stage][sampler_state];
state->sampler_states[stage][sampler_state] = value;
if (stage >= MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS;
if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS;
wined3d_device_set_sampler_state(device, stage, sampler_state, value);
}
......@@ -1237,7 +1237,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
if (!(map & 1)) continue;
stage = i < MAX_FRAGMENT_SAMPLERS ? i : WINED3DVERTEXTEXTURESAMPLER0 + i - MAX_FRAGMENT_SAMPLERS;
stage = i < WINED3D_MAX_FRAGMENT_SAMPLERS ? i : WINED3DVERTEXTEXTURESAMPLER0 + i - WINED3D_MAX_FRAGMENT_SAMPLERS;
if (stateblock->stateblock_state.textures[i])
wined3d_texture_incref(stateblock->stateblock_state.textures[i]);
if (state->textures[i])
......
......@@ -260,9 +260,9 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup
/* Device caps */
#define WINED3D_MAX_STREAMS 16
#define WINED3D_MAX_TEXTURES 8
#define MAX_FRAGMENT_SAMPLERS 16
#define WINED3D_MAX_FRAGMENT_SAMPLERS 16
#define MAX_VERTEX_SAMPLERS 4
#define MAX_COMBINED_SAMPLERS (MAX_FRAGMENT_SAMPLERS + MAX_VERTEX_SAMPLERS)
#define MAX_COMBINED_SAMPLERS (WINED3D_MAX_FRAGMENT_SAMPLERS + MAX_VERTEX_SAMPLERS)
#define MAX_ACTIVE_LIGHTS 8
#define MAX_CLIP_DISTANCES 8
#define MAX_CONSTANT_BUFFERS 15
......@@ -1344,7 +1344,7 @@ enum wined3d_shader_tex_types
struct ps_compile_args
{
struct color_fixup_desc color_fixup[MAX_FRAGMENT_SAMPLERS];
struct color_fixup_desc color_fixup[WINED3D_MAX_FRAGMENT_SAMPLERS];
enum wined3d_vertex_processing_mode vp_mode;
enum wined3d_ffp_ps_fog_mode fog;
WORD tex_transform; /* ps 1.0-1.3, 4 textures */
......@@ -1354,7 +1354,7 @@ struct ps_compile_args
D3D9 has a limit of 16 samplers and the fixup is superfluous
in D3D10 (unconditional NP2 support mandatory). */
WORD np2_fixup;
WORD shadow; /* MAX_FRAGMENT_SAMPLERS, 16 */
WORD shadow; /* WINED3D_MAX_FRAGMENT_SAMPLERS, 16 */
WORD texcoords_initialized; /* WINED3D_MAX_TEXTURES, 8 */
DWORD pointsprite : 1;
DWORD flatshading : 1;
......@@ -4413,7 +4413,7 @@ void get_fog_start_end(const struct wined3d_context *context, const struct wined
*
* This structure is shared between the GLSL and the ARB backend.*/
struct ps_np2fixup_info {
unsigned char idx[MAX_FRAGMENT_SAMPLERS]; /* indices to the real constant */
unsigned char idx[WINED3D_MAX_FRAGMENT_SAMPLERS]; /* indices to the real constant */
WORD active; /* bitfield indicating if we can apply the fixup */
WORD num_consts;
};
......
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