wined3d: Store GL sampler limits as array.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3f10995ecb
commit
09fa9fbcf1
|
@ -5795,7 +5795,7 @@ static void arbfp_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen
|
||||||
/* TODO: Implement WINED3DTEXOPCAPS_PREMODULATE */
|
/* TODO: Implement WINED3DTEXOPCAPS_PREMODULATE */
|
||||||
|
|
||||||
caps->MaxTextureBlendStages = MAX_TEXTURES;
|
caps->MaxTextureBlendStages = MAX_TEXTURES;
|
||||||
caps->MaxSimultaneousTextures = min(gl_info->limits.fragment_samplers, MAX_TEXTURES);
|
caps->MaxSimultaneousTextures = min(gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL], MAX_TEXTURES);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD arbfp_get_emul_mask(const struct wined3d_gl_info *gl_info)
|
static DWORD arbfp_get_emul_mask(const struct wined3d_gl_info *gl_info)
|
||||||
|
|
|
@ -3404,12 +3404,12 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||||
gl_info->limits.textures = 0;
|
gl_info->limits.textures = 0;
|
||||||
gl_info->limits.texture_coords = 0;
|
gl_info->limits.texture_coords = 0;
|
||||||
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
|
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
|
||||||
|
{
|
||||||
gl_info->limits.uniform_blocks[i] = 0;
|
gl_info->limits.uniform_blocks[i] = 0;
|
||||||
gl_info->limits.fragment_samplers = 1;
|
gl_info->limits.samplers[i] = 0;
|
||||||
gl_info->limits.vertex_samplers = 0;
|
}
|
||||||
gl_info->limits.geometry_samplers = 0;
|
gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL] = 1;
|
||||||
gl_info->limits.compute_samplers = 0;
|
gl_info->limits.combined_samplers = gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL];
|
||||||
gl_info->limits.combined_samplers = gl_info->limits.fragment_samplers + gl_info->limits.vertex_samplers;
|
|
||||||
gl_info->limits.graphics_samplers = gl_info->limits.combined_samplers;
|
gl_info->limits.graphics_samplers = gl_info->limits.combined_samplers;
|
||||||
gl_info->limits.vertex_attribs = 16;
|
gl_info->limits.vertex_attribs = 16;
|
||||||
gl_info->limits.texture_buffer_offset_alignment = 1;
|
gl_info->limits.texture_buffer_offset_alignment = 1;
|
||||||
|
@ -3489,18 +3489,20 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||||
if (gl_info->supported[ARB_FRAGMENT_PROGRAM] || gl_info->supported[ARB_FRAGMENT_SHADER])
|
if (gl_info->supported[ARB_FRAGMENT_PROGRAM] || gl_info->supported[ARB_FRAGMENT_SHADER])
|
||||||
{
|
{
|
||||||
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &gl_max);
|
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &gl_max);
|
||||||
gl_info->limits.fragment_samplers = gl_max;
|
gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL] = gl_max;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gl_info->limits.fragment_samplers = gl_info->limits.textures;
|
gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL] = gl_info->limits.textures;
|
||||||
}
|
}
|
||||||
TRACE("Max fragment samplers: %d.\n", gl_info->limits.fragment_samplers);
|
TRACE("Max fragment samplers: %d.\n", gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL]);
|
||||||
|
|
||||||
if (gl_info->supported[ARB_VERTEX_SHADER])
|
if (gl_info->supported[ARB_VERTEX_SHADER])
|
||||||
{
|
{
|
||||||
|
unsigned int vertex_sampler_count;
|
||||||
|
|
||||||
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &gl_max);
|
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &gl_max);
|
||||||
gl_info->limits.vertex_samplers = gl_max;
|
vertex_sampler_count = gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX] = gl_max;
|
||||||
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &gl_max);
|
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &gl_max);
|
||||||
gl_info->limits.combined_samplers = gl_max;
|
gl_info->limits.combined_samplers = gl_max;
|
||||||
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &gl_max);
|
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &gl_max);
|
||||||
|
@ -3520,23 +3522,24 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||||
*
|
*
|
||||||
* So this is just a check to check that our assumption holds true. If not, write a warning
|
* So this is just a check to check that our assumption holds true. If not, write a warning
|
||||||
* and reduce the number of vertex samplers or probably disable vertex texture fetch. */
|
* and reduce the number of vertex samplers or probably disable vertex texture fetch. */
|
||||||
if (gl_info->limits.vertex_samplers && gl_info->limits.combined_samplers < 12
|
if (vertex_sampler_count && gl_info->limits.combined_samplers < 12
|
||||||
&& MAX_TEXTURES + gl_info->limits.vertex_samplers > gl_info->limits.combined_samplers)
|
&& MAX_TEXTURES + vertex_sampler_count > gl_info->limits.combined_samplers)
|
||||||
{
|
{
|
||||||
FIXME("OpenGL implementation supports %u vertex samplers and %u total samplers.\n",
|
FIXME("OpenGL implementation supports %u vertex samplers and %u total samplers.\n",
|
||||||
gl_info->limits.vertex_samplers, gl_info->limits.combined_samplers);
|
vertex_sampler_count, gl_info->limits.combined_samplers);
|
||||||
FIXME("Expected vertex samplers + MAX_TEXTURES(=8) > combined_samplers.\n");
|
FIXME("Expected vertex samplers + MAX_TEXTURES(=8) > combined_samplers.\n");
|
||||||
if (gl_info->limits.combined_samplers > MAX_TEXTURES)
|
if (gl_info->limits.combined_samplers > MAX_TEXTURES)
|
||||||
gl_info->limits.vertex_samplers = gl_info->limits.combined_samplers - MAX_TEXTURES;
|
vertex_sampler_count = gl_info->limits.combined_samplers - MAX_TEXTURES;
|
||||||
else
|
else
|
||||||
gl_info->limits.vertex_samplers = 0;
|
vertex_sampler_count = 0;
|
||||||
|
gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX] = vertex_sampler_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gl_info->limits.combined_samplers = gl_info->limits.fragment_samplers;
|
gl_info->limits.combined_samplers = gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL];
|
||||||
}
|
}
|
||||||
TRACE("Max vertex samplers: %u.\n", gl_info->limits.vertex_samplers);
|
TRACE("Max vertex samplers: %u.\n", gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX]);
|
||||||
TRACE("Max combined samplers: %u.\n", gl_info->limits.combined_samplers);
|
TRACE("Max combined samplers: %u.\n", gl_info->limits.combined_samplers);
|
||||||
TRACE("Max vertex attributes: %u.\n", gl_info->limits.vertex_attribs);
|
TRACE("Max vertex attributes: %u.\n", gl_info->limits.vertex_attribs);
|
||||||
}
|
}
|
||||||
|
@ -3621,8 +3624,8 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||||
TRACE("Max geometry uniform blocks: %u (%d).\n",
|
TRACE("Max geometry uniform blocks: %u (%d).\n",
|
||||||
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_GEOMETRY], gl_max);
|
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_GEOMETRY], gl_max);
|
||||||
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &gl_max);
|
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &gl_max);
|
||||||
gl_info->limits.geometry_samplers = gl_max;
|
gl_info->limits.samplers[WINED3D_SHADER_TYPE_GEOMETRY] = gl_max;
|
||||||
TRACE("Max geometry samplers: %u.\n", gl_info->limits.geometry_samplers);
|
TRACE("Max geometry samplers: %u.\n", gl_info->limits.samplers[WINED3D_SHADER_TYPE_GEOMETRY]);
|
||||||
}
|
}
|
||||||
if (gl_info->supported[ARB_FRAGMENT_SHADER])
|
if (gl_info->supported[ARB_FRAGMENT_SHADER])
|
||||||
{
|
{
|
||||||
|
@ -3648,8 +3651,8 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||||
TRACE("Max compute uniform blocks: %u (%d).\n",
|
TRACE("Max compute uniform blocks: %u (%d).\n",
|
||||||
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_COMPUTE], gl_max);
|
gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_COMPUTE], gl_max);
|
||||||
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS, &gl_max);
|
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS, &gl_max);
|
||||||
gl_info->limits.compute_samplers = gl_max;
|
gl_info->limits.samplers[WINED3D_SHADER_TYPE_COMPUTE] = gl_max;
|
||||||
TRACE("Max compute samplers: %u.\n", gl_info->limits.compute_samplers);
|
TRACE("Max compute samplers: %u.\n", gl_info->limits.samplers[WINED3D_SHADER_TYPE_COMPUTE]);
|
||||||
}
|
}
|
||||||
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
|
if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT])
|
||||||
{
|
{
|
||||||
|
@ -3694,9 +3697,11 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||||
gl_info->limits.samples = gl_max;
|
gl_info->limits.samples = gl_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_info->limits.fragment_samplers = min(gl_info->limits.fragment_samplers, MAX_GL_FRAGMENT_SAMPLERS);
|
gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL] =
|
||||||
sampler_count = gl_info->limits.vertex_samplers + gl_info->limits.fragment_samplers
|
min(gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL], MAX_GL_FRAGMENT_SAMPLERS);
|
||||||
+ gl_info->limits.geometry_samplers;
|
sampler_count = 0;
|
||||||
|
for (i = 0; i < WINED3D_SHADER_TYPE_GRAPHICS_COUNT; ++i)
|
||||||
|
sampler_count += gl_info->limits.samplers[i];
|
||||||
if (gl_info->supported[WINED3D_GL_VERSION_3_2] && gl_info->limits.combined_samplers < sampler_count)
|
if (gl_info->supported[WINED3D_GL_VERSION_3_2] && gl_info->limits.combined_samplers < sampler_count)
|
||||||
{
|
{
|
||||||
/* The minimum value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS in OpenGL
|
/* The minimum value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS in OpenGL
|
||||||
|
@ -3704,16 +3709,16 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||||
* the minimum value is increased to 80. */
|
* the minimum value is increased to 80. */
|
||||||
WARN("Graphics pipeline sampler count %u is greater than combined sampler count %u.\n",
|
WARN("Graphics pipeline sampler count %u is greater than combined sampler count %u.\n",
|
||||||
sampler_count, gl_info->limits.combined_samplers);
|
sampler_count, gl_info->limits.combined_samplers);
|
||||||
gl_info->limits.fragment_samplers = min(gl_info->limits.fragment_samplers, 16);
|
for (i = 0; i < WINED3D_SHADER_TYPE_GRAPHICS_COUNT; ++i)
|
||||||
gl_info->limits.vertex_samplers = min(gl_info->limits.vertex_samplers, 16);
|
gl_info->limits.samplers[i] = min(gl_info->limits.samplers[i], 16);
|
||||||
gl_info->limits.geometry_samplers = min(gl_info->limits.geometry_samplers, 16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A majority of OpenGL implementations allow us to statically partition
|
/* A majority of OpenGL implementations allow us to statically partition
|
||||||
* the set of texture bindings into six separate sets. */
|
* the set of texture bindings into six separate sets. */
|
||||||
gl_info->limits.graphics_samplers = gl_info->limits.combined_samplers;
|
gl_info->limits.graphics_samplers = gl_info->limits.combined_samplers;
|
||||||
if (gl_info->limits.combined_samplers >= sampler_count + gl_info->limits.compute_samplers)
|
sampler_count += gl_info->limits.samplers[WINED3D_SHADER_TYPE_COMPUTE];
|
||||||
gl_info->limits.graphics_samplers -= gl_info->limits.compute_samplers;
|
if (gl_info->limits.combined_samplers >= sampler_count)
|
||||||
|
gl_info->limits.graphics_samplers -= gl_info->limits.samplers[WINED3D_SHADER_TYPE_COMPUTE];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Context activation is done by the caller. */
|
/* Context activation is done by the caller. */
|
||||||
|
|
|
@ -10476,7 +10476,7 @@ static void glsl_fragment_pipe_get_caps(const struct wined3d_gl_info *gl_info, s
|
||||||
| WINED3DTEXOPCAPS_BUMPENVMAP
|
| WINED3DTEXOPCAPS_BUMPENVMAP
|
||||||
| WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE;
|
| WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE;
|
||||||
caps->MaxTextureBlendStages = MAX_TEXTURES;
|
caps->MaxTextureBlendStages = MAX_TEXTURES;
|
||||||
caps->MaxSimultaneousTextures = min(gl_info->limits.fragment_samplers, MAX_TEXTURES);
|
caps->MaxSimultaneousTextures = min(gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL], MAX_TEXTURES);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD glsl_fragment_pipe_get_emul_mask(const struct wined3d_gl_info *gl_info)
|
static DWORD glsl_fragment_pipe_get_emul_mask(const struct wined3d_gl_info *gl_info)
|
||||||
|
|
|
@ -3323,7 +3323,7 @@ static void tex_coordindex(struct wined3d_context *context, const struct wined3d
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapped_stage >= min(gl_info->limits.fragment_samplers, MAX_FRAGMENT_SAMPLERS))
|
if (mapped_stage >= min(gl_info->limits.samplers[WINED3D_SHADER_TYPE_PIXEL], MAX_FRAGMENT_SAMPLERS))
|
||||||
{
|
{
|
||||||
WARN("stage %u not mapped to a valid texture unit (%u)\n", stage, mapped_stage);
|
WARN("stage %u not mapped to a valid texture unit (%u)\n", stage, mapped_stage);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2759,7 +2759,7 @@ static void query_internal_format(struct wined3d_adapter *adapter,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!gl_info->limits.vertex_samplers)
|
if (!gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX])
|
||||||
format_clear_flag(format, WINED3DFMT_FLAG_VTF);
|
format_clear_flag(format, WINED3DFMT_FLAG_VTF);
|
||||||
|
|
||||||
if (!(gl_info->quirks & WINED3D_QUIRK_LIMITED_TEX_FILTERING))
|
if (!(gl_info->quirks & WINED3D_QUIRK_LIMITED_TEX_FILTERING))
|
||||||
|
@ -5994,32 +5994,28 @@ void wined3d_gl_limits_get_uniform_block_range(const struct wined3d_gl_limits *g
|
||||||
void wined3d_gl_limits_get_texture_unit_range(const struct wined3d_gl_limits *gl_limits,
|
void wined3d_gl_limits_get_texture_unit_range(const struct wined3d_gl_limits *gl_limits,
|
||||||
enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
|
enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
if (shader_type == WINED3D_SHADER_TYPE_COMPUTE)
|
if (shader_type == WINED3D_SHADER_TYPE_COMPUTE)
|
||||||
{
|
{
|
||||||
if (gl_limits->combined_samplers == gl_limits->graphics_samplers)
|
if (gl_limits->combined_samplers == gl_limits->graphics_samplers)
|
||||||
*base = 0;
|
*base = 0;
|
||||||
else
|
else
|
||||||
*base = gl_limits->graphics_samplers - 1;
|
*base = gl_limits->graphics_samplers - 1;
|
||||||
*count = gl_limits->compute_samplers;
|
*count = gl_limits->samplers[WINED3D_SHADER_TYPE_COMPUTE];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*base = 0;
|
*base = 0;
|
||||||
*count = gl_limits->fragment_samplers;
|
for (i = 0; i < WINED3D_SHADER_TYPE_GRAPHICS_COUNT; ++i)
|
||||||
if (shader_type == WINED3D_SHADER_TYPE_PIXEL)
|
{
|
||||||
|
*count = gl_limits->samplers[i];
|
||||||
|
if (i == shader_type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
*base += *count;
|
*base += *count;
|
||||||
*count = gl_limits->vertex_samplers;
|
}
|
||||||
if (shader_type == WINED3D_SHADER_TYPE_VERTEX)
|
|
||||||
return;
|
|
||||||
|
|
||||||
*base += *count;
|
ERR("Unrecognized shader type %#x.\n", shader_type);
|
||||||
*count = gl_limits->geometry_samplers;
|
|
||||||
if (shader_type == WINED3D_SHADER_TYPE_GEOMETRY)
|
|
||||||
return;
|
|
||||||
|
|
||||||
*base += *count;
|
|
||||||
*count = 0;
|
*count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2275,10 +2275,7 @@ struct wined3d_gl_limits
|
||||||
UINT textures;
|
UINT textures;
|
||||||
UINT texture_coords;
|
UINT texture_coords;
|
||||||
unsigned int uniform_blocks[WINED3D_SHADER_TYPE_COUNT];
|
unsigned int uniform_blocks[WINED3D_SHADER_TYPE_COUNT];
|
||||||
unsigned int fragment_samplers;
|
unsigned int samplers[WINED3D_SHADER_TYPE_COUNT];
|
||||||
unsigned int vertex_samplers;
|
|
||||||
unsigned int geometry_samplers;
|
|
||||||
unsigned int compute_samplers;
|
|
||||||
unsigned int graphics_samplers;
|
unsigned int graphics_samplers;
|
||||||
unsigned int combined_samplers;
|
unsigned int combined_samplers;
|
||||||
UINT general_combiners;
|
UINT general_combiners;
|
||||||
|
|
Loading…
Reference in New Issue