On 8/19/22 19:28, Francisco Casas wrote:
+static inline unsigned int hlsl_offset_dim_count(enum hlsl_sampler_dim dim)
As long as we don't actually need to use this outside of hlsl.y, I'd mildly prefer to keep it there.
+{
- switch (dim)
- {
case HLSL_SAMPLER_DIM_1D:
case HLSL_SAMPLER_DIM_1DARRAY:
return 1;
case HLSL_SAMPLER_DIM_2D:
case HLSL_SAMPLER_DIM_2DMS:
case HLSL_SAMPLER_DIM_2DARRAY:
case HLSL_SAMPLER_DIM_2DMSARRAY:
return 2;
case HLSL_SAMPLER_DIM_3D:
return 3;
case HLSL_SAMPLER_DIM_CUBE:
case HLSL_SAMPLER_DIM_CUBEARRAY:
return 0; // Offset parameters not supported for these types.
That's a C99 comment. I don't know if there's a reason to avoid those except for aesthetics, but we have thus far.
@@ -2472,10 +2473,10 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, sampler_dim), loc))) return false;
if (params->args_count == 3)
if (!!offset_dim && params->args_count == 3)
The !! is mildly redundant here.