mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-06-08 11:23:52 +00:00
Reorganized opcode type and location bits in constant buffer opcode.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$input v_wpos, v_view, v_normal, v_tangent, v_texcoord0
|
||||
$input v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
@@ -64,15 +64,20 @@ vec3 calcLight(int _idx, mat3 _tbn, vec3 _wpos, vec3 _normal, vec3 _view)
|
||||
|
||||
void main()
|
||||
{
|
||||
mat3 tbn = mat3(v_tangent, cross(v_normal, v_tangent), v_normal);
|
||||
mat3 tbn = mat3(
|
||||
normalize(v_tangent),
|
||||
normalize(v_bitangent),
|
||||
normalize(v_normal)
|
||||
);
|
||||
|
||||
vec3 normal = normalize(2.0*texture2D(u_texNormal, v_texcoord0).xyz-1.0);
|
||||
vec3 normal = normalize(texture2D(u_texNormal, v_texcoord0).xyz * 2.0 - 1.0);
|
||||
vec3 view = -normalize(v_view);
|
||||
|
||||
vec3 lightColor;
|
||||
lightColor = calcLight(0, tbn, v_wpos, normal, v_view);
|
||||
lightColor += calcLight(1, tbn, v_wpos, normal, v_view);
|
||||
lightColor += calcLight(2, tbn, v_wpos, normal, v_view);
|
||||
lightColor += calcLight(3, tbn, v_wpos, normal, v_view);
|
||||
lightColor = calcLight(0, tbn, v_wpos, normal, view);
|
||||
lightColor += calcLight(1, tbn, v_wpos, normal, view);
|
||||
lightColor += calcLight(2, tbn, v_wpos, normal, view);
|
||||
lightColor += calcLight(3, tbn, v_wpos, normal, view);
|
||||
|
||||
vec4 color = toLinear(texture2D(u_texColor, v_texcoord0) );
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@ vec3 v_wpos : TEXCOORD1 = vec3(0.0, 0.0, 0.0);
|
||||
vec3 v_view : TEXCOORD2 = vec3(0.0, 0.0, 0.0);
|
||||
vec3 v_normal : NORMAL = vec3(0.0, 0.0, 1.0);
|
||||
vec3 v_tangent : TANGENT = vec3(1.0, 0.0, 0.0);
|
||||
vec3 v_bitangent : BINORMAL = vec3(0.0, 1.0, 0.0);
|
||||
|
||||
vec3 a_position : POSITION;
|
||||
vec3 a_normal : NORMAL;
|
||||
vec3 a_tangent : TANGENT;
|
||||
vec4 a_normal : NORMAL;
|
||||
vec4 a_tangent : TANGENT;
|
||||
vec2 a_texcoord0 : TEXCOORD0;
|
||||
vec4 i_data0 : TEXCOORD4;
|
||||
vec4 i_data1 : TEXCOORD5;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
$input a_position, a_normal, a_tangent, a_texcoord0, i_data0, i_data1, i_data2, i_data3
|
||||
$output v_wpos, v_view, v_normal, v_tangent, v_texcoord0
|
||||
$output v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
@@ -19,23 +19,25 @@ void main()
|
||||
vec3 wpos = instMul(model, vec4(a_position, 1.0) ).xyz;
|
||||
gl_Position = mul(u_viewProj, vec4(wpos, 1.0) );
|
||||
|
||||
vec3 normal = a_normal * 2.0f - 1.0f;
|
||||
vec3 wnormal = instMul(model, vec4(normal, 0.0) ).xyz;
|
||||
vec4 normal = a_normal * 2.0f - 1.0f;
|
||||
vec3 wnormal = instMul(model, vec4(normal.xyz, 0.0) ).xyz;
|
||||
|
||||
vec3 tangent = a_tangent * 2.0f - 1.0f;
|
||||
vec4 tangent = a_tangent * 2.0f - 1.0f;
|
||||
vec3 wtangent = instMul(model, vec4(tangent.xyz, 0.0) ).xyz;
|
||||
|
||||
vec3 viewNormal = normalize(mul(u_view, vec4(wnormal, 0.0) ).xyz);
|
||||
vec3 viewTangent = normalize(mul(u_view, vec4(wtangent, 0.0) ).xyz);
|
||||
mat3 tbn = mat3(viewTangent, cross(viewNormal, viewTangent), viewNormal);
|
||||
vec3 viewBitangent = cross(viewNormal, viewTangent) * a_tangent.w;
|
||||
mat3 tbn = mat3(viewTangent, viewBitangent, viewNormal);
|
||||
|
||||
v_wpos = wpos;
|
||||
|
||||
vec3 view = -mul(u_view, vec4(wpos, 1.0) ).xyz;
|
||||
v_view = mul(tbn, view);
|
||||
vec3 view = mul(u_view, vec4(wpos, 0.0) ).xyz;
|
||||
v_view = instMul(view, tbn);
|
||||
|
||||
v_normal = viewNormal;
|
||||
v_tangent = viewTangent;
|
||||
v_bitangent = viewBitangent;
|
||||
|
||||
v_texcoord0 = a_texcoord0;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
68
src/bgfx.cpp
68
src/bgfx.cpp
@@ -478,19 +478,24 @@ namespace bgfx
|
||||
return;
|
||||
}
|
||||
|
||||
m_key.m_depth = _depth;
|
||||
m_key.m_view = _id;
|
||||
m_key.m_seq = s_ctx.m_seq[_id] & s_ctx.m_seqMask[_id];
|
||||
s_ctx.m_seq[_id]++;
|
||||
uint64_t key = m_key.encode();
|
||||
m_sortKeys[m_num] = key;
|
||||
m_sortValues[m_num] = m_numRenderStates;
|
||||
++m_num;
|
||||
BX_WARN(invalidHandle != m_key.m_program, "Program with invalid handle");
|
||||
if (invalidHandle != m_key.m_program)
|
||||
{
|
||||
m_key.m_depth = _depth;
|
||||
m_key.m_view = _id;
|
||||
m_key.m_seq = s_ctx.m_seq[_id] & s_ctx.m_seqMask[_id];
|
||||
s_ctx.m_seq[_id]++;
|
||||
uint64_t key = m_key.encode();
|
||||
m_sortKeys[m_num] = key;
|
||||
m_sortValues[m_num] = m_numRenderStates;
|
||||
++m_num;
|
||||
|
||||
m_state.m_constEnd = m_constantBuffer->getPos();
|
||||
m_state.m_flags |= m_flags;
|
||||
m_renderState[m_numRenderStates] = m_state;
|
||||
++m_numRenderStates;
|
||||
}
|
||||
|
||||
m_state.m_constEnd = m_constantBuffer->getPos();
|
||||
m_state.m_flags |= m_flags;
|
||||
m_renderState[m_numRenderStates] = m_state;
|
||||
++m_numRenderStates;
|
||||
m_state.clear();
|
||||
m_flags = BGFX_STATE_NONE;
|
||||
}
|
||||
@@ -510,26 +515,31 @@ namespace bgfx
|
||||
return;
|
||||
}
|
||||
|
||||
m_key.m_depth = _depth;
|
||||
|
||||
for (uint32_t id = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = uint32_cnttz(viewMask) )
|
||||
BX_WARN(invalidHandle != m_key.m_program, "Program with invalid handle");
|
||||
if (invalidHandle != m_key.m_program)
|
||||
{
|
||||
viewMask >>= ntz;
|
||||
id += ntz;
|
||||
m_key.m_depth = _depth;
|
||||
|
||||
m_key.m_view = id;
|
||||
m_key.m_seq = s_ctx.m_seq[id] & s_ctx.m_seqMask[id];
|
||||
s_ctx.m_seq[id]++;
|
||||
uint64_t key = m_key.encode();
|
||||
m_sortKeys[m_num] = key;
|
||||
m_sortValues[m_num] = m_numRenderStates;
|
||||
++m_num;
|
||||
for (uint32_t id = 0, viewMask = _viewMask, ntz = uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = uint32_cnttz(viewMask) )
|
||||
{
|
||||
viewMask >>= ntz;
|
||||
id += ntz;
|
||||
|
||||
m_key.m_view = id;
|
||||
m_key.m_seq = s_ctx.m_seq[id] & s_ctx.m_seqMask[id];
|
||||
s_ctx.m_seq[id]++;
|
||||
uint64_t key = m_key.encode();
|
||||
m_sortKeys[m_num] = key;
|
||||
m_sortValues[m_num] = m_numRenderStates;
|
||||
++m_num;
|
||||
}
|
||||
|
||||
m_state.m_constEnd = m_constantBuffer->getPos();
|
||||
m_state.m_flags |= m_flags;
|
||||
m_renderState[m_numRenderStates] = m_state;
|
||||
++m_numRenderStates;
|
||||
}
|
||||
|
||||
m_state.m_constEnd = m_constantBuffer->getPos();
|
||||
m_state.m_flags |= m_flags;
|
||||
m_renderState[m_numRenderStates] = m_state;
|
||||
++m_numRenderStates;
|
||||
|
||||
m_state.clear();
|
||||
m_flags = BGFX_STATE_NONE;
|
||||
}
|
||||
|
||||
32
src/bgfx_p.h
32
src/bgfx_p.h
@@ -76,9 +76,9 @@ extern HWND g_bgfxHwnd;
|
||||
|
||||
#include "dds.h"
|
||||
|
||||
#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x0)
|
||||
#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x1)
|
||||
#define BGFX_CHUNK_MAGIC_TEX BX_MAKEFOURCC('T', 'E', 'X', 0x0)
|
||||
#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x0)
|
||||
#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x1)
|
||||
|
||||
#if BGFX_CONFIG_USE_TINYSTL
|
||||
|
||||
@@ -595,18 +595,16 @@ namespace bgfx
|
||||
|
||||
#define CONSTANT_OPCODE_MASK(_bits) ( (1<<_bits)-1)
|
||||
|
||||
#define CONSTANT_OPCODE_TYPE_BITS 8
|
||||
#define CONSTANT_OPCODE_TYPE_BITS 5
|
||||
#define CONSTANT_OPCODE_TYPE_MASK CONSTANT_OPCODE_MASK(CONSTANT_OPCODE_TYPE_BITS)
|
||||
#define CONSTANT_OPCODE_LOC_BITS 10
|
||||
#define CONSTANT_OPCODE_LOC_BITS 16
|
||||
#define CONSTANT_OPCODE_LOC_MASK CONSTANT_OPCODE_MASK(CONSTANT_OPCODE_LOC_BITS)
|
||||
#define CONSTANT_OPCODE_NUM_BITS 10
|
||||
#define CONSTANT_OPCODE_NUM_MASK CONSTANT_OPCODE_MASK(CONSTANT_OPCODE_NUM_BITS)
|
||||
#define CONSTANT_OPCODE_COPY_BITS 1
|
||||
#define CONSTANT_OPCODE_COPY_MASK CONSTANT_OPCODE_MASK(CONSTANT_OPCODE_COPY_BITS)
|
||||
|
||||
#define BGFX_UNIFORM_FUNCTIONBIT UINT8_C(0x40)
|
||||
#define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x80)
|
||||
#define BGFX_UNIFORM_TYPEMASK UINT8_C(0x3f)
|
||||
#define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10)
|
||||
|
||||
class ConstantBuffer
|
||||
{
|
||||
@@ -1837,6 +1835,12 @@ namespace bgfx
|
||||
|
||||
void destroyVertexShader(VertexShaderHandle _handle)
|
||||
{
|
||||
if (invalidHandle == _handle.idx)
|
||||
{
|
||||
BX_WARN(false, "Passing invalid vertex shader handle to bgfx::destroyVertexShader");
|
||||
return;
|
||||
}
|
||||
|
||||
vertexShaderDecRef(_handle);
|
||||
}
|
||||
|
||||
@@ -1886,6 +1890,12 @@ namespace bgfx
|
||||
|
||||
void destroyFragmentShader(FragmentShaderHandle _handle)
|
||||
{
|
||||
if (invalidHandle == _handle.idx)
|
||||
{
|
||||
BX_WARN(false, "Passing invalid fragment shader handle to bgfx::destroyFragmentShader");
|
||||
return;
|
||||
}
|
||||
|
||||
fragmentShaderDecRef(_handle);
|
||||
}
|
||||
|
||||
@@ -1909,6 +1919,14 @@ namespace bgfx
|
||||
|
||||
ProgramHandle createProgram(VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
{
|
||||
if (invalidHandle == _vsh.idx
|
||||
|| invalidHandle == _fsh.idx)
|
||||
{
|
||||
BX_WARN(false, "Vertex/fragment shader is invalid (vsh %d, fsh %d).", _vsh.idx, _fsh.idx);
|
||||
ProgramHandle invalid = BGFX_INVALID_HANDLE;
|
||||
return invalid;
|
||||
}
|
||||
|
||||
const VertexShaderRef& vsr = m_vertexShaderRef[_vsh.idx];
|
||||
const FragmentShaderRef& fsr = m_fragmentShaderRef[_fsh.idx];
|
||||
if (vsr.m_outputHash != fsr.m_inputHash)
|
||||
|
||||
@@ -79,6 +79,21 @@ vec4 bgfxTextureCube(BgfxSamplerCube _sampler, vec3 _coord)
|
||||
# define vec3_splat(_x) float3(_x, _x, _x)
|
||||
# define vec4_splat(_x) float4(_x, _x, _x, _x)
|
||||
|
||||
vec3 instMul(vec3 _vec, mat3 _mtx)
|
||||
{
|
||||
return mul(_mtx, _vec);
|
||||
}
|
||||
|
||||
vec3 instMul(mat3 _mtx, vec3 _vec)
|
||||
{
|
||||
return mul(_vec, _mtx);
|
||||
}
|
||||
|
||||
vec4 instMul(vec4 _vec, mat4 _mtx)
|
||||
{
|
||||
return mul(_mtx, _vec);
|
||||
}
|
||||
|
||||
vec4 instMul(mat4 _mtx, vec4 _vec)
|
||||
{
|
||||
return mul(_vec, _mtx);
|
||||
@@ -96,6 +111,21 @@ vec4 instMul(mat4 _mtx, vec4 _vec)
|
||||
# define vec3_splat(_x) vec3(_x)
|
||||
# define vec4_splat(_x) vec4(_x)
|
||||
|
||||
vec3 instMul(vec3 _vec, mat3 _mtx)
|
||||
{
|
||||
return mul(_vec, _mtx);
|
||||
}
|
||||
|
||||
vec3 instMul(mat3 _mtx, vec3 _vec)
|
||||
{
|
||||
return mul(_mtx, _vec);
|
||||
}
|
||||
|
||||
vec4 instMul(vec4 _vec, mat4 _mtx)
|
||||
{
|
||||
return mul(_vec, _mtx);
|
||||
}
|
||||
|
||||
vec4 instMul(mat4 _mtx, vec4 _vec)
|
||||
{
|
||||
return mul(_mtx, _vec);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
static const uint8_t fs_clear_dx11[562] =
|
||||
{
|
||||
0x46, 0x53, 0x48, 0x00, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, // FSH....I........
|
||||
0x46, 0x53, 0x48, 0x01, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, // FSH....I........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x02, 0x44, 0x58, 0x42, // .............DXB
|
||||
0x43, 0xda, 0x0f, 0xc3, 0x91, 0x70, 0x6f, 0xd4, 0x7b, 0xeb, 0xe0, 0x21, 0x07, 0x79, 0xd8, 0x54, // C....po.{..!.y.T
|
||||
0xd4, 0x01, 0x00, 0x00, 0x00, 0x14, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, // .............4..
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
static const uint8_t fs_debugfont_dx11[930] =
|
||||
{
|
||||
0x46, 0x53, 0x48, 0x00, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, // FSH..."f........
|
||||
0x46, 0x53, 0x48, 0x01, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, // FSH..."f........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x03, 0x44, 0x58, 0x42, // .............DXB
|
||||
0x43, 0x7f, 0x04, 0x32, 0xab, 0xf6, 0xa8, 0x90, 0xe5, 0x2c, 0xd4, 0x3b, 0xd7, 0xa9, 0x89, 0x79, // C..2.....,.;...y
|
||||
0xfd, 0x01, 0x00, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, // .............4..
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
static const uint8_t fs_debugfont_dx9[353] =
|
||||
{
|
||||
0x46, 0x53, 0x48, 0x00, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x54, 0x01, 0x01, 0x02, 0xff, 0xff, // FSH..."f..T.....
|
||||
0x46, 0x53, 0x48, 0x01, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x54, 0x01, 0x01, 0x02, 0xff, 0xff, // FSH..."f..T.....
|
||||
0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // ..".CTAB....S...
|
||||
0x01, 0x02, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // ................
|
||||
0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, // L...0...........
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
static const uint8_t fs_debugfont_glsl[360] =
|
||||
{
|
||||
0x46, 0x53, 0x48, 0x00, 0xb8, 0xbe, 0x22, 0x66, 0x23, 0x69, 0x66, 0x64, 0x65, 0x66, 0x20, 0x47, // FSH..."f#ifdef G
|
||||
0x46, 0x53, 0x48, 0x01, 0xb8, 0xbe, 0x22, 0x66, 0x23, 0x69, 0x66, 0x64, 0x65, 0x66, 0x20, 0x47, // FSH..."f#ifdef G
|
||||
0x4c, 0x5f, 0x45, 0x53, 0x0a, 0x70, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x68, // L_ES.precision h
|
||||
0x69, 0x67, 0x68, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3b, 0x0a, 0x23, 0x65, 0x6e, 0x64, // ighp float;.#end
|
||||
0x69, 0x66, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x4c, 0x5f, 0x45, 0x53, 0x0a, 0x0a, 0x75, 0x6e, 0x69, // if // GL_ES..uni
|
||||
|
||||
@@ -492,12 +492,12 @@ namespace bgfx
|
||||
if (_flags&BGFX_UNIFORM_FRAGMENTBIT)
|
||||
{
|
||||
memcpy(&m_fsScratch[_regIndex], _val, _numRegs*16);
|
||||
++m_fsChanges;
|
||||
m_fsChanges += _numRegs;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&m_vsScratch[_regIndex], _val, _numRegs*16);
|
||||
++m_vsChanges;
|
||||
m_vsChanges += _numRegs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace bgfx
|
||||
void dump(const VertexDecl& _decl)
|
||||
{
|
||||
#if BGFX_CONFIG_DEBUG
|
||||
dbgPrintf("vertexdecl %08x (%08x), stride %d"
|
||||
dbgPrintf("vertexdecl %08x (%08x), stride %d\n"
|
||||
, _decl.m_hash
|
||||
, bx::hashMurmur2A(_decl.m_attributes, sizeof(_decl.m_attributes) )
|
||||
, _decl.m_stride
|
||||
@@ -133,7 +133,7 @@ namespace bgfx
|
||||
bool asInt;
|
||||
_decl.decode(Attrib::Enum(attr), num, type, normalized, asInt);
|
||||
|
||||
dbgPrintf("\tattr %d - %s, num %d, type %d, norm %d, asint %d, offset %d"
|
||||
dbgPrintf("\tattr %d - %s, num %d, type %d, norm %d, asint %d, offset %d\n"
|
||||
, attr
|
||||
, getAttribName(Attrib::Enum(attr) )
|
||||
, num
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
static const uint8_t vs_clear_dx11[658] =
|
||||
{
|
||||
0x56, 0x53, 0x48, 0x00, 0xa4, 0x8b, 0xef, 0x49, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, // VSH....I........
|
||||
0x56, 0x53, 0x48, 0x01, 0xa4, 0x8b, 0xef, 0x49, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, // VSH....I........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x02, 0x44, 0x58, 0x42, // ...........t.DXB
|
||||
0x43, 0xda, 0x52, 0xa4, 0x82, 0x31, 0xef, 0x9d, 0x65, 0xc3, 0x64, 0xcc, 0x10, 0x3d, 0x4f, 0x86, // C.R..1..e.d..=O.
|
||||
0x53, 0x01, 0x00, 0x00, 0x00, 0x74, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, // S....t.......4..
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
static const uint8_t vs_debugfont_dx11[1484] =
|
||||
{
|
||||
0x56, 0x53, 0x48, 0x00, 0xb8, 0xbe, 0x22, 0x66, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, // VSH..."f........
|
||||
0x56, 0x53, 0x48, 0x01, 0xb8, 0xbe, 0x22, 0x66, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, // VSH..."f........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xc0, 0x01, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo
|
||||
0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x00, 0x00, 0x01, 0x04, // delViewProj.....
|
||||
0x00, 0x98, 0x05, 0x44, 0x58, 0x42, 0x43, 0x4e, 0x14, 0xcf, 0x18, 0xca, 0x5f, 0xd6, 0x83, 0xb0, // ...DXBCN...._...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
static const uint8_t vs_debugfont_dx9[343] =
|
||||
{
|
||||
0x56, 0x53, 0x48, 0x00, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod
|
||||
0x56, 0x53, 0x48, 0x01, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod
|
||||
0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj......
|
||||
0x34, 0x01, 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // 4.......#.CTAB..
|
||||
0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W.............
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
static const uint8_t vs_debugfont_glsl[474] =
|
||||
{
|
||||
0x56, 0x53, 0x48, 0x00, 0xb8, 0xbe, 0x22, 0x66, 0x23, 0x69, 0x66, 0x64, 0x65, 0x66, 0x20, 0x47, // VSH..."f#ifdef G
|
||||
0x56, 0x53, 0x48, 0x01, 0xb8, 0xbe, 0x22, 0x66, 0x23, 0x69, 0x66, 0x64, 0x65, 0x66, 0x20, 0x47, // VSH..."f#ifdef G
|
||||
0x4c, 0x5f, 0x45, 0x53, 0x0a, 0x70, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x68, // L_ES.precision h
|
||||
0x69, 0x67, 0x68, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3b, 0x0a, 0x23, 0x65, 0x6e, 0x64, // ighp float;.#end
|
||||
0x69, 0x66, 0x20, 0x2f, 0x2f, 0x20, 0x47, 0x4c, 0x5f, 0x45, 0x53, 0x0a, 0x0a, 0x75, 0x6e, 0x69, // if // GL_ES..uni
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -30,8 +30,8 @@ extern "C"
|
||||
# define BX_TRACE(_format, ...) fprintf(stderr, "" _format "\n", ##__VA_ARGS__)
|
||||
#endif // DEBUG
|
||||
|
||||
#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x0)
|
||||
#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x0)
|
||||
#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x1)
|
||||
#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x1)
|
||||
|
||||
#include <bx/bx.h>
|
||||
|
||||
@@ -145,11 +145,11 @@ struct ConstantType
|
||||
Uniform4x4fv,
|
||||
|
||||
Count,
|
||||
TypeMask = 0x7f,
|
||||
FragmentBit = 0x80
|
||||
};
|
||||
};
|
||||
|
||||
#define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10)
|
||||
|
||||
static const char* s_constantTypeName[ConstantType::Count] =
|
||||
{
|
||||
"int",
|
||||
@@ -653,7 +653,7 @@ bool compileHLSLShaderDx9(bx::CommandLine& _cmdLine, const std::string& _code, b
|
||||
uint16_t count = (uint16_t)uniforms.size();
|
||||
bx::write(_writer, count);
|
||||
|
||||
uint32_t fragmentBit = profile[0] == 'p' ? ConstantType::FragmentBit : 0;
|
||||
uint32_t fragmentBit = profile[0] == 'p' ? BGFX_UNIFORM_FRAGMENTBIT : 0;
|
||||
for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it)
|
||||
{
|
||||
const Uniform& un = *it;
|
||||
@@ -930,7 +930,7 @@ bool compileHLSLShaderDx11(bx::CommandLine& _cmdLine, const std::string& _code,
|
||||
|
||||
bx::write(_writer, size);
|
||||
|
||||
uint32_t fragmentBit = profile[0] == 'p' ? ConstantType::FragmentBit : 0;
|
||||
uint32_t fragmentBit = profile[0] == 'p' ? BGFX_UNIFORM_FRAGMENTBIT : 0;
|
||||
for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it)
|
||||
{
|
||||
const Uniform& un = *it;
|
||||
|
||||
Reference in New Issue
Block a user