xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/StreamProducerImpl.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker //
2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2016 The ANGLE Project Authors. All rights reserved.
3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file.
5*8975f5c5SAndroid Build Coastguard Worker //
6*8975f5c5SAndroid Build Coastguard Worker 
7*8975f5c5SAndroid Build Coastguard Worker // StreamProducerImpl.h: Defines the abstract rx::StreamProducerImpl class.
8*8975f5c5SAndroid Build Coastguard Worker 
9*8975f5c5SAndroid Build Coastguard Worker #ifndef LIBANGLE_RENDERER_STREAMPRODUCERIMPL_H_
10*8975f5c5SAndroid Build Coastguard Worker #define LIBANGLE_RENDERER_STREAMPRODUCERIMPL_H_
11*8975f5c5SAndroid Build Coastguard Worker 
12*8975f5c5SAndroid Build Coastguard Worker #include "common/angleutils.h"
13*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Stream.h"
14*8975f5c5SAndroid Build Coastguard Worker 
15*8975f5c5SAndroid Build Coastguard Worker namespace rx
16*8975f5c5SAndroid Build Coastguard Worker {
17*8975f5c5SAndroid Build Coastguard Worker 
18*8975f5c5SAndroid Build Coastguard Worker class StreamProducerImpl : angle::NonCopyable
19*8975f5c5SAndroid Build Coastguard Worker {
20*8975f5c5SAndroid Build Coastguard Worker   public:
StreamProducerImpl()21*8975f5c5SAndroid Build Coastguard Worker     explicit StreamProducerImpl() {}
~StreamProducerImpl()22*8975f5c5SAndroid Build Coastguard Worker     virtual ~StreamProducerImpl() {}
23*8975f5c5SAndroid Build Coastguard Worker 
24*8975f5c5SAndroid Build Coastguard Worker     // Validates the ability for the producer to accept an arbitrary pointer to a frame. All
25*8975f5c5SAndroid Build Coastguard Worker     // pointers should be validated through this function before being used to produce a frame.
26*8975f5c5SAndroid Build Coastguard Worker     virtual egl::Error validateD3DTexture(const void *pointer,
27*8975f5c5SAndroid Build Coastguard Worker                                           const egl::AttributeMap &attributes) const = 0;
28*8975f5c5SAndroid Build Coastguard Worker 
29*8975f5c5SAndroid Build Coastguard Worker     // Constructs a frame from an arbitrary external pointer that points to producer specific frame
30*8975f5c5SAndroid Build Coastguard Worker     // data. Replaces the internal frame with the new one.
31*8975f5c5SAndroid Build Coastguard Worker     virtual void postD3DTexture(void *pointer, const egl::AttributeMap &attributes) = 0;
32*8975f5c5SAndroid Build Coastguard Worker 
33*8975f5c5SAndroid Build Coastguard Worker     // Returns an OpenGL texture interpretation of some frame attributes for the purpose of
34*8975f5c5SAndroid Build Coastguard Worker     // constructing an OpenGL texture from a frame. Depending on the producer and consumer, some
35*8975f5c5SAndroid Build Coastguard Worker     // frames may have multiple "planes" with different OpenGL texture representations.
36*8975f5c5SAndroid Build Coastguard Worker     virtual egl::Stream::GLTextureDescription getGLFrameDescription(int planeIndex) = 0;
37*8975f5c5SAndroid Build Coastguard Worker };
38*8975f5c5SAndroid Build Coastguard Worker }  // namespace rx
39*8975f5c5SAndroid Build Coastguard Worker 
40*8975f5c5SAndroid Build Coastguard Worker #endif  // LIBANGLE_RENDERER_STREAMPRODUCERIMPL_H_
41