mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-13 06:38:31 +09:00
[Chore] (...): Format code.
This commit is contained in:
@@ -71,8 +71,7 @@ namespace MobileGL {
|
|||||||
.TargetGLVersion = {3, 3, 0}, // Target OpenGL Version
|
.TargetGLVersion = {3, 3, 0}, // Target OpenGL Version
|
||||||
.TargetGLSLVersion = {4, 6, 0}, // Target Shading Language Version
|
.TargetGLSLVersion = {4, 6, 0}, // Target Shading Language Version
|
||||||
.Extensions = {V_OpenGL30, V_OpenGL31, V_OpenGL32, // OpenGL Extensions
|
.Extensions = {V_OpenGL30, V_OpenGL31, V_OpenGL32, // OpenGL Extensions
|
||||||
V_OpenGL33,
|
V_OpenGL33, E_GL_ARB_draw_buffers_blend},
|
||||||
E_GL_ARB_draw_buffers_blend},
|
|
||||||
.IsCompatibilityProfile = false // Is Compatibility Profile
|
.IsCompatibilityProfile = false // Is Compatibility Profile
|
||||||
},
|
},
|
||||||
.BackendCapability = {} // Backend Capability
|
.BackendCapability = {} // Backend Capability
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
GLint dstY1, GLbitfield mask, GLenum filter);
|
GLint dstY1, GLbitfield mask, GLenum filter);
|
||||||
void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width,
|
void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width,
|
||||||
GLsizei height, GLint border);
|
GLsizei height, GLint border);
|
||||||
void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y,
|
void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
|
||||||
GLsizei width, GLsizei height);
|
GLsizei height);
|
||||||
void GenerateMipmap(GLenum target);
|
void GenerateMipmap(GLenum target);
|
||||||
const GLubyte* GetString(GLenum name);
|
const GLubyte* GetString(GLenum name);
|
||||||
} // namespace MobileGL::MG_Backend::DirectGLES
|
} // namespace MobileGL::MG_Backend::DirectGLES
|
||||||
@@ -277,15 +277,13 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
const auto mipmapCount = stateTextureObject->GetMipmapLevelCount();
|
const auto mipmapCount = stateTextureObject->GetMipmapLevelCount();
|
||||||
const auto baseSize = stateTextureObject->GetBaseSize();
|
const auto baseSize = stateTextureObject->GetBaseSize();
|
||||||
StateTextureBasicInfo currentTextureInfo = {
|
StateTextureBasicInfo currentTextureInfo = {
|
||||||
stateTextureObject->GetFormat(), static_cast<SizeT>(baseSize.x()),
|
stateTextureObject->GetFormat(), static_cast<SizeT>(baseSize.x()), static_cast<SizeT>(baseSize.y()),
|
||||||
static_cast<SizeT>(baseSize.y()),
|
static_cast<SizeT>(baseSize.z()), mipmapCount};
|
||||||
static_cast<SizeT>(baseSize.z()), mipmapCount };
|
|
||||||
|
|
||||||
Bool needsRegeneration = !m_isInitialized || (currentTextureInfo != m_prevTextureInfo);
|
Bool needsRegeneration = !m_isInitialized || (currentTextureInfo != m_prevTextureInfo);
|
||||||
|
|
||||||
MGLOG_D("%s: Got texture info: %dx%dx%d, mips %d, format %s", __func__,
|
MGLOG_D("%s: Got texture info: %dx%dx%d, mips %d, format %s", __func__, baseSize.x(), baseSize.y(),
|
||||||
baseSize.x(), baseSize.y(), baseSize.z(),
|
baseSize.z(), mipmapCount,
|
||||||
mipmapCount,
|
|
||||||
MG_Util::ConvertTextureInternalFormatToString(stateTextureObject->GetFormat()).c_str());
|
MG_Util::ConvertTextureInternalFormatToString(stateTextureObject->GetFormat()).c_str());
|
||||||
|
|
||||||
if (needsRegeneration) {
|
if (needsRegeneration) {
|
||||||
@@ -298,41 +296,31 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
&glFormat);
|
&glFormat);
|
||||||
|
|
||||||
const auto& uploadTargets = stateTextureObject->GetUploadTargets();
|
const auto& uploadTargets = stateTextureObject->GetUploadTargets();
|
||||||
for (auto uploadTarget: uploadTargets) {
|
for (auto uploadTarget : uploadTargets) {
|
||||||
for (SizeT level = 0; level < mipmapCount; ++level) {
|
for (SizeT level = 0; level < mipmapCount; ++level) {
|
||||||
auto levelTexelSize = stateTextureObject->GetMipmapTexelSize(
|
auto levelTexelSize = stateTextureObject->GetMipmapTexelSize(uploadTarget, level);
|
||||||
uploadTarget, level);
|
auto levelByteSize = stateTextureObject->GetMipmapByteSize(uploadTarget, level);
|
||||||
auto levelByteSize = stateTextureObject->GetMipmapByteSize(
|
bool levelDirty = stateTextureObject->IsStorageDirty(uploadTarget, 0);
|
||||||
uploadTarget, level);
|
|
||||||
bool levelDirty = stateTextureObject->IsStorageDirty(
|
|
||||||
uploadTarget, 0);
|
|
||||||
auto glUploadTarget = MG_Util::ConvertTextureUploadTargetToGLEnum(uploadTarget);
|
auto glUploadTarget = MG_Util::ConvertTextureUploadTargetToGLEnum(uploadTarget);
|
||||||
auto *pData = (levelDirty && levelByteSize != 0)
|
auto* pData = (levelDirty && levelByteSize != 0)
|
||||||
? stateTextureObject->MapMipmapData(
|
? stateTextureObject->MapMipmapData(uploadTarget, level)
|
||||||
uploadTarget, level) : nullptr;
|
: nullptr;
|
||||||
MGLOG_D("%s: target: %s: syncing mip %d: %dx%dx%d, byteSize = %d, pData = %p", __func__,
|
MGLOG_D("%s: target: %s: syncing mip %d: %dx%dx%d, byteSize = %d, pData = %p", __func__,
|
||||||
MG_Util::ConvertTextureUploadTargetToString(uploadTarget).c_str(),
|
MG_Util::ConvertTextureUploadTargetToString(uploadTarget).c_str(), level,
|
||||||
level,
|
levelTexelSize.x(), levelTexelSize.y(), levelTexelSize.z(), levelByteSize, pData);
|
||||||
levelTexelSize.x(), levelTexelSize.y(), levelTexelSize.z(),
|
|
||||||
levelByteSize,
|
|
||||||
pData);
|
|
||||||
BufferImpl::BackendBufferBindingProtector pixelUnpackProtector =
|
BufferImpl::BackendBufferBindingProtector pixelUnpackProtector =
|
||||||
BufferImpl::BackendBufferBindingProtector(GL_PIXEL_UNPACK_BUFFER);
|
BufferImpl::BackendBufferBindingProtector(GL_PIXEL_UNPACK_BUFFER);
|
||||||
errorLopper.Clear();
|
errorLopper.Clear();
|
||||||
MG_External::GLES::glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
MG_External::GLES::glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
MG_External::GLES::glTexImage2D(glUploadTarget, static_cast<GLint>(level),
|
MG_External::GLES::glTexImage2D(glUploadTarget, static_cast<GLint>(level), glInternalFormat,
|
||||||
glInternalFormat,
|
|
||||||
static_cast<GLsizei>(levelTexelSize.x()),
|
static_cast<GLsizei>(levelTexelSize.x()),
|
||||||
static_cast<GLsizei>(levelTexelSize.y()), 0,
|
static_cast<GLsizei>(levelTexelSize.y()), 0, glFormat, glType,
|
||||||
glFormat, glType,
|
|
||||||
pData);
|
pData);
|
||||||
|
|
||||||
// TODO: handle more texture types
|
// TODO: handle more texture types
|
||||||
|
|
||||||
MGLOG_D("Regenerated mipmap level %d for texture with ID: %u", level,
|
MGLOG_D("Regenerated mipmap level %d for texture with ID: %u", level, m_backendTextureId);
|
||||||
m_backendTextureId);
|
stateTextureObject->MarkStorageDirty(uploadTarget, level, false);
|
||||||
stateTextureObject->MarkStorageDirty(uploadTarget, level,
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,20 +336,23 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
MG_External::GLES::glTexParameteri(target, glName, \
|
MG_External::GLES::glTexParameteri(target, glName, \
|
||||||
MG_Util::ConvertSampler##type##ToGLEnum(samplerParams.internalName)); \
|
MG_Util::ConvertSampler##type##ToGLEnum(samplerParams.internalName)); \
|
||||||
m_cacheSamplerParameters.internalName = samplerParams.internalName; \
|
m_cacheSamplerParameters.internalName = samplerParams.internalName; \
|
||||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__, t = MG_Util::ConvertSampler##type##ToGLEnum(samplerParams.internalName)](GLenum err) { \
|
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__, \
|
||||||
|
t = MG_Util::ConvertSampler##type##ToGLEnum(samplerParams.internalName)](GLenum err) { \
|
||||||
MGLOG_D("%s(%s:%d) ES error %s, GL_TEXTURE_MIN_FILTER = %s", func, file, line, \
|
MGLOG_D("%s(%s:%d) ES error %s, GL_TEXTURE_MIN_FILTER = %s", func, file, line, \
|
||||||
MG_Util::ConvertGLEnumToString(err).c_str(), MG_Util::ConvertGLEnumToString(t).c_str());\
|
MG_Util::ConvertGLEnumToString(err).c_str(), MG_Util::ConvertGLEnumToString(t).c_str()); \
|
||||||
}); \
|
}); \
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_cacheSamplerParameters.minFilter != samplerParams.minFilter) {
|
if (m_cacheSamplerParameters.minFilter != samplerParams.minFilter) {
|
||||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_MIN_FILTER,
|
MG_External::GLES::glTexParameteri(
|
||||||
|
target, GL_TEXTURE_MIN_FILTER,
|
||||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.minFilter, samplerParams.mipmapMode));
|
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.minFilter, samplerParams.mipmapMode));
|
||||||
m_cacheSamplerParameters.minFilter = samplerParams.minFilter;
|
m_cacheSamplerParameters.minFilter = samplerParams.minFilter;
|
||||||
m_cacheSamplerParameters.mipmapMode = samplerParams.mipmapMode;
|
m_cacheSamplerParameters.mipmapMode = samplerParams.mipmapMode;
|
||||||
}
|
}
|
||||||
if (m_cacheSamplerParameters.magFilter != samplerParams.magFilter) {
|
if (m_cacheSamplerParameters.magFilter != samplerParams.magFilter) {
|
||||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_MAG_FILTER,
|
MG_External::GLES::glTexParameteri(
|
||||||
|
target, GL_TEXTURE_MAG_FILTER,
|
||||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.magFilter, SamplerMipmapMode::None));
|
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.magFilter, SamplerMipmapMode::None));
|
||||||
m_cacheSamplerParameters.magFilter = samplerParams.magFilter;
|
m_cacheSamplerParameters.magFilter = samplerParams.magFilter;
|
||||||
}
|
}
|
||||||
@@ -369,8 +360,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line, MG_Util::ConvertGLEnumToString(err).c_str());
|
MGLOG_D("%s(%s:%d) ES error %s", func, file, line, MG_Util::ConvertGLEnumToString(err).c_str());
|
||||||
});
|
});
|
||||||
|
|
||||||
// SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(minFilter, GL_TEXTURE_MIN_FILTER, FilterMode)
|
// SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(minFilter, GL_TEXTURE_MIN_FILTER, FilterMode)
|
||||||
// SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(magFilter, GL_TEXTURE_MAG_FILTER, FilterMode)
|
// SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(magFilter, GL_TEXTURE_MAG_FILTER, FilterMode)
|
||||||
SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(wrapS, GL_TEXTURE_WRAP_S, WrapMode)
|
SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(wrapS, GL_TEXTURE_WRAP_S, WrapMode)
|
||||||
SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(wrapT, GL_TEXTURE_WRAP_T, WrapMode)
|
SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(wrapT, GL_TEXTURE_WRAP_T, WrapMode)
|
||||||
SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(wrapR, GL_TEXTURE_WRAP_R, WrapMode)
|
SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(wrapR, GL_TEXTURE_WRAP_R, WrapMode)
|
||||||
@@ -385,8 +376,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
m_cacheSamplerParameters.maxLod = samplerParams.maxLod;
|
m_cacheSamplerParameters.maxLod = samplerParams.maxLod;
|
||||||
}
|
}
|
||||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line,
|
MGLOG_D("%s(%s:%d) ES error %s", func, file, line, MG_Util::ConvertGLEnumToString(err).c_str());
|
||||||
MG_Util::ConvertGLEnumToString(err).c_str());
|
|
||||||
});
|
});
|
||||||
#undef SYNC_TEX_SAMPLER_PARAM_IF_CHANGED
|
#undef SYNC_TEX_SAMPLER_PARAM_IF_CHANGED
|
||||||
}
|
}
|
||||||
@@ -397,13 +387,11 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
const auto& levelRange = stateTextureObject->GetLevelRange();
|
const auto& levelRange = stateTextureObject->GetLevelRange();
|
||||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, static_cast<GLint>(levelRange.x()));
|
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, static_cast<GLint>(levelRange.x()));
|
||||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line,
|
MGLOG_D("%s(%s:%d) ES error %s", func, file, line, MG_Util::ConvertGLEnumToString(err).c_str());
|
||||||
MG_Util::ConvertGLEnumToString(err).c_str());
|
|
||||||
});
|
});
|
||||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, static_cast<GLint>(levelRange.y()));
|
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, static_cast<GLint>(levelRange.y()));
|
||||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line,
|
MGLOG_D("%s(%s:%d) ES error %s", func, file, line, MG_Util::ConvertGLEnumToString(err).c_str());
|
||||||
MG_Util::ConvertGLEnumToString(err).c_str());
|
|
||||||
});
|
});
|
||||||
GLenum swizzleParams[4] = {MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
GLenum swizzleParams[4] = {MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Red)),
|
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Red)),
|
||||||
@@ -416,13 +404,15 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_R,
|
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_R,
|
||||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Red)));
|
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Red)));
|
||||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_G,
|
MG_External::GLES::glTexParameteri(
|
||||||
|
target, GL_TEXTURE_SWIZZLE_G,
|
||||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Green)));
|
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Green)));
|
||||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_B,
|
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_B,
|
||||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Blue)));
|
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Blue)));
|
||||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_A,
|
MG_External::GLES::glTexParameteri(
|
||||||
|
target, GL_TEXTURE_SWIZZLE_A,
|
||||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Alpha)));
|
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Alpha)));
|
||||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__, swizzleParams](GLenum err) {
|
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__, swizzleParams](GLenum err) {
|
||||||
@@ -444,14 +434,13 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
TextureImpl::GenerateTextureFormatInfo(stateTextureObject->GetFormat(), &glInternalFormat, &glType,
|
TextureImpl::GenerateTextureFormatInfo(stateTextureObject->GetFormat(), &glInternalFormat, &glType,
|
||||||
&glFormat);
|
&glFormat);
|
||||||
const auto& uploadTargets = stateTextureObject->GetUploadTargets();
|
const auto& uploadTargets = stateTextureObject->GetUploadTargets();
|
||||||
for (auto uploadTarget: uploadTargets) {
|
for (auto uploadTarget : uploadTargets) {
|
||||||
for (SizeT level = 0; level < mipmapCount; ++level) {
|
for (SizeT level = 0; level < mipmapCount; ++level) {
|
||||||
if (!stateTextureObject->IsStorageDirty(uploadTarget, level)) {
|
if (!stateTextureObject->IsStorageDirty(uploadTarget, level)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto byteSize = stateTextureObject->GetMipmapByteSize(
|
auto byteSize = stateTextureObject->GetMipmapByteSize(uploadTarget, level);
|
||||||
uploadTarget, level);
|
|
||||||
if (byteSize == 0) {
|
if (byteSize == 0) {
|
||||||
MGLOG_W("Mipmap level %d has no data, skipping update.", level);
|
MGLOG_W("Mipmap level %d has no data, skipping update.", level);
|
||||||
continue;
|
continue;
|
||||||
@@ -462,18 +451,14 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
BufferImpl::BackendBufferBindingProtector pixelUnpackProtector =
|
BufferImpl::BackendBufferBindingProtector pixelUnpackProtector =
|
||||||
BufferImpl::BackendBufferBindingProtector(GL_PIXEL_UNPACK_BUFFER);
|
BufferImpl::BackendBufferBindingProtector(GL_PIXEL_UNPACK_BUFFER);
|
||||||
MG_External::GLES::glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
MG_External::GLES::glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
errorLopper.Loop(
|
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||||
[file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
|
||||||
MGLOG_D("%s(%s:%d) ES error: %s", func, file, line,
|
MGLOG_D("%s(%s:%d) ES error: %s", func, file, line,
|
||||||
MG_Util::ConvertGLEnumToString(err).c_str());
|
MG_Util::ConvertGLEnumToString(err).c_str());
|
||||||
});
|
});
|
||||||
auto texelSize = stateTextureObject->GetMipmapTexelSize(
|
auto texelSize = stateTextureObject->GetMipmapTexelSize(uploadTarget, level);
|
||||||
uploadTarget, level);
|
MG_External::GLES::glTexSubImage2D(glUploadTarget, static_cast<GLint>(level), 0, 0,
|
||||||
MG_External::GLES::glTexSubImage2D(glUploadTarget, static_cast<GLint>(level),
|
|
||||||
0, 0,
|
|
||||||
static_cast<GLsizei>(texelSize.x()),
|
static_cast<GLsizei>(texelSize.x()),
|
||||||
static_cast<GLsizei>(texelSize.y()),
|
static_cast<GLsizei>(texelSize.y()), glFormat, glType,
|
||||||
glFormat, glType,
|
|
||||||
stateTextureObject->MapMipmapData(uploadTarget, level));
|
stateTextureObject->MapMipmapData(uploadTarget, level));
|
||||||
|
|
||||||
stateTextureObject->MarkStorageDirty(uploadTarget, level, false);
|
stateTextureObject->MarkStorageDirty(uploadTarget, level, false);
|
||||||
@@ -551,13 +536,14 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
if (asTarget == FramebufferTarget::Draw) {
|
if (asTarget == FramebufferTarget::Draw) {
|
||||||
// Create mappings for draw buffers
|
// Create mappings for draw buffers
|
||||||
int nBuffers = 0;
|
int nBuffers = 0;
|
||||||
std::fill(m_frontendDrawBuffers, m_frontendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS,
|
std::fill(m_frontendDrawBuffers,
|
||||||
|
m_frontendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS,
|
||||||
FramebufferAttachmentType::None);
|
FramebufferAttachmentType::None);
|
||||||
std::fill(m_compactedFrontendDrawBuffers,
|
std::fill(m_compactedFrontendDrawBuffers,
|
||||||
m_compactedFrontendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS,
|
m_compactedFrontendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS,
|
||||||
FramebufferAttachmentType::None);
|
FramebufferAttachmentType::None);
|
||||||
std::fill(m_backendDrawBuffers, m_backendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS,
|
std::fill(m_backendDrawBuffers,
|
||||||
GL_NONE);
|
m_backendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS, GL_NONE);
|
||||||
auto& stateDrawBuffers = stateFBOObject->GetDrawBuffers();
|
auto& stateDrawBuffers = stateFBOObject->GetDrawBuffers();
|
||||||
for (GLint i = 0; i < MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS; ++i) {
|
for (GLint i = 0; i < MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS; ++i) {
|
||||||
if (stateDrawBuffers[i] == FramebufferAttachmentType::None) {
|
if (stateDrawBuffers[i] == FramebufferAttachmentType::None) {
|
||||||
@@ -576,22 +562,24 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
MG_External::GLES::glDrawBuffers(nBuffers, m_backendDrawBuffers);
|
MG_External::GLES::glDrawBuffers(nBuffers, m_backendDrawBuffers);
|
||||||
|
|
||||||
// Attach textures for compacted draw buffers
|
// Attach textures for compacted draw buffers
|
||||||
// for (int i = 0; i < nBuffers; ++i) {
|
// for (int i = 0; i < nBuffers; ++i) {
|
||||||
// FramebufferAttachmentType frontendAttachmentType =
|
// FramebufferAttachmentType frontendAttachmentType =
|
||||||
// MG_Util::ConvertGLEnumToFramebufferAttachmentType(m_compactedFrontendBuffers[i]);
|
// MG_Util::ConvertGLEnumToFramebufferAttachmentType(m_compactedFrontendBuffers[i]);
|
||||||
// GLenum backendAttachment = m_backendBuffers[i];
|
// GLenum backendAttachment = m_backendBuffers[i];
|
||||||
// const auto& attachment = attachments[static_cast<SizeT>(frontendAttachmentType)];
|
// const auto& attachment = attachments[static_cast<SizeT>(frontendAttachmentType)];
|
||||||
// if (!attachment.IsTexture()) continue;
|
// if (!attachment.IsTexture()) continue;
|
||||||
// const auto& textureObject = attachment.GetTexture();
|
// const auto& textureObject = attachment.GetTexture();
|
||||||
// const auto& backendTextureIt = TextureImpl::g_backendTextureObjects.find(textureObject);
|
// const auto& backendTextureIt =
|
||||||
// if (backendTextureIt == TextureImpl::g_backendTextureObjects.end()) continue;
|
// TextureImpl::g_backendTextureObjects.find(textureObject); if (backendTextureIt ==
|
||||||
// const auto& backendTextureObject = backendTextureIt->second;
|
// TextureImpl::g_backendTextureObjects.end()) continue; const auto&
|
||||||
// auto glTextureTarget = MG_Util::ConvertTextureTargetToGLEnum(textureObject->GetTarget());
|
// backendTextureObject = backendTextureIt->second; auto glTextureTarget =
|
||||||
// backendTextureObject->Bind(glTextureTarget);
|
// MG_Util::ConvertTextureTargetToGLEnum(textureObject->GetTarget());
|
||||||
// MG_External::GLES::glFramebufferTexture2D(glFBOTarget, backendAttachment, glTextureTarget,
|
// backendTextureObject->Bind(glTextureTarget);
|
||||||
// backendTextureObject->GetBackendTextureId(),
|
// MG_External::GLES::glFramebufferTexture2D(glFBOTarget, backendAttachment,
|
||||||
// static_cast<GLint>(attachment.GetTextureLevel()));
|
// glTextureTarget,
|
||||||
// }
|
// backendTextureObject->GetBackendTextureId(),
|
||||||
|
// static_cast<GLint>(attachment.GetTextureLevel()));
|
||||||
|
// }
|
||||||
|
|
||||||
stateFBOObject->ClearDrawBuffersDirtyState();
|
stateFBOObject->ClearDrawBuffersDirtyState();
|
||||||
}
|
}
|
||||||
@@ -601,15 +589,15 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
GLenum frontendAtt = MG_Util::ConvertFramebufferAttachmentTypeToGLEnum(m_frontendReadBuffer);
|
GLenum frontendAtt = MG_Util::ConvertFramebufferAttachmentTypeToGLEnum(m_frontendReadBuffer);
|
||||||
GLenum backendAtt = GL_NONE;
|
GLenum backendAtt = GL_NONE;
|
||||||
// Find corresponding backend attachment in compacted draw buffers
|
// Find corresponding backend attachment in compacted draw buffers
|
||||||
// for (SizeT i = 0; i < MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS; ++i) {
|
// for (SizeT i = 0; i < MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS; ++i) {
|
||||||
// if (m_compactedFrontendBuffers[i] == frontendAtt) {
|
// if (m_compactedFrontendBuffers[i] == frontendAtt) {
|
||||||
// backendAtt = m_backendBuffers[i];
|
// backendAtt = m_backendBuffers[i];
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// if (backendAtt != GL_NONE) {
|
// if (backendAtt != GL_NONE) {
|
||||||
// MG_External::GLES::glReadBuffer(backendAtt);
|
// MG_External::GLES::glReadBuffer(backendAtt);
|
||||||
// } else {
|
// } else {
|
||||||
const auto& readAttachment = attachments[(SizeT)m_frontendReadBuffer];
|
const auto& readAttachment = attachments[(SizeT)m_frontendReadBuffer];
|
||||||
GLenum glAttachment = MG_Util::ConvertFramebufferAttachmentTypeToGLEnum(m_frontendReadBuffer);
|
GLenum glAttachment = MG_Util::ConvertFramebufferAttachmentTypeToGLEnum(m_frontendReadBuffer);
|
||||||
if (!readAttachment.IsValid() || readAttachment.IsEmpty()) {
|
if (!readAttachment.IsValid() || readAttachment.IsEmpty()) {
|
||||||
@@ -632,7 +620,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
// TODO: renderbuffer support
|
// TODO: renderbuffer support
|
||||||
}
|
}
|
||||||
MG_External::GLES::glReadBuffer(glAttachment);
|
MG_External::GLES::glReadBuffer(glAttachment);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -838,19 +826,21 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_cacheSamplerParameters.minFilter != samplerParams.minFilter) {
|
if (m_cacheSamplerParameters.minFilter != samplerParams.minFilter) {
|
||||||
MG_External::GLES::glSamplerParameteri(m_backendSamplerId, GL_TEXTURE_MIN_FILTER,
|
MG_External::GLES::glSamplerParameteri(
|
||||||
|
m_backendSamplerId, GL_TEXTURE_MIN_FILTER,
|
||||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.minFilter, samplerParams.mipmapMode));
|
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.minFilter, samplerParams.mipmapMode));
|
||||||
m_cacheSamplerParameters.minFilter = samplerParams.minFilter;
|
m_cacheSamplerParameters.minFilter = samplerParams.minFilter;
|
||||||
m_cacheSamplerParameters.mipmapMode = samplerParams.mipmapMode;
|
m_cacheSamplerParameters.mipmapMode = samplerParams.mipmapMode;
|
||||||
}
|
}
|
||||||
if (m_cacheSamplerParameters.magFilter != samplerParams.magFilter) {
|
if (m_cacheSamplerParameters.magFilter != samplerParams.magFilter) {
|
||||||
MG_External::GLES::glSamplerParameteri(m_backendSamplerId, GL_TEXTURE_MAG_FILTER,
|
MG_External::GLES::glSamplerParameteri(
|
||||||
|
m_backendSamplerId, GL_TEXTURE_MAG_FILTER,
|
||||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.magFilter, SamplerMipmapMode::None));
|
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.magFilter, SamplerMipmapMode::None));
|
||||||
m_cacheSamplerParameters.magFilter = samplerParams.magFilter;
|
m_cacheSamplerParameters.magFilter = samplerParams.magFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SYNC_SAMPLER_PARAM_IF_CHANGED(minFilter, GL_TEXTURE_MIN_FILTER, FilterMode)
|
// SYNC_SAMPLER_PARAM_IF_CHANGED(minFilter, GL_TEXTURE_MIN_FILTER, FilterMode)
|
||||||
// SYNC_SAMPLER_PARAM_IF_CHANGED(magFilter, GL_TEXTURE_MAG_FILTER, FilterMode)
|
// SYNC_SAMPLER_PARAM_IF_CHANGED(magFilter, GL_TEXTURE_MAG_FILTER, FilterMode)
|
||||||
SYNC_SAMPLER_PARAM_IF_CHANGED(wrapS, GL_TEXTURE_WRAP_S, WrapMode)
|
SYNC_SAMPLER_PARAM_IF_CHANGED(wrapS, GL_TEXTURE_WRAP_S, WrapMode)
|
||||||
SYNC_SAMPLER_PARAM_IF_CHANGED(wrapT, GL_TEXTURE_WRAP_T, WrapMode)
|
SYNC_SAMPLER_PARAM_IF_CHANGED(wrapT, GL_TEXTURE_WRAP_T, WrapMode)
|
||||||
SYNC_SAMPLER_PARAM_IF_CHANGED(wrapR, GL_TEXTURE_WRAP_R, WrapMode)
|
SYNC_SAMPLER_PARAM_IF_CHANGED(wrapR, GL_TEXTURE_WRAP_R, WrapMode)
|
||||||
|
|||||||
@@ -99,13 +99,16 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
Probably useful to re-link shader output according to this.
|
Probably useful to re-link shader output according to this.
|
||||||
aka. realizing `glBindFragDataLocation`
|
aka. realizing `glBindFragDataLocation`
|
||||||
*/
|
*/
|
||||||
FramebufferAttachmentType m_frontendDrawBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {FramebufferAttachmentType::None};
|
FramebufferAttachmentType m_frontendDrawBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {
|
||||||
|
FramebufferAttachmentType::None};
|
||||||
/* this will save buffers in its compacted GL form,
|
/* this will save buffers in its compacted GL form,
|
||||||
not consecutive is not allowed
|
not consecutive is not allowed
|
||||||
i.e. it could be like [COLOR_ATTACHMENT0, COLOR_ATTACHMENT5, COLOR_ATTACHMENT4]
|
i.e. it could be like [COLOR_ATTACHMENT0, COLOR_ATTACHMENT5, COLOR_ATTACHMENT4]
|
||||||
(no GL_NONE among those)
|
(no GL_NONE among those)
|
||||||
*/
|
*/
|
||||||
FramebufferAttachmentType m_compactedFrontendDrawBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {FramebufferAttachmentType::None};
|
FramebufferAttachmentType
|
||||||
|
m_compactedFrontendDrawBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {
|
||||||
|
FramebufferAttachmentType::None};
|
||||||
/* this will save buffers in stricter ES rules
|
/* this will save buffers in stricter ES rules
|
||||||
reversion, absence or not consecutive are not allowed, according to ES spec
|
reversion, absence or not consecutive are not allowed, according to ES spec
|
||||||
i.e. it could be like [COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, NONE, NONE, ...]
|
i.e. it could be like [COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, NONE, NONE, ...]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
ErrorLopper();
|
ErrorLopper();
|
||||||
~ErrorLopper();
|
~ErrorLopper();
|
||||||
};
|
};
|
||||||
}
|
} // namespace DebugImpl
|
||||||
|
|
||||||
namespace BufferImpl {
|
namespace BufferImpl {
|
||||||
class BackendBufferBindingProtector {
|
class BackendBufferBindingProtector {
|
||||||
@@ -66,6 +66,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
|
|
||||||
static GLuint GetTempFBO(FramebufferTarget target);
|
static GLuint GetTempFBO(FramebufferTarget target);
|
||||||
static void BindTempFBO(FramebufferTarget target);
|
static void BindTempFBO(FramebufferTarget target);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLenum m_target;
|
GLenum m_target;
|
||||||
GLint m_previousBinding = 0;
|
GLint m_previousBinding = 0;
|
||||||
|
|||||||
@@ -434,8 +434,9 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BufferData_State(GLenum target, GLsizeiptr size, const void* data, GLenum usage) {
|
void BufferData_State(GLenum target, GLsizeiptr size, const void* data, GLenum usage) {
|
||||||
MGLOG_D("%s: %s, size = %d, data = %p, usage = %s",
|
MGLOG_D("%s: %s, size = %d, data = %p, usage = %s", __func__,
|
||||||
__func__, MG_Util::ConvertGLEnumToString(target).c_str(), size, data, MG_Util::ConvertGLEnumToString(usage).c_str());
|
MG_Util::ConvertGLEnumToString(target).c_str(), size, data,
|
||||||
|
MG_Util::ConvertGLEnumToString(usage).c_str());
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
MG_State::pGLContext->RecordError(
|
MG_State::pGLContext->RecordError(
|
||||||
ErrorCode::InvalidValue,
|
ErrorCode::InvalidValue,
|
||||||
@@ -479,7 +480,8 @@ namespace MobileGL {
|
|||||||
|
|
||||||
auto& bindingSlot = MG_State::pGLContext->GetBufferBindingSlot(bufferTarget);
|
auto& bindingSlot = MG_State::pGLContext->GetBufferBindingSlot(bufferTarget);
|
||||||
bindingSlot.Bind(bufferObject);
|
bindingSlot.Bind(bufferObject);
|
||||||
MGLOG_D("%s: bind buffer object %p -> %s", __func__, bufferObject.get(), MG_Util::ConvertGLEnumToString(target).c_str());
|
MGLOG_D("%s: bind buffer object %p -> %s", __func__, bufferObject.get(),
|
||||||
|
MG_Util::ConvertGLEnumToString(target).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenBuffers_State(GLsizei n, GLuint* buffers) {
|
void GenBuffers_State(GLsizei n, GLuint* buffers) {
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ namespace MobileGL {
|
|||||||
if (rendererString.empty()) {
|
if (rendererString.empty()) {
|
||||||
const char* backendStr = (const char*)GetString_Backend(GL_RENDERER);
|
const char* backendStr = (const char*)GetString_Backend(GL_RENDERER);
|
||||||
const char* backendVersionStr = (const char*)GetString_Backend(GL_VERSION);
|
const char* backendVersionStr = (const char*)GetString_Backend(GL_VERSION);
|
||||||
rendererString =
|
rendererString = std::format("{} ({}) ({} | {})", MG_Config::RendererInfoPtr->RendererName.c_str(),
|
||||||
std::format("{} ({}) ({} | {})", MG_Config::RendererInfoPtr->RendererName.c_str(),
|
MG_Config::CoreName.c_str(), backendStr ? backendStr : "<unknown GPU>",
|
||||||
MG_Config::CoreName.c_str(), backendStr ? backendStr : "<unknown GPU>", backendVersionStr ? backendVersionStr : "<unknown version>");
|
backendVersionStr ? backendVersionStr : "<unknown version>");
|
||||||
}
|
}
|
||||||
return (const GLubyte*)rendererString.c_str();
|
return (const GLubyte*)rendererString.c_str();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ namespace MobileGL {
|
|||||||
GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName);
|
GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName);
|
||||||
void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
|
void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
|
||||||
void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
|
void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
|
||||||
void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
|
void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length,
|
||||||
|
GLchar* uniformBlockName);
|
||||||
void BindFragDataLocation(GLuint program, GLuint colorNumber, const char* name);
|
void BindFragDataLocation(GLuint program, GLuint colorNumber, const char* name);
|
||||||
GLint GetFragDataLocation(GLuint program, const char* name);
|
GLint GetFragDataLocation(GLuint program, const char* name);
|
||||||
void ValidateProgram(GLuint program);
|
void ValidateProgram(GLuint program);
|
||||||
|
|||||||
@@ -76,10 +76,12 @@ namespace MobileGL {
|
|||||||
*(GLint*)params = MG_Util::ConvertSamplerWrapModeToGLEnum(samplerObj->GetWrapR());
|
*(GLint*)params = MG_Util::ConvertSamplerWrapModeToGLEnum(samplerObj->GetWrapR());
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_MIN_FILTER:
|
case GL_TEXTURE_MIN_FILTER:
|
||||||
*(GLint*)params = MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMinFilter(), samplerObj->GetMipmapMode());
|
*(GLint*)params =
|
||||||
|
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMinFilter(), samplerObj->GetMipmapMode());
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_MAG_FILTER:
|
case GL_TEXTURE_MAG_FILTER:
|
||||||
*(GLint*)params = MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMagFilter(), SamplerMipmapMode::None);
|
*(GLint*)params =
|
||||||
|
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMagFilter(), SamplerMipmapMode::None);
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_MIN_LOD:
|
case GL_TEXTURE_MIN_LOD:
|
||||||
*(GLfloat*)params = samplerObj->GetMinLod();
|
*(GLfloat*)params = samplerObj->GetMinLod();
|
||||||
|
|||||||
@@ -384,8 +384,7 @@ namespace MobileGL {
|
|||||||
textureObject->SetInternalFormat(textureInternalFormat);
|
textureObject->SetInternalFormat(textureInternalFormat);
|
||||||
|
|
||||||
// if isProxy, no more pixel transfer needed below
|
// if isProxy, no more pixel transfer needed below
|
||||||
if (isProxy)
|
if (isProxy) return;
|
||||||
return;
|
|
||||||
|
|
||||||
const void* originalPixels = pixels;
|
const void* originalPixels = pixels;
|
||||||
|
|
||||||
@@ -409,8 +408,8 @@ namespace MobileGL {
|
|||||||
|
|
||||||
void* processedPixels = nullptr;
|
void* processedPixels = nullptr;
|
||||||
processedPixels = MG_Util::PixelStoreProcessor::ProcessTexturePixelsDataUnpack(
|
processedPixels = MG_Util::PixelStoreProcessor::ProcessTexturePixelsDataUnpack(
|
||||||
originalPixels, MG_State::pGLContext->GetPixelStoreParameters(true), bytesPerPixel,
|
originalPixels, MG_State::pGLContext->GetPixelStoreParameters(true), bytesPerPixel, {width, height, 1},
|
||||||
{width, height, 1}, false, imageSize);
|
false, imageSize);
|
||||||
|
|
||||||
if (processedPixels && imageSize > 0) {
|
if (processedPixels && imageSize > 0) {
|
||||||
if (imageSize != totalBytes) {
|
if (imageSize != totalBytes) {
|
||||||
@@ -420,7 +419,7 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SizeT copySize = std::min(imageSize, totalBytes);
|
const SizeT copySize = std::min(imageSize, totalBytes);
|
||||||
DataPtr texelInput { processedPixels, copySize };
|
DataPtr texelInput{processedPixels, copySize};
|
||||||
textureObject->UpdateMipmapSubData(textureUploadingTarget, level, texelInput);
|
textureObject->UpdateMipmapSubData(textureUploadingTarget, level, texelInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,14 +474,15 @@ namespace MobileGL {
|
|||||||
switch (pname) {
|
switch (pname) {
|
||||||
case GL_TEXTURE_MAG_FILTER:
|
case GL_TEXTURE_MAG_FILTER:
|
||||||
if (params) {
|
if (params) {
|
||||||
*params =
|
*params = MG_Util::ConvertSamplerFilterModeToGLEnum(
|
||||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_MIN_FILTER:
|
case GL_TEXTURE_MIN_FILTER:
|
||||||
if (params) {
|
if (params) {
|
||||||
*params =
|
*params =
|
||||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(), textureObject->GetSamplerObject()->GetMipmapMode());
|
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(),
|
||||||
|
textureObject->GetSamplerObject()->GetMipmapMode());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_MIN_LOD:
|
case GL_TEXTURE_MIN_LOD:
|
||||||
@@ -555,14 +555,15 @@ namespace MobileGL {
|
|||||||
switch (pname) {
|
switch (pname) {
|
||||||
case GL_TEXTURE_MAG_FILTER:
|
case GL_TEXTURE_MAG_FILTER:
|
||||||
if (params) {
|
if (params) {
|
||||||
*params =
|
*params = MG_Util::ConvertSamplerFilterModeToGLEnum(
|
||||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_MIN_FILTER:
|
case GL_TEXTURE_MIN_FILTER:
|
||||||
if (params) {
|
if (params) {
|
||||||
*params =
|
*params =
|
||||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(), textureObject->GetSamplerObject()->GetMipmapMode());
|
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(),
|
||||||
|
textureObject->GetSamplerObject()->GetMipmapMode());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_MIN_LOD:
|
case GL_TEXTURE_MIN_LOD:
|
||||||
@@ -880,9 +881,7 @@ namespace MobileGL {
|
|||||||
auto textureObject = MG_State::pGLContext->GetTextureObject(texture);
|
auto textureObject = MG_State::pGLContext->GetTextureObject(texture);
|
||||||
|
|
||||||
// ===================== Error Checking ==============================
|
// ===================== Error Checking ==============================
|
||||||
if (textureTarget != TextureTarget::TextureCubeMap &&
|
if (!TextureImpl::ValidateTextureTargetUniformity(textureObject, textureTarget)) return;
|
||||||
!TextureImpl::ValidateTextureTargetUniformity(textureObject, textureTarget))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// ======================= Processing ================================
|
// ======================= Processing ================================
|
||||||
if (!textureObject) {
|
if (!textureObject) {
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ namespace MobileGL {
|
|||||||
auto fbo0 = MG_State::pGLContext->CreateFramebufferObject(0);
|
auto fbo0 = MG_State::pGLContext->CreateFramebufferObject(0);
|
||||||
auto colorTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
auto colorTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
||||||
colorTex->SetInternalFormat(TextureInternalFormat::RGBA8);
|
colorTex->SetInternalFormat(TextureInternalFormat::RGBA8);
|
||||||
colorTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, { {512, 512, 1}, 0 });
|
colorTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, {{512, 512, 1}, 0});
|
||||||
// colorTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
// colorTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
||||||
auto depthTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
auto depthTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
||||||
depthTex->SetInternalFormat(TextureInternalFormat::Depth32FStencil8);
|
depthTex->SetInternalFormat(TextureInternalFormat::Depth32FStencil8);
|
||||||
depthTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, { {512, 512, 1}, 0 });
|
depthTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, {{512, 512, 1}, 0});
|
||||||
// depthTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
// depthTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
||||||
auto stencilTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
auto stencilTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
||||||
stencilTex->SetInternalFormat(TextureInternalFormat::Depth32FStencil8);
|
stencilTex->SetInternalFormat(TextureInternalFormat::Depth32FStencil8);
|
||||||
stencilTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, { {512, 512, 1}, 0 });
|
stencilTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, {{512, 512, 1}, 0});
|
||||||
// stencilTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
// stencilTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
||||||
fbo0->AttachTexture(FramebufferAttachmentType::Color0, colorTex);
|
fbo0->AttachTexture(FramebufferAttachmentType::Color0, colorTex);
|
||||||
fbo0->AttachTexture(FramebufferAttachmentType::Depth, depthTex);
|
fbo0->AttachTexture(FramebufferAttachmentType::Depth, depthTex);
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace MobileGL {
|
|||||||
BufferTarget::TransformFeedback, BufferTarget::AtomicCounter, BufferTarget::DispatchIndirect,
|
BufferTarget::TransformFeedback, BufferTarget::AtomicCounter, BufferTarget::DispatchIndirect,
|
||||||
BufferTarget::DrawIndirect, BufferTarget::ShaderStorage);
|
BufferTarget::DrawIndirect, BufferTarget::ShaderStorage);
|
||||||
constexpr const auto BufferBindPointTargets =
|
constexpr const auto BufferBindPointTargets =
|
||||||
ToArray(BufferTarget::Uniform, BufferTarget::TransformFeedback,
|
ToArray(BufferTarget::Uniform, BufferTarget::TransformFeedback, BufferTarget::AtomicCounter,
|
||||||
BufferTarget::AtomicCounter, BufferTarget::ShaderStorage);
|
BufferTarget::ShaderStorage);
|
||||||
|
|
||||||
class BufferState {
|
class BufferState {
|
||||||
public:
|
public:
|
||||||
@@ -40,7 +40,8 @@ namespace MobileGL {
|
|||||||
Array<BindingSlot<BufferObject>, GlobalBufferTargets.size()> m_bindingSlots;
|
Array<BindingSlot<BufferObject>, GlobalBufferTargets.size()> m_bindingSlots;
|
||||||
// TODO: query the count somewhere globally?
|
// TODO: query the count somewhere globally?
|
||||||
// For glBindBufferBase / glBindBufferRange
|
// For glBindBufferBase / glBindBufferRange
|
||||||
Array<Array<BindingSlotRange1D<BufferObject>, 16>, BufferBindPointTargets.size()> m_bufferBindPointTargets;
|
Array<Array<BindingSlotRange1D<BufferObject>, 16>, BufferBindPointTargets.size()>
|
||||||
|
m_bufferBindPointTargets;
|
||||||
};
|
};
|
||||||
} // namespace GLState
|
} // namespace GLState
|
||||||
} // namespace MG_State
|
} // namespace MG_State
|
||||||
|
|||||||
@@ -106,7 +106,8 @@ namespace MobileGL {
|
|||||||
|
|
||||||
Uint GetExternalIndex() const { return m_externalIndex; }
|
Uint GetExternalIndex() const { return m_externalIndex; }
|
||||||
|
|
||||||
// const UnorderedMap<String, Uint>& GetAttribLocationMap() const { return m_attribLocation; }
|
// const UnorderedMap<String, Uint>& GetAttribLocationMap() const { return
|
||||||
|
// m_attribLocation; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DoReflection();
|
void DoReflection();
|
||||||
@@ -126,7 +127,7 @@ namespace MobileGL {
|
|||||||
Vector<String> m_attribs;
|
Vector<String> m_attribs;
|
||||||
Vector<GLenum> m_attribTypes;
|
Vector<GLenum> m_attribTypes;
|
||||||
// For SpvcSession::SetVertexAttribLocation()
|
// For SpvcSession::SetVertexAttribLocation()
|
||||||
// UnorderedMap<String, Uint> m_attribLocation;
|
// UnorderedMap<String, Uint> m_attribLocation;
|
||||||
|
|
||||||
// FragData (Frag out)
|
// FragData (Frag out)
|
||||||
UnorderedMap<String, Uint> m_explicitFragDataLocation;
|
UnorderedMap<String, Uint> m_explicitFragDataLocation;
|
||||||
|
|||||||
@@ -36,6 +36,6 @@ namespace MobileGL {
|
|||||||
Bool SamplerState::ValidateSamplerObject(Uint index) const {
|
Bool SamplerState::ValidateSamplerObject(Uint index) const {
|
||||||
return m_samplerObjects.find(index) != m_samplerObjects.end();
|
return m_samplerObjects.find(index) != m_samplerObjects.end();
|
||||||
}
|
}
|
||||||
}
|
} // namespace GLState
|
||||||
}
|
} // namespace MG_State
|
||||||
}
|
} // namespace MobileGL
|
||||||
|
|||||||
@@ -725,65 +725,65 @@ TEST_F(ProgramTest, MinecraftBlitScreenLightmap) {
|
|||||||
ASSERT_GT(programObject->GetUBOSize(), 0);
|
ASSERT_GT(programObject->GetUBOSize(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//const char* minecraft_core_tex_color_1216_vs = R"(#version 150
|
// const char* minecraft_core_tex_color_1216_vs = R"(#version 150
|
||||||
//
|
//
|
||||||
//// Can't moj_import in things used during startup, when resource packs don't exist.
|
//// Can't moj_import in things used during startup, when resource packs don't exist.
|
||||||
//// This is a copy of dynamicimports.glsl and projection.glsl
|
//// This is a copy of dynamicimports.glsl and projection.glsl
|
||||||
//layout(std140) uniform DynamicTransforms {
|
// layout(std140) uniform DynamicTransforms {
|
||||||
// mat4 ModelViewMat;
|
// mat4 ModelViewMat;
|
||||||
// vec4 ColorModulator;
|
// vec4 ColorModulator;
|
||||||
// vec3 ModelOffset;
|
// vec3 ModelOffset;
|
||||||
// mat4 TextureMat;
|
// mat4 TextureMat;
|
||||||
// float LineWidth;
|
// float LineWidth;
|
||||||
//};
|
// };
|
||||||
//layout(std140) uniform Projection {
|
// layout(std140) uniform Projection {
|
||||||
// mat4 ProjMat;
|
// mat4 ProjMat;
|
||||||
//};
|
// };
|
||||||
//
|
//
|
||||||
//in vec3 Position;
|
// in vec3 Position;
|
||||||
//in vec2 UV0;
|
// in vec2 UV0;
|
||||||
//in vec4 Color;
|
// in vec4 Color;
|
||||||
//
|
//
|
||||||
//out vec2 texCoord0;
|
// out vec2 texCoord0;
|
||||||
//out vec4 vertexColor;
|
// out vec4 vertexColor;
|
||||||
//
|
//
|
||||||
//void main() {
|
// void main() {
|
||||||
// gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
|
// gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
|
||||||
//
|
//
|
||||||
// texCoord0 = UV0;
|
// texCoord0 = UV0;
|
||||||
// vertexColor = Color;
|
// vertexColor = Color;
|
||||||
//}
|
// }
|
||||||
//)";
|
//)";
|
||||||
//
|
//
|
||||||
//const char* minecraft_core_tex_color_1216_fs = R"(#version 150
|
// const char* minecraft_core_tex_color_1216_fs = R"(#version 150
|
||||||
//
|
//
|
||||||
//// Can't moj_import in things used during startup, when resource packs don't exist.
|
//// Can't moj_import in things used during startup, when resource packs don't exist.
|
||||||
//// This is a copy of dynamicimports.glsl
|
//// This is a copy of dynamicimports.glsl
|
||||||
//layout(std140) uniform DynamicTransforms {
|
// layout(std140) uniform DynamicTransforms {
|
||||||
// mat4 ModelViewMat;
|
// mat4 ModelViewMat;
|
||||||
// vec4 ColorModulator;
|
// vec4 ColorModulator;
|
||||||
// vec3 ModelOffset;
|
// vec3 ModelOffset;
|
||||||
// mat4 TextureMat;
|
// mat4 TextureMat;
|
||||||
// float LineWidth;
|
// float LineWidth;
|
||||||
//};
|
// };
|
||||||
//
|
//
|
||||||
//uniform sampler2D Sampler0;
|
// uniform sampler2D Sampler0;
|
||||||
//
|
//
|
||||||
//in vec2 texCoord0;
|
// in vec2 texCoord0;
|
||||||
//in vec4 vertexColor;
|
// in vec4 vertexColor;
|
||||||
//
|
//
|
||||||
//out vec4 fragColor;
|
// out vec4 fragColor;
|
||||||
//
|
//
|
||||||
//void main() {
|
// void main() {
|
||||||
// vec4 color = texture(Sampler0, texCoord0) * vertexColor;
|
// vec4 color = texture(Sampler0, texCoord0) * vertexColor;
|
||||||
// if (color.a == 0.0) {
|
// if (color.a == 0.0) {
|
||||||
// discard;
|
// discard;
|
||||||
// }
|
// }
|
||||||
// fragColor = color * ColorModulator;
|
// fragColor = color * ColorModulator;
|
||||||
//}
|
// }
|
||||||
//)";
|
//)";
|
||||||
//
|
//
|
||||||
//TEST_F(ProgramTest, MinecraftTexColor1_21_6) {
|
// TEST_F(ProgramTest, MinecraftTexColor1_21_6) {
|
||||||
// char infoLog[1024] = "";
|
// char infoLog[1024] = "";
|
||||||
//
|
//
|
||||||
// GLuint vs = CreateShader(GL_VERTEX_SHADER);
|
// GLuint vs = CreateShader(GL_VERTEX_SHADER);
|
||||||
@@ -835,7 +835,7 @@ TEST_F(ProgramTest, MinecraftBlitScreenLightmap) {
|
|||||||
// // spvcSession.Compile(&result);
|
// // spvcSession.Compile(&result);
|
||||||
// // printf("%s\n\n", result);
|
// // printf("%s\n\n", result);
|
||||||
// // }
|
// // }
|
||||||
//}
|
// }
|
||||||
|
|
||||||
const char* optifine_vs1 = R"(#version 460 core
|
const char* optifine_vs1 = R"(#version 460 core
|
||||||
|
|
||||||
@@ -931,10 +931,10 @@ TEST_F(ProgramTest, CompileAndLinkWithExplicitVertexIn) {
|
|||||||
spvcSession.Compile(&result);
|
spvcSession.Compile(&result);
|
||||||
printf("%s\n\n", result);
|
printf("%s\n\n", result);
|
||||||
const char* ret = strstr(result, needle);
|
const char* ret = strstr(result, needle);
|
||||||
if (ret)
|
if (ret) pSrcVertIn = (char*)ret;
|
||||||
pSrcVertIn = (char*)ret;
|
|
||||||
// }
|
// }
|
||||||
ASSERT_TRUE(pSrcVertIn != nullptr) << "Not found expected string in generated shader.\n(Searching for \"" << needle << "\")";
|
ASSERT_TRUE(pSrcVertIn != nullptr) << "Not found expected string in generated shader.\n(Searching for \"" << needle
|
||||||
|
<< "\")";
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProgramTest, CompileAndLinkWithExplicitFragmentOut) {
|
TEST_F(ProgramTest, CompileAndLinkWithExplicitFragmentOut) {
|
||||||
@@ -992,8 +992,8 @@ TEST_F(ProgramTest, CompileAndLinkWithExplicitFragmentOut) {
|
|||||||
spvcSession.Compile(&result);
|
spvcSession.Compile(&result);
|
||||||
printf("%s\n\n", result);
|
printf("%s\n\n", result);
|
||||||
const char* ret = strstr(result, needle);
|
const char* ret = strstr(result, needle);
|
||||||
if (ret)
|
if (ret) pSrcfragOut = (char*)ret;
|
||||||
pSrcfragOut = (char*)ret;
|
|
||||||
// }
|
// }
|
||||||
ASSERT_TRUE(pSrcfragOut != nullptr) << "Not found expected string in generated shader.\n(Searching for \"" << needle << "\")";
|
ASSERT_TRUE(pSrcfragOut != nullptr) << "Not found expected string in generated shader.\n(Searching for \"" << needle
|
||||||
|
<< "\")";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -396,8 +396,7 @@ TEST_F(ProgramUtilTest, CompileAndLinkBlitProgram) {
|
|||||||
|
|
||||||
ProgramAttrib programAttrib{// .shaderTypes = { GL_VERTEX_SHADER, GL_FRAGMENT_SHADER },
|
ProgramAttrib programAttrib{// .shaderTypes = { GL_VERTEX_SHADER, GL_FRAGMENT_SHADER },
|
||||||
.shaders = {vs_res.value(), fs_res.value()},
|
.shaders = {vs_res.value(), fs_res.value()},
|
||||||
.explicitVertexInLocations = attribLocations
|
.explicitVertexInLocations = attribLocations};
|
||||||
};
|
|
||||||
|
|
||||||
auto program_res = ShaderCompiler::LinkProgram(programAttrib);
|
auto program_res = ShaderCompiler::LinkProgram(programAttrib);
|
||||||
if (!program_res) {
|
if (!program_res) {
|
||||||
|
|||||||
@@ -311,16 +311,16 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode v) {
|
// GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode v) {
|
||||||
// switch (v) {
|
// switch (v) {
|
||||||
// case SamplerFilterMode::Nearest:
|
// case SamplerFilterMode::Nearest:
|
||||||
// return GL_NEAREST;
|
// return GL_NEAREST;
|
||||||
// case SamplerFilterMode::Linear:
|
// case SamplerFilterMode::Linear:
|
||||||
// return GL_LINEAR;
|
// return GL_LINEAR;
|
||||||
// default:
|
// default:
|
||||||
// return GL_UNKNOWN_MGL;
|
// return GL_UNKNOWN_MGL;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode filter, SamplerMipmapMode mipmap) {
|
GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode filter, SamplerMipmapMode mipmap) {
|
||||||
switch (mipmap) {
|
switch (mipmap) {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ namespace MobileGL {
|
|||||||
GLenum ConvertTextureInternalFormatToGLEnum(TextureInternalFormat internalformat);
|
GLenum ConvertTextureInternalFormatToGLEnum(TextureInternalFormat internalformat);
|
||||||
GLenum ConvertTexturePixelDataTypeToGLEnum(TexturePixelDataType type);
|
GLenum ConvertTexturePixelDataTypeToGLEnum(TexturePixelDataType type);
|
||||||
GLenum ConvertTextureUploadTargetToGLEnum(TextureUploadTarget target);
|
GLenum ConvertTextureUploadTargetToGLEnum(TextureUploadTarget target);
|
||||||
// GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode value);
|
// GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode value);
|
||||||
// GLenum ConvertSamplerMipmapModeToGLEnum(SamplerMipmapMode value);
|
// GLenum ConvertSamplerMipmapModeToGLEnum(SamplerMipmapMode value);
|
||||||
GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode filter, SamplerMipmapMode mipmap);
|
GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode filter, SamplerMipmapMode mipmap);
|
||||||
GLenum ConvertSamplerWrapModeToGLEnum(SamplerWrapMode value);
|
GLenum ConvertSamplerWrapModeToGLEnum(SamplerWrapMode value);
|
||||||
GLenum ConvertSamplerCompareModeToGLEnum(SamplerCompareMode value);
|
GLenum ConvertSamplerCompareModeToGLEnum(SamplerCompareMode value);
|
||||||
|
|||||||
@@ -174,17 +174,16 @@ namespace MobileGL {
|
|||||||
return std::unexpected(r);
|
return std::unexpected(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto [name, loc]: attrib.explicitVertexInLocations) {
|
for (auto [name, loc] : attrib.explicitVertexInLocations) {
|
||||||
MGLOG_D("%s: got explicitly set - layout(location = %d) %s;", __func__, loc, name.c_str());
|
MGLOG_D("%s: got explicitly set - layout(location = %d) %s;", __func__, loc, name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// UniquePtr<glslang::TIoMapResolver> resolver;
|
// UniquePtr<glslang::TIoMapResolver> resolver;
|
||||||
UniquePtr<TMglGlslIoResolver> resolver;
|
UniquePtr<TMglGlslIoResolver> resolver;
|
||||||
for (unsigned stage = 0; stage < EShLangCount; stage++) {
|
for (unsigned stage = 0; stage < EShLangCount; stage++) {
|
||||||
if (program->getIntermediate((EShLanguage)stage) == nullptr)
|
if (program->getIntermediate((EShLanguage)stage) == nullptr) continue;
|
||||||
continue;
|
resolver =
|
||||||
resolver = MakeUnique<TMglGlslIoResolver>(*program, (EShLanguage)stage,
|
MakeUnique<TMglGlslIoResolver>(*program, (EShLanguage)stage, attrib.explicitVertexInLocations,
|
||||||
attrib.explicitVertexInLocations,
|
|
||||||
attrib.explicitFragmentOutLocations);
|
attrib.explicitFragmentOutLocations);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,10 @@ namespace MobileGL {
|
|||||||
// TODO: We should assert we're really dealing with vertex shader here
|
// TODO: We should assert we're really dealing with vertex shader here
|
||||||
|
|
||||||
SPVC_CHK_INIT
|
SPVC_CHK_INIT
|
||||||
const spvc_reflected_resource *list = nullptr;
|
const spvc_reflected_resource* list = nullptr;
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
SPVC_CHK_RESULT(spvc_resources_get_resource_list_for_type(resources, SPVC_RESOURCE_TYPE_STAGE_INPUT, &list, &count));
|
SPVC_CHK_RESULT(spvc_resources_get_resource_list_for_type(resources, SPVC_RESOURCE_TYPE_STAGE_INPUT,
|
||||||
|
&list, &count));
|
||||||
for (size_t i = 0; i < count; ++i) {
|
for (size_t i = 0; i < count; ++i) {
|
||||||
auto& resource = list[i];
|
auto& resource = list[i];
|
||||||
auto it = location.find(resource.name);
|
auto it = location.find(resource.name);
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
TDefaultGlslIoResolver::reserverStorageSlot(ent, infoSink);
|
TDefaultGlslIoResolver::reserverStorageSlot(ent, infoSink);
|
||||||
}
|
}
|
||||||
}
|
} // namespace MobileGL
|
||||||
@@ -14,18 +14,19 @@
|
|||||||
#include "MG_Util/Types.h"
|
#include "MG_Util/Types.h"
|
||||||
|
|
||||||
namespace MobileGL {
|
namespace MobileGL {
|
||||||
class TMglGlslIoResolver: public glslang::TDefaultGlslIoResolver {
|
class TMglGlslIoResolver : public glslang::TDefaultGlslIoResolver {
|
||||||
public:
|
public:
|
||||||
using ExplicitVarSlotMap = UnorderedMap<String, Uint>;
|
using ExplicitVarSlotMap = UnorderedMap<String, Uint>;
|
||||||
TMglGlslIoResolver(const glslang::TIntermediate& intermediate, const ExplicitVarSlotMap& vertexIns, const ExplicitVarSlotMap& fragOuts):
|
TMglGlslIoResolver(const glslang::TIntermediate& intermediate, const ExplicitVarSlotMap& vertexIns,
|
||||||
TDefaultGlslIoResolver(intermediate), m_explicitVertexIns(vertexIns), m_explicitFragOuts(fragOuts) {}
|
const ExplicitVarSlotMap& fragOuts)
|
||||||
TMglGlslIoResolver(const glslang::TProgram& program, const EShLanguage stage, const ExplicitVarSlotMap& vertexIns, const ExplicitVarSlotMap& fragOuts):
|
: TDefaultGlslIoResolver(intermediate), m_explicitVertexIns(vertexIns), m_explicitFragOuts(fragOuts) {}
|
||||||
TMglGlslIoResolver(*program.getIntermediate(stage), vertexIns, fragOuts) {}
|
TMglGlslIoResolver(const glslang::TProgram& program, const EShLanguage stage,
|
||||||
|
const ExplicitVarSlotMap& vertexIns, const ExplicitVarSlotMap& fragOuts)
|
||||||
|
: TMglGlslIoResolver(*program.getIntermediate(stage), vertexIns, fragOuts) {}
|
||||||
void reserverStorageSlot(glslang::TVarEntryInfo& ent, TInfoSink& infoSink) override;
|
void reserverStorageSlot(glslang::TVarEntryInfo& ent, TInfoSink& infoSink) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const ExplicitVarSlotMap& m_explicitVertexIns;
|
const ExplicitVarSlotMap& m_explicitVertexIns;
|
||||||
const ExplicitVarSlotMap& m_explicitFragOuts;
|
const ExplicitVarSlotMap& m_explicitFragOuts;
|
||||||
};
|
};
|
||||||
}
|
} // namespace MobileGL
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
namespace glslang {
|
namespace glslang {
|
||||||
struct TVarEntryInfo {
|
struct TVarEntryInfo {
|
||||||
long long id;
|
long long id;
|
||||||
TIntermSymbol *symbol;
|
TIntermSymbol* symbol;
|
||||||
bool live;
|
bool live;
|
||||||
TLayoutPacking upgradedToPushConstantPacking; // ElpNone means it hasn't been upgraded
|
TLayoutPacking upgradedToPushConstantPacking; // ElpNone means it hasn't been upgraded
|
||||||
int newBinding;
|
int newBinding;
|
||||||
@@ -26,4 +26,4 @@ namespace glslang {
|
|||||||
|
|
||||||
void clearNewAssignments();
|
void clearNewAssignments();
|
||||||
};
|
};
|
||||||
}
|
} // namespace glslang
|
||||||
|
|||||||
Reference in New Issue
Block a user