Disabling bulk glReadPixels due to unpredictable behavior between drivers and internal image formats.
Commented out document recent changes. Will remove later.
This commit is contained in:
@@ -4422,21 +4422,35 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
|
||||
render_ui(scale_factor, subfield);
|
||||
}
|
||||
|
||||
#if 1//SHY_MOD // screenshot improvement
|
||||
#if 0//SHY_MOD // screenshot improvement
|
||||
/*
|
||||
//No longer doing this. glReadPixels can behave unpredictably between depth formats. May be the case for color formats as well.
|
||||
if(scale_factor <= 1.f && image_width == image_buffer_x && image_height == image_buffer_y) //faster. bulk copy opposed to line per line
|
||||
{
|
||||
if (type == SNAPSHOT_TYPE_OBJECT_ID || type == SNAPSHOT_TYPE_COLOR)
|
||||
{
|
||||
glReadPixels(0,0,image_width, image_height,GL_RGB, GL_UNSIGNED_BYTE,raw->getData());
|
||||
continue;
|
||||
}
|
||||
else // SNAPSHOT_TYPE_DEPTH
|
||||
//Buggered with GL_DEPTH_COMPONENT32_ARB, which flips the image upside down.
|
||||
/*else // SNAPSHOT_TYPE_DEPTH
|
||||
{
|
||||
LLPointer<LLImageRaw> depth_line_buffer = new LLImageRaw(image_width, image_height, sizeof(GL_FLOAT));
|
||||
glReadPixels(0, 0,image_width,image_height, GL_DEPTH_COMPONENT, GL_FLOAT,depth_line_buffer->getData());
|
||||
raw->copy(depth_line_buffer);
|
||||
//S32 desired_components = raw->getComponents();
|
||||
raw->resize(image_width,image_height,sizeof(FLOAT));
|
||||
glReadPixels(0, 0,image_width,image_height, GL_DEPTH_COMPONENT, GL_FLOAT,raw->getData());
|
||||
raw->setSize(image_width,image_height,desired_components);//Set components without reallocating
|
||||
for(int i = 0;i<image_width*image_height;++i)
|
||||
{
|
||||
F32 depth_float = *(F32*)(raw->getData() + (i * sizeof(F32)));
|
||||
F32 linear_depth_float = 1.f / (depth_conversion_factor_1 - (depth_float * depth_conversion_factor_2));
|
||||
U8 depth_byte = F32_to_U8(linear_depth_float, LLViewerCamera::getInstance()->getNear(), LLViewerCamera::getInstance()->getFar());
|
||||
for(S32 j = 0; j < raw->getComponents(); j++)
|
||||
raw->getData()[i*raw->getComponents()+j] = depth_byte;
|
||||
}
|
||||
raw->reallocateData(image_width*image_height*raw->getComponents()*sizeof(U8)); //Reallocate without erasing data
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
#endif //shy_mod
|
||||
S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width);
|
||||
// handle fractional rows
|
||||
|
||||
Reference in New Issue
Block a user