Merge "Fix unsafety in SkiaShader storage, and texture unit accounting" into mnc-dev
This commit is contained in:
@ -370,7 +370,11 @@ void SkiaShader::store(Caches& caches, const SkShader& shader, const Matrix4& mo
|
||||
if (tryStoreLayer(caches, shader, modelViewMatrix,
|
||||
textureUnit, description, &outData->layerData)) {
|
||||
outData->skiaShaderType = kLayer_SkiaShaderType;
|
||||
return;
|
||||
}
|
||||
|
||||
// Unknown/unsupported type, so explicitly ignore shader
|
||||
outData->skiaShaderType = kNone_SkiaShaderType;
|
||||
}
|
||||
|
||||
void SkiaShader::apply(Caches& caches, const SkiaShaderData& data) {
|
||||
|
@ -22,7 +22,8 @@ namespace uirenderer {
|
||||
const GLenum kTextureUnits[] = {
|
||||
GL_TEXTURE0,
|
||||
GL_TEXTURE1,
|
||||
GL_TEXTURE2
|
||||
GL_TEXTURE2,
|
||||
GL_TEXTURE3
|
||||
};
|
||||
|
||||
TextureState::TextureState()
|
||||
@ -33,10 +34,13 @@ TextureState::TextureState()
|
||||
GLint maxTextureUnits;
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
|
||||
LOG_ALWAYS_FATAL_IF(maxTextureUnits < kTextureUnitsCount,
|
||||
"At least %d texture units are required!", kTextureUnitsCount);
|
||||
"At least %d texture units are required!", kTextureUnitsCount);
|
||||
}
|
||||
|
||||
void TextureState::activateTexture(GLuint textureUnit) {
|
||||
LOG_ALWAYS_FATAL_IF(textureUnit >= kTextureUnitsCount,
|
||||
"Tried to use texture unit index %d, only %d exist",
|
||||
textureUnit, kTextureUnitsCount);
|
||||
if (mTextureUnit != textureUnit) {
|
||||
glActiveTexture(kTextureUnits[textureUnit]);
|
||||
mTextureUnit = textureUnit;
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
void unbindTexture(GLuint texture);
|
||||
private:
|
||||
// total number of texture units available for use
|
||||
static const int kTextureUnitsCount = 3;
|
||||
static const int kTextureUnitsCount = 4;
|
||||
|
||||
TextureState();
|
||||
GLuint mTextureUnit;
|
||||
|
Reference in New Issue
Block a user