=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Add support for samplers in geometry shaders.

Alexandre Julliard julliard at winehq.org
Tue Mar 14 16:14:37 CDT 2017


Module: wine
Branch: master
Commit: 2ac254a0ff9be1227140abdb98b4d8327e3e4780
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2ac254a0ff9be1227140abdb98b4d8327e3e4780

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Mar 14 13:16:00 2017 +0100

wined3d: Add support for samplers in geometry shaders.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 671fb94..1a56b81 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 6fe96e4..f22c314 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -6015,6 +6015,11 @@ void wined3d_gl_limits_get_texture_unit_range(const struct wined3d_gl_limits *gl
         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 8637dd3..cdcb1d1 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;




More information about the wine-cvs mailing list