Skip to content

Commit

Permalink
Removed D3D9.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Nov 4, 2023
1 parent 6a914f5 commit d0a7997
Show file tree
Hide file tree
Showing 266 changed files with 187 additions and 6,554 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ rendering library.

Supported rendering backends:

* Direct3D 9
* Direct3D 11
* Direct3D 12
* GNM (only for licensed PS4 developers, search DevNet forums for source)
Expand Down
5 changes: 0 additions & 5 deletions bindings/bf/bgfx.bf
Original file line number Diff line number Diff line change
Expand Up @@ -1374,11 +1374,6 @@ public static class bgfx
/// </summary>
Agc,

/// <summary>
/// Direct3D 9.0
/// </summary>
Direct3D9,

/// <summary>
/// Direct3D 11.0
/// </summary>
Expand Down
5 changes: 0 additions & 5 deletions bindings/cs/bgfx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,11 +1371,6 @@ public enum RendererType
/// </summary>
Agc,

/// <summary>
/// Direct3D 9.0
/// </summary>
Direct3D9,

/// <summary>
/// Direct3D 11.0
/// </summary>
Expand Down
7 changes: 6 additions & 1 deletion bindings/d/fakeenum.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern(C++, "bgfx") package final abstract class Fatal{
}
extern(C++, "bgfx") package final abstract class RendererType{
enum Enum{
noop,agc,direct3D9,direct3D11,direct3D12,gnm,metal,nvn,openGLES,openGL,vulkan,webGPU,count
noop,agc,direct3D11,direct3D12,gnm,metal,nvn,openGLES,openGL,vulkan,webGPU,count
}
}
extern(C++, "bgfx") package final abstract class Access{
Expand Down Expand Up @@ -72,6 +72,11 @@ extern(C++, "bgfx") package final abstract class ViewMode{
default_,sequential,depthAscending,depthDescending,count
}
}
extern(C++, "bgfx") package final abstract class NativeWindowHandleType{
enum Enum{
default_,wayland,count
}
}
extern(C++, "bgfx") package final abstract class RenderFrame{
enum Enum{
noContext,render,timeout,exiting,count
Expand Down
3 changes: 1 addition & 2 deletions bindings/d/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import bindbc.bgfx.config;
import bindbc.common.types: va_list;
static import bgfx.fakeenum;

enum uint apiVersion = 122;
enum uint apiVersion = 123;

alias ViewID = ushort;
deprecated("Please use `ViewID` instead.") alias ViewId = ushort;
Expand Down Expand Up @@ -592,7 +592,6 @@ enum Fatal: bgfx.fakeenum.Fatal.Enum{
enum RendererType: bgfx.fakeenum.RendererType.Enum{
noop = bgfx.fakeenum.RendererType.Enum.noop,
agc = bgfx.fakeenum.RendererType.Enum.agc,
direct3D9 = bgfx.fakeenum.RendererType.Enum.direct3D9,
direct3D11 = bgfx.fakeenum.RendererType.Enum.direct3D11,
direct3D12 = bgfx.fakeenum.RendererType.Enum.direct3D12,
gnm = bgfx.fakeenum.RendererType.Enum.gnm,
Expand Down
3 changes: 0 additions & 3 deletions bindings/zig/bgfx.zig
Original file line number Diff line number Diff line change
Expand Up @@ -840,9 +840,6 @@ pub const RendererType = enum(c_int) {
/// AGC
Agc,

/// Direct3D 9.0
Direct3D9,

/// Direct3D 11.0
Direct3D11,

Expand Down
1 change: 0 additions & 1 deletion docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ licensed under permissive BSD-2 clause open source license.
Supported rendering backends
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Direct3D 9
- Direct3D 11
- Direct3D 12
- GNM (only for licensed PS4 developers, search DevNet forums for source)
Expand Down
41 changes: 18 additions & 23 deletions examples/09-hdr/hdr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
namespace
{

static float s_texelHalf = 0.0f;

struct PosColorTexCoord0Vertex
{
float m_x;
Expand All @@ -37,7 +35,7 @@ struct PosColorTexCoord0Vertex

bgfx::VertexLayout PosColorTexCoord0Vertex::ms_layout;

void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f)
void screenSpaceQuad(bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f)
{
if (3 == bgfx::getAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_layout) )
{
Expand All @@ -52,13 +50,11 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBott
const float miny = 0.0f;
const float maxy = _height*2.0f;

const float texelHalfW = s_texelHalf/_textureWidth;
const float texelHalfH = s_texelHalf/_textureHeight;
const float minu = -1.0f + texelHalfW;
const float maxu = 1.0f + texelHalfW;
const float minu = -1.0f;
const float maxu = 1.0f;

float minv = texelHalfH;
float maxv = 2.0f + texelHalfH;
float minv = 0.0f;
float maxv = 2.0f;

if (_originBottomLeft)
{
Expand Down Expand Up @@ -107,8 +103,8 @@ void setOffsets2x2Lum(bgfx::UniformHandle _handle, uint32_t _width, uint32_t _he
{
for (uint32_t xx = 0; xx < 3; ++xx)
{
offsets[num][0] = (xx - s_texelHalf) * du;
offsets[num][1] = (yy - s_texelHalf) * dv;
offsets[num][0] = xx * du;
offsets[num][1] = yy * dv;
++num;
}
}
Expand All @@ -128,8 +124,8 @@ void setOffsets4x4Lum(bgfx::UniformHandle _handle, uint32_t _width, uint32_t _he
{
for (uint32_t xx = 0; xx < 4; ++xx)
{
offsets[num][0] = (xx - 1.0f - s_texelHalf) * du;
offsets[num][1] = (yy - 1.0f - s_texelHalf) * dv;
offsets[num][0] = (xx - 1.0f) * du;
offsets[num][1] = (yy - 1.0f) * dv;
++num;
}
}
Expand Down Expand Up @@ -221,7 +217,6 @@ class ExampleHDR : public entry::AppI
imguiCreate();

m_caps = bgfx::getCaps();
s_texelHalf = bgfx::RendererType::Direct3D9 == m_caps->rendererType ? 0.5f : 0.0f;

m_oldWidth = 0;
m_oldHeight = 0;
Expand Down Expand Up @@ -496,7 +491,7 @@ class ExampleHDR : public entry::AppI
bgfx::setTexture(0, s_texCube, m_uffizi);
bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A);
bgfx::setUniform(u_mtx, mtx);
screenSpaceQuad( (float)m_width, (float)m_height, true);
screenSpaceQuad(true);
bgfx::submit(hdrSkybox, m_skyProgram);

// Render m_mesh into view hdrMesh.
Expand All @@ -508,35 +503,35 @@ class ExampleHDR : public entry::AppI
setOffsets2x2Lum(u_offset, 128, 128);
bgfx::setTexture(0, s_texColor, m_fbtextures[0]);
bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A);
screenSpaceQuad(128.0f, 128.0f, m_caps->originBottomLeft);
screenSpaceQuad(m_caps->originBottomLeft);
bgfx::submit(hdrLuminance, m_lumProgram);

// Downscale luminance 0.
setOffsets4x4Lum(u_offset, 128, 128);
bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[0]) );
bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A);
screenSpaceQuad(64.0f, 64.0f, m_caps->originBottomLeft);
screenSpaceQuad(m_caps->originBottomLeft);
bgfx::submit(hdrLumScale0, m_lumAvgProgram);

// Downscale luminance 1.
setOffsets4x4Lum(u_offset, 64, 64);
bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[1]) );
bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A);
screenSpaceQuad(16.0f, 16.0f, m_caps->originBottomLeft);
screenSpaceQuad(m_caps->originBottomLeft);
bgfx::submit(hdrLumScale1, m_lumAvgProgram);

// Downscale luminance 2.
setOffsets4x4Lum(u_offset, 16, 16);
bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[2]) );
bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A);
screenSpaceQuad(4.0f, 4.0f, m_caps->originBottomLeft);
screenSpaceQuad(m_caps->originBottomLeft);
bgfx::submit(hdrLumScale2, m_lumAvgProgram);

