diff --git a/examples/09-hdr/hdr.cpp b/examples/09-hdr/hdr.cpp index 134d8f7a..5cf53cec 100644 --- a/examples/09-hdr/hdr.cpp +++ b/examples/09-hdr/hdr.cpp @@ -478,20 +478,20 @@ int _main_(int /*_argc*/, char** /*_argv*/) Mesh mesh; mesh.load("meshes/bunny.bin"); - bgfx::RenderTargetHandle rt = bgfx::createRenderTarget(width, height, BGFX_RENDER_TARGET_COLOR_RGBA|BGFX_RENDER_TARGET_DEPTH|BGFX_RENDER_TARGET_MSAA_X8); + bgfx::RenderTargetHandle rt = bgfx::createRenderTarget(width, height, BGFX_RENDER_TARGET_COLOR_RGBA8|BGFX_RENDER_TARGET_DEPTH); bgfx::RenderTargetHandle lum[5]; - lum[0] = bgfx::createRenderTarget(128, 128, BGFX_RENDER_TARGET_COLOR_RGBA); - lum[1] = bgfx::createRenderTarget( 64, 64, BGFX_RENDER_TARGET_COLOR_RGBA); - lum[2] = bgfx::createRenderTarget( 16, 16, BGFX_RENDER_TARGET_COLOR_RGBA); - lum[3] = bgfx::createRenderTarget( 4, 4, BGFX_RENDER_TARGET_COLOR_RGBA); - lum[4] = bgfx::createRenderTarget( 1, 1, BGFX_RENDER_TARGET_COLOR_RGBA); + lum[0] = bgfx::createRenderTarget(128, 128, BGFX_RENDER_TARGET_COLOR_RGBA8); + lum[1] = bgfx::createRenderTarget( 64, 64, BGFX_RENDER_TARGET_COLOR_RGBA8); + lum[2] = bgfx::createRenderTarget( 16, 16, BGFX_RENDER_TARGET_COLOR_RGBA8); + lum[3] = bgfx::createRenderTarget( 4, 4, BGFX_RENDER_TARGET_COLOR_RGBA8); + lum[4] = bgfx::createRenderTarget( 1, 1, BGFX_RENDER_TARGET_COLOR_RGBA8); bgfx::RenderTargetHandle bright; - bright = bgfx::createRenderTarget(width/2, height/2, BGFX_RENDER_TARGET_COLOR_RGBA); + bright = bgfx::createRenderTarget(width/2, height/2, BGFX_RENDER_TARGET_COLOR_RGBA8); bgfx::RenderTargetHandle blur; - blur = bgfx::createRenderTarget(width/8, height/8, BGFX_RENDER_TARGET_COLOR_RGBA); + blur = bgfx::createRenderTarget(width/8, height/8, BGFX_RENDER_TARGET_COLOR_RGBA8); uint32_t oldWidth = 0; uint32_t oldHeight = 0; @@ -508,9 +508,9 @@ int _main_(int /*_argc*/, char** /*_argv*/) bgfx::destroyRenderTarget(bright); bgfx::destroyRenderTarget(blur); - rt = bgfx::createRenderTarget(width, height, BGFX_RENDER_TARGET_COLOR_RGBA|BGFX_RENDER_TARGET_DEPTH|BGFX_RENDER_TARGET_MSAA_X8); - bright = bgfx::createRenderTarget(width/2, height/2, BGFX_RENDER_TARGET_COLOR_RGBA); - blur = bgfx::createRenderTarget(width/8, height/8, BGFX_RENDER_TARGET_COLOR_RGBA); + rt = bgfx::createRenderTarget(width, height, BGFX_RENDER_TARGET_COLOR_RGBA8|BGFX_RENDER_TARGET_DEPTH); + bright = bgfx::createRenderTarget(width/2, height/2, BGFX_RENDER_TARGET_COLOR_RGBA8); + blur = bgfx::createRenderTarget(width/8, height/8, BGFX_RENDER_TARGET_COLOR_RGBA8); } // This dummy draw call is here to make sure that view 0 is cleared diff --git a/include/bgfx.h b/include/bgfx.h index 216e71c6..0e6dd58b 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -10,61 +10,61 @@ #include // size_t /// -#define BGFX_STATE_DEPTH_WRITE UINT64_C(0x0000000000000001) +#define BGFX_STATE_DEPTH_WRITE UINT64_C(0x0000000000000001) -#define BGFX_STATE_ALPHA_WRITE UINT64_C(0x0000000000000008) -#define BGFX_STATE_ALPHA_MASK UINT64_C(0x000000000000000c) +#define BGFX_STATE_ALPHA_WRITE UINT64_C(0x0000000000000008) +#define BGFX_STATE_ALPHA_MASK UINT64_C(0x000000000000000c) -#define BGFX_STATE_DEPTH_TEST_LESS UINT64_C(0x0000000000000010) -#define BGFX_STATE_DEPTH_TEST_LEQUAL UINT64_C(0x0000000000000020) -#define BGFX_STATE_DEPTH_TEST_EQUAL UINT64_C(0x0000000000000030) -#define BGFX_STATE_DEPTH_TEST_GEQUAL UINT64_C(0x0000000000000040) -#define BGFX_STATE_DEPTH_TEST_GREATER UINT64_C(0x0000000000000050) -#define BGFX_STATE_DEPTH_TEST_NOTEQUAL UINT64_C(0x0000000000000060) -#define BGFX_STATE_DEPTH_TEST_NEVER UINT64_C(0x0000000000000070) -#define BGFX_STATE_DEPTH_TEST_ALWAYS UINT64_C(0x0000000000000080) -#define BGFX_STATE_DEPTH_TEST_SHIFT 4 -#define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) +#define BGFX_STATE_DEPTH_TEST_LESS UINT64_C(0x0000000000000010) +#define BGFX_STATE_DEPTH_TEST_LEQUAL UINT64_C(0x0000000000000020) +#define BGFX_STATE_DEPTH_TEST_EQUAL UINT64_C(0x0000000000000030) +#define BGFX_STATE_DEPTH_TEST_GEQUAL UINT64_C(0x0000000000000040) +#define BGFX_STATE_DEPTH_TEST_GREATER UINT64_C(0x0000000000000050) +#define BGFX_STATE_DEPTH_TEST_NOTEQUAL UINT64_C(0x0000000000000060) +#define BGFX_STATE_DEPTH_TEST_NEVER UINT64_C(0x0000000000000070) +#define BGFX_STATE_DEPTH_TEST_ALWAYS UINT64_C(0x0000000000000080) +#define BGFX_STATE_DEPTH_TEST_SHIFT 4 +#define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) -#define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) -#define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000) -#define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000) -#define BGFX_STATE_BLEND_INV_SRC_COLOR UINT64_C(0x0000000000004000) -#define BGFX_STATE_BLEND_SRC_ALPHA UINT64_C(0x0000000000005000) -#define BGFX_STATE_BLEND_INV_SRC_ALPHA UINT64_C(0x0000000000006000) -#define BGFX_STATE_BLEND_DST_ALPHA UINT64_C(0x0000000000007000) -#define BGFX_STATE_BLEND_INV_DST_ALPHA UINT64_C(0x0000000000008000) -#define BGFX_STATE_BLEND_DST_COLOR UINT64_C(0x0000000000009000) -#define BGFX_STATE_BLEND_INV_DST_COLOR UINT64_C(0x000000000000a000) -#define BGFX_STATE_BLEND_SRC_ALPHA_SAT UINT64_C(0x000000000000b000) -#define BGFX_STATE_BLEND_SHIFT 12 -#define BGFX_STATE_BLEND_MASK UINT64_C(0x000000000ffff000) +#define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) +#define BGFX_STATE_BLEND_ONE UINT64_C(0x0000000000002000) +#define BGFX_STATE_BLEND_SRC_COLOR UINT64_C(0x0000000000003000) +#define BGFX_STATE_BLEND_INV_SRC_COLOR UINT64_C(0x0000000000004000) +#define BGFX_STATE_BLEND_SRC_ALPHA UINT64_C(0x0000000000005000) +#define BGFX_STATE_BLEND_INV_SRC_ALPHA UINT64_C(0x0000000000006000) +#define BGFX_STATE_BLEND_DST_ALPHA UINT64_C(0x0000000000007000) +#define BGFX_STATE_BLEND_INV_DST_ALPHA UINT64_C(0x0000000000008000) +#define BGFX_STATE_BLEND_DST_COLOR UINT64_C(0x0000000000009000) +#define BGFX_STATE_BLEND_INV_DST_COLOR UINT64_C(0x000000000000a000) +#define BGFX_STATE_BLEND_SRC_ALPHA_SAT UINT64_C(0x000000000000b000) +#define BGFX_STATE_BLEND_SHIFT 12 +#define BGFX_STATE_BLEND_MASK UINT64_C(0x000000000ffff000) -#define BGFX_STATE_CULL_CW UINT64_C(0x0000000010000000) -#define BGFX_STATE_CULL_CCW UINT64_C(0x0000000020000000) -#define BGFX_STATE_CULL_SHIFT 28 -#define BGFX_STATE_CULL_MASK UINT64_C(0x0000000030000000) +#define BGFX_STATE_CULL_CW UINT64_C(0x0000000010000000) +#define BGFX_STATE_CULL_CCW UINT64_C(0x0000000020000000) +#define BGFX_STATE_CULL_SHIFT 28 +#define BGFX_STATE_CULL_MASK UINT64_C(0x0000000030000000) -#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000040000000) +#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000040000000) -#define BGFX_STATE_ALPHA_REF_SHIFT 32 -#define BGFX_STATE_ALPHA_REF_MASK UINT64_C(0x000000ff00000000) +#define BGFX_STATE_ALPHA_REF_SHIFT 32 +#define BGFX_STATE_ALPHA_REF_MASK UINT64_C(0x000000ff00000000) -#define BGFX_STATE_PT_LINES UINT64_C(0x0000010000000000) -#define BGFX_STATE_PT_POINTS UINT64_C(0x0000020000000000) -#define BGFX_STATE_PT_SHIFT 40 -#define BGFX_STATE_PT_MASK UINT64_C(0x0000030000000000) +#define BGFX_STATE_PT_LINES UINT64_C(0x0000010000000000) +#define BGFX_STATE_PT_POINTS UINT64_C(0x0000020000000000) +#define BGFX_STATE_PT_SHIFT 40 +#define BGFX_STATE_PT_MASK UINT64_C(0x0000030000000000) -#define BGFX_STATE_POINT_SIZE_SHIFT 44 -#define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x000ff00000000000) +#define BGFX_STATE_POINT_SIZE_SHIFT 44 +#define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x000ff00000000000) -#define BGFX_STATE_SRGBWRITE UINT64_C(0x0010000000000000) -#define BGFX_STATE_MSAA UINT64_C(0x0020000000000000) +#define BGFX_STATE_SRGBWRITE UINT64_C(0x0010000000000000) +#define BGFX_STATE_MSAA UINT64_C(0x0020000000000000) -#define BGFX_STATE_RESERVED UINT64_C(0xff00000000000000) +#define BGFX_STATE_RESERVED UINT64_C(0xff00000000000000) -#define BGFX_STATE_NONE UINT64_C(0x0000000000000000) -#define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff) +#define BGFX_STATE_NONE UINT64_C(0x0000000000000000) +#define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff) #define BGFX_STATE_DEFAULT (0 \ | BGFX_STATE_RGB_WRITE \ | BGFX_STATE_ALPHA_WRITE \ @@ -79,132 +79,136 @@ #define BGFX_STATE_BLEND_FUNC(_src, _dst) ( uint64_t(_src)|( uint64_t(_dst)<<4) ) /// -#define BGFX_STENCIL_FUNC_REF_SHIFT 0 -#define BGFX_STENCIL_FUNC_REF_MASK UINT32_C(0x000000ff) -#define BGFX_STENCIL_FUNC_RMASK_SHIFT 8 -#define BGFX_STENCIL_FUNC_RMASK_MASK UINT32_C(0x0000ff00) +#define BGFX_STENCIL_FUNC_REF_SHIFT 0 +#define BGFX_STENCIL_FUNC_REF_MASK UINT32_C(0x000000ff) +#define BGFX_STENCIL_FUNC_RMASK_SHIFT 8 +#define BGFX_STENCIL_FUNC_RMASK_MASK UINT32_C(0x0000ff00) -#define BGFX_STENCIL_TEST_LESS UINT32_C(0x00010000) -#define BGFX_STENCIL_TEST_LEQUAL UINT32_C(0x00020000) -#define BGFX_STENCIL_TEST_EQUAL UINT32_C(0x00030000) -#define BGFX_STENCIL_TEST_GEQUAL UINT32_C(0x00040000) -#define BGFX_STENCIL_TEST_GREATER UINT32_C(0x00050000) -#define BGFX_STENCIL_TEST_NOTEQUAL UINT32_C(0x00060000) -#define BGFX_STENCIL_TEST_NEVER UINT32_C(0x00070000) -#define BGFX_STENCIL_TEST_ALWAYS UINT32_C(0x00080000) -#define BGFX_STENCIL_TEST_SHIFT 16 -#define BGFX_STENCIL_TEST_MASK UINT32_C(0x000f0000) +#define BGFX_STENCIL_TEST_LESS UINT32_C(0x00010000) +#define BGFX_STENCIL_TEST_LEQUAL UINT32_C(0x00020000) +#define BGFX_STENCIL_TEST_EQUAL UINT32_C(0x00030000) +#define BGFX_STENCIL_TEST_GEQUAL UINT32_C(0x00040000) +#define BGFX_STENCIL_TEST_GREATER UINT32_C(0x00050000) +#define BGFX_STENCIL_TEST_NOTEQUAL UINT32_C(0x00060000) +#define BGFX_STENCIL_TEST_NEVER UINT32_C(0x00070000) +#define BGFX_STENCIL_TEST_ALWAYS UINT32_C(0x00080000) +#define BGFX_STENCIL_TEST_SHIFT 16 +#define BGFX_STENCIL_TEST_MASK UINT32_C(0x000f0000) -#define BGFX_STENCIL_OP_FAIL_S_ZERO UINT32_C(0x00000000) -#define BGFX_STENCIL_OP_FAIL_S_KEEP UINT32_C(0x00100000) -#define BGFX_STENCIL_OP_FAIL_S_REPLACE UINT32_C(0x00200000) -#define BGFX_STENCIL_OP_FAIL_S_INCR UINT32_C(0x00300000) -#define BGFX_STENCIL_OP_FAIL_S_INCRSAT UINT32_C(0x00400000) -#define BGFX_STENCIL_OP_FAIL_S_DECR UINT32_C(0x00500000) -#define BGFX_STENCIL_OP_FAIL_S_DECRSAT UINT32_C(0x00600000) -#define BGFX_STENCIL_OP_FAIL_S_INVERT UINT32_C(0x00700000) -#define BGFX_STENCIL_OP_FAIL_S_SHIFT 20 -#define BGFX_STENCIL_OP_FAIL_S_MASK UINT32_C(0x00f00000) +#define BGFX_STENCIL_OP_FAIL_S_ZERO UINT32_C(0x00000000) +#define BGFX_STENCIL_OP_FAIL_S_KEEP UINT32_C(0x00100000) +#define BGFX_STENCIL_OP_FAIL_S_REPLACE UINT32_C(0x00200000) +#define BGFX_STENCIL_OP_FAIL_S_INCR UINT32_C(0x00300000) +#define BGFX_STENCIL_OP_FAIL_S_INCRSAT UINT32_C(0x00400000) +#define BGFX_STENCIL_OP_FAIL_S_DECR UINT32_C(0x00500000) +#define BGFX_STENCIL_OP_FAIL_S_DECRSAT UINT32_C(0x00600000) +#define BGFX_STENCIL_OP_FAIL_S_INVERT UINT32_C(0x00700000) +#define BGFX_STENCIL_OP_FAIL_S_SHIFT 20 +#define BGFX_STENCIL_OP_FAIL_S_MASK UINT32_C(0x00f00000) -#define BGFX_STENCIL_OP_FAIL_Z_ZERO UINT32_C(0x00000000) -#define BGFX_STENCIL_OP_FAIL_Z_KEEP UINT32_C(0x01000000) -#define BGFX_STENCIL_OP_FAIL_Z_REPLACE UINT32_C(0x02000000) -#define BGFX_STENCIL_OP_FAIL_Z_INCR UINT32_C(0x03000000) -#define BGFX_STENCIL_OP_FAIL_Z_INCRSAT UINT32_C(0x04000000) -#define BGFX_STENCIL_OP_FAIL_Z_DECR UINT32_C(0x05000000) -#define BGFX_STENCIL_OP_FAIL_Z_DECRSAT UINT32_C(0x06000000) -#define BGFX_STENCIL_OP_FAIL_Z_INVERT UINT32_C(0x07000000) -#define BGFX_STENCIL_OP_FAIL_Z_SHIFT 24 -#define BGFX_STENCIL_OP_FAIL_Z_MASK UINT32_C(0x0f000000) +#define BGFX_STENCIL_OP_FAIL_Z_ZERO UINT32_C(0x00000000) +#define BGFX_STENCIL_OP_FAIL_Z_KEEP UINT32_C(0x01000000) +#define BGFX_STENCIL_OP_FAIL_Z_REPLACE UINT32_C(0x02000000) +#define BGFX_STENCIL_OP_FAIL_Z_INCR UINT32_C(0x03000000) +#define BGFX_STENCIL_OP_FAIL_Z_INCRSAT UINT32_C(0x04000000) +#define BGFX_STENCIL_OP_FAIL_Z_DECR UINT32_C(0x05000000) +#define BGFX_STENCIL_OP_FAIL_Z_DECRSAT UINT32_C(0x06000000) +#define BGFX_STENCIL_OP_FAIL_Z_INVERT UINT32_C(0x07000000) +#define BGFX_STENCIL_OP_FAIL_Z_SHIFT 24 +#define BGFX_STENCIL_OP_FAIL_Z_MASK UINT32_C(0x0f000000) -#define BGFX_STENCIL_OP_PASS_Z_ZERO UINT32_C(0x00000000) -#define BGFX_STENCIL_OP_PASS_Z_KEEP UINT32_C(0x10000000) -#define BGFX_STENCIL_OP_PASS_Z_REPLACE UINT32_C(0x20000000) -#define BGFX_STENCIL_OP_PASS_Z_INCR UINT32_C(0x30000000) -#define BGFX_STENCIL_OP_PASS_Z_INCRSAT UINT32_C(0x40000000) -#define BGFX_STENCIL_OP_PASS_Z_DECR UINT32_C(0x50000000) -#define BGFX_STENCIL_OP_PASS_Z_DECRSAT UINT32_C(0x60000000) -#define BGFX_STENCIL_OP_PASS_Z_INVERT UINT32_C(0x70000000) -#define BGFX_STENCIL_OP_PASS_Z_SHIFT 28 -#define BGFX_STENCIL_OP_PASS_Z_MASK UINT32_C(0xf0000000) +#define BGFX_STENCIL_OP_PASS_Z_ZERO UINT32_C(0x00000000) +#define BGFX_STENCIL_OP_PASS_Z_KEEP UINT32_C(0x10000000) +#define BGFX_STENCIL_OP_PASS_Z_REPLACE UINT32_C(0x20000000) +#define BGFX_STENCIL_OP_PASS_Z_INCR UINT32_C(0x30000000) +#define BGFX_STENCIL_OP_PASS_Z_INCRSAT UINT32_C(0x40000000) +#define BGFX_STENCIL_OP_PASS_Z_DECR UINT32_C(0x50000000) +#define BGFX_STENCIL_OP_PASS_Z_DECRSAT UINT32_C(0x60000000) +#define BGFX_STENCIL_OP_PASS_Z_INVERT UINT32_C(0x70000000) +#define BGFX_STENCIL_OP_PASS_Z_SHIFT 28 +#define BGFX_STENCIL_OP_PASS_Z_MASK UINT32_C(0xf0000000) -#define BGFX_STENCIL_NONE UINT32_C(0x00000000) -#define BGFX_STENCIL_MASK UINT32_C(0xffffffff) -#define BGFX_STENCIL_DEFAULT UINT32_C(0x00000000) +#define BGFX_STENCIL_NONE UINT32_C(0x00000000) +#define BGFX_STENCIL_MASK UINT32_C(0xffffffff) +#define BGFX_STENCIL_DEFAULT UINT32_C(0x00000000) #define BGFX_STENCIL_FUNC_REF(_ref) ( (uint32_t(_ref)<