Reparing broken normals and also fixing the ambient lighting bug

This commit is contained in:
samcake 2017-02-08 16:56:59 -08:00
parent 363db8a834
commit e11d10f5d4
5 changed files with 34 additions and 18 deletions

View file

@ -328,12 +328,12 @@ void GLBackend::render(const Batch& batch) {
void GLBackend::syncCache() {
PROFILE_RANGE(render_gpu_gl_detail, __FUNCTION__);
syncTransformStateCache();
syncPipelineStateCache();
syncInputStateCache();
syncOutputStateCache();
glEnable(GL_LINE_SMOOTH);
}
#ifdef GPU_STEREO_DRAWCALL_DOUBLED

View file

@ -1,4 +1,4 @@
//
//
// GLBackendPipeline.cpp
// libraries/gpu/src/gpu
//

View file

@ -28,11 +28,8 @@ void GLBackend::resetPipelineState(State::Signature nextSignature) {
}
}
}
}
void GLBackend::syncPipelineStateCache() {
State::Data state;
// force a few states regardless
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
// Point size is always on
@ -43,6 +40,25 @@ void GLBackend::syncPipelineStateCache() {
// Default line width accross the board
glLineWidth(1.0f);
glEnable(GL_LINE_SMOOTH);
}
void GLBackend::syncPipelineStateCache() {
State::Data state;
// force a few states regardless
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
// Point size is always on
// FIXME CORE
//glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable(GL_PROGRAM_POINT_SIZE_EXT);
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
// Default line width accross the board
glLineWidth(1.0f);
glEnable(GL_LINE_SMOOTH);
getCurrentGLState(state);
State::Signature signature = State::evalSignature(state);

View file

@ -151,7 +151,7 @@ bool GLTextureTransferHelper::process() {
#endif
return true;
}
PROFILE_COUNTER_IF_CHANGED(render_gpu_gl, "transferringTextures", size_t, _transferringTextures.size())
PROFILE_COUNTER_IF_CHANGED(render_gpu_gl, "transferringTextures", int, (int) _transferringTextures.size())
static auto lastReport = usecTimestampNow();
auto now = usecTimestampNow();

View file

@ -143,7 +143,7 @@ const QImage TextureUsage::process2DImageColor(const QImage& srcImage, bool& val
// Force all the color images to be rgba32bits
if (image.format() != QImage::Format_ARGB32) {
image = image.convertToFormat(QImage::Format_ARGB32);
image = image.convertToFormat(QImage::Format_ARGB32);
}
return image;
@ -287,8 +287,8 @@ gpu::Texture* TextureUsage::createNormalTextureFromNormalImage(const QImage& src
QImage image = processSourceImage(srcImage, false);
// Make sure the normal map source image is RGBA32
if (image.format() != QImage::Format_ARGB32) {
image = image.convertToFormat(QImage::Format_ARGB32);
if (image.format() != QImage::Format_RGBA8888) {
image = image.convertToFormat(QImage::Format_RGBA8888);
}
gpu::Texture* theTexture = nullptr;
@ -332,7 +332,7 @@ gpu::Texture* TextureUsage::createNormalTextureFromBumpImage(const QImage& srcIm
int width = image.width();
int height = image.height();
// THe end result image for normal map is RGBA32 even though the A is not used
QImage result(width, height, QImage::Format_ARGB32);
QImage result(width, height, QImage::Format_RGBA8888);
for (int i = 0; i < width; i++) {
const int iNextClamped = clampPixelCoordinate(i + 1, width - 1);
@ -400,8 +400,8 @@ gpu::Texture* TextureUsage::createRoughnessTextureFromImage(const QImage& srcIma
image = image.convertToFormat(QImage::Format_RGB888);
}
} else {
if (image.format() != QImage::Format_ARGB32) {
image = image.convertToFormat(QImage::Format_ARGB32);
if (image.format() != QImage::Format_RGBA8888) {
image = image.convertToFormat(QImage::Format_RGBA8888);
}
}
@ -435,8 +435,8 @@ gpu::Texture* TextureUsage::createRoughnessTextureFromGlossImage(const QImage& s
image = image.convertToFormat(QImage::Format_RGB888);
}
} else {
if (image.format() != QImage::Format_ARGB32) {
image = image.convertToFormat(QImage::Format_ARGB32);
if (image.format() != QImage::Format_RGBA8888) {
image = image.convertToFormat(QImage::Format_RGBA8888);
}
}
@ -474,8 +474,8 @@ gpu::Texture* TextureUsage::createMetallicTextureFromImage(const QImage& srcImag
image = image.convertToFormat(QImage::Format_RGB888);
}
} else {
if (image.format() != QImage::Format_ARGB32) {
image = image.convertToFormat(QImage::Format_ARGB32);
if (image.format() != QImage::Format_RGBA8888) {
image = image.convertToFormat(QImage::Format_RGBA8888);
}
}