Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_shader_create_info.hh
| Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | struct ShaderCreateInfo { | ||||
| bool do_static_compilation_ = false; | bool do_static_compilation_ = false; | ||||
| /** If true, all additionally linked create info will be merged into this one. */ | /** If true, all additionally linked create info will be merged into this one. */ | ||||
| bool finalized_ = false; | bool finalized_ = false; | ||||
| /** | /** | ||||
| * Maximum length of all the resource names including each null terminator. | * Maximum length of all the resource names including each null terminator. | ||||
| * Only for names used by gpu::ShaderInterface. | * Only for names used by gpu::ShaderInterface. | ||||
| */ | */ | ||||
| size_t interface_names_size_ = 0; | size_t interface_names_size_ = 0; | ||||
| /** Only for compute shaders. */ | |||||
| int local_group_size_[3] = {0, 0, 0}; | |||||
| struct VertIn { | struct VertIn { | ||||
| int index; | int index; | ||||
| Type type; | Type type; | ||||
| StringRefNull name; | StringRefNull name; | ||||
| }; | }; | ||||
| Vector<VertIn> vertex_inputs_; | Vector<VertIn> vertex_inputs_; | ||||
| struct GeometryStageLayout { | struct GeometryStageLayout { | ||||
| PrimitiveIn primitive_in; | PrimitiveIn primitive_in; | ||||
| int invocations; | int invocations; | ||||
| PrimitiveOut primitive_out; | PrimitiveOut primitive_out; | ||||
| /** Set to -1 by default to check if used. */ | /** Set to -1 by default to check if used. */ | ||||
| int max_vertices = -1; | int max_vertices = -1; | ||||
| }; | }; | ||||
| GeometryStageLayout geometry_layout_; | GeometryStageLayout geometry_layout_; | ||||
| struct ComputeStageLayout { | |||||
| int local_size_x = -1; | |||||
jbakker: Could have used 0, but think that should be handled by the compiler. | |||||
Done Inline ActionsYes, if ommitted, the dimension is set to 1. fclem: Yes, if ommitted, the dimension is set to 1. | |||||
| int local_size_y = -1; | |||||
| int local_size_z = -1; | |||||
| }; | |||||
| ComputeStageLayout compute_layout_; | |||||
| struct FragOut { | struct FragOut { | ||||
| int index; | int index; | ||||
| Type type; | Type type; | ||||
| DualBlend blend; | DualBlend blend; | ||||
| StringRefNull name; | StringRefNull name; | ||||
| }; | }; | ||||
| Vector<FragOut> fragment_outputs_; | Vector<FragOut> fragment_outputs_; | ||||
| ▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | public: | ||||
| { | { | ||||
| geometry_layout_.primitive_in = prim_in; | geometry_layout_.primitive_in = prim_in; | ||||
| geometry_layout_.primitive_out = prim_out; | geometry_layout_.primitive_out = prim_out; | ||||
| geometry_layout_.max_vertices = max_vertices; | geometry_layout_.max_vertices = max_vertices; | ||||
| geometry_layout_.invocations = invocations; | geometry_layout_.invocations = invocations; | ||||
| return *(Self *)this; | return *(Self *)this; | ||||
| } | } | ||||
| Self &local_group_size(int local_size_x = -1, int local_size_y = -1, int local_size_z = -1) | |||||
| { | |||||
| compute_layout_.local_size_x = local_size_x; | |||||
| compute_layout_.local_size_y = local_size_y; | |||||
| compute_layout_.local_size_z = local_size_z; | |||||
| return *(Self *)this; | |||||
| } | |||||
| /* Only needed if geometry shader is enabled. */ | /* Only needed if geometry shader is enabled. */ | ||||
| Self &geometry_out(StageInterfaceInfo &interface) | Self &geometry_out(StageInterfaceInfo &interface) | ||||
| { | { | ||||
| geometry_out_interfaces_.append(&interface); | geometry_out_interfaces_.append(&interface); | ||||
| return *(Self *)this; | return *(Self *)this; | ||||
| } | } | ||||
| Self &fragment_out(int slot, Type type, StringRefNull name, DualBlend blend = DualBlend::NONE) | Self &fragment_out(int slot, Type type, StringRefNull name, DualBlend blend = DualBlend::NONE) | ||||
| ▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | Self &push_constant(int slot, Type type, StringRefNull name, int array_size = 0) | ||||
| push_constants_.append({slot, type, name, array_size}); | push_constants_.append({slot, type, name, array_size}); | ||||
| interface_names_size_ += name.size() + 1; | interface_names_size_ += name.size() + 1; | ||||
| return *(Self *)this; | return *(Self *)this; | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Compute shaders Local Group Size | |||||
| * \{ */ | |||||
| Self &local_group_size(int x, int y = 1, int z = 1) | |||||
| { | |||||
| local_group_size_[0] = x; | |||||
| local_group_size_[1] = y; | |||||
| local_group_size_[2] = z; | |||||
| return *(Self *)this; | |||||
| } | |||||
| /** \} */ | |||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Defines | /** \name Defines | ||||
| * \{ */ | * \{ */ | ||||
| Self &define(StringRefNull name, StringRefNull value = "") | Self &define(StringRefNull name, StringRefNull value = "") | ||||
| { | { | ||||
| defines_.append({name, value}); | defines_.append({name, value}); | ||||
| return *(Self *)this; | return *(Self *)this; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines | |||||
Could have used 0, but think that should be handled by the compiler.