Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-06-08 11:58:45 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-06-08 11:58:45 +0300
commit1f6d1213d27cbe3e50460aa6da54e0c7606f2216 (patch)
treee2c42891c2e76fc3f36ce62d9e81a2d4751c6f59 /source/blender/draw/intern
parent11ba9eec70175b39e34943c8ffacb54c35cbb897 (diff)
Workbench: Use eGPUSamplerState to change texture sampling behavior
This removes some fragment shader hacks and improve the support of different repeat & filtering modes. This fix T77453 Image texture not repeating in viewport
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/DRW_render.h4
-rw-r--r--source/blender/draw/intern/draw_manager_data.c15
2 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index e7dd9e449b7..89dd6fa210c 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -458,6 +458,10 @@ void DRW_shgroup_clear_framebuffer(DRWShadingGroup *shgroup,
float depth,
uchar stencil);
+void DRW_shgroup_uniform_texture_ex(DRWShadingGroup *shgroup,
+ const char *name,
+ const struct GPUTexture *tex,
+ eGPUSamplerState sampler_state);
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup,
const char *name,
const struct GPUTexture *tex);
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index ea67dd87772..07fb97236fb 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -247,11 +247,19 @@ static void drw_shgroup_uniform(DRWShadingGroup *shgroup,
drw_shgroup_uniform_create_ex(shgroup, location, type, value, 0, length, arraysize);
}
-void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
+void DRW_shgroup_uniform_texture_ex(DRWShadingGroup *shgroup,
+ const char *name,
+ const GPUTexture *tex,
+ eGPUSamplerState sampler_state)
{
BLI_assert(tex != NULL);
int loc = GPU_shader_get_texture_binding(shgroup->shader, name);
- drw_shgroup_uniform_create_ex(shgroup, loc, DRW_UNIFORM_TEXTURE, tex, GPU_SAMPLER_MAX, 0, 1);
+ drw_shgroup_uniform_create_ex(shgroup, loc, DRW_UNIFORM_TEXTURE, tex, sampler_state, 0, 1);
+}
+
+void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
+{
+ DRW_shgroup_uniform_texture_ex(shgroup, name, tex, GPU_SAMPLER_MAX);
}
void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
@@ -1278,8 +1286,7 @@ static void drw_shgroup_material_texture(DRWShadingGroup *grp,
{
GPUTexture *gputex = GPU_texture_from_blender(tex->ima, tex->iuser, NULL, textarget);
- int loc = GPU_shader_get_texture_binding(grp->shader, name);
- drw_shgroup_uniform_create_ex(grp, loc, DRW_UNIFORM_TEXTURE, gputex, state, 0, 1);
+ DRW_shgroup_uniform_texture_ex(grp, name, gputex, state);
GPUTexture **gputex_ref = BLI_memblock_alloc(DST.vmempool->images);
*gputex_ref = gputex;