[Mesa-dev] [PATCH 10/40] mesa: Update viewport state for viewport_array
Kenneth Graunke
kenneth at whitecape.org
Fri Jan 10 18:35:24 PST 2014
On 01/10/2014 06:23 PM, Ian Romanick wrote:
> On 01/10/2014 05:59 PM, Kenneth Graunke wrote:
>> On 01/10/2014 05:40 PM, Ian Romanick wrote:
>>> From: Courtney Goeltzenleuchter <courtney at LunarG.com>
>>>
>>> Include DepthRange as well since it's state is lumped together with
>>> viewport state. Updates all the drivers that reference Viewport state
>>> in gl_context.
>>>
>>> v2 (idr): Rebase fixes. Also, don't have meta call _mesa_Viewport. We
>>> don't want the extra validation overhead, and meta will only ever need
>>> to change viewport 0 (while _mesa_Viewport updates all of them).
>>>
>>> v3 (idr): Remove spurious casts to float in _mesa_DepthRange.
>>> gl_viewport_attrib::Near and gl_viewport_attrib::Far are double now,
>>> just like nearval and farval. As result, the casts aren't just
>>> unnecessary, they're wrong.
>>>
>>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> [snip]
>>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>>> index da65d15..305b752 100644
>>> --- a/src/mesa/main/mtypes.h
>>> +++ b/src/mesa/main/mtypes.h
>>> @@ -1429,9 +1429,9 @@ struct gl_transform_attrib
>>> */
>>> struct gl_viewport_attrib
>>> {
>>> - GLint X, Y; /**< position */
>>> - GLsizei Width, Height; /**< size */
>>> - GLfloat Near, Far; /**< Depth buffer range */
>>> + GLfloat X, Y; /**< position */
>>> + GLfloat Width, Height; /**< size */
>>> + GLdouble Near, Far; /**< Depth buffer range */
>>> GLmatrix _WindowMap; /**< Mapping transformation as a matrix. */
>>> };
>>>
>>> @@ -3884,7 +3884,7 @@ struct gl_context
>>> struct gl_stencil_attrib Stencil; /**< Stencil buffer attributes */
>>> struct gl_texture_attrib Texture; /**< Texture attributes */
>>> struct gl_transform_attrib Transform; /**< Transformation attributes */
>>> - struct gl_viewport_attrib Viewport; /**< Viewport attributes */
>>> + struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS]; /**< Viewport attributes */
>>> /*@}*/
>>>
>>> /** \name Client attribute stack */
>>
>> This patch does four separate things:
>>
>> 1. Converts X/Y from GLint to GLfloat.
>> 2. Converts Width/Height from GLsizei to GLfloat.
>> 3. Converts Near/Far from GLfloat to GLdouble.
>> 4. Converts Viewport to ViewportArray[]
>>
>> Each of those really ought to be a separate patch...
>
> That's fair. I think I'd like to keep the first three together because
> the all get passed together to _math_matrix_viewport. Changing them
> piecemeal seems ugly.
Yeah, that's probably fine.
> How would you feel about squashing the next patch in with the patch that
> changes the types?
Strongly in favor. The patch to change the variable types in mtypes.h
should also take care of adding/removing appropriate casts for all
users, IMO.
--Ken
More information about the mesa-dev
mailing list