Skip to content

Commit 99dce6a

Browse files
Automated Code Change
PiperOrigin-RevId: 713862200
1 parent 8f60a93 commit 99dce6a

File tree

6 files changed

+69
-68
lines changed

6 files changed

+69
-68
lines changed

tensorflow_graphics/rendering/opengl/egl_offscreen_context.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ EGLOffscreenContext::EGLOffscreenContext(EGLContext context, EGLDisplay display,
2929

3030
EGLOffscreenContext::~EGLOffscreenContext() { TF_CHECK_OK(Destroy()); }
3131

32-
tensorflow::Status EGLOffscreenContext::Create(
32+
absl::Status EGLOffscreenContext::Create(
3333
std::unique_ptr<EGLOffscreenContext>* egl_offscreen_context) {
3434
constexpr std::array<int, 13> kDefaultConfigurationAttributes = {
3535
EGL_SURFACE_TYPE,
@@ -56,7 +56,7 @@ tensorflow::Status EGLOffscreenContext::Create(
5656
kDefaultContextAttributes.data(), egl_offscreen_context);
5757
}
5858

59-
tensorflow::Status EGLOffscreenContext::Create(
59+
absl::Status EGLOffscreenContext::Create(
6060
const int pixel_buffer_width, const int pixel_buffer_height,
6161
const EGLenum rendering_api, const EGLint* configuration_attributes,
6262
const EGLint* context_attributes,
@@ -112,10 +112,10 @@ tensorflow::Status EGLOffscreenContext::Create(
112112
surface_cleanup.release();
113113
*egl_offscreen_context = std::unique_ptr<EGLOffscreenContext>(
114114
new EGLOffscreenContext(context, display, pixel_buffer_surface));
115-
return tensorflow::Status();
115+
return absl::Status();
116116
}
117117

118-
tensorflow::Status EGLOffscreenContext::Destroy() {
118+
absl::Status EGLOffscreenContext::Destroy() {
119119
TF_RETURN_IF_ERROR(Release());
120120
if (eglDestroyContext(display_, context_) == false) {
121121
return TFG_INTERNAL_ERROR("an error occured in eglDestroyContext.");
@@ -127,19 +127,19 @@ tensorflow::Status EGLOffscreenContext::Destroy() {
127127
return TFG_INTERNAL_ERROR(
128128
"an error occured in TerminateInitializedEGLDisplay.");
129129
}
130-
return tensorflow::Status();
130+
return absl::Status();
131131
}
132132

133-
tensorflow::Status EGLOffscreenContext::MakeCurrent() const {
133+
absl::Status EGLOffscreenContext::MakeCurrent() const {
134134
TFG_RETURN_IF_EGL_ERROR(eglMakeCurrent(display_, pixel_buffer_surface_,
135135
pixel_buffer_surface_, context_));
136-
return tensorflow::Status();
136+
return absl::Status();
137137
}
138138

139-
tensorflow::Status EGLOffscreenContext::Release() {
139+
absl::Status EGLOffscreenContext::Release() {
140140
if (context_ != EGL_NO_CONTEXT && context_ == eglGetCurrentContext()) {
141141
TFG_RETURN_IF_EGL_ERROR(eglMakeCurrent(display_, EGL_NO_SURFACE,
142142
EGL_NO_SURFACE, EGL_NO_CONTEXT));
143143
}
144-
return tensorflow::Status();
144+
return absl::Status();
145145
}

tensorflow_graphics/rendering/opengl/gl_program.cc

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ Program::Program(GLuint program_handle) : program_handle_(program_handle) {}
2424

2525
Program::~Program() { glDeleteProgram(program_handle_); }
2626

27-
tensorflow::Status Program::CompileShader(const std::string& shader_code,
28-
const GLenum& shader_type,
29-
GLuint* shader_idx) {
27+
absl::Status Program::CompileShader(const std::string& shader_code,
28+
const GLenum& shader_type,
29+
GLuint* shader_idx) {
3030
// Create an empty shader object.
3131
TFG_RETURN_IF_EGL_ERROR(*shader_idx = glCreateShader(shader_type));
3232
if (*shader_idx == 0)
@@ -59,10 +59,10 @@ tensorflow::Status Program::CompileShader(const std::string& shader_code,
5959
std::string(&info_log[0]));
6060
}
6161
shader_cleanup.release();
62-
return tensorflow::Status();
62+
return absl::Status();
6363
}
6464

65-
tensorflow::Status Program::Create(
65+
absl::Status Program::Create(
6666
const std::vector<std::pair<std::string, GLenum>>& shaders,
6767
std::unique_ptr<Program>* program) {
6868
// Create an empty program object.
@@ -99,37 +99,39 @@ tensorflow::Status Program::Create(
9999
program_cleanup.release();
100100
// The content of shader_cleanups needs cleanup and hence is not released; see
101101
// https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glDeleteProgram.xhtml.
102-
return tensorflow::Status();
102+
return absl::Status();
103103
}
104104

105-
tensorflow::Status Program::Detach() const {
105+
absl::Status Program::Detach() const {
106106
TFG_RETURN_IF_GL_ERROR(glUseProgram(0));
107-
return tensorflow::Status();
107+
return absl::Status();
108108
}
109109

110-
tensorflow::Status Program::GetProgramResourceIndex(
111-
GLenum program_interface, absl::string_view resource_name,
112-
GLuint* resource_index) const {
110+
absl::Status Program::GetProgramResourceIndex(GLenum program_interface,
111+
absl::string_view resource_name,
112+
GLuint* resource_index) const {
113113
TFG_RETURN_IF_EGL_ERROR(*resource_index = glGetProgramResourceIndex(
114114
program_handle_, program_interface,
115115
resource_name.data()));
116-
return tensorflow::Status();
116+
return absl::Status();
117117
}
118118

119-
tensorflow::Status Program::GetProgramResourceiv(
119+
absl::Status Program::GetProgramResourceiv(
120120
GLenum program_interface, GLuint resource_index, int num_properties,
121121
const GLenum* properties, int num_property_value, GLsizei* length,
122122
GLint* property_value) const {
123123
TFG_RETURN_IF_EGL_ERROR(glGetProgramResourceiv(
124124
program_handle_, program_interface, resource_index, num_properties,
125125
properties, num_property_value, length, property_value));
126-
return tensorflow::Status();
126+
return absl::Status();
127127
}
128128

129-
tensorflow::Status Program::GetResourceProperty(
130-
const std::string& resource_name, GLenum program_interface,
131-
int num_properties, const GLenum* properties, int num_property_value,
132-
GLint* property_value) {
129+
absl::Status Program::GetResourceProperty(const std::string& resource_name,
130+
GLenum program_interface,
131+
int num_properties,
132+
const GLenum* properties,
133+
int num_property_value,
134+
GLint* property_value) {
133135
if (num_property_value != num_properties)
134136
return TFG_INTERNAL_ERROR("num_property_value != num_properties");
135137

@@ -152,12 +154,12 @@ tensorflow::Status Program::GetResourceProperty(
152154
return TFG_INTERNAL_ERROR("length != num_properties: ", length,
153155
" != ", num_properties);
154156

155-
return tensorflow::Status();
157+
return absl::Status();
156158
}
157159

158-
tensorflow::Status Program::Use() const {
160+
absl::Status Program::Use() const {
159161
TFG_RETURN_IF_EGL_ERROR(glUseProgram(program_handle_));
160-
return tensorflow::Status();
162+
return absl::Status();
161163
}
162164

163165
} // namespace gl_utils

tensorflow_graphics/rendering/opengl/gl_render_targets.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ RenderTargets::~RenderTargets() {
3838
glDeleteFramebuffers(1, &frame_buffer_);
3939
}
4040

41-
tensorflow::Status RenderTargets::BindFramebuffer() const {
41+
absl::Status RenderTargets::BindFramebuffer() const {
4242
TFG_RETURN_IF_GL_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, frame_buffer_));
43-
return tensorflow::Status();
43+
return absl::Status();
4444
}
4545

46-
tensorflow::Status RenderTargets::CreateValidInternalFormat(
46+
absl::Status RenderTargets::CreateValidInternalFormat(
4747
GLenum internalformat, GLsizei width, GLsizei height,
4848
std::unique_ptr<RenderTargets>* render_targets) {
4949
GLuint color_buffer;
@@ -92,16 +92,16 @@ tensorflow::Status RenderTargets::CreateValidInternalFormat(
9292
gen_color_cleanup.release();
9393
gen_depth_cleanup.release();
9494
gen_frame_cleanup.release();
95-
return tensorflow::Status();
95+
return absl::Status();
9696
}
9797

9898
GLsizei RenderTargets::GetHeight() const { return height_; }
9999

100100
GLsizei RenderTargets::GetWidth() const { return width_; }
101101

102-
tensorflow::Status RenderTargets::UnbindFrameBuffer() const {
102+
absl::Status RenderTargets::UnbindFrameBuffer() const {
103103
TFG_RETURN_IF_GL_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, 0));
104-
return tensorflow::Status();
104+
return absl::Status();
105105
}
106106

107107
} // namespace gl_utils

tensorflow_graphics/rendering/opengl/gl_shader_storage_buffer.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ ShaderStorageBuffer::ShaderStorageBuffer(GLuint buffer) : buffer_(buffer) {}
2424

2525
ShaderStorageBuffer::~ShaderStorageBuffer() { glDeleteBuffers(1, &buffer_); }
2626

27-
tensorflow::Status ShaderStorageBuffer::Create(
27+
absl::Status ShaderStorageBuffer::Create(
2828
std::unique_ptr<ShaderStorageBuffer>* shader_storage_buffer) {
2929
GLuint buffer;
3030

3131
// Generate one buffer object.
3232
TFG_RETURN_IF_EGL_ERROR(glGenBuffers(1, &buffer));
3333
*shader_storage_buffer =
3434
std::unique_ptr<ShaderStorageBuffer>(new ShaderStorageBuffer(buffer));
35-
return tensorflow::Status();
35+
return absl::Status();
3636
}
3737

38-
tensorflow::Status ShaderStorageBuffer::BindBufferBase(GLuint index) const {
38+
absl::Status ShaderStorageBuffer::BindBufferBase(GLuint index) const {
3939
TFG_RETURN_IF_EGL_ERROR(
4040
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, index, buffer_));
41-
return tensorflow::Status();
41+
return absl::Status();
4242
}
4343

4444
} // namespace gl_utils

tensorflow_graphics/rendering/opengl/rasterizer.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ void Rasterizer::Reset() {
3636
for (auto&& buffer : shader_storage_buffers_) buffer.second.reset();
3737
}
3838

39-
tensorflow::Status Rasterizer::Render(int num_points,
40-
absl::Span<float> result) {
39+
absl::Status Rasterizer::Render(int num_points, absl::Span<float> result) {
4140
return RenderImpl(num_points, result);
4241
}
4342

44-
tensorflow::Status Rasterizer::Render(int num_points,
45-
absl::Span<unsigned char> result) {
43+
absl::Status Rasterizer::Render(int num_points,
44+
absl::Span<unsigned char> result) {
4645
return RenderImpl(num_points, result);
4746
}
4847

49-
tensorflow::Status Rasterizer::SetUniformMatrix(
50-
const std::string& name, int num_columns, int num_rows, bool transpose,
51-
absl::Span<const float> matrix) {
48+
absl::Status Rasterizer::SetUniformMatrix(const std::string& name,
49+
int num_columns, int num_rows,
50+
bool transpose,
51+
absl::Span<const float> matrix) {
5252
if (size_t(num_rows * num_columns) != matrix.size())
5353
return TFG_INTERNAL_ERROR("num_rows * num_columns != matrix.size()");
5454

@@ -98,5 +98,5 @@ tensorflow::Status Rasterizer::SetUniformMatrix(
9898
uniform_location, 1, transpose ? GL_TRUE : GL_FALSE, matrix.data()));
9999

100100
// Cleanup the program; no program is active at this point.
101-
return tensorflow::Status();
101+
return absl::Status();
102102
}

tensorflow_graphics/rendering/opengl/rasterizer_op.cc

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ limitations under the License.
2626
#include "tensorflow/core/lib/core/errors.h"
2727
#include "tensorflow/core/lib/core/status.h"
2828

29-
static tensorflow::Status GetVariablesRank(
29+
static absl::Status GetVariablesRank(
3030
::tensorflow::shape_inference::InferenceContext* c,
3131
tensorflow::int32* rank) {
3232
std::vector<std::string> variable_names, variable_kinds;
@@ -68,7 +68,7 @@ static tensorflow::Status GetVariablesRank(
6868
"Variable with name='", variable_names[index],
6969
"' has an invalid batch rank of ", batch_rank, "; expected ", *rank);
7070
}
71-
return tensorflow::Status();
71+
return absl::Status();
7272
}
7373

7474
REGISTER_OP("Rasterize")
@@ -137,7 +137,7 @@ rendered_image: A tensor of shape `[A1, ..., An, width, height, 4]`, with the
137137
c->Concatenate(batch_shape, image_shape, &output_shape));
138138
c->set_output(0, output_shape);
139139

140-
return tensorflow::Status();
140+
return absl::Status();
141141
});
142142

143143
class RasterizeOp : public tensorflow::OpKernel {
@@ -176,8 +176,8 @@ class RasterizeOp : public tensorflow::OpKernel {
176176
auto rasterizer_creator =
177177
[vertex_shader, geometry_shader, fragment_shader, red_clear,
178178
green_clear, blue_clear, alpha_clear, depth_clear, enable_cull_face,
179-
this](std::unique_ptr<RasterizerWithContext>* resource)
180-
-> tensorflow::Status {
179+
this](
180+
std::unique_ptr<RasterizerWithContext>* resource) -> absl::Status {
181181
return RasterizerWithContext::Create(
182182
output_resolution_.dim_size(0), output_resolution_.dim_size(1),
183183
vertex_shader, geometry_shader, fragment_shader, resource, red_clear,
@@ -219,15 +219,14 @@ class RasterizeOp : public tensorflow::OpKernel {
219219
}
220220

221221
private:
222-
tensorflow::Status SetVariables(
223-
tensorflow::OpKernelContext* context,
224-
std::unique_ptr<RasterizerWithContext>& rasterizer, int outer_dim);
225-
tensorflow::Status RenderImage(
226-
tensorflow::OpKernelContext* context,
227-
std::unique_ptr<RasterizerWithContext>& rasterizer,
228-
tensorflow::int64 image_size, float* image_data);
229-
tensorflow::Status ValidateVariables(tensorflow::OpKernelContext* context,
230-
tensorflow::TensorShape* batch_shape);
222+
absl::Status SetVariables(tensorflow::OpKernelContext* context,
223+
std::unique_ptr<RasterizerWithContext>& rasterizer,
224+
int outer_dim);
225+
absl::Status RenderImage(tensorflow::OpKernelContext* context,
226+
std::unique_ptr<RasterizerWithContext>& rasterizer,
227+
tensorflow::int64 image_size, float* image_data);
228+
absl::Status ValidateVariables(tensorflow::OpKernelContext* context,
229+
tensorflow::TensorShape* batch_shape);
231230

232231
std::unique_ptr<ThreadSafeResourcePool<RasterizerWithContext>>
233232
rasterizer_pool_;
@@ -236,18 +235,18 @@ class RasterizeOp : public tensorflow::OpKernel {
236235
tensorflow::TensorShape output_resolution_;
237236
};
238237

239-
tensorflow::Status RasterizeOp::RenderImage(
238+
absl::Status RasterizeOp::RenderImage(
240239
tensorflow::OpKernelContext* context,
241240
std::unique_ptr<RasterizerWithContext>& rasterizer,
242241
const tensorflow::int64 image_size, float* image_data) {
243242
int num_points = context->input(0).scalar<int>()();
244243

245244
TF_RETURN_IF_ERROR(rasterizer->Render(
246245
num_points, absl::MakeSpan(image_data, image_data + image_size)));
247-
return tensorflow::Status();
246+
return absl::Status();
248247
}
249248

250-
tensorflow::Status RasterizeOp::SetVariables(
249+
absl::Status RasterizeOp::SetVariables(
251250
tensorflow::OpKernelContext* context,
252251
std::unique_ptr<RasterizerWithContext>& rasterizer, int outer_dim) {
253252
tensorflow::OpInputList variable_values;
@@ -280,10 +279,10 @@ tensorflow::Status RasterizeOp::SetVariables(
280279
value_pointer + buffer_length * (outer_dim + 1))));
281280
}
282281
}
283-
return tensorflow::Status();
282+
return absl::Status();
284283
}
285284

286-
tensorflow::Status RasterizeOp::ValidateVariables(
285+
absl::Status RasterizeOp::ValidateVariables(
287286
tensorflow::OpKernelContext* context,
288287
tensorflow::TensorShape* batch_shape) {
289288
tensorflow::OpInputList variable_values;
@@ -327,7 +326,7 @@ tensorflow::Status RasterizeOp::ValidateVariables(
327326
*batch_shape);
328327
}
329328
}
330-
return tensorflow::Status();
329+
return absl::Status();
331330
}
332331

333332
// Register kernel with TF

0 commit comments

Comments
 (0)