// Downscale luminance 3.
setOffsets4x4Lum(u_offset, 4, 4);
bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[3]) );
bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A);
screenSpaceQuad(1.0f, 1.0f, m_caps->originBottomLeft);
screenSpaceQuad(m_caps->originBottomLeft);
bgfx::submit(hdrLumScale3, m_lumAvgProgram);

// m_bright pass m_threshold is tonemap[3].
Expand All @@ -545,22 +540,22 @@ class ExampleHDR : public entry::AppI
bgfx::setTexture(1, s_texLum, bgfx::getTexture(m_lum[4]) );
bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A);
bgfx::setUniform(u_tonemap, tonemap);
screenSpaceQuad( (float)m_width/2.0f, (float)m_height/2.0f, m_caps->originBottomLeft);
screenSpaceQuad(m_caps->originBottomLeft);
bgfx::submit(hdrBrightness, m_brightProgram);

// m_blur m_bright pass vertically.
bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_bright) );
bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A);
bgfx::setUniform(u_tonemap, tonemap);
screenSpaceQuad( (float)m_width/8.0f, (float)m_height/8.0f, m_caps->originBottomLeft);
screenSpaceQuad(m_caps->originBottomLeft);
bgfx::submit(hdrVBlur, m_blurProgram);

// m_blur m_bright pass horizontally, do tonemaping and combine.
bgfx::setTexture(0, s_texColor, m_fbtextures[0]);
bgfx::setTexture(1, s_texLum, bgfx::getTexture(m_lum[4]) );
bgfx::setTexture(2, s_texBlur, bgfx::getTexture(m_blur) );
bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A);
screenSpaceQuad( (float)m_width, (float)m_height, m_caps->originBottomLeft);
screenSpaceQuad(m_caps->originBottomLeft);
bgfx::submit(hdrHBlurTonemap, m_tonemapProgram);

if (bgfx::isValid(m_rb) )
Expand Down
13 changes: 4 additions & 9 deletions examples/10-font/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,16 @@ class ExampleFont : public entry::AppI
float view[16];
bx::mtxLookAt(view, eye, at);

float centering = 0.0f;
if (bgfx::getRendererType() == bgfx::RendererType::Direct3D9) {
centering = -0.5f;
}

// Setup a top-left ortho matrix for screen space drawing.
const bgfx::Caps* caps = bgfx::getCaps();
{
float ortho[16];
bx::mtxOrtho(
ortho
, centering
, m_width + centering
, m_height + centering
, centering
, 0.0f
, m_width
, m_height
, 0.0f
, 0.0f
, 100.0f
, 0.0f
Expand Down
7 changes: 1 addition & 6 deletions examples/11-fontsdf/fontsdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,11 @@ class ExampleFontSDF : public entry::AppI
float view[16];
bx::mtxLookAt(view, eye, at);

float centering = 0.0f;
if (bgfx::getRendererType() == bgfx::RendererType::Direct3D9) {
centering = -0.5f;
}

// Setup a top-left ortho matrix for screen space drawing.
const bgfx::Caps* caps = bgfx::getCaps();
{
float ortho[16];
bx::mtxOrtho(ortho, centering, m_width + centering, m_height + centering, centering, -1.0f, 1.0f, 0.0f, caps->homogeneousDepth);
bx::mtxOrtho(ortho, 0.0f, m_width, m_height, 0.0f, -1.0f, 1.0f, 0.0f, caps->homogeneousDepth);
bgfx::setViewTransform(0, view, ortho);
bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) );
}
Expand Down
4 changes: 1 addition & 3 deletions examples/14-shadowvolumes/shadowvolumes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ static const uint16_t s_planeIndices[] =
};

static bool s_oglNdc = false;
static float s_texelHalf = 0.0f;

static uint32_t s_viewMask = 0;

Expand Down Expand Up @@ -1797,7 +1796,6 @@ class ExampleShadowVolumes : public entry::AppI

const bgfx::Caps* caps = bgfx::getCaps();
s_oglNdc = caps->homogeneousDepth;
s_texelHalf = bgfx::RendererType::Direct3D9 == caps->rendererType ? 0.5f : 0.0f;

// Imgui
imguiCreate();
Expand Down Expand Up @@ -2187,7 +2185,7 @@ class ExampleShadowVolumes : public entry::AppI
//update settings
s_uniforms.m_params.m_ambientPass = 1.0f;
s_uniforms.m_params.m_lightingPass = 1.0f;
s_uniforms.m_params.m_texelHalf = s_texelHalf;
s_uniforms.m_params.m_texelHalf = 0.0f;
s_uniforms.m_svparams.m_useStencilTex = float(m_useStencilTexture);

//set picked bunny model
Expand Down
Loading

0 comments on commit d0a7997

Please sign in to comment.