From: Sven Hesse Subject: [PATCH v3 3/9] wined3d: Implement handling of GL_TEXTURE_1D. Message-Id: <20180207153509.10627-3-shesse@codeweavers.com> Date: Wed, 7 Feb 2018 16:35:03 +0100 In-Reply-To: <20180207153509.10627-1-shesse@codeweavers.com> References: <20180207153509.10627-1-shesse@codeweavers.com> Signed-off-by: Sven Hesse --- dlls/wined3d/context.c | 21 ++++++++++++++++++++- dlls/wined3d/device.c | 26 ++++++++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 7 +++++++ dlls/wined3d/wined3d_private.h | 2 ++ 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index f8419f063c..63e2b620b8 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -139,7 +139,8 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context, gl_info->fbo_ops.glFramebufferTexture(fbo_target, attachment, resource->object, resource->level); } - else if (resource->target == GL_TEXTURE_2D_ARRAY || resource->target == GL_TEXTURE_3D) + else if (resource->target == GL_TEXTURE_1D_ARRAY || resource->target == GL_TEXTURE_2D_ARRAY + || resource->target == GL_TEXTURE_3D) { if (!gl_info->fbo_ops.glFramebufferTextureLayer) { @@ -150,6 +151,12 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context, gl_info->fbo_ops.glFramebufferTextureLayer(fbo_target, attachment, resource->object, resource->level, resource->layer); } + else if (resource->target == GL_TEXTURE_1D) + { + gl_info->fbo_ops.glFramebufferTexture1D(fbo_target, attachment, + resource->target, resource->object, resource->level); + checkGLcall("glFramebufferTexture1D()"); + } else { gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, attachment, @@ -1708,6 +1715,7 @@ void context_bind_dummy_textures(const struct wined3d_device *device, const stru GL_EXTCALL(glActiveTexture(GL_TEXTURE0 + i)); checkGLcall("glActiveTexture"); + gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_textures.tex_1d); gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_textures.tex_2d); if (gl_info->supported[ARB_TEXTURE_RECTANGLE]) @@ -1723,7 +1731,10 @@ void context_bind_dummy_textures(const struct wined3d_device *device, const stru gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, device->dummy_textures.tex_cube_array); if (gl_info->supported[EXT_TEXTURE_ARRAY]) + { + gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_textures.tex_1d_array); gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, device->dummy_textures.tex_2d_array); + } if (gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT]) gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_BUFFER, device->dummy_textures.tex_buffer); @@ -2704,6 +2715,14 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint case GL_NONE: /* nothing to do */ break; + case GL_TEXTURE_1D: + gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_textures.tex_1d); + checkGLcall("glBindTexture"); + break; + case GL_TEXTURE_1D_ARRAY: + gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_textures.tex_1d_array); + checkGLcall("glBindTexture"); + break; case GL_TEXTURE_2D: gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_textures.tex_2d); checkGLcall("glBindTexture"); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 096f4010fb..8558f9018b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -620,6 +620,17 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_ * to each texture stage when the currently set D3D texture is NULL. */ context_active_texture(context, gl_info, 0); + gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_1d); + checkGLcall("glGenTextures"); + TRACE("Dummy 1D texture given name %u.\n", device->dummy_textures.tex_1d); + + gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, device->dummy_textures.tex_1d); + checkGLcall("glBindTexture"); + + gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA8, 1, 0, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color); + checkGLcall("glTexImage1D"); + gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_2d); checkGLcall("glGenTextures"); TRACE("Dummy 2D texture given name %u.\n", device->dummy_textures.tex_2d); @@ -696,6 +707,17 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_ if (gl_info->supported[EXT_TEXTURE_ARRAY]) { + gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_1d_array); + checkGLcall("glGenTextures"); + TRACE("Dummy 1D array texture given name %u.\n", device->dummy_textures.tex_1d_array); + + gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, device->dummy_textures.tex_1d_array); + checkGLcall("glBindTexture"); + + gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_1D_ARRAY, 0, GL_RGBA8, 1, 1, 0, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color); + checkGLcall("glTexImage2D"); + gl_info->gl_ops.gl.p_glGenTextures(1, &device->dummy_textures.tex_2d_array); checkGLcall("glGenTextures"); TRACE("Dummy 2D array texture given name %u.\n", device->dummy_textures.tex_2d_array); @@ -743,7 +765,10 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_buffer); if (gl_info->supported[EXT_TEXTURE_ARRAY]) + { + gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_1d_array); gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_2d_array); + } if (gl_info->supported[ARB_TEXTURE_CUBE_MAP_ARRAY]) gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_cube_array); @@ -757,6 +782,7 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d if (gl_info->supported[ARB_TEXTURE_RECTANGLE]) gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_rect); + gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_1d); gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->dummy_textures.tex_2d); checkGLcall("Delete dummy textures"); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 6f54b3177f..d599d68d06 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2577,6 +2577,13 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont sampler_type = "samplerCube"; break; + case WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY: + if (shadow_sampler) + sampler_type = "sampler1DArrayShadow"; + else + sampler_type = "sampler1DArray"; + break; + case WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY: if (shadow_sampler) sampler_type = "sampler2DArrayShadow"; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 334724514d..3d81be359b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2919,11 +2919,13 @@ struct wined3d_device /* Textures for when no other textures are mapped */ struct { + GLuint tex_1d; GLuint tex_2d; GLuint tex_rect; GLuint tex_3d; GLuint tex_cube; GLuint tex_cube_array; + GLuint tex_1d_array; GLuint tex_2d_array; GLuint tex_buffer; } dummy_textures; -- 2.16.1