Skip to content

Commit 5f18d26

Browse files
authored
Rename GPURenderPipeline to RenderPipeline and GPUShaderModule to ShaderModule. (#954)
1 parent e9378cf commit 5f18d26

16 files changed

+50
-51
lines changed

src/gpu/GPU.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include <memory>
2222
#include "gpu/CommandEncoder.h"
2323
#include "gpu/CommandQueue.h"
24-
#include "gpu/GPURenderPipeline.h"
2524
#include "gpu/GPUSampler.h"
26-
#include "gpu/GPUShaderModule.h"
25+
#include "gpu/RenderPipeline.h"
26+
#include "gpu/ShaderModule.h"
2727
#include "gpu/YUVFormat.h"
2828
#include "tgfx/gpu/Backend.h"
2929
#include "tgfx/gpu/Caps.h"
@@ -141,18 +141,18 @@ class GPU {
141141
virtual std::shared_ptr<GPUSampler> createSampler(const GPUSamplerDescriptor& descriptor) = 0;
142142

143143
/**
144-
* Creates a GPUShaderModule from the provided shader code. The shader code must be valid and
144+
* Creates a ShaderModule from the provided shader code. The shader code must be valid and
145145
* compatible with the GPU backend. Returns nullptr if the shader module creation fails.
146146
*/
147-
virtual std::shared_ptr<GPUShaderModule> createShaderModule(
148-
const GPUShaderModuleDescriptor& descriptor) = 0;
147+
virtual std::shared_ptr<ShaderModule> createShaderModule(
148+
const ShaderModuleDescriptor& descriptor) = 0;
149149

150150
/**
151-
* Creates a GPURenderPipeline that manages the vertex and fragment shader stages for use in a
151+
* Creates a RenderPipeline that manages the vertex and fragment shader stages for use in a
152152
* RenderPass. Returns nullptr if pipeline creation fails.
153153
*/
154-
virtual std::shared_ptr<GPURenderPipeline> createRenderPipeline(
155-
const GPURenderPipelineDescriptor& descriptor) = 0;
154+
virtual std::shared_ptr<RenderPipeline> createRenderPipeline(
155+
const RenderPipelineDescriptor& descriptor) = 0;
156156

157157
/**
158158
* Creates a command encoder that can be used to encode commands to be issued to the GPU.

src/gpu/ProgramInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#pragma once
2020

2121
#include <unordered_map>
22-
#include "gpu/GPURenderPipeline.h"
2322
#include "gpu/RenderPass.h"
23+
#include "gpu/RenderPipeline.h"
2424
#include "gpu/processors/EmptyXferProcessor.h"
2525
#include "gpu/processors/FragmentProcessor.h"
2626
#include "gpu/processors/GeometryProcessor.h"

src/gpu/RenderPass.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
#include "core/utils/Log.h"
2222
#include "gpu/GPUBuffer.h"
23-
#include "gpu/GPURenderPipeline.h"
2423
#include "gpu/GPUSampler.h"
2524
#include "gpu/GPUTexture.h"
25+
#include "gpu/RenderPipeline.h"
2626
#include "tgfx/core/Color.h"
2727

2828
namespace tgfx {
@@ -266,7 +266,7 @@ class RenderPass {
266266
* Sets the render pipeline to be used for subsequent draw calls. The pipeline defines the shader
267267
* programs and fixed-function state used during rendering.
268268
*/
269-
virtual void setPipeline(std::shared_ptr<GPURenderPipeline> pipeline) = 0;
269+
virtual void setPipeline(std::shared_ptr<RenderPipeline> pipeline) = 0;
270270

271271
/**
272272
* Sets the uniform data to a specified binding index in the shader's UBO table.

src/gpu/GPURenderPipeline.cpp renamed to src/gpu/RenderPipeline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//
1717
/////////////////////////////////////////////////////////////////////////////////////////////////
1818

19-
#include "GPURenderPipeline.h"
19+
#include "RenderPipeline.h"
2020

2121
namespace tgfx {
2222
VertexDescriptor::VertexDescriptor(std::vector<Attribute> attribs, size_t stride)

src/gpu/GPURenderPipeline.h renamed to src/gpu/RenderPipeline.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "gpu/BlendOperation.h"
2727
#include "gpu/ColorWriteMask.h"
2828
#include "gpu/CompareFunction.h"
29-
#include "gpu/GPUShaderModule.h"
29+
#include "gpu/ShaderModule.h"
3030
#include "gpu/StencilOperation.h"
3131
#include "gpu/Uniform.h"
3232
#include "tgfx/gpu/PixelFormat.h"
@@ -95,9 +95,9 @@ class PipelineColorAttachment {
9595
class FragmentDescriptor {
9696
public:
9797
/**
98-
* A GPUShaderModule object containing the fragment shader code.
98+
* A ShaderModule object containing the fragment shader code.
9999
*/
100-
std::shared_ptr<GPUShaderModule> module = nullptr;
100+
std::shared_ptr<ShaderModule> module = nullptr;
101101

102102
/**
103103
* The name of the entry point function in the shader code.
@@ -129,9 +129,9 @@ class VertexDescriptor {
129129
VertexDescriptor(std::vector<Attribute> attributes, size_t vertexStride = 0);
130130

131131
/**
132-
* A GPUShaderModule object containing the vertex shader code.
132+
* A ShaderModule object containing the vertex shader code.
133133
*/
134-
std::shared_ptr<GPUShaderModule> module = nullptr;
134+
std::shared_ptr<ShaderModule> module = nullptr;
135135

136136
/**
137137
* The name of the entry point function in the shader code.
@@ -263,7 +263,7 @@ class DepthStencilDescriptor {
263263
/**
264264
* Options you provide to a GPU device to create a render pipeline state.
265265
*/
266-
class GPURenderPipelineDescriptor {
266+
class RenderPipelineDescriptor {
267267
public:
268268
/**
269269
* The vertex shader entry point and its input buffer layouts.
@@ -289,11 +289,11 @@ class GPURenderPipelineDescriptor {
289289
};
290290

291291
/**
292-
* GPURenderPipeline represents a graphics pipeline configuration for a render pass, which the pass
292+
* RenderPipeline represents a graphics pipeline configuration for a render pass, which the pass
293293
* applies to the draw commands you encode.
294294
*/
295-
class GPURenderPipeline {
295+
class RenderPipeline {
296296
public:
297-
virtual ~GPURenderPipeline() = default;
297+
virtual ~RenderPipeline() = default;
298298
};
299299
} // namespace tgfx

src/gpu/GPUShaderModule.h renamed to src/gpu/ShaderModule.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323

2424
namespace tgfx {
2525
/**
26-
* GPUShaderModuleDescriptor describes the properties required to create a GPUShaderModule.
26+
* ShaderModuleDescriptor describes the properties required to create a ShaderModule.
2727
*/
28-
class GPUShaderModuleDescriptor {
28+
class ShaderModuleDescriptor {
2929
public:
3030
/**
31-
* The shader code to be compiled into a GPUShaderModule.
31+
* The shader code to be compiled into a ShaderModule.
3232
*/
3333
std::string code;
3434

@@ -40,11 +40,11 @@ class GPUShaderModuleDescriptor {
4040
};
4141

4242
/**
43-
* GPUShaderModule is an internal object that serves as a container for shader code,allowing it to
43+
* ShaderModule is an internal object that serves as a container for shader code,allowing it to
4444
* be submitted to the GPU for execution within a pipeline.
4545
*/
46-
class GPUShaderModule {
46+
class ShaderModule {
4747
public:
48-
virtual ~GPUShaderModule() = default;
48+
virtual ~ShaderModule() = default;
4949
};
5050
} // namespace tgfx

src/gpu/glsl/GLSLProgramBuilder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,21 +173,21 @@ std::shared_ptr<PipelineProgram> GLSLProgramBuilder::finalize() {
173173
}
174174
finalizeShaders();
175175
auto gpu = context->gpu();
176-
GPUShaderModuleDescriptor vertexModule = {};
176+
ShaderModuleDescriptor vertexModule = {};
177177
vertexModule.code = vertexShaderBuilder()->shaderString();
178178
vertexModule.stage = ShaderStage::Vertex;
179179
auto vertexShader = gpu->createShaderModule(vertexModule);
180180
if (vertexShader == nullptr) {
181181
return nullptr;
182182
}
183-
GPUShaderModuleDescriptor fragmentModule = {};
183+
ShaderModuleDescriptor fragmentModule = {};
184184
fragmentModule.code = fragmentShaderBuilder()->shaderString();
185185
fragmentModule.stage = ShaderStage::Fragment;
186186
auto fragmentShader = gpu->createShaderModule(fragmentModule);
187187
if (fragmentShader == nullptr) {
188188
return nullptr;
189189
}
190-
GPURenderPipelineDescriptor descriptor = {};
190+
RenderPipelineDescriptor descriptor = {};
191191
descriptor.vertex = {programInfo->getVertexAttributes()};
192192
descriptor.vertex.module = vertexShader;
193193
descriptor.fragment.module = fragmentShader;

src/gpu/opengl/GLGPU.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ std::shared_ptr<GPUSampler> GLGPU::createSampler(const GPUSamplerDescriptor& des
225225
ToGLWrap(descriptor.addressModeY), minFilter, magFilter);
226226
}
227227

228-
std::shared_ptr<GPUShaderModule> GLGPU::createShaderModule(
229-
const GPUShaderModuleDescriptor& descriptor) {
228+
std::shared_ptr<ShaderModule> GLGPU::createShaderModule(const ShaderModuleDescriptor& descriptor) {
230229
if (descriptor.code.empty()) {
231230
LOGE("GLGPU::createShaderModule() shader code is empty!");
232231
return nullptr;
@@ -260,8 +259,8 @@ std::shared_ptr<GPUShaderModule> GLGPU::createShaderModule(
260259
return makeResource<GLShaderModule>(shader);
261260
}
262261

263-
std::shared_ptr<GPURenderPipeline> GLGPU::createRenderPipeline(
264-
const GPURenderPipelineDescriptor& descriptor) {
262+
std::shared_ptr<RenderPipeline> GLGPU::createRenderPipeline(
263+
const RenderPipelineDescriptor& descriptor) {
265264
auto vertexModule = static_cast<GLShaderModule*>(descriptor.vertex.module.get());
266265
auto fragmentModule = static_cast<GLShaderModule*>(descriptor.fragment.module.get());
267266
if (vertexModule == nullptr || vertexModule->shader() == 0 || vertexModule == nullptr ||

src/gpu/opengl/GLGPU.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ class GLGPU : public GPU {
7171

7272
std::shared_ptr<GPUSampler> createSampler(const GPUSamplerDescriptor& descriptor) override;
7373

74-
std::shared_ptr<GPUShaderModule> createShaderModule(
75-
const GPUShaderModuleDescriptor& descriptor) override;
74+
std::shared_ptr<ShaderModule> createShaderModule(
75+
const ShaderModuleDescriptor& descriptor) override;
7676

77-
std::shared_ptr<GPURenderPipeline> createRenderPipeline(
78-
const GPURenderPipelineDescriptor& descriptor) override;
77+
std::shared_ptr<RenderPipeline> createRenderPipeline(
78+
const RenderPipelineDescriptor& descriptor) override;
7979

8080
std::shared_ptr<CommandEncoder> createCommandEncoder() override;
8181

src/gpu/opengl/GLRenderPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void GLRenderPass::setScissorRect(int x, int y, int width, int height) {
8484
}
8585
}
8686

87-
void GLRenderPass::setPipeline(std::shared_ptr<GPURenderPipeline> pipeline) {
87+
void GLRenderPass::setPipeline(std::shared_ptr<RenderPipeline> pipeline) {
8888
if (renderPipeline == pipeline) {
8989
return;
9090
}

0 commit comments

Comments
 (0)