From 2ac254a0ff9be1227140abdb98b4d8327e3e4780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Tue, 14 Mar 2017 13:16:00 +0100 Subject: [PATCH] wined3d: Add support for samplers in geometry shaders. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/directx.c | 8 +++++++- dlls/wined3d/utils.c | 5 +++++ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 671fb94cc13..1a56b81432b 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -3407,6 +3407,7 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info) gl_info->limits.uniform_blocks[i] = 0; gl_info->limits.fragment_samplers = 1; gl_info->limits.vertex_samplers = 0; + gl_info->limits.geometry_samplers = 0; gl_info->limits.compute_samplers = 0; 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; @@ -3619,6 +3620,9 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info) gl_info->limits.uniform_blocks[WINED3D_SHADER_TYPE_GEOMETRY] = min(gl_max, WINED3D_MAX_CBS); TRACE("Max geometry uniform blocks: %u (%d).\n", 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->limits.geometry_samplers = gl_max; + TRACE("Max geometry samplers: %u.\n", gl_info->limits.geometry_samplers); } if (gl_info->supported[ARB_FRAGMENT_SHADER]) { @@ -3691,7 +3695,8 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info) } gl_info->limits.fragment_samplers = min(gl_info->limits.fragment_samplers, MAX_GL_FRAGMENT_SAMPLERS); - sampler_count = gl_info->limits.vertex_samplers + gl_info->limits.fragment_samplers; + sampler_count = gl_info->limits.vertex_samplers + gl_info->limits.fragment_samplers + + gl_info->limits.geometry_samplers; 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 @@ -3701,6 +3706,7 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info) sampler_count, gl_info->limits.combined_samplers); gl_info->limits.fragment_samplers = min(gl_info->limits.fragment_samplers, 16); gl_info->limits.vertex_samplers = min(gl_info->limits.vertex_samplers, 16); + gl_info->limits.geometry_samplers = min(gl_info->limits.geometry_samplers, 16); } /* A majority of OpenGL implementations allow us to statically partition diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 6fe96e47fb2..f22c314572a 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6014,6 +6014,11 @@ void wined3d_gl_limits_get_texture_unit_range(const struct wined3d_gl_limits *gl if (shader_type == WINED3D_SHADER_TYPE_VERTEX) return; + *base += *count; + *count = gl_limits->geometry_samplers; + if (shader_type == WINED3D_SHADER_TYPE_GEOMETRY) + return; + *base += *count; *count = 0; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8637dd38d0a..cdcb1d16647 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2277,6 +2277,7 @@ struct wined3d_gl_limits unsigned int uniform_blocks[WINED3D_SHADER_TYPE_COUNT]; unsigned int fragment_samplers; unsigned int vertex_samplers; + unsigned int geometry_samplers; unsigned int compute_samplers; unsigned int graphics_samplers; unsigned int combined_samplers;