Removing use of setView*Mask API.

This commit is contained in:
Branimir Karadžić 2014-09-27 11:31:04 -07:00
parent c659e70bdc
commit fc371fc24c
6 changed files with 32 additions and 66 deletions

View File

@ -196,7 +196,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
while (!entry::processEvents(width, height, debug, reset) ) while (!entry::processEvents(width, height, debug, reset) )
{ {
// Set view 0 and 1 viewport. // 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 // This dummy draw call is here to make sure that view 0 is cleared
// if no other draw calls are submitted to view 0. // if no other draw calls are submitted to view 0.

View File

@ -294,8 +294,12 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs);
// Set views. // Set views.
bgfx::setViewRectMask(0x1f, 0, 0, width, height); for (uint32_t ii = 0; ii < 6; ++ii)
bgfx::setViewFrameBufferMask(0x3, fbh); {
bgfx::setViewRect(ii, 0, 0, width, height);
}
bgfx::setViewFrameBuffer(0, fbh);
bgfx::setViewFrameBuffer(1, fbh);
bgfx::setViewRect(2, 0, 0, 128, 128); bgfx::setViewRect(2, 0, 0, 128, 128);
bgfx::setViewFrameBuffer(2, lum[0]); 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); bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f);
// Set view and projection matrix for view 0. // Set view and projection matrix for view 0.
bgfx::setViewTransformMask(0 for (uint32_t ii = 0; ii < 10; ++ii)
|(1<<0) {
|(1<<2) bgfx::setViewTransform(ii, view, proj);
|(1<<3) }
|(1<<4)
|(1<<5)
|(1<<6)
|(1<<7)
|(1<<8)
|(1<<9)
, view
, proj
);
float at[3] = { 0.0f, 1.0f, 0.0f }; float at[3] = { 0.0f, 1.0f, 0.0f };
float eye[3] = { 0.0f, 1.0f, -2.5f }; 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); bx::mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f);
// Set view and projection matrix for view 1. // Set view and projection matrix for view 1.
bgfx::setViewTransformMask(1<<1, view, proj); bgfx::setViewTransform(1, view, proj);
bgfx::setUniform(u_mtx, mtx); bgfx::setUniform(u_mtx, mtx);

View File

@ -16,10 +16,7 @@
#include "entry/entry.h" #include "entry/entry.h"
#define RENDER_SHADOW_PASS_ID 0 #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_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) 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); bgfx::setViewTransform(RENDER_SCENE_PASS_ID, view, proj);
// Clear backbuffer and shadowmap framebuffer at beginning. // 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 , BGFX_CLEAR_COLOR_BIT | BGFX_CLEAR_DEPTH_BIT
, 0x303030ff, 1.0f, 0 , 0x303030ff, 1.0f, 0
); );

View File

@ -37,26 +37,6 @@
#define RENDERVIEW_DRAWDEPTH_2_ID 18 #define RENDERVIEW_DRAWDEPTH_2_ID 18
#define RENDERVIEW_DRAWDEPTH_3_ID 19 #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) uint32_t packUint32(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w)
{ {
union union
@ -2553,9 +2533,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
} }
// Reset render targets. // Reset render targets.
const uint32_t viewMask = (uint32_t(1) << (RENDERVIEW_DRAWDEPTH_3_ID+1) ) - 1;
const bgfx::FrameBufferHandle invalidRt = BGFX_INVALID_HANDLE; 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. // Determine on-screen rectangle size where depth buffer will be drawn.
const uint16_t depthRectHeight = uint16_t(float(viewState.m_height) / 2.5f); const uint16_t depthRectHeight = uint16_t(float(viewState.m_height) / 2.5f);

View File

@ -273,7 +273,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
imguiEndFrame(); imguiEndFrame();
// Set view 0 default viewport. // 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(); int64_t now = bx::getHPCounter();
static int64_t last = now; static int64_t last = now;

View File

@ -10,19 +10,10 @@
#include "bounds.h" #include "bounds.h"
#define RENDER_PASS_GEOMETRY_ID 0 #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_ID 1
#define RENDER_PASS_LIGHT_BIT (1<<RENDER_PASS_LIGHT_ID)
#define RENDER_PASS_COMBINE_ID 2 #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_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_ID 4
#define RENDER_PASS_DEBUG_GBUFFER_BIT (1<<RENDER_PASS_DEBUG_GBUFFER_ID)
struct PosNormalTangentTexcoordVertex struct PosNormalTangentTexcoordVertex
{ {
@ -448,14 +439,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float vp[16]; float vp[16];
float invMvp[16]; float invMvp[16];
{ {
bgfx::setViewRectMask(0 bgfx::setViewRect(RENDER_PASS_GEOMETRY_ID, 0, 0, width, height);
| RENDER_PASS_GEOMETRY_BIT bgfx::setViewRect(RENDER_PASS_LIGHT_ID, 0, 0, width, height);
| RENDER_PASS_LIGHT_BIT bgfx::setViewRect(RENDER_PASS_COMBINE_ID, 0, 0, width, height);
| RENDER_PASS_COMBINE_BIT bgfx::setViewRect(RENDER_PASS_DEBUG_LIGHTS_ID, 0, 0, width, height);
| RENDER_PASS_DEBUG_LIGHTS_BIT bgfx::setViewRect(RENDER_PASS_DEBUG_GBUFFER_ID, 0, 0, width, height);
| RENDER_PASS_DEBUG_GBUFFER_BIT
, 0, 0, width, height
);
bgfx::setViewFrameBuffer(RENDER_PASS_LIGHT_ID, lightBuffer); bgfx::setViewFrameBuffer(RENDER_PASS_LIGHT_ID, lightBuffer);
@ -469,11 +457,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bx::mtxInverse(invMvp, vp); bx::mtxInverse(invMvp, vp);
bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f); bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f);
bgfx::setViewTransformMask(0 bgfx::setViewTransform(RENDER_PASS_LIGHT_ID, NULL, proj);
| RENDER_PASS_LIGHT_BIT bgfx::setViewTransform(RENDER_PASS_COMBINE_ID, NULL, proj);
| RENDER_PASS_COMBINE_BIT
, NULL, proj
);
const float aspectRatio = float(height)/float(width); const float aspectRatio = float(height)/float(width);
const float size = 10.0f; const float size = 10.0f;