Add ray-tracing reflection to main.cpp and C API.

This commit is contained in:
Hans-Kristian Arntzen 2019-03-27 10:21:30 +01:00
Родитель 689a7deb3e
Коммит 88ce958a51
5 изменённых файлов: 28 добавлений и 4 удалений

Просмотреть файл

@ -195,7 +195,7 @@ endif()
if (SPIRV_CROSS_SHARED)
set(spirv-cross-abi-major 0)
set(spirv-cross-abi-minor 3)
set(spirv-cross-abi-minor 4)
set(spirv-cross-abi-patch 0)
set(SPIRV_CROSS_VERSION ${spirv-cross-abi-major}.${spirv-cross-abi-minor}.${spirv-cross-abi-patch})
set(SPIRV_CROSS_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)

Просмотреть файл

@ -310,6 +310,18 @@ static const char *execution_model_to_str(spv::ExecutionModel model)
return "fragment";
case ExecutionModelGLCompute:
return "compute";
case ExecutionModelRayGenerationNV:
return "raygenNV";
case ExecutionModelIntersectionNV:
return "intersectionNV";
case ExecutionModelCallableNV:
return "callableNV";
case ExecutionModelAnyHitNV:
return "anyhitNV";
case ExecutionModelClosestHitNV:
return "closesthitNV";
case ExecutionModelMissNV:
return "missNV";
default:
return "???";
}
@ -396,6 +408,7 @@ static void print_resources(const Compiler &compiler, const ShaderResources &res
print_resources(compiler, "ubos", res.uniform_buffers);
print_resources(compiler, "push", res.push_constant_buffers);
print_resources(compiler, "counters", res.atomic_counters);
print_resources(compiler, "acceleration structures", res.acceleration_structures);
}
static void print_push_constant_resources(const Compiler &compiler, const vector<Resource> &res)

Просмотреть файл

@ -423,7 +423,6 @@ struct SPIRType : IVariant
Unknown,
Void,
Boolean,
Char,
SByte,
UByte,
Short,
@ -440,8 +439,11 @@ struct SPIRType : IVariant
Image,
SampledImage,
Sampler,
AccelerationStructureNV,
// Keep internal types at the end.
ControlPointArray,
AccelerationStructureNV
Char
};
// Scalar/vector/matrix support.

Просмотреть файл

@ -164,6 +164,7 @@ struct spvc_resources_s : ScratchMemoryAllocation
std::vector<spvc_reflected_resource> push_constant_buffers;
std::vector<spvc_reflected_resource> separate_images;
std::vector<spvc_reflected_resource> separate_samplers;
std::vector<spvc_reflected_resource> acceleration_structures;
bool copy_resources(std::vector<spvc_reflected_resource> &outputs, const std::vector<Resource> &inputs);
bool copy_resources(const ShaderResources &resources);
@ -860,6 +861,8 @@ bool spvc_resources_s::copy_resources(const ShaderResources &resources)
return false;
if (!copy_resources(separate_samplers, resources.separate_samplers))
return false;
if (!copy_resources(acceleration_structures, resources.acceleration_structures))
return false;
return true;
}
@ -999,6 +1002,10 @@ spvc_result spvc_resources_get_resource_list_for_type(spvc_resources resources,
list = &resources->separate_samplers;
break;
case SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE:
list = &resources->acceleration_structures;
break;
default:
break;
}

Просмотреть файл

@ -33,7 +33,7 @@ extern "C" {
/* Bumped if ABI or API breaks backwards compatibility. */
#define SPVC_C_API_VERSION_MAJOR 0
/* Bumped if APIs or enumerations are added in a backwards compatible way. */
#define SPVC_C_API_VERSION_MINOR 3
#define SPVC_C_API_VERSION_MINOR 4
/* Bumped if internal implementation details change. */
#define SPVC_C_API_VERSION_PATCH 0
@ -198,6 +198,7 @@ typedef enum spvc_resource_type
SPVC_RESOURCE_TYPE_PUSH_CONSTANT = 9,
SPVC_RESOURCE_TYPE_SEPARATE_IMAGE = 10,
SPVC_RESOURCE_TYPE_SEPARATE_SAMPLERS = 11,
SPVC_RESOURCE_TYPE_ACCELERATION_STRUCTURE = 12,
SPVC_RESOURCE_TYPE_INT_MAX = 0x7fffffff
} spvc_resource_type;
@ -223,6 +224,7 @@ typedef enum spvc_basetype
SPVC_BASETYPE_IMAGE = 16,
SPVC_BASETYPE_SAMPLED_IMAGE = 17,
SPVC_BASETYPE_SAMPLER = 18,
SPVC_BASETYPE_ACCELERATION_STRUCTURE = 19,
SPVC_BASETYPE_INT_MAX = 0x7fffffff
} spvc_basetype;