Bug 106123

Summary: draw does not work in a simple example
Product: Mesa Reporter: xinghua <xinghua.cao>
Component: Drivers/DRI/i965Assignee: Intel 3D Bugs Mailing List <intel-3d-bugs>
Status: RESOLVED MOVED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: source code of example

Description xinghua 2018-04-18 09:22:31 UTC
Created attachment 138904 [details]
source code of example

I found a issue in ANGLE project that draw does not work, and had written a simple example to reproduce this issue, attachment is the source code.
Steps:
1. gcc -o srgb srgb.c -lX11 -lepoxy
2. ./srgb

I had used readPixels to get fbo content and wrote content to files in current directory, the name is "result_1/2/3/4.rgba", These files were all empty, it seems that mesa did draw nothing.
The same case had run on NVIDIA GPU, which draw something normally.
I had spent some time to debug it, but did not find the root cause. Please help me to check it, thank you.
Comment 1 Denis 2018-04-18 10:45:17 UTC
Your variant:

GLubyte pixels_4[128 * 128 * 4];
  glReadPixels(0, 0, 128, 128, GL_RGBA, GL_UNSIGNED_BYTE, &pixels_4[0]);
  FILE *outputFile_4 = fopen("result_4.rgba", "a");
  fprintf(outputFile_4, "%s\n", (char *)(pixels_4));
  fclose(outputFile_4);


Proposed variant:

GLubyte pixels_4[128 * 128 * 4];
  glReadPixels(0, 0, 128, 128, GL_RGBA, GL_UNSIGNED_BYTE, &pixels_4[0]);
  FILE *outputFile_4 = fopen("result_4.rgba", "a");
  //fprintf(outputFile_4, "%s\n", (char *)(pixels_4));
  fwrite( pixels_4, sizeof pixels_4[0], sizeof(pixels_4)/sizeof(pixels_4[0]), outputFile_4 );
  fclose(outputFile_4);


In all of these files after changing the code (as I pasted higher) - was written repeated values of 00 00 00 FF. Each file has the same size - 65536 B.
In your variant each time should contain only 0A "\n" because first byte of pixels_N contains 00.

Are you sure that output for Nvidia had correct (expected) values??
Comment 2 GitLab Migration User 2019-09-25 19:10:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1716.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.