Signed-off-by: Sven Hesse shesse@codeweavers.com --- dlls/wined3d/context.c | 21 ++++++++++++++++++++- dlls/wined3d/device.c | 26 ++++++++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 7 +++++++ dlls/wined3d/utils.c | 28 ++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 2 ++ 5 files changed, 83 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 53f177980d..e654f24d60 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, @@ -1709,6 +1716,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]) @@ -1724,7 +1732,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); @@ -2705,6 +2716,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 2b7d515af4..c26fe4f4f2 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 e18a99f066..9c5f6ef77c 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/utils.c b/dlls/wined3d/utils.c index daf7e7cba6..13a60f9e97 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5705,7 +5705,27 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st { switch (texture->target) { + case GL_TEXTURE_1D: + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D); + checkGLcall("glDisable(GL_TEXTURE_2D)"); + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D); + checkGLcall("glDisable(GL_TEXTURE_3D)"); + if (gl_info->supported[ARB_TEXTURE_CUBE_MAP]) + { + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB); + checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)"); + } + if (gl_info->supported[ARB_TEXTURE_RECTANGLE]) + { + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB); + checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); + } + gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_1D); + checkGLcall("glEnable(GL_TEXTURE_1D)"); + break; case GL_TEXTURE_2D: + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D); + checkGLcall("glDisable(GL_TEXTURE_1D)"); gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D); checkGLcall("glDisable(GL_TEXTURE_3D)"); if (gl_info->supported[ARB_TEXTURE_CUBE_MAP]) @@ -5722,6 +5742,8 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st checkGLcall("glEnable(GL_TEXTURE_2D)"); break; case GL_TEXTURE_RECTANGLE_ARB: + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D); + checkGLcall("glDisable(GL_TEXTURE_1D)"); gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D); checkGLcall("glDisable(GL_TEXTURE_2D)"); gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D); @@ -5745,12 +5767,16 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB); checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); } + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D); + checkGLcall("glDisable(GL_TEXTURE_1D)"); gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D); checkGLcall("glDisable(GL_TEXTURE_2D)"); gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_3D); checkGLcall("glEnable(GL_TEXTURE_3D)"); break; case GL_TEXTURE_CUBE_MAP_ARB: + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D); + checkGLcall("glDisable(GL_TEXTURE_1D)"); gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D); checkGLcall("glDisable(GL_TEXTURE_2D)"); gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D); @@ -5767,6 +5793,8 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st } else { + gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D); + checkGLcall("glDisable(GL_TEXTURE_1D)"); gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D); checkGLcall("glEnable(GL_TEXTURE_2D)"); gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 20f53aa9e9..e7c4b2742d 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;