Commit 7f90dfb6 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Stub out the RasterDecoder

If you patch in https://pastebin.com/k1MTXxYt, this is enough to get poster circle "running" with black tiles.

The magic set of flags to run with this stub are:
--enable-gpu-rasterization --enable-oop-rasterization --enable-gpu-async-worker-context --enable-raster-decoder

Sample LOGs from stub: https://pastebin.com/48sGk6cM

BUG=789238

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I5ce826f68acdfb7ca23a2fb7698d156bf1a7505c
Reviewed-on: https://chromium-review.googlesource.com/820150
Commit-Queue: Jonathan Backer <backer@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarVictor Miura <vmiura@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524728}
parent 10fd28c6
......@@ -119,6 +119,8 @@ target(link_target_type, "service_sources") {
"program_manager.h",
"query_manager.cc",
"query_manager.h",
"raster_decoder.cc",
"raster_decoder.h",
"renderbuffer_manager.cc",
"renderbuffer_manager.h",
"sampler_manager.cc",
......
......@@ -34,10 +34,11 @@ struct GLVersionInfo;
namespace gpu {
struct Capabilities;
class FeatureInfo;
namespace gles2 {
class FeatureInfo;
struct CALayerSharedState {
float opacity;
bool is_clipped;
......
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gpu/command_buffer/service/raster_decoder.h"
#include "base/logging.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "gpu/command_buffer/common/context_result.h"
#include "gpu/command_buffer/common/gles2_cmd_ids.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/shader_translator.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface.h"
// Local versions of the SET_GL_ERROR macros
#define LOCAL_SET_GL_ERROR(error, function_name, msg) \
ERRORSTATE_SET_GL_ERROR(state_.GetErrorState(), error, function_name, msg)
#define LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, value, label) \
ERRORSTATE_SET_GL_ERROR_INVALID_ENUM(state_.GetErrorState(), function_name, \
value, label)
#define LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name) \
ERRORSTATE_COPY_REAL_GL_ERRORS_TO_WRAPPER(state_.GetErrorState(), \
function_name)
#define LOCAL_PEEK_GL_ERROR(function_name) \
ERRORSTATE_PEEK_GL_ERROR(state_.GetErrorState(), function_name)
#define LOCAL_CLEAR_REAL_GL_ERRORS(function_name) \
ERRORSTATE_CLEAR_REAL_GL_ERRORS(state_.GetErrorState(), function_name)
#define LOCAL_PERFORMANCE_WARNING(msg) \
PerformanceWarning(__FILE__, __LINE__, msg)
#define LOCAL_RENDER_WARNING(msg) RenderWarning(__FILE__, __LINE__, msg)
using namespace gpu::gles2;
namespace gpu {
namespace raster {
// TODO(backer): Use a different set of commands.
RasterDecoder::CommandInfo RasterDecoder::command_info[] = {
#define GLES2_CMD_OP(name) \
{ \
nullptr, cmds::name::kArgFlags, cmds::name::cmd_flags, \
sizeof(cmds::name) / sizeof(CommandBufferEntry) - 1, \
}, /* NOLINT */
GLES2_COMMAND_LIST(GLES2_CMD_OP)
#undef GLES2_CMD_OP
};
RasterDecoder::RasterDecoder(GLES2DecoderClient* client,
CommandBufferServiceBase* command_buffer_service,
Outputter* outputter,
ContextGroup* group)
: GLES2Decoder(command_buffer_service, outputter),
commands_to_process_(0),
current_decoder_error_(error::kNoError),
client_(client),
logger_(&debug_marker_manager_, client),
group_(group),
validators_(group_->feature_info()->validators()),
feature_info_(group_->feature_info()),
state_(group_->feature_info(), this, &logger_),
weak_ptr_factory_(this) {}
RasterDecoder::~RasterDecoder() {}
base::WeakPtr<GLES2Decoder> RasterDecoder::AsWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
gpu::ContextResult RasterDecoder::Initialize(
const scoped_refptr<gl::GLSurface>& surface,
const scoped_refptr<gl::GLContext>& context,
bool offscreen,
const DisallowedFeatures& disallowed_features,
const ContextCreationAttribHelper& attrib_helper) {
TRACE_EVENT0("gpu", "RasterDecoder::Initialize");
DCHECK(context->IsCurrent(surface.get()));
DCHECK(!context_.get());
state_.set_api(gl::g_current_gl_context);
set_initialized();
// TODO(backer): Remove temporary hack once we use a separate set of
// commands. Thread safe because Initialize is always called from CrGpuMain
// thread.
static bool updated_command_info = false;
if (!updated_command_info) {
updated_command_info = true;
command_info[cmds::GetString::kCmdId - kFirstGLES2Command].cmd_handler =
&RasterDecoder::HandleGetString;
command_info[cmds::TraceBeginCHROMIUM::kCmdId - kFirstGLES2Command]
.cmd_handler = &RasterDecoder::HandleTraceBeginCHROMIUM;
command_info[cmds::TraceEndCHROMIUM::kCmdId - kFirstGLES2Command]
.cmd_handler = &RasterDecoder::HandleTraceEndCHROMIUM;
command_info[cmds::InsertFenceSyncCHROMIUM::kCmdId - kFirstGLES2Command]
.cmd_handler = &RasterDecoder::HandleInsertFenceSyncCHROMIUM;
command_info[cmds::WaitSyncTokenCHROMIUM::kCmdId - kFirstGLES2Command]
.cmd_handler = &RasterDecoder::HandleWaitSyncTokenCHROMIUM;
}
if (!offscreen) {
return gpu::ContextResult::kFatalFailure;
}
if (group_->gpu_preferences().enable_gpu_debugging)
set_debug(true);
if (group_->gpu_preferences().enable_gpu_command_logging)
set_log_commands(true);
surface_ = surface;
context_ = context;
auto result =
group_->Initialize(this, attrib_helper.context_type, disallowed_features);
if (result != gpu::ContextResult::kSuccess) {
group_ =
nullptr; // Must not destroy ContextGroup if it is not initialized.
Destroy(true);
return result;
}
CHECK_GL_ERROR();
return gpu::ContextResult::kSuccess;
}
void RasterDecoder::Destroy(bool have_context) {}
void RasterDecoder::SetSurface(const scoped_refptr<gl::GLSurface>& surface) {
NOTIMPLEMENTED();
}
void RasterDecoder::ReleaseSurface() {
NOTIMPLEMENTED();
}
void RasterDecoder::TakeFrontBuffer(const Mailbox& mailbox) {
NOTIMPLEMENTED();
}
void RasterDecoder::ReturnFrontBuffer(const Mailbox& mailbox, bool is_lost) {
NOTIMPLEMENTED();
}
bool RasterDecoder::ResizeOffscreenFramebuffer(const gfx::Size& size) {
NOTIMPLEMENTED();
return true;
}
// Make this decoder's GL context current.
bool RasterDecoder::MakeCurrent() {
DCHECK(surface_);
if (!context_.get())
return false;
if (WasContextLost()) {
LOG(ERROR) << " GLES2DecoderImpl: Trying to make lost context current.";
return false;
}
if (!context_->MakeCurrent(surface_.get())) {
LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent.";
MarkContextLost(error::kMakeCurrentFailed);
group_->LoseContexts(error::kUnknown);
return false;
}
return true;
}
GLES2Util* RasterDecoder::GetGLES2Util() {
NOTIMPLEMENTED();
return nullptr;
}
gl::GLContext* RasterDecoder::GetGLContext() {
return context_.get();
}
ContextGroup* RasterDecoder::GetContextGroup() {
NOTIMPLEMENTED();
return nullptr;
}
const FeatureInfo* RasterDecoder::GetFeatureInfo() const {
NOTIMPLEMENTED();
return nullptr;
}
Capabilities RasterDecoder::GetCapabilities() {
gpu::Capabilities caps;
caps.gpu_rasterization = true;
caps.supports_oop_raster = true;
return caps;
}
void RasterDecoder::RestoreState(const ContextState* prev_state) {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreActiveTexture() const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreAllTextureUnitAndSamplerBindings(
const ContextState* prev_state) const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreActiveTextureUnitBinding(unsigned int target) const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreBufferBinding(unsigned int target) {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreBufferBindings() const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreFramebufferBindings() const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreRenderbufferBindings() {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreGlobalState() const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreProgramBindings() const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreTextureState(unsigned service_id) const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreTextureUnitBindings(unsigned unit) const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreVertexAttribArray(unsigned index) {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreAllExternalTextureBindingsIfNeeded() {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreDeviceWindowRectangles() const {
NOTIMPLEMENTED();
}
void RasterDecoder::ClearAllAttributes() const {
NOTIMPLEMENTED();
}
void RasterDecoder::RestoreAllAttributes() const {
NOTIMPLEMENTED();
}
void RasterDecoder::SetIgnoreCachedStateForTest(bool ignore) {
NOTIMPLEMENTED();
}
void RasterDecoder::SetForceShaderNameHashingForTest(bool force) {
NOTIMPLEMENTED();
}
uint32_t RasterDecoder::GetAndClearBackbufferClearBitsForTest() {
NOTIMPLEMENTED();
return 0;
}
size_t RasterDecoder::GetSavedBackTextureCountForTest() {
NOTIMPLEMENTED();
return 0;
}
size_t RasterDecoder::GetCreatedBackTextureCountForTest() {
NOTIMPLEMENTED();
return 0;
}
QueryManager* RasterDecoder::GetQueryManager() {
NOTIMPLEMENTED();
return nullptr;
}
GpuFenceManager* RasterDecoder::GetGpuFenceManager() {
NOTIMPLEMENTED();
return nullptr;
}
FramebufferManager* RasterDecoder::GetFramebufferManager() {
NOTIMPLEMENTED();
return nullptr;
}
TransformFeedbackManager* RasterDecoder::GetTransformFeedbackManager() {
NOTIMPLEMENTED();
return nullptr;
}
VertexArrayManager* RasterDecoder::GetVertexArrayManager() {
NOTIMPLEMENTED();
return nullptr;
}
ImageManager* RasterDecoder::GetImageManagerForTest() {
NOTIMPLEMENTED();
return nullptr;
}
bool RasterDecoder::HasPendingQueries() const {
NOTIMPLEMENTED();
return false;
}
void RasterDecoder::ProcessPendingQueries(bool did_finish) {
NOTIMPLEMENTED();
}
bool RasterDecoder::HasMoreIdleWork() const {
NOTIMPLEMENTED();
return false;
}
void RasterDecoder::PerformIdleWork() {
NOTIMPLEMENTED();
}
bool RasterDecoder::HasPollingWork() const {
NOTIMPLEMENTED();
return false;
}
void RasterDecoder::PerformPollingWork() {
NOTIMPLEMENTED();
}
bool RasterDecoder::GetServiceTextureId(uint32_t client_texture_id,
uint32_t* service_texture_id) {
NOTIMPLEMENTED();
return false;
}
TextureBase* RasterDecoder::GetTextureBase(uint32_t client_id) {
NOTIMPLEMENTED();
return nullptr;
}
bool RasterDecoder::ClearLevel(Texture* texture,
unsigned target,
int level,
unsigned format,
unsigned type,
int xoffset,
int yoffset,
int width,
int height) {
NOTIMPLEMENTED();
return false;
}
bool RasterDecoder::ClearCompressedTextureLevel(Texture* texture,
unsigned target,
int level,
unsigned format,
int width,
int height) {
NOTIMPLEMENTED();
return false;
}
bool RasterDecoder::IsCompressedTextureFormat(unsigned format) {
NOTIMPLEMENTED();
return false;
}
bool RasterDecoder::ClearLevel3D(Texture* texture,
unsigned target,
int level,
unsigned format,
unsigned type,
int width,
int height,
int depth) {
NOTIMPLEMENTED();
return false;
}
ErrorState* RasterDecoder::GetErrorState() {
return state_.GetErrorState();
}
void RasterDecoder::WaitForReadPixels(base::Closure callback) {
NOTIMPLEMENTED();
}
bool RasterDecoder::WasContextLost() const {
return false;
}
bool RasterDecoder::WasContextLostByRobustnessExtension() const {
NOTIMPLEMENTED();
return false;
}
void RasterDecoder::MarkContextLost(error::ContextLostReason reason) {
NOTIMPLEMENTED();
}
bool RasterDecoder::CheckResetStatus() {
NOTIMPLEMENTED();
return false;
}
Logger* RasterDecoder::GetLogger() {
return &logger_;
}
void RasterDecoder::BeginDecoding() {
NOTIMPLEMENTED();
}
void RasterDecoder::EndDecoding() {
NOTIMPLEMENTED();
}
const char* RasterDecoder::GetCommandName(unsigned int command_id) const {
if (command_id >= kFirstGLES2Command && command_id < kNumCommands) {
return gles2::GetCommandName(static_cast<CommandId>(command_id));
}
return GetCommonCommandName(static_cast<cmd::CommandId>(command_id));
}
error::Error RasterDecoder::DoCommands(unsigned int num_commands,
const volatile void* buffer,
int num_entries,
int* entries_processed) {
DCHECK(entries_processed);
commands_to_process_ = num_commands;
error::Error result = error::kNoError;
const volatile CommandBufferEntry* cmd_data =
static_cast<const volatile CommandBufferEntry*>(buffer);
int process_pos = 0;
unsigned int command = 0;
while (process_pos < num_entries && result == error::kNoError &&
commands_to_process_--) {
const unsigned int size = cmd_data->value_header.size;
command = cmd_data->value_header.command;
if (size == 0) {
result = error::kInvalidSize;
break;
}
if (static_cast<int>(size) + process_pos > num_entries) {
result = error::kOutOfBounds;
break;
}
const unsigned int arg_count = size - 1;
unsigned int command_index = command - kFirstGLES2Command;
if (command_index < arraysize(command_info)) {
const CommandInfo& info = command_info[command_index];
unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count);
if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) ||
(info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) {
uint32_t immediate_data_size = (arg_count - info_arg_count) *
sizeof(CommandBufferEntry); // NOLINT
if (info.cmd_handler == nullptr) {
LOG(ERROR) << "[" << logger_.GetLogPrefix() << "] "
<< GetCommandName(command) << "(" << command << ", "
<< command_index << ") is NOTIMPLEMENTED";
} else {
result = (this->*info.cmd_handler)(immediate_data_size, cmd_data);
}
} else {
result = error::kInvalidArguments;
}
} else {
result = DoCommonCommand(command, arg_count, cmd_data);
}
if (result == error::kNoError &&
current_decoder_error_ != error::kNoError) {
result = current_decoder_error_;
current_decoder_error_ = error::kNoError;
}
if (result != error::kDeferCommandUntilLater) {
process_pos += size;
cmd_data += size;
}
}
*entries_processed = process_pos;
if (error::IsError(result)) {
LOG(ERROR) << "Error: " << result << " for Command "
<< GetCommandName(command);
}
return result;
}
const ContextState* RasterDecoder::GetContextState() {
NOTIMPLEMENTED();
return nullptr;
}
scoped_refptr<ShaderTranslatorInterface> RasterDecoder::GetTranslator(
unsigned int type) {
NOTIMPLEMENTED();
return nullptr;
}
void RasterDecoder::BindImage(uint32_t client_texture_id,
uint32_t texture_target,
gl::GLImage* image,
bool can_bind_to_sampler) {
NOTIMPLEMENTED();
}
void RasterDecoder::OnContextLostError() {
NOTIMPLEMENTED();
}
void RasterDecoder::OnOutOfMemoryError() {
NOTIMPLEMENTED();
}
error::Error RasterDecoder::HandleTraceBeginCHROMIUM(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::TraceBeginCHROMIUM& c =
*static_cast<const volatile gles2::cmds::TraceBeginCHROMIUM*>(cmd_data);
Bucket* category_bucket = GetBucket(c.category_bucket_id);
Bucket* name_bucket = GetBucket(c.name_bucket_id);
if (!category_bucket || category_bucket->size() == 0 || !name_bucket ||
name_bucket->size() == 0) {
return error::kInvalidArguments;
}
std::string category_name;
std::string trace_name;
if (!category_bucket->GetAsString(&category_name) ||
!name_bucket->GetAsString(&trace_name)) {
return error::kInvalidArguments;
}
debug_marker_manager_.PushGroup(trace_name);
return error::kNoError;
}
error::Error RasterDecoder::HandleTraceEndCHROMIUM(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
debug_marker_manager_.PopGroup();
return error::kNoError;
}
error::Error RasterDecoder::HandleInsertFenceSyncCHROMIUM(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::InsertFenceSyncCHROMIUM& c =
*static_cast<const volatile gles2::cmds::InsertFenceSyncCHROMIUM*>(
cmd_data);
const uint64_t release_count = c.release_count();
client_->OnFenceSyncRelease(release_count);
// Exit inner command processing loop so that we check the scheduling state
// and yield if necessary as we may have unblocked a higher priority context.
ExitCommandProcessingEarly();
return error::kNoError;
}
error::Error RasterDecoder::HandleWaitSyncTokenCHROMIUM(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::WaitSyncTokenCHROMIUM& c =
*static_cast<const volatile gles2::cmds::WaitSyncTokenCHROMIUM*>(
cmd_data);
const gpu::CommandBufferNamespace kMinNamespaceId =
gpu::CommandBufferNamespace::INVALID;
const gpu::CommandBufferNamespace kMaxNamespaceId =
gpu::CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES;
gpu::CommandBufferNamespace namespace_id =
static_cast<gpu::CommandBufferNamespace>(c.namespace_id);
if ((namespace_id < static_cast<int32_t>(kMinNamespaceId)) ||
(namespace_id >= static_cast<int32_t>(kMaxNamespaceId))) {
namespace_id = gpu::CommandBufferNamespace::INVALID;
}
const CommandBufferId command_buffer_id =
CommandBufferId::FromUnsafeValue(c.command_buffer_id());
const uint64_t release = c.release_count();
gpu::SyncToken sync_token;
sync_token.Set(namespace_id, 0, command_buffer_id, release);
return client_->OnWaitSyncToken(sync_token) ? error::kDeferCommandUntilLater
: error::kNoError;
}
error::Error RasterDecoder::HandleGetString(uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::GetString& c =
*static_cast<const volatile gles2::cmds::GetString*>(cmd_data);
GLenum name = static_cast<GLenum>(c.name);
// TODO(backer): Passthrough decoder does not validate. It's possible that
// we don't have a validator there.
if (!validators_->string_type.IsValid(name)) {
LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name");
return error::kNoError;
}
const char* str = nullptr;
std::string extensions;
switch (name) {
case GL_VERSION:
str = GetServiceVersionString(feature_info_.get());
break;
case GL_SHADING_LANGUAGE_VERSION:
str = GetServiceShadingLanguageVersionString(feature_info_.get());
break;
case GL_EXTENSIONS: {
str = "";
NOTIMPLEMENTED();
break;
}
default:
str = reinterpret_cast<const char*>(api()->glGetStringFn(name));
break;
}
Bucket* bucket = CreateBucket(c.bucket_id);
bucket->SetFromString(str);
return error::kNoError;
}
} // namespace raster
} // namespace gpu
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_COMMAND_BUFFER_SERVICE_RASTER_DECODER_H_
#define GPU_COMMAND_BUFFER_SERVICE_RASTER_DECODER_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "gpu/command_buffer/common/command_buffer_id.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/common/context_result.h"
#include "gpu/command_buffer/common/debug_marker_manager.h"
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "gpu/command_buffer/service/context_state.h"
#include "gpu/command_buffer/service/error_state.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/gles2_cmd_validation.h"
#include "gpu/command_buffer/service/logger.h"
#include "gpu/gpu_export.h"
namespace gpu {
namespace raster {
// This class implements the AsyncAPIInterface interface, decoding
// RasterInterface commands and calling GL.
class GPU_EXPORT RasterDecoder : public gles2::GLES2Decoder,
public gles2::ErrorStateClient {
public:
RasterDecoder(gles2::GLES2DecoderClient* client,
CommandBufferServiceBase* command_buffer_service,
gles2::Outputter* outputter,
gles2::ContextGroup* group);
~RasterDecoder() override;
// GLES2Decoder implementation.
base::WeakPtr<GLES2Decoder> AsWeakPtr() override;
gpu::ContextResult Initialize(
const scoped_refptr<gl::GLSurface>& surface,
const scoped_refptr<gl::GLContext>& context,
bool offscreen,
const gles2::DisallowedFeatures& disallowed_features,
const gles2::ContextCreationAttribHelper& attrib_helper) override;
void Destroy(bool have_context) override;
void SetSurface(const scoped_refptr<gl::GLSurface>& surface) override;
void ReleaseSurface() override;
void TakeFrontBuffer(const Mailbox& mailbox) override;
void ReturnFrontBuffer(const Mailbox& mailbox, bool is_lost) override;
bool ResizeOffscreenFramebuffer(const gfx::Size& size) override;
bool MakeCurrent() override;
gles2::GLES2Util* GetGLES2Util() override;
gl::GLContext* GetGLContext() override;
gles2::ContextGroup* GetContextGroup() override;
const gles2::FeatureInfo* GetFeatureInfo() const override;
Capabilities GetCapabilities() override;
void RestoreState(const gles2::ContextState* prev_state) override;
void RestoreActiveTexture() const override;
void RestoreAllTextureUnitAndSamplerBindings(
const gles2::ContextState* prev_state) const override;
void RestoreActiveTextureUnitBinding(unsigned int target) const override;
void RestoreBufferBinding(unsigned int target) override;
void RestoreBufferBindings() const override;
void RestoreFramebufferBindings() const override;
void RestoreRenderbufferBindings() override;
void RestoreGlobalState() const override;
void RestoreProgramBindings() const override;
void RestoreTextureState(unsigned service_id) const override;
void RestoreTextureUnitBindings(unsigned unit) const override;
void RestoreVertexAttribArray(unsigned index) override;
void RestoreAllExternalTextureBindingsIfNeeded() override;
void RestoreDeviceWindowRectangles() const override;
void ClearAllAttributes() const override;
void RestoreAllAttributes() const override;
void SetIgnoreCachedStateForTest(bool ignore) override;
void SetForceShaderNameHashingForTest(bool force) override;
uint32_t GetAndClearBackbufferClearBitsForTest() override;
size_t GetSavedBackTextureCountForTest() override;
size_t GetCreatedBackTextureCountForTest() override;
gles2::QueryManager* GetQueryManager() override;
gles2::GpuFenceManager* GetGpuFenceManager() override;
gles2::FramebufferManager* GetFramebufferManager() override;
gles2::TransformFeedbackManager* GetTransformFeedbackManager() override;
gles2::VertexArrayManager* GetVertexArrayManager() override;
gles2::ImageManager* GetImageManagerForTest() override;
bool HasPendingQueries() const override;
void ProcessPendingQueries(bool did_finish) override;
bool HasMoreIdleWork() const override;
void PerformIdleWork() override;
bool HasPollingWork() const override;
void PerformPollingWork() override;
bool GetServiceTextureId(uint32_t client_texture_id,
uint32_t* service_texture_id) override;
gles2::TextureBase* GetTextureBase(uint32_t client_id) override;
bool ClearLevel(gles2::Texture* texture,
unsigned target,
int level,
unsigned format,
unsigned type,
int xoffset,
int yoffset,
int width,
int height) override;
bool ClearCompressedTextureLevel(gles2::Texture* texture,
unsigned target,
int level,
unsigned format,
int width,
int height) override;
bool IsCompressedTextureFormat(unsigned format) override;
bool ClearLevel3D(gles2::Texture* texture,
unsigned target,
int level,
unsigned format,
unsigned type,
int width,
int height,
int depth) override;
gles2::ErrorState* GetErrorState() override;
void WaitForReadPixels(base::Closure callback) override;
bool WasContextLost() const override;
bool WasContextLostByRobustnessExtension() const override;
void MarkContextLost(error::ContextLostReason reason) override;
bool CheckResetStatus() override;
gles2::Logger* GetLogger() override;
void BeginDecoding() override;
void EndDecoding() override;
const char* GetCommandName(unsigned int command_id) const;
error::Error DoCommands(unsigned int num_commands,
const volatile void* buffer,
int num_entries,
int* entries_processed) override;
const gles2::ContextState* GetContextState() override;
scoped_refptr<gles2::ShaderTranslatorInterface> GetTranslator(
unsigned int type) override;
void BindImage(uint32_t client_texture_id,
uint32_t texture_target,
gl::GLImage* image,
bool can_bind_to_sampler) override;
// ErrorClientState implementation.
void OnContextLostError() override;
void OnOutOfMemoryError() override;
private:
gl::GLApi* api() const { return state_.api(); }
// Set remaining commands to process to 0 to force DoCommands to return
// and allow context preemption and GPU watchdog checks in CommandExecutor().
void ExitCommandProcessingEarly() { commands_to_process_ = 0; }
error::Error HandleGetString(uint32_t immediate_data_size,
const volatile void* cmd_data);
error::Error HandleTraceBeginCHROMIUM(uint32_t immediate_data_size,
const volatile void* cmd_data);
error::Error HandleTraceEndCHROMIUM(uint32_t immediate_data_size,
const volatile void* cmd_data);
error::Error HandleInsertFenceSyncCHROMIUM(uint32_t immediate_data_size,
const volatile void* cmd_data);
error::Error HandleWaitSyncTokenCHROMIUM(uint32_t immediate_data_size,
const volatile void* cmd_data);
typedef gpu::gles2::GLES2Decoder::Error (RasterDecoder::*CmdHandler)(
uint32_t immediate_data_size,
const volatile void* data);
// A struct to hold info about each command.
struct CommandInfo {
CmdHandler cmd_handler;
uint8_t arg_flags; // How to handle the arguments for this command
uint8_t cmd_flags; // How to handle this command
uint16_t arg_count; // How many arguments are expected for this command.
};
// A table of CommandInfo for all the commands.
static CommandInfo
command_info[gles2::kNumCommands - gles2::kFirstGLES2Command];
// Number of commands remaining to be processed in DoCommands().
int commands_to_process_;
// The current decoder error communicates the decoder error through command
// processing functions that do not return the error value. Should be set
// only if not returning an error.
error::Error current_decoder_error_;
scoped_refptr<gl::GLSurface> surface_;
scoped_refptr<gl::GLContext> context_;
gles2::GLES2DecoderClient* client_;
gles2::DebugMarkerManager debug_marker_manager_;
gles2::Logger logger_;
// The ContextGroup for this decoder uses to track resources.
scoped_refptr<gles2::ContextGroup> group_;
const gles2::Validators* validators_;
scoped_refptr<gles2::FeatureInfo> feature_info_;
// All the state for this context.
gles2::ContextState state_;
base::WeakPtrFactory<gles2::GLES2Decoder> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(RasterDecoder);
};
} // namespace raster
} // namespace gpu
#endif // GPU_COMMAND_BUFFER_SERVICE_RASTER_DECODER_H_
......@@ -20,6 +20,7 @@
#include "gpu/command_buffer/service/logger.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/command_buffer/service/raster_decoder.h"
#include "gpu/command_buffer/service/service_utils.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "gpu/command_buffer/service/transfer_buffer_manager.h"
......@@ -130,7 +131,7 @@ gpu::ContextResult RasterCommandBufferStub::Initialize(
command_buffer_ = std::make_unique<CommandBufferService>(
this, context_group_->transfer_buffer_manager());
decoder_.reset(gles2::GLES2Decoder::Create(
decoder_.reset(new raster::RasterDecoder(
this, command_buffer_.get(), manager->outputter(), context_group_.get()));
sync_point_client_state_ =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment