This commit is contained in:
Branimir Karadžić 2014-07-30 20:37:54 -07:00
parent f580110d7f
commit 1c04b822bd
5 changed files with 29 additions and 27 deletions

View file

@ -127,8 +127,6 @@ namespace stl
#define BGFX_DEFAULT_WIDTH 1280
#define BGFX_DEFAULT_HEIGHT 720
#define BGFX_STATE_TEX_COUNT 16
#define BGFX_MAX_COMPUTE_BINDINGS 8
#define BGFX_SAMPLER_DEFAULT_FLAGS UINT32_C(0x10000000)
@ -980,7 +978,7 @@ namespace bgfx
m_indexBuffer.idx = invalidHandle;
m_instanceDataBuffer.idx = invalidHandle;
for (uint32_t ii = 0; ii < BGFX_STATE_TEX_COUNT; ++ii)
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii)
{
m_sampler[ii].m_idx = invalidHandle;
m_sampler[ii].m_flags = 0;
@ -1007,7 +1005,7 @@ namespace bgfx
VertexDeclHandle m_vertexDecl;
IndexBufferHandle m_indexBuffer;
VertexBufferHandle m_instanceDataBuffer;
Sampler m_sampler[BGFX_STATE_TEX_COUNT];
Sampler m_sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
};
struct ComputeBinding

View file

@ -180,6 +180,10 @@
# define BGFX_CONFIG_MAX_TEXTURES (4<<10)
#endif // BGFX_CONFIG_MAX_TEXTURES
#ifndef BGFX_CONFIG_MAX_TEXTURE_SAMPLERS
# define BGFX_CONFIG_MAX_TEXTURE_SAMPLERS 16
#endif // BGFX_CONFIG_MAX_TEXTURE_SAMPLERS
#ifndef BGFX_CONFIG_MAX_FRAME_BUFFERS
# define BGFX_CONFIG_MAX_FRAME_BUFFERS 64
#endif // BGFX_CONFIG_MAX_FRAME_BUFFERS

View file

@ -338,8 +338,8 @@ namespace bgfx
memset(m_sampler, 0, sizeof(m_sampler) );
}
ID3D11ShaderResourceView* m_srv[BGFX_STATE_TEX_COUNT];
ID3D11SamplerState* m_sampler[BGFX_STATE_TEX_COUNT];
ID3D11ShaderResourceView* m_srv[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
ID3D11SamplerState* m_sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
};
static const GUID WKPDID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } };
@ -1479,8 +1479,8 @@ namespace bgfx
void commitTextureStage()
{
m_deviceCtx->PSSetShaderResources(0, BGFX_STATE_TEX_COUNT, m_textureStage.m_srv);
m_deviceCtx->PSSetSamplers(0, BGFX_STATE_TEX_COUNT, m_textureStage.m_sampler);
m_deviceCtx->PSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, m_textureStage.m_srv);
m_deviceCtx->PSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, m_textureStage.m_sampler);
}
void invalidateTextureStage()
@ -2573,13 +2573,13 @@ namespace bgfx
{
wasCompute = true;
ID3D11ShaderResourceView* srv[BGFX_STATE_TEX_COUNT] = {};
deviceCtx->VSSetShaderResources(0, BGFX_STATE_TEX_COUNT, srv);
deviceCtx->PSSetShaderResources(0, BGFX_STATE_TEX_COUNT, srv);
ID3D11ShaderResourceView* srv[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
deviceCtx->VSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, srv);
deviceCtx->PSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, srv);
ID3D11SamplerState* sampler[BGFX_STATE_TEX_COUNT] = {};
deviceCtx->VSSetSamplers(0, BGFX_STATE_TEX_COUNT, sampler);
deviceCtx->PSSetSamplers(0, BGFX_STATE_TEX_COUNT, sampler);
ID3D11SamplerState* sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
deviceCtx->VSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, sampler);
deviceCtx->PSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, sampler);
}
const RenderCompute& compute = renderItem.compute;
@ -2624,7 +2624,7 @@ namespace bgfx
ID3D11UnorderedAccessView* uav[BGFX_MAX_COMPUTE_BINDINGS] = {};
ID3D11ShaderResourceView* srv[BGFX_MAX_COMPUTE_BINDINGS] = {};
ID3D11SamplerState* sampler[BGFX_STATE_TEX_COUNT] = {};
ID3D11SamplerState* sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii)
{
@ -2676,14 +2676,14 @@ namespace bgfx
deviceCtx->CSSetShader(NULL, NULL, 0);
ID3D11UnorderedAccessView* uav[BGFX_STATE_TEX_COUNT] = {};
deviceCtx->CSSetUnorderedAccessViews(0, BGFX_STATE_TEX_COUNT, uav, NULL);
ID3D11UnorderedAccessView* uav[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
deviceCtx->CSSetUnorderedAccessViews(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, uav, NULL);
ID3D11ShaderResourceView* srv[BGFX_STATE_TEX_COUNT] = {};
deviceCtx->CSSetShaderResources(0, BGFX_STATE_TEX_COUNT, srv);
ID3D11ShaderResourceView* srv[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
deviceCtx->CSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, srv);
ID3D11SamplerState* samplers[BGFX_STATE_TEX_COUNT] = {};
m_deviceCtx->CSSetSamplers(0, BGFX_STATE_TEX_COUNT, samplers);
ID3D11SamplerState* samplers[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
m_deviceCtx->CSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, samplers);
}
const RenderDraw& draw = renderItem.draw;
@ -2982,7 +2982,7 @@ namespace bgfx
{
uint32_t changes = 0;
for (uint32_t stage = 0; stage < BGFX_STATE_TEX_COUNT; ++stage)
for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
{
const Sampler& sampler = draw.m_sampler[stage];
Sampler& current = currentState.m_sampler[stage];

View file

@ -1062,7 +1062,7 @@ namespace bgfx
{
invalidateSamplerState();
for (uint32_t stage = 0; stage < BGFX_STATE_TEX_COUNT; ++stage)
for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
{
DX_CHECK(m_device->SetTexture(stage, NULL) );
}
@ -1134,7 +1134,7 @@ namespace bgfx
void invalidateSamplerState()
{
for (uint32_t stage = 0; stage < BGFX_STATE_TEX_COUNT; ++stage)
for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
{
m_samplerFlags[stage] = UINT32_MAX;
}
@ -1416,7 +1416,7 @@ namespace bgfx
UniformRegistry m_uniformReg;
void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS];
uint32_t m_samplerFlags[BGFX_STATE_TEX_COUNT];
uint32_t m_samplerFlags[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
TextureD3D9* m_updateTexture;
uint8_t* m_updateTextureBits;
@ -2975,7 +2975,7 @@ namespace bgfx
}
{
for (uint32_t stage = 0; stage < BGFX_STATE_TEX_COUNT; ++stage)
for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
{
const Sampler& sampler = draw.m_sampler[stage];
Sampler& current = currentState.m_sampler[stage];

View file

@ -4424,7 +4424,7 @@ namespace bgfx
}
{
for (uint32_t stage = 0; stage < BGFX_STATE_TEX_COUNT; ++stage)
for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
{
const Sampler& sampler = draw.m_sampler[stage];
Sampler& current = currentState.m_sampler[stage];