compiler: Add the rest of the subpassInput types

There are actually 6 of them according to the GL_KHR_vulkan_glsl spec.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
Jason Ekstrand
2016-11-14 18:11:07 -08:00
parent 7a2cfd4adb
commit 111d57e7d2
4 changed files with 23 additions and 6 deletions

View File

@@ -159,7 +159,12 @@ DECL_TYPE(uimageCubeArray, GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY, GLSL_TYPE
DECL_TYPE(uimage2DMS, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_UINT) DECL_TYPE(uimage2DMS, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(uimage2DMSArray, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_UINT) DECL_TYPE(uimage2DMSArray, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_UINT)
DECL_TYPE(subpassInput, 0, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,0, 0, GLSL_TYPE_FLOAT) DECL_TYPE(subpassInput, 0, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(subpassInputMS, 0, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(isubpassInput, 0, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(isubpassInputMS, 0, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_INT)
DECL_TYPE(usubpassInput, 0, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(usubpassInputMS, 0, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_UINT)
DECL_TYPE(atomic_uint, GL_UNSIGNED_INT_ATOMIC_COUNTER, GLSL_TYPE_ATOMIC_UINT, 1, 1) DECL_TYPE(atomic_uint, GL_UNSIGNED_INT_ATOMIC_COUNTER, GLSL_TYPE_ATOMIC_UINT, 1, 1)

View File

@@ -644,6 +644,7 @@ glsl_type::get_sampler_instance(enum glsl_sampler_dim dim,
else else
return samplerExternalOES_type; return samplerExternalOES_type;
case GLSL_SAMPLER_DIM_SUBPASS: case GLSL_SAMPLER_DIM_SUBPASS:
case GLSL_SAMPLER_DIM_SUBPASS_MS:
return error_type; return error_type;
} }
case GLSL_TYPE_INT: case GLSL_TYPE_INT:
@@ -673,6 +674,7 @@ glsl_type::get_sampler_instance(enum glsl_sampler_dim dim,
case GLSL_SAMPLER_DIM_EXTERNAL: case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type; return error_type;
case GLSL_SAMPLER_DIM_SUBPASS: case GLSL_SAMPLER_DIM_SUBPASS:
case GLSL_SAMPLER_DIM_SUBPASS_MS:
return error_type; return error_type;
} }
case GLSL_TYPE_UINT: case GLSL_TYPE_UINT:
@@ -702,6 +704,7 @@ glsl_type::get_sampler_instance(enum glsl_sampler_dim dim,
case GLSL_SAMPLER_DIM_EXTERNAL: case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type; return error_type;
case GLSL_SAMPLER_DIM_SUBPASS: case GLSL_SAMPLER_DIM_SUBPASS:
case GLSL_SAMPLER_DIM_SUBPASS_MS:
return error_type; return error_type;
} }
default: default:
@@ -715,8 +718,6 @@ const glsl_type *
glsl_type::get_image_instance(enum glsl_sampler_dim dim, glsl_type::get_image_instance(enum glsl_sampler_dim dim,
bool array, glsl_base_type type) bool array, glsl_base_type type)
{ {
if (dim == GLSL_SAMPLER_DIM_SUBPASS)
return subpassInput_type;
switch (type) { switch (type) {
case GLSL_TYPE_FLOAT: case GLSL_TYPE_FLOAT:
switch (dim) { switch (dim) {
@@ -740,8 +741,11 @@ glsl_type::get_image_instance(enum glsl_sampler_dim dim,
return imageBuffer_type; return imageBuffer_type;
case GLSL_SAMPLER_DIM_MS: case GLSL_SAMPLER_DIM_MS:
return (array ? image2DMSArray_type : image2DMS_type); return (array ? image2DMSArray_type : image2DMS_type);
case GLSL_SAMPLER_DIM_EXTERNAL:
case GLSL_SAMPLER_DIM_SUBPASS: case GLSL_SAMPLER_DIM_SUBPASS:
return subpassInput_type;
case GLSL_SAMPLER_DIM_SUBPASS_MS:
return subpassInputMS_type;
case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type; return error_type;
} }
case GLSL_TYPE_INT: case GLSL_TYPE_INT:
@@ -766,8 +770,11 @@ glsl_type::get_image_instance(enum glsl_sampler_dim dim,
return iimageBuffer_type; return iimageBuffer_type;
case GLSL_SAMPLER_DIM_MS: case GLSL_SAMPLER_DIM_MS:
return (array ? iimage2DMSArray_type : iimage2DMS_type); return (array ? iimage2DMSArray_type : iimage2DMS_type);
case GLSL_SAMPLER_DIM_EXTERNAL:
case GLSL_SAMPLER_DIM_SUBPASS: case GLSL_SAMPLER_DIM_SUBPASS:
return isubpassInput_type;
case GLSL_SAMPLER_DIM_SUBPASS_MS:
return isubpassInputMS_type;
case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type; return error_type;
} }
case GLSL_TYPE_UINT: case GLSL_TYPE_UINT:
@@ -792,8 +799,11 @@ glsl_type::get_image_instance(enum glsl_sampler_dim dim,
return uimageBuffer_type; return uimageBuffer_type;
case GLSL_SAMPLER_DIM_MS: case GLSL_SAMPLER_DIM_MS:
return (array ? uimage2DMSArray_type : uimage2DMS_type); return (array ? uimage2DMSArray_type : uimage2DMS_type);
case GLSL_SAMPLER_DIM_EXTERNAL:
case GLSL_SAMPLER_DIM_SUBPASS: case GLSL_SAMPLER_DIM_SUBPASS:
return usubpassInput_type;
case GLSL_SAMPLER_DIM_SUBPASS_MS:
return usubpassInputMS_type;
case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type; return error_type;
} }
default: default:

View File

@@ -82,6 +82,7 @@ enum glsl_sampler_dim {
GLSL_SAMPLER_DIM_EXTERNAL, GLSL_SAMPLER_DIM_EXTERNAL,
GLSL_SAMPLER_DIM_MS, GLSL_SAMPLER_DIM_MS,
GLSL_SAMPLER_DIM_SUBPASS, /* for vulkan input attachments */ GLSL_SAMPLER_DIM_SUBPASS, /* for vulkan input attachments */
GLSL_SAMPLER_DIM_SUBPASS_MS, /* for multisampled vulkan input attachments */
}; };
enum glsl_interface_packing { enum glsl_interface_packing {

View File

@@ -598,6 +598,7 @@ ptn_tex(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src,
instr->coord_components = 3; instr->coord_components = 3;
break; break;
case GLSL_SAMPLER_DIM_SUBPASS: case GLSL_SAMPLER_DIM_SUBPASS:
case GLSL_SAMPLER_DIM_SUBPASS_MS:
unreachable("can't reach"); unreachable("can't reach");
} }