[Piglit] [PATCH] gl-3.0/minmax: Pass glGetIntegerv two-value params.
Morgan Armand
morgan.devel at gmail.com
Fri Jan 20 09:26:21 PST 2012
You're right. I also corrected the line in the 2.1 version. Let me know if
you prefer two separate patches.
---
tests/spec/gl-2.1/minmax.c | 2 +-
tests/spec/gl-3.0/minmax.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/spec/gl-2.1/minmax.c b/tests/spec/gl-2.1/minmax.c
index 2ce7e1e..bc40816 100644
--- a/tests/spec/gl-2.1/minmax.c
+++ b/tests/spec/gl-2.1/minmax.c
@@ -122,7 +122,7 @@ test_oq_bits()
*/
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
- minbits = log2((float)dims[0] * dims[0] * 2);
+ minbits = log2((float)dims[0] * dims[1] * 2);
if (minbits > 32)
minbits = 32;
diff --git a/tests/spec/gl-3.0/minmax.c b/tests/spec/gl-3.0/minmax.c
index d81ddc7..775cd18 100644
--- a/tests/spec/gl-3.0/minmax.c
+++ b/tests/spec/gl-3.0/minmax.c
@@ -60,16 +60,16 @@ max_test_i(GLenum token, GLint max, const char *name)
static void
min_test_i(GLenum token, GLint min, const char *name)
{
- GLint val;
+ GLint vals[2];
- glGetIntegerv(token, &val);
+ glGetIntegerv(token, vals);
- if (val < min) {
+ if (vals[0] < min) {
fprintf(stderr, "%-50s %8d %8d (ERROR)\n",
- name, min, val);
+ name, min, vals[0]);
pass = false;
} else {
- printf("%-50s %8d %8d\n", name, min, val);
+ printf("%-50s %8d %8d\n", name, min, vals[0]);
}
}
@@ -119,7 +119,7 @@ static double log2(double x)
static void
test_oq_bits()
{
- GLint dims;
+ GLint dims[2];
GLint minbits, oqbits;
/* From the GL 3.0 specification, page 329:
@@ -141,8 +141,8 @@ test_oq_bits()
* n = min{32, log2(maxViewportWidth ∗ maxViewportHeight * 2}"
*/
- glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &dims);
- minbits = log2((float)dims * dims * 2);
+ glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
+ minbits = log2((float)dims[0] * dims[1] * 2);
if (minbits > 32)
minbits = 32;
--
1.7.7.1.msysgit.0
On 1/20/2012 3:20 AM, Eric Anholt wrote:
> On Thu, 19 Jan 2012 22:09:01 +0100, Morgan Armand <morgan.devel at gmail.com> wrote:
>> Same problem and patch as the one done by Vinson Lee a couple of days ago,
>> but for the 3.0 version.
>>
>> Get for GL_MAX_VIEWPORT_DIMS returns two values.
>>
>> Fixes crash on Windows.
>>
>> ---
>> tests/spec/gl-3.0/minmax.c | 16 ++++++++--------
>> 1 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/tests/spec/gl-3.0/minmax.c b/tests/spec/gl-3.0/minmax.c
>> index d81ddc7..24a4482 100644
>> --- a/tests/spec/gl-3.0/minmax.c
>> +++ b/tests/spec/gl-3.0/minmax.c
>> @@ -60,16 +60,16 @@ max_test_i(GLenum token, GLint max, const char *name)
>> static void
>> min_test_i(GLenum token, GLint min, const char *name)
>> {
>> - GLint val;
>> + GLint vals[2];
>>
>> - glGetIntegerv(token, &val);
>> + glGetIntegerv(token, vals);
>>
>> - if (val < min) {
>> + if (vals[0] < min) {
>> fprintf(stderr, "%-50s %8d %8d (ERROR)\n",
>> - name, min, val);
>> + name, min, vals[0]);
>> pass = false;
>> } else {
>> - printf("%-50s %8d %8d\n", name, min, val);
>> + printf("%-50s %8d %8d\n", name, min, vals[0]);
>> }
>> }
>>
>> @@ -119,7 +119,7 @@ static double log2(double x)
>> static void
>> test_oq_bits()
>> {
>> - GLint dims;
>> + GLint dims[2];
>> GLint minbits, oqbits;
>>
>> /* From the GL 3.0 specification, page 329:
>> @@ -141,8 +141,8 @@ test_oq_bits()
>> * n = min{32, log2(maxViewportWidth ∗ maxViewportHeight * 2}"
>> */
>>
>> - glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &dims);
>> - minbits = log2((float)dims * dims * 2);
>> + glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
>> + minbits = log2((float)dims[0] * dims[0] * 2);
>> if (minbits > 32)
>> minbits = 32;
>
> Both values should be used, not just the width value.
More information about the Piglit
mailing list