[Mesa-dev] [PATCH 14/17] glsl: Support double inouts (was: add double support)
Ilia Mirkin
imirkin at alum.mit.edu
Thu Feb 5 18:40:02 PST 2015
On Thu, Feb 5, 2015 at 2:14 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Thu, Feb 5, 2015 at 3:05 AM, Topi Pohjolainen
> <topi.pohjolainen at intel.com> wrote:
>> From: Dave Airlie <airlied at gmail.com>
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>> ---
>> src/glsl/ir_set_program_inouts.cpp | 24 +++++++++++++++++++++---
>> 1 file changed, 21 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp
>> index 97ead75..4aa402e 100644
>> --- a/src/glsl/ir_set_program_inouts.cpp
>> +++ b/src/glsl/ir_set_program_inouts.cpp
>> @@ -81,6 +81,17 @@ is_shader_inout(ir_variable *var)
>> var->data.mode == ir_var_system_value;
>> }
>>
>> +static inline bool
>> +is_dvec34_inout(ir_variable *var)
>> +{
>> + if (var->type == glsl_type::dvec4_type || var->type == glsl_type::dvec3_type)
>> + return true;
>> +
>> + if (var->type->is_array() && (var->type->element_type() == glsl_type::dvec4_type || var->type->element_type() == glsl_type::dvec3_type))
>
> Line wrap.
Bleh. Switched to use var->type->without_array(). Much more concise.
>
>> + return true;
>> + return false;
>> +}
>> +
>> static void
>> mark(struct gl_program *prog, ir_variable *var, int offset, int len,
>> bool is_fragment_shader)
>> @@ -94,19 +105,26 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
>> */
>>
>> for (int i = 0; i < len; i++) {
>> + int idx = var->data.location + var->data.index + offset + i;
>> GLbitfield64 bitfield =
>> - BITFIELD64_BIT(var->data.location + var->data.index + offset + i);
>> + BITFIELD64_BIT(idx);
>> +
>> + if (is_dvec34_inout(var))
>
> I don't understand what's special about dvec3/dvec4. Some comments
> would be nice.
I didn't write this code, but I think it's because dvec3/4 take up 2
vec4 slots. Added comments to that effect.
>
>> + bitfield |= bitfield << 1;
>> if (var->data.mode == ir_var_shader_in) {
>> prog->InputsRead |= bitfield;
>> if (is_fragment_shader) {
>> gl_fragment_program *fprog = (gl_fragment_program *) prog;
>> - fprog->InterpQualifier[var->data.location +
>> - var->data.index + offset + i] =
>> + fprog->InterpQualifier[idx] =
>> (glsl_interp_qualifier) var->data.interpolation;
>> if (var->data.centroid)
>> fprog->IsCentroid |= bitfield;
>> if (var->data.sample)
>> fprog->IsSample |= bitfield;
>> +
>> + if (is_dvec34_inout(var))
>> + fprog->InterpQualifier[idx + 1] =
>> + (glsl_interp_qualifier) var->data.interpolation;
>> }
>> } else if (var->data.mode == ir_var_system_value) {
>> prog->SystemValuesRead |= bitfield;
>> --
>> 1.9.3
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list