[Mesa-dev] [PATCHv2 09/14] i965: Reserve enough parameter entries for all image uniforms used in the program.

Francisco Jerez currojerez at riseup.net
Thu Aug 6 07:15:10 PDT 2015


"Pohjolainen, Topi" <topi.pohjolainen at intel.com> writes:

> On Mon, Jul 20, 2015 at 07:23:00PM +0300, Francisco Jerez wrote:
>> v2: Add CS support.
>> ---
>>  src/mesa/drivers/dri/i965/brw_cs.cpp | 3 ++-
>>  src/mesa/drivers/dri/i965/brw_gs.c   | 1 +
>>  src/mesa/drivers/dri/i965/brw_vs.c   | 3 ++-
>>  src/mesa/drivers/dri/i965/brw_wm.c   | 3 ++-
>>  4 files changed, 7 insertions(+), 3 deletions(-)
>> 
>> diff --git a/src/mesa/drivers/dri/i965/brw_cs.cpp b/src/mesa/drivers/dri/i965/brw_cs.cpp
>> index 144aa27..232ea18 100644
>> --- a/src/mesa/drivers/dri/i965/brw_cs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_cs.cpp
>> @@ -182,7 +182,8 @@ brw_codegen_cs_prog(struct brw_context *brw,
>>      * prog_data associated with the compiled program, and which will be freed
>>      * by the state cache.
>>      */
>> -   int param_count = cs->num_uniform_components;
>> +   int param_count = cs->num_uniform_components +
>> +                     cs->NumImages * BRW_IMAGE_PARAM_SIZE;
>>  
>>     /* The backend also sometimes adds params for texture size. */
>>     param_count += 2 * ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits;
>> diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
>> index d1a955a..5c0d923 100644
>> --- a/src/mesa/drivers/dri/i965/brw_gs.c
>> +++ b/src/mesa/drivers/dri/i965/brw_gs.c
>> @@ -64,6 +64,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
>>  
>>     /* We also upload clip plane data as uniforms */
>>     param_count += MAX_CLIP_PLANES * 4;
>> +   param_count += gs->NumImages * BRW_IMAGE_PARAM_SIZE;
>>  
>>     c.prog_data.base.base.param =
>>        rzalloc_array(NULL, const gl_constant_value *, param_count);
>> diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
>> index 20bc7a9..96aa56d 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vs.c
>> +++ b/src/mesa/drivers/dri/i965/brw_vs.c
>> @@ -121,7 +121,8 @@ brw_codegen_vs_prog(struct brw_context *brw,
>>         * case being a float value that gets blown up to a vec4, so be
>>         * conservative here.
>>         */
>> -      param_count = vs->num_uniform_components * 4;
>> +      param_count = (vs->num_uniform_components * 4  +
>
> Extra space before +
>
>> +                     vs->NumImages * BRW_IMAGE_PARAM_SIZE);
>
> Above in compute case you don't have the surrounding (), I think you can drop
> them here and further down in scalar case as well.
>

Sure, fixed.

> Not really a big thing though:
>
> Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
>
Thanks.

>>        stage_prog_data->nr_image_params = vs->NumImages;
>>     } else {
>>        param_count = vp->program.Base.Parameters->NumParameters * 4;
>> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
>> index e0e0bb7..9d3da49 100644
>> --- a/src/mesa/drivers/dri/i965/brw_wm.c
>> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
>> @@ -195,7 +195,8 @@ brw_codegen_wm_prog(struct brw_context *brw,
>>      */
>>     int param_count;
>>     if (fs) {
>> -      param_count = fs->num_uniform_components;
>> +      param_count = (fs->num_uniform_components +
>> +                     fs->NumImages * BRW_IMAGE_PARAM_SIZE);
>>        prog_data.base.nr_image_params = fs->NumImages;
>>     } else {
>>        param_count = fp->program.Base.Parameters->NumParameters * 4;
>> -- 
>> 2.4.3
>> 
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150806/46a113d0/attachment.sig>


More information about the mesa-dev mailing list