summaryrefslogtreecommitdiffstats
path: root/Whisper/ML/ConstantBuffer.h
blob: 3e6664dfbb91727558f0763436ae9c56801ce06d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once
#include "../D3D/device.h"
#include "TensorShape.h"

namespace DirectCompute
{
	// 96 bytes dynamic constant buffers, with dimensions and VRAM layout of 2-3 tensors
	class ConstantBuffer
	{
		CComPtr<ID3D11Buffer> buffer;

	public:
		HRESULT create();
		HRESULT update( const TensorShape& t0 );
		HRESULT update( const TensorShape& t0, const TensorShape& t1 );
		HRESULT update( const TensorShape& t0, const TensorShape& t1, const TensorShape& t2 );

		void bind() const;

		__m128i getMemoryUse() const
		{
			return bufferMemoryUsage( buffer );
		}
	};
}