mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-02-17 20:31:57 -05:00
Removing use of setView*Mask API.
This commit is contained in:
parent
c659e70bdc
commit
fc371fc24c
6 changed files with 32 additions and 66 deletions
|
@ -196,7 +196,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
while (!entry::processEvents(width, height, debug, reset) )
|
||||
{
|
||||
// Set view 0 and 1 viewport.
|
||||
bgfx::setViewRectMask(0x3, 0, 0, width, height);
|
||||
bgfx::setViewRect(0, 0, 0, width, height);
|
||||
bgfx::setViewRect(1, 0, 0, width, height);
|
||||
|
||||
// This dummy draw call is here to make sure that view 0 is cleared
|
||||
// if no other draw calls are submitted to view 0.
|
||||
|
|
|
@ -294,8 +294,12 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs);
|
||||
|
||||
// Set views.
|
||||
bgfx::setViewRectMask(0x1f, 0, 0, width, height);
|
||||
bgfx::setViewFrameBufferMask(0x3, fbh);
|
||||
for (uint32_t ii = 0; ii < 6; ++ii)
|
||||
{
|
||||
bgfx::setViewRect(ii, 0, 0, width, height);
|
||||
}
|
||||
bgfx::setViewFrameBuffer(0, fbh);
|
||||
bgfx::setViewFrameBuffer(1, fbh);
|
||||
|
||||
bgfx::setViewRect(2, 0, 0, 128, 128);
|
||||
bgfx::setViewFrameBuffer(2, lum[0]);
|
||||
|
@ -327,19 +331,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransformMask(0
|
||||
|(1<<0)
|
||||
|(1<<2)
|
||||
|(1<<3)
|
||||
|(1<<4)
|
||||
|(1<<5)
|
||||
|(1<<6)
|
||||
|(1<<7)
|
||||
|(1<<8)
|
||||
|(1<<9)
|
||||
, view
|
||||
, proj
|
||||
);
|
||||
for (uint32_t ii = 0; ii < 10; ++ii)
|
||||
{
|
||||
bgfx::setViewTransform(ii, view, proj);
|
||||
}
|
||||
|
||||
float at[3] = { 0.0f, 1.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 1.0f, -2.5f };
|
||||
|
@ -357,7 +352,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
bx::mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 1.
|
||||
bgfx::setViewTransformMask(1<<1, view, proj);
|
||||
bgfx::setViewTransform(1, view, proj);
|
||||
|
||||
bgfx::setUniform(u_mtx, mtx);
|
||||
|
||||
|
|
|
@ -16,10 +16,7 @@
|
|||
#include "entry/entry.h"
|
||||
|
||||
#define RENDER_SHADOW_PASS_ID 0
|
||||
#define RENDER_SHADOW_PASS_BIT (1<<RENDER_SHADOW_PASS_ID)
|
||||
|
||||
#define RENDER_SCENE_PASS_ID 1
|
||||
#define RENDER_SCENE_PASS_BIT (1<<RENDER_SCENE_PASS_ID)
|
||||
|
||||
uint32_t packUint32(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w)
|
||||
{
|
||||
|
@ -579,7 +576,12 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
bgfx::setViewTransform(RENDER_SCENE_PASS_ID, view, proj);
|
||||
|
||||
// Clear backbuffer and shadowmap framebuffer at beginning.
|
||||
bgfx::setViewClearMask(RENDER_SHADOW_PASS_BIT|RENDER_SCENE_PASS_BIT
|
||||
bgfx::setViewClear(RENDER_SHADOW_PASS_ID
|
||||
, BGFX_CLEAR_COLOR_BIT | BGFX_CLEAR_DEPTH_BIT
|
||||
, 0x303030ff, 1.0f, 0
|
||||
);
|
||||
|
||||
bgfx::setViewClear(RENDER_SCENE_PASS_ID
|
||||
, BGFX_CLEAR_COLOR_BIT | BGFX_CLEAR_DEPTH_BIT
|
||||
, 0x303030ff, 1.0f, 0
|
||||
);
|
||||
|
|
|
@ -37,26 +37,6 @@
|
|||
#define RENDERVIEW_DRAWDEPTH_2_ID 18
|
||||
#define RENDERVIEW_DRAWDEPTH_3_ID 19
|
||||
|
||||
#define RENDERVIEW_SHADOWMAP_0_BIT (1<<RENDERVIEW_SHADOWMAP_0_ID)
|
||||
#define RENDERVIEW_SHADOWMAP_1_BIT (1<<RENDERVIEW_SHADOWMAP_1_ID)
|
||||
#define RENDERVIEW_SHADOWMAP_2_BIT (1<<RENDERVIEW_SHADOWMAP_2_ID)
|
||||
#define RENDERVIEW_SHADOWMAP_3_BIT (1<<RENDERVIEW_SHADOWMAP_3_ID)
|
||||
#define RENDERVIEW_SHADOWMAP_4_BIT (1<<RENDERVIEW_SHADOWMAP_4_ID)
|
||||
#define RENDERVIEW_VBLUR_0_BIT (1<<RENDERVIEW_VBLUR_0_ID)
|
||||
#define RENDERVIEW_HBLUR_0_BIT (1<<RENDERVIEW_HBLUR_0_ID)
|
||||
#define RENDERVIEW_VBLUR_1_BIT (1<<RENDERVIEW_VBLUR_1_ID)
|
||||
#define RENDERVIEW_HBLUR_1_BIT (1<<RENDERVIEW_HBLUR_1_ID)
|
||||
#define RENDERVIEW_VBLUR_2_BIT (1<<RENDERVIEW_VBLUR_2_ID)
|
||||
#define RENDERVIEW_HBLUR_2_BIT (1<<RENDERVIEW_HBLUR_2_ID)
|
||||
#define RENDERVIEW_VBLUR_3_BIT (1<<RENDERVIEW_VBLUR_3_ID)
|
||||
#define RENDERVIEW_HBLUR_3_BIT (1<<RENDERVIEW_HBLUR_3_ID)
|
||||
#define RENDERVIEW_DRAWSCENE_0_BIT (1<<RENDERVIEW_DRAWSCENE_0_ID)
|
||||
#define RENDERVIEW_DRAWSCENE_1_BIT (1<<RENDERVIEW_DRAWSCENE_1_ID)
|
||||
#define RENDERVIEW_DRAWDEPTH_0_BIT (1<<RENDERVIEW_DRAWDEPTH_0_ID)
|
||||
#define RENDERVIEW_DRAWDEPTH_1_BIT (1<<RENDERVIEW_DRAWDEPTH_1_ID)
|
||||
#define RENDERVIEW_DRAWDEPTH_2_BIT (1<<RENDERVIEW_DRAWDEPTH_2_ID)
|
||||
#define RENDERVIEW_DRAWDEPTH_3_BIT (1<<RENDERVIEW_DRAWDEPTH_3_ID)
|
||||
|
||||
uint32_t packUint32(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w)
|
||||
{
|
||||
union
|
||||
|
@ -2553,9 +2533,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
}
|
||||
|
||||
// Reset render targets.
|
||||
const uint32_t viewMask = (uint32_t(1) << (RENDERVIEW_DRAWDEPTH_3_ID+1) ) - 1;
|
||||
const bgfx::FrameBufferHandle invalidRt = BGFX_INVALID_HANDLE;
|
||||
bgfx::setViewFrameBufferMask(viewMask, invalidRt);
|
||||
for (uint32_t ii = 0; ii < RENDERVIEW_DRAWDEPTH_3_ID+1; ++ii)
|
||||
{
|
||||
bgfx::setViewFrameBuffer(ii, invalidRt);
|
||||
}
|
||||
|
||||
// Determine on-screen rectangle size where depth buffer will be drawn.
|
||||
const uint16_t depthRectHeight = uint16_t(float(viewState.m_height) / 2.5f);
|
||||
|
|
|
@ -273,7 +273,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
imguiEndFrame();
|
||||
|
||||
// Set view 0 default viewport.
|
||||
bgfx::setViewRectMask(0x3, 0, 0, width, height);
|
||||
bgfx::setViewRect(0, 0, 0, width, height);
|
||||
bgfx::setViewRect(1, 0, 0, width, height);
|
||||
|
||||
int64_t now = bx::getHPCounter();
|
||||
static int64_t last = now;
|
||||
|
|
|
@ -10,19 +10,10 @@
|
|||
#include "bounds.h"
|
||||
|
||||
#define RENDER_PASS_GEOMETRY_ID 0
|
||||
#define RENDER_PASS_GEOMETRY_BIT (1<<RENDER_PASS_GEOMETRY_ID)
|
||||
|
||||
#define RENDER_PASS_LIGHT_ID 1
|
||||
#define RENDER_PASS_LIGHT_BIT (1<<RENDER_PASS_LIGHT_ID)
|
||||
|
||||
#define RENDER_PASS_COMBINE_ID 2
|
||||
#define RENDER_PASS_COMBINE_BIT (1<<RENDER_PASS_COMBINE_ID)
|
||||
|
||||
#define RENDER_PASS_DEBUG_LIGHTS_ID 3
|
||||
#define RENDER_PASS_DEBUG_LIGHTS_BIT (1<<RENDER_PASS_DEBUG_LIGHTS_ID)
|
||||
|
||||
#define RENDER_PASS_DEBUG_GBUFFER_ID 4
|
||||
#define RENDER_PASS_DEBUG_GBUFFER_BIT (1<<RENDER_PASS_DEBUG_GBUFFER_ID)
|
||||
|
||||
struct PosNormalTangentTexcoordVertex
|
||||
{
|
||||
|
@ -448,14 +439,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
float vp[16];
|
||||
float invMvp[16];
|
||||
{
|
||||
bgfx::setViewRectMask(0
|
||||
| RENDER_PASS_GEOMETRY_BIT
|
||||
| RENDER_PASS_LIGHT_BIT
|
||||
| RENDER_PASS_COMBINE_BIT
|
||||
| RENDER_PASS_DEBUG_LIGHTS_BIT
|
||||
| RENDER_PASS_DEBUG_GBUFFER_BIT
|
||||
, 0, 0, width, height
|
||||
);
|
||||
bgfx::setViewRect(RENDER_PASS_GEOMETRY_ID, 0, 0, width, height);
|
||||
bgfx::setViewRect(RENDER_PASS_LIGHT_ID, 0, 0, width, height);
|
||||
bgfx::setViewRect(RENDER_PASS_COMBINE_ID, 0, 0, width, height);
|
||||
bgfx::setViewRect(RENDER_PASS_DEBUG_LIGHTS_ID, 0, 0, width, height);
|
||||
bgfx::setViewRect(RENDER_PASS_DEBUG_GBUFFER_ID, 0, 0, width, height);
|
||||
|
||||
bgfx::setViewFrameBuffer(RENDER_PASS_LIGHT_ID, lightBuffer);
|
||||
|
||||
|
@ -469,11 +457,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
bx::mtxInverse(invMvp, vp);
|
||||
|
||||
bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f);
|
||||
bgfx::setViewTransformMask(0
|
||||
| RENDER_PASS_LIGHT_BIT
|
||||
| RENDER_PASS_COMBINE_BIT
|
||||
, NULL, proj
|
||||
);
|
||||
bgfx::setViewTransform(RENDER_PASS_LIGHT_ID, NULL, proj);
|
||||
bgfx::setViewTransform(RENDER_PASS_COMBINE_ID, NULL, proj);
|
||||
|
||||
const float aspectRatio = float(height)/float(width);
|
||||
const float size = 10.0f;
|
||||
|
|
Loading…
Reference in a new issue