Merge pull request #10439 from sethalves/word-align--memorystorage

fix - avoid crash in glTextureSubImage2D
This commit is contained in:
Seth Alves 2017-05-12 10:31:44 -07:00 committed by GitHub
commit 4b0e51ca54
3 changed files with 8 additions and 2 deletions

View file

@ -14,7 +14,7 @@
class OtherAvatar : public Avatar {
public:
explicit OtherAvatar(QThread* thread, RigPointer rig = nullptr);
void instantiableAvatar() {};
virtual void instantiableAvatar() override {};
};
#endif // hifi_OtherAvatar_h

View file

@ -383,6 +383,7 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
} else if (mipFormat == gpu::Element::COLOR_RGBA_32) {
compressionOptions.setFormat(nvtt::Format_RGBA);
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
compressionOptions.setPitchAlignment(4);
compressionOptions.setPixelFormat(32,
0x000000FF,
0x0000FF00,
@ -393,6 +394,7 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
} else if (mipFormat == gpu::Element::COLOR_BGRA_32) {
compressionOptions.setFormat(nvtt::Format_RGBA);
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
compressionOptions.setPitchAlignment(4);
compressionOptions.setPixelFormat(32,
0x00FF0000,
0x0000FF00,
@ -403,6 +405,7 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
} else if (mipFormat == gpu::Element::COLOR_SRGBA_32) {
compressionOptions.setFormat(nvtt::Format_RGBA);
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
compressionOptions.setPitchAlignment(4);
compressionOptions.setPixelFormat(32,
0x000000FF,
0x0000FF00,
@ -411,6 +414,7 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
} else if (mipFormat == gpu::Element::COLOR_SBGRA_32) {
compressionOptions.setFormat(nvtt::Format_RGBA);
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
compressionOptions.setPitchAlignment(4);
compressionOptions.setPixelFormat(32,
0x00FF0000,
0x0000FF00,
@ -419,11 +423,13 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
} else if (mipFormat == gpu::Element::COLOR_R_8) {
compressionOptions.setFormat(nvtt::Format_RGB);
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
compressionOptions.setPitchAlignment(4);
compressionOptions.setPixelFormat(8, 0, 0, 0);
} else if (mipFormat == gpu::Element::VEC2NU8_XY) {
inputOptions.setNormalMap(true);
compressionOptions.setFormat(nvtt::Format_RGBA);
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
compressionOptions.setPitchAlignment(4);
compressionOptions.setPixelFormat(8, 8, 0, 0);
} else {
qCWarning(imagelogging) << "Unknown mip format";

View file

@ -71,7 +71,7 @@ public:
void addSample(T sample) {
if (numSamples > 0) {
average = (sample * WEIGHTING) + (average * ONE_MINUS_WEIGHTING);
average = (sample * (T)WEIGHTING) + (average * (T)ONE_MINUS_WEIGHTING);
} else {
average = sample;
}