diff options
Diffstat (limited to 'src/gallium/drivers/d3d12/d3d12_resource.h')
-rw-r--r-- | src/gallium/drivers/d3d12/d3d12_resource.h | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/gallium/drivers/d3d12/d3d12_resource.h b/src/gallium/drivers/d3d12/d3d12_resource.h index a71c8206f44..9667991cdef 100644 --- a/src/gallium/drivers/d3d12/d3d12_resource.h +++ b/src/gallium/drivers/d3d12/d3d12_resource.h @@ -28,30 +28,49 @@ struct pipe_screen; #include "d3d12_bufmgr.h" #include "util/u_range.h" #include "util/u_transfer.h" +#include "util/u_threaded_context.h" -#include <directx/d3d12.h> +#include "d3d12_common.h" enum d3d12_resource_binding_type { D3D12_RESOURCE_BINDING_TYPE_SRV, D3D12_RESOURCE_BINDING_TYPE_CBV, + D3D12_RESOURCE_BINDING_TYPE_SSBO, + D3D12_RESOURCE_BINDING_TYPE_IMAGE, D3D12_RESOURCE_BINDING_TYPES }; struct d3d12_resource { - struct pipe_resource base; + struct threaded_resource base; struct d3d12_bo *bo; DXGI_FORMAT dxgi_format; + enum pipe_format overall_format; + unsigned int plane_slice; + struct pipe_resource* first_plane; unsigned mip_levels; + struct sw_displaytarget *dt; + unsigned dt_refcount; /* For planar resources sharing the dt pointer */ unsigned dt_stride; + struct pipe_resource *dt_proxy; + struct util_range valid_buffer_range; uint32_t bind_counts[PIPE_SHADER_TYPES][D3D12_RESOURCE_BINDING_TYPES]; + unsigned generation_id; +}; + +struct d3d12_memory_object { + struct pipe_memory_object base; + ID3D12Resource *res; + ID3D12Heap *heap; }; struct d3d12_transfer { - struct pipe_transfer base; + struct threaded_transfer base; struct pipe_resource *staging_res; void *data; + unsigned zs_cpu_copy_stride; + unsigned zs_cpu_copy_layer_stride; }; static inline struct d3d12_resource * @@ -60,6 +79,12 @@ d3d12_resource(struct pipe_resource *r) return (struct d3d12_resource *)r; } +static inline struct d3d12_memory_object * +d3d12_memory_object(struct pipe_memory_object *m) +{ + return (struct d3d12_memory_object *)m; +} + /* Returns the underlying ID3D12Resource and offset for this resource */ static inline ID3D12Resource * d3d12_resource_underlying(struct d3d12_resource *res, uint64_t *offset) @@ -80,15 +105,6 @@ d3d12_resource_resource(struct d3d12_resource *res) return ret; } -static inline struct TransitionableResourceState * -d3d12_resource_state(struct d3d12_resource *res) -{ - uint64_t offset; - if (!res->bo) - return NULL; - return d3d12_bo_get_base(res->bo, &offset)->trans_state; -} - static inline D3D12_GPU_VIRTUAL_ADDRESS d3d12_resource_gpu_virtual_address(struct d3d12_resource *res) { @@ -101,6 +117,7 @@ static inline bool d3d12_subresource_id_uses_layer(enum pipe_texture_target target) { return target == PIPE_TEXTURE_CUBE || + target == PIPE_TEXTURE_CUBE_ARRAY || target == PIPE_TEXTURE_1D_ARRAY || target == PIPE_TEXTURE_2D_ARRAY; } @@ -110,11 +127,8 @@ d3d12_resource_release(struct d3d12_resource *res); void d3d12_resource_wait_idle(struct d3d12_context *ctx, - struct d3d12_resource *res); - -void -d3d12_resource_make_writeable(struct pipe_context *pctx, - struct pipe_resource *pres); + struct d3d12_resource *res, + bool want_to_write); void d3d12_screen_resource_init(struct pipe_screen *pscreen); @@ -122,4 +136,8 @@ d3d12_screen_resource_init(struct pipe_screen *pscreen); void d3d12_context_resource_init(struct pipe_context *pctx); +struct pipe_resource * +d3d12_resource_from_resource(struct pipe_screen *pscreen, + ID3D12Resource* inputRes); + #endif |