From 72446e998bd2b182136b1e6b0080e61f71a1dfa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 11 Sep 2015 17:40:38 -0700 Subject: [PATCH] Added border texture address mode. --- include/bgfxdefines.h | 3 +++ src/renderer_d3d11.cpp | 1 + src/renderer_d3d12.cpp | 9 +++++++-- src/renderer_d3d9.cpp | 1 + src/renderer_gl.cpp | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/bgfxdefines.h b/include/bgfxdefines.h index f88e05053..459ce6a39 100644 --- a/include/bgfxdefines.h +++ b/include/bgfxdefines.h @@ -263,14 +263,17 @@ #define BGFX_TEXTURE_NONE UINT32_C(0x00000000) //!< #define BGFX_TEXTURE_U_MIRROR UINT32_C(0x00000001) //!< #define BGFX_TEXTURE_U_CLAMP UINT32_C(0x00000002) //!< +#define BGFX_TEXTURE_U_BORDER UINT32_C(0x00000003) //!< #define BGFX_TEXTURE_U_SHIFT 0 //!< #define BGFX_TEXTURE_U_MASK UINT32_C(0x00000003) //!< #define BGFX_TEXTURE_V_MIRROR UINT32_C(0x00000004) //!< #define BGFX_TEXTURE_V_CLAMP UINT32_C(0x00000008) //!< +#define BGFX_TEXTURE_V_BORDER UINT32_C(0x0000000c) //!< #define BGFX_TEXTURE_V_SHIFT 2 //!< #define BGFX_TEXTURE_V_MASK UINT32_C(0x0000000c) //!< #define BGFX_TEXTURE_W_MIRROR UINT32_C(0x00000010) //!< #define BGFX_TEXTURE_W_CLAMP UINT32_C(0x00000020) //!< +#define BGFX_TEXTURE_W_BORDER UINT32_C(0x00000030) //!< #define BGFX_TEXTURE_W_SHIFT 4 //!< #define BGFX_TEXTURE_W_MASK UINT32_C(0x00000030) //!< #define BGFX_TEXTURE_MIN_POINT UINT32_C(0x00000040) //!< diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 6b57be173..4c50f1124 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -141,6 +141,7 @@ namespace bgfx { namespace d3d11 D3D11_TEXTURE_ADDRESS_WRAP, D3D11_TEXTURE_ADDRESS_MIRROR, D3D11_TEXTURE_ADDRESS_CLAMP, + D3D11_TEXTURE_ADDRESS_BORDER, }; /* diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 7050cc2c9..174b2d1c2 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -125,6 +125,7 @@ namespace bgfx { namespace d3d12 D3D12_TEXTURE_ADDRESS_MODE_WRAP, D3D12_TEXTURE_ADDRESS_MODE_MIRROR, D3D12_TEXTURE_ADDRESS_MODE_CLAMP, + D3D12_TEXTURE_ADDRESS_MODE_BORDER, }; /* @@ -2804,11 +2805,15 @@ data.NumQualityLevels = 0; sd.AddressU = s_textureAddress[(flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]; sd.AddressV = s_textureAddress[(flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; sd.AddressW = s_textureAddress[(flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; - sd.MinLOD = 0; - sd.MaxLOD = D3D12_FLOAT32_MAX; sd.MipLODBias = 0.0f; sd.MaxAnisotropy = 1; //m_maxAnisotropy; sd.ComparisonFunc = 0 == cmpFunc ? D3D12_COMPARISON_FUNC_NEVER : s_cmpFunc[cmpFunc]; + sd.BorderColor[0] = 0.0f; + sd.BorderColor[1] = 0.0f; + sd.BorderColor[2] = 0.0f; + sd.BorderColor[3] = 0.0f; + sd.MinLOD = 0; + sd.MaxLOD = D3D12_FLOAT32_MAX; D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle = { diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 6067b8eab..05536157d 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -153,6 +153,7 @@ namespace bgfx { namespace d3d9 D3DTADDRESS_WRAP, D3DTADDRESS_MIRROR, D3DTADDRESS_CLAMP, + D3DTADDRESS_BORDER, }; static const D3DTEXTUREFILTERTYPE s_textureFilter[] = diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index a7702c408..59d054b5b 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -160,6 +160,7 @@ namespace bgfx { namespace gl GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, + GL_CLAMP, }; static const GLenum s_textureFilterMag[] =