summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <cuavas@users.noreply.github.com>2022-05-23 05:14:49 +1000
committer GitHub <noreply@github.com>2022-05-23 05:14:49 +1000
commitea3adb9a4370f77ef9fac06b84ea8bb9d2980033 (patch)
treec837524154be987e1476277d2682585a982721e1
parent3aa0f6db77dc4427d35c104f8cc4950e372bac86 (diff)
bgfx: Honour texture wrap flag. (#9812)
-rw-r--r--src/osd/modules/render/bgfx/chainmanager.cpp5
-rw-r--r--src/osd/modules/render/drawbgfx.cpp12
2 files changed, 10 insertions, 7 deletions
diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp
index b0a239756c6..afbb7a99500 100644
--- a/src/osd/modules/render/bgfx/chainmanager.cpp
+++ b/src/osd/modules/render/bgfx/chainmanager.cpp
@@ -468,7 +468,10 @@ uint32_t chain_manager::update_screen_textures(uint32_t view, render_primitive *
if (texture == nullptr)
{
- bgfx_texture *texture = new bgfx_texture(full_name, dst_format, tex_width, tex_height, mem, BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT, pitch, prim.m_rowpixels, width_div_factor, width_mul_factor);
+ uint32_t flags = BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT;
+ if (!PRIMFLAG_GET_TEXWRAP(prim.m_flags))
+ flags |= BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP;
+ bgfx_texture *texture = new bgfx_texture(full_name, dst_format, tex_width, tex_height, mem, flags, pitch, prim.m_rowpixels, width_div_factor, width_mul_factor);
m_textures.add_provider(full_name, texture);
if (prim.m_prim->texture.palette)
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp
index 7c509d0f441..07570882ec0 100644
--- a/src/osd/modules/render/drawbgfx.cpp
+++ b/src/osd/modules/render/drawbgfx.cpp
@@ -542,11 +542,11 @@ void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bg
vertex(&vertices[4], x[2], y[2], 0, 0xffffffff, u[2], v[2]);
vertex(&vertices[5], x[0], y[0], 0, 0xffffffff, u[0], v[0]);
- uint32_t texture_flags = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP;
+ uint32_t texture_flags = 0U;
+ if (!PRIMFLAG_GET_TEXWRAP(prim->flags))
+ texture_flags |= BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP;
if (video_config.filter == 0)
- {
texture_flags |= BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT;
- }
uint32_t blend = PRIMFLAG_GET_BLENDMODE(prim->flags);
bgfx::setVertexBuffer(0,buffer);
@@ -602,11 +602,11 @@ void renderer_bgfx::render_textured_quad(render_primitive* prim, bgfx::Transient
vertex(&vertices[4], x[2], y[2], 0, rgba, u[2], v[2]);
vertex(&vertices[5], x[0], y[0], 0, rgba, u[0], v[0]);
- uint32_t texture_flags = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP;
+ uint32_t texture_flags = 0U;
+ if (!PRIMFLAG_GET_TEXWRAP(prim->flags))
+ texture_flags |= BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP;
if (video_config.filter == 0)
- {
texture_flags |= BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT;
- }
const bool is_screen = PRIMFLAG_GET_SCREENTEX(prim->flags);
uint16_t tex_width(prim->texture.width);