mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
GLES3.1: Fixed getting compute shader active uniform information.
This commit is contained in:
parent
185c1fc400
commit
532fdf2198
3 changed files with 57 additions and 5 deletions
|
@ -1956,7 +1956,9 @@ namespace bgfx
|
|||
|
||||
BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl) )
|
||||
{
|
||||
DynamicVertexBufferHandle handle = createDynamicVertexBuffer(_mem->size/_decl.m_stride, _decl);
|
||||
uint32_t numVertices = _mem->size/_decl.m_stride;
|
||||
BX_CHECK(numVertices <= UINT16_MAX, "Num vertices exceeds maximum (num %d, max %d).", numVertices, UINT16_MAX);
|
||||
DynamicVertexBufferHandle handle = createDynamicVertexBuffer(uint16_t(numVertices), _decl);
|
||||
if (isValid(handle) )
|
||||
{
|
||||
updateDynamicVertexBuffer(handle, _mem);
|
||||
|
|
|
@ -2461,14 +2461,56 @@ namespace bgfx
|
|||
m_constantBuffer = ConstantBuffer::create(1024);
|
||||
m_numSamplers = 0;
|
||||
|
||||
struct VariableInfo
|
||||
{
|
||||
GLenum type;
|
||||
GLint loc;
|
||||
GLint num;
|
||||
};
|
||||
VariableInfo vi;
|
||||
GLenum props[] = { GL_TYPE, GL_LOCATION, GL_ARRAY_SIZE };
|
||||
|
||||
const bool piqSupported = s_extension[Extension::ARB_program_interface_query].m_supported;
|
||||
|
||||
BX_TRACE("Uniforms (%d):", activeUniforms);
|
||||
for (int32_t ii = 0; ii < activeUniforms; ++ii)
|
||||
{
|
||||
GLint num;
|
||||
GLenum gltype;
|
||||
GLint num;
|
||||
GLint loc;
|
||||
|
||||
GL_CHECK(glGetActiveUniform(m_id, ii, maxLength + 1, NULL, &num, &gltype, name) );
|
||||
GLint loc = glGetUniformLocation(m_id, name);
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31)
|
||||
|| piqSupported)
|
||||
{
|
||||
GL_CHECK(glGetProgramResourceiv(m_id
|
||||
, GL_UNIFORM
|
||||
, ii
|
||||
, BX_COUNTOF(props)
|
||||
, props
|
||||
, BX_COUNTOF(props)
|
||||
, NULL
|
||||
, (GLint*)&vi
|
||||
) );
|
||||
|
||||
GL_CHECK(glGetProgramResourceName(m_id
|
||||
, GL_UNIFORM
|
||||
, ii
|
||||
, maxLength + 1
|
||||
, NULL
|
||||
, name
|
||||
) );
|
||||
|
||||
gltype = vi.type;
|
||||
loc = vi.loc;
|
||||
num = vi.num;
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_CHECK(glGetActiveUniform(m_id, ii, maxLength + 1, NULL, &num, &gltype, name) );
|
||||
loc = glGetUniformLocation(m_id, name);
|
||||
}
|
||||
|
||||
num = bx::uint32_max(num, 1);
|
||||
|
||||
int offset = 0;
|
||||
char* array = strchr(name, '[');
|
||||
|
@ -2844,7 +2886,7 @@ namespace bgfx
|
|||
{
|
||||
uint8_t numMips = imageContainer.m_numMips;
|
||||
const uint32_t startLod = bx::uint32_min(_skip, numMips-1);
|
||||
numMips -= startLod;
|
||||
numMips -= uint8_t(startLod);
|
||||
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
|
||||
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
|
||||
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
|
||||
|
|
|
@ -456,6 +456,14 @@ typedef uint64_t GLuint64;
|
|||
# define GL_TYPE 0x92FA
|
||||
#endif // GL_TYPE
|
||||
|
||||
#ifndef GL_ARRAY_SIZE
|
||||
# define GL_ARRAY_SIZE 0x92FB
|
||||
#endif // GL_ARRAY_SIZE
|
||||
|
||||
#ifndef GL_LOCATION
|
||||
# define GL_LOCATION 0x930E
|
||||
#endif // GL_LOCATION
|
||||
|
||||
#if BX_PLATFORM_NACL
|
||||
# include "glcontext_ppapi.h"
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
|
|
Loading…
Reference in a new issue