43 texture_subpass_map_.clear();
48 for (
auto geom :
IndexRange(geometry_type_len)) {
50 passes_[geom][
shader] =
nullptr;
57 static std::string pass_names[geometry_type_len][shader_type_len] = {};
59 PassMain::Sub *&sub_pass = passes_[int(geometry_type)][int(shader_type)];
61 std::string &pass_name = pass_names[int(geometry_type)][int(shader_type)];
62 if (pass_name.empty()) {
63 pass_name = std::string(get_name(geometry_type)) + std::string(get_name(shader_type));
65 sub_pass = &
sub(pass_name.c_str());
67 ShaderCache::get().prepass_get(geometry_type, pipeline_, lighting_, shader_type, clip_));
82 if (
texture->gpu.tile_mapping) {
95 sub_pass->
push_constant(
"image_transparency_cutoff", alpha_cutoff);
99 return *texture_subpass_map_.lookup_or_add_cb(
100 {
texture->gpu.texture,
texture->sampler_state, geometry_type}, add_cb);
157 gpu::TextureFormat::SFLOAT_16_16_16_16,
160 gpu::TextureFormat::SFLOAT_16_16,
172 object_id_attachment);
186 object_id_attachment);
204 shadow_pass->
draw(manager,
218 if (!shadow_pass || !shadow_pass->
is_debug()) {
276 gpu::TextureFormat::SFLOAT_16_16_16_16,
279 gpu::TextureFormat::SFLOAT_16,
361 object_id_attachment);
374 object_id_attachment);
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
constexpr IndexRange()=default
void ensure(GPUAttachment depth=GPU_ATTACHMENT_NONE, GPUAttachment color1=GPU_ATTACHMENT_NONE, GPUAttachment color2=GPU_ATTACHMENT_NONE, GPUAttachment color3=GPU_ATTACHMENT_NONE, GPUAttachment color4=GPU_ATTACHMENT_NONE, GPUAttachment color5=GPU_ATTACHMENT_NONE, GPUAttachment color6=GPU_ATTACHMENT_NONE, GPUAttachment color7=GPU_ATTACHMENT_NONE, GPUAttachment color8=GPU_ATTACHMENT_NONE)
void submit(PassSimple &pass, View &view)
bool acquire_2d(int2 extent, gpu::TextureFormat format, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, int mip_len=1)
bool ensure_2d(gpu::TextureFormat format, int2 extent, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const float *data=nullptr, int mip_len=1)
gpu::Texture * gpu_texture()
gpu::Texture * stencil_view(bool cube_as_array=false)
void draw_procedural(GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceIDRange res_id={}, uint custom_id=0)
void shader_set(gpu::Shader *shader)
void bind_texture(const char *name, gpu::Texture *texture, GPUSamplerState state=sampler_auto)
void clear_color(float4 color)
PassBase< DrawCommandBufType > & sub(const char *name)
void state_set(DRWState state, int clip_plane_count=0)
void state_stencil(uint8_t write_mask, uint8_t reference, uint8_t compare_mask)
void bind_ubo(const char *name, gpu::UniformBuf *buffer)
void push_constant(const char *name, const float &data)
void bind_ssbo(const char *name, gpu::StorageBuf *buffer)
detail::PassBase< command::DrawMultiBuf > Sub
void setup_resolve_pass(PassSimple &pass, SceneResources &resources)
MeshPass(const char *name)
void init_pass(SceneResources &resources, DRWState state, int clip_planes)
void init_subpasses(ePipelineType pipeline, eLightingType lighting, bool clip)
void sync(const SceneState &scene_state, SceneResources &resources)
MeshPass gbuffer_in_front_ps_
TextureFromPool gbuffer_material_tx
gpu::Texture * deferred_ps_stencil_tx
Texture shadow_depth_stencil_tx
Framebuffer gbuffer_in_front_fb
TextureFromPool gbuffer_normal_tx
void draw(Manager &manager, View &view, SceneResources &resources, int2 resolution, class ShadowPass *shadow_pass)
static ShaderCache & get()
void draw(Manager &manager, View &view, SceneResources &resources, gpu::Texture &depth_stencil_tx, gpu::Texture &normal_tx, int2 resolution, bool force_fail_method)
void draw(Manager &manager, View &view, SceneResources &resources)
void sync(const SceneState &scene_state, SceneResources &resources)
TextureFromPool accumulation_tx
MeshPass accumulation_in_front_ps_
void sync(const SceneState &scene_state, SceneResources &resources)
void draw(Manager &manager, View &view, SceneResources &resources, int2 resolution)
MeshPass accumulation_ps_
Framebuffer transparent_fb
TextureFromPool reveal_tx
#define DRW_CLIPPING_UBO_SLOT
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
detail::Pass< command::DrawMultiBuf > PassMain
void GPU_texture_copy(gpu::Texture *dst, gpu::Texture *src)
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
@ GPU_TEXTURE_USAGE_FORMAT_VIEW
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
@ DRW_STATE_STENCIL_ALWAYS
@ DRW_STATE_WRITE_STENCIL
@ DRW_STATE_STENCIL_EQUAL
@ DRW_STATE_STENCIL_NEQUAL
@ DRW_STATE_DEPTH_LESS_EQUAL
void GPU_framebuffer_clear_stencil(gpu::FrameBuffer *fb, uint clear_stencil)
UniformBuffer< WorldData > world_buf
StorageVectorBuffer< Material > material_buf
TextureRef depth_in_front_tx
Texture dummy_tile_array_tx
TextureFromPool object_id_tx
Texture dummy_tile_data_tx
UniformArrayBuffer< float4, 6 > clip_planes_buf
eLightingType lighting_type
Vector< float4 > clip_planes
#define WB_TILE_DATA_SLOT
#define WB_TILE_ARRAY_SLOT