On 12/7/21 13:08, Francisco Casas wrote:
@@ -424,20 +428,34 @@ static D3D_RESOURCE_RETURN_TYPE sm4_resource_format(const struct hlsl_type *type
static D3D_SRV_DIMENSION sm4_rdef_resource_dimension(const struct hlsl_type *type)
{
- switch (type->sampler_dim)
- if (type->base_type == HLSL_TYPE_TEXTURE)
Does this need to be a conditional? Should this just be an assertion instead?
I did it because the return type D3D_SRV_DIMENSION had the D3D_SRV_DIMENSION_BUFFER D3D_SRV_DIMENSION_BUFFEREX values for buffer types and because sm4_rdef_resource_dimension() is called from a path that seems could be used for other types than HLSL_TYPE_TEXTURE. But maybe is too soon to care about that, yes, an assertion for now would do.
Yeah, fair enough. I'm mostly inclined to concur with "too soon to care".
Who knows, we might do something crazy like generalize HLSL_TYPE_TEXTURE to HLSL_TYPE_RESOURCE and store both buffers and textures the same way :-)