diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-06-08 11:58:45 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-06-08 11:58:45 +0300 |
commit | 1f6d1213d27cbe3e50460aa6da54e0c7606f2216 (patch) | |
tree | e2c42891c2e76fc3f36ce62d9e81a2d4751c6f59 /source/blender/draw/engines/workbench/workbench_engine.c | |
parent | 11ba9eec70175b39e34943c8ffacb54c35cbb897 (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/engines/workbench/workbench_engine.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_engine.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c index 511dd563b46..bc5a2c14538 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.c +++ b/source/blender/draw/engines/workbench/workbench_engine.c @@ -141,10 +141,10 @@ static void workbench_cache_texpaint_populate(WORKBENCH_PrivateData *wpd, Object struct GPUBatch *geom = DRW_cache_mesh_surface_texpaint_single_get(ob); if (geom) { Image *ima = imapaint->canvas; - int interp = (imapaint->interp == IMAGEPAINT_INTERP_LINEAR) ? SHD_INTERP_LINEAR : - SHD_INTERP_CLOSEST; + eGPUSamplerState state = GPU_SAMPLER_REPEAT; + SET_FLAG_FROM_TEST(state, imapaint->interp == IMAGEPAINT_INTERP_LINEAR, GPU_SAMPLER_FILTER); - DRWShadingGroup *grp = workbench_image_setup(wpd, ob, 0, ima, NULL, interp); + DRWShadingGroup *grp = workbench_image_setup(wpd, ob, 0, ima, NULL, state); DRW_shgroup_call(grp, geom, ob); } } @@ -210,10 +210,10 @@ static void workbench_cache_hair_populate(WORKBENCH_PrivateData *wpd, const ImagePaintSettings *imapaint = use_texpaint_mode ? &scene->toolsettings->imapaint : NULL; Image *ima = (imapaint && imapaint->mode == IMAGEPAINT_MODE_IMAGE) ? imapaint->canvas : NULL; - int interp = (imapaint && imapaint->interp == IMAGEPAINT_INTERP_LINEAR) ? SHD_INTERP_LINEAR : - SHD_INTERP_CLOSEST; + eGPUSamplerState state = 0; + SET_FLAG_FROM_TEST(state, imapaint->interp == IMAGEPAINT_INTERP_LINEAR, GPU_SAMPLER_FILTER); DRWShadingGroup *grp = (use_texpaint_mode) ? - workbench_image_hair_setup(wpd, ob, matnr, ima, NULL, interp) : + workbench_image_hair_setup(wpd, ob, matnr, ima, NULL, state) : workbench_material_hair_setup(wpd, ob, matnr, color_type); DRW_shgroup_hair_create_sub(ob, psys, md, grp); |