diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 22:57:44 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 22:57:44 +0000 |
commit | 2c1639589b5932b565c9d420cb79b56a4212a706 (patch) | |
tree | d74cd853d4753f9c19e5d50ad58d156a33417806 /o3d/core | |
parent | 2e29d9243d84374d861a86252a2923cba9e49941 (diff) | |
download | chromium_src-2c1639589b5932b565c9d420cb79b56a4212a706.zip chromium_src-2c1639589b5932b565c9d420cb79b56a4212a706.tar.gz chromium_src-2c1639589b5932b565c9d420cb79b56a4212a706.tar.bz2 |
Fixes to get renderer=cb cb_service=gl to compile
again.
I was working on spliting some of the command buffer
code in preparation for GL command buffers so those
changes are in there as well. I didn't realize the
gl command buffers were broken.
I'm planning on sharing some of the command buffer
code and commands so I thought about making the
command buffers into 2 parts. The first N (256?)
commands are common commands. Noop, SetToken, Jump
Gosub. Those will be handled by common code.
After that come the O3D or GL command buffer
commands. I'm not sure that's a good idea but
there is a significant amount of code in managing
tokens and parsing etc and it seems like it would
be nice to share it until/if we delete the O3D
command buffers.
Note: You'll see that SetToken is hardcoded to 1.
I plan to fix that in the next CL when I split
the command into shared vs specific.
Review URL: http://codereview.chromium.org/307043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
24 files changed, 105 insertions, 76 deletions
diff --git a/o3d/core/cross/command_buffer/buffer_cb.cc b/o3d/core/cross/command_buffer/buffer_cb.cc index 2809d7f..2d8d890 100644 --- a/o3d/core/cross/command_buffer/buffer_cb.cc +++ b/o3d/core/cross/command_buffer/buffer_cb.cc @@ -34,12 +34,12 @@ #include "core/cross/precompile.h" #include "core/cross/command_buffer/buffer_cb.h" -#include "command_buffer/client/cross/cmd_buffer_helper.h" +#include "command_buffer/client/cross/o3d_cmd_helper.h" #include "command_buffer/client/cross/fenced_allocator.h" namespace o3d { using command_buffer::CommandBufferEntry; -using command_buffer::CommandBufferHelper; +using command_buffer::O3DCmdHelper; using command_buffer::FencedAllocator; VertexBufferCB::VertexBufferCB(ServiceLocator* service_locator, @@ -59,7 +59,7 @@ VertexBufferCB::~VertexBufferCB() { // Sends the DestroyVertexBuffer command, and frees the ID from the allocator. void VertexBufferCB::ConcreteFree() { if (resource_id_ != command_buffer::kInvalidResource) { - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->DestroyVertexBuffer(resource_id_); renderer_->vertex_buffer_ids().FreeID(resource_id_); resource_id_ = command_buffer::kInvalidResource; @@ -71,7 +71,7 @@ bool VertexBufferCB::ConcreteAllocate(size_t size_in_bytes) { ConcreteFree(); if (size_in_bytes > 0) { resource_id_ = renderer_->vertex_buffer_ids().AllocateID(); - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->CreateVertexBuffer(resource_id_, size_in_bytes, command_buffer::vertex_buffer::kNone); has_data_ = false; @@ -89,7 +89,7 @@ bool VertexBufferCB::ConcreteLock(AccessMode access_mode, void **buffer_data) { lock_pointer_ = renderer_->allocator()->Alloc(GetSizeInBytes()); if (!lock_pointer_) return false; if (has_data_) { - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->GetVertexBufferData( resource_id_, 0, GetSizeInBytes(), renderer_->transfer_shm_id(), @@ -105,7 +105,7 @@ bool VertexBufferCB::ConcreteLock(AccessMode access_mode, void **buffer_data) { bool VertexBufferCB::ConcreteUnlock() { if (GetSizeInBytes() == 0 || !lock_pointer_) return false; - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->SetVertexBufferData( resource_id_, 0, GetSizeInBytes(), renderer_->transfer_shm_id(), @@ -135,7 +135,7 @@ IndexBufferCB::~IndexBufferCB() { // Sends the DestroyIndexBuffer command, and frees the ID from the allocator. void IndexBufferCB::ConcreteFree() { if (resource_id_ != command_buffer::kInvalidResource) { - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->DestroyIndexBuffer(resource_id_); renderer_->index_buffer_ids().FreeID(resource_id_); resource_id_ = command_buffer::kInvalidResource; @@ -147,7 +147,7 @@ bool IndexBufferCB::ConcreteAllocate(size_t size_in_bytes) { ConcreteFree(); if (size_in_bytes > 0) { resource_id_ = renderer_->index_buffer_ids().AllocateID(); - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->CreateIndexBuffer( resource_id_, size_in_bytes, command_buffer::index_buffer::kIndex32Bit); @@ -166,7 +166,7 @@ bool IndexBufferCB::ConcreteLock(AccessMode access_mode, void **buffer_data) { lock_pointer_ = renderer_->allocator()->Alloc(GetSizeInBytes()); if (!lock_pointer_) return false; if (has_data_) { - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->GetIndexBufferData( resource_id_, 0, GetSizeInBytes(), renderer_->transfer_shm_id(), @@ -182,7 +182,7 @@ bool IndexBufferCB::ConcreteLock(AccessMode access_mode, void **buffer_data) { bool IndexBufferCB::ConcreteUnlock() { if (GetSizeInBytes() == 0 || !lock_pointer_) return false; - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->SetIndexBufferData( resource_id_, 0, GetSizeInBytes(), renderer_->transfer_shm_id(), diff --git a/o3d/core/cross/command_buffer/effect_cb.cc b/o3d/core/cross/command_buffer/effect_cb.cc index 172d717..a3b0260 100644 --- a/o3d/core/cross/command_buffer/effect_cb.cc +++ b/o3d/core/cross/command_buffer/effect_cb.cc @@ -40,12 +40,12 @@ #include "command_buffer/common/cross/constants.h" #include "command_buffer/common/cross/cmd_buffer_format.h" #include "command_buffer/client/cross/fenced_allocator.h" -#include "command_buffer/client/cross/cmd_buffer_helper.h" +#include "command_buffer/client/cross/o3d_cmd_helper.h" namespace o3d { using command_buffer::CommandBufferEntry; -using command_buffer::CommandBufferHelper; +using command_buffer::O3DCmdHelper; using command_buffer::ResourceId; namespace effect_param = command_buffer::effect_param; namespace parse_error = command_buffer::parse_error; @@ -91,7 +91,7 @@ bool EffectCB::LoadFromFXString(const String& source) { ResourceId resource_id = renderer_->effect_ids().AllocateID(); - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->CreateEffect( resource_id, source_size, renderer_->transfer_shm_id(), @@ -136,7 +136,7 @@ void EffectCB::Destroy() { set_source(""); ++generation_; if (resource_id_ != command_buffer::kInvalidResource) { - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->DestroyEffect(resource_id_); renderer_->effect_ids().FreeID(resource_id_); resource_id_ = command_buffer::kInvalidResource; diff --git a/o3d/core/cross/command_buffer/param_cache_cb.cc b/o3d/core/cross/command_buffer/param_cache_cb.cc index 297be90..db3d0d7 100644 --- a/o3d/core/cross/command_buffer/param_cache_cb.cc +++ b/o3d/core/cross/command_buffer/param_cache_cb.cc @@ -40,12 +40,12 @@ #include "core/cross/command_buffer/param_cache_cb.h" #include "core/cross/command_buffer/sampler_cb.h" #include "command_buffer/common/cross/cmd_buffer_format.h" -#include "command_buffer/client/cross/cmd_buffer_helper.h" +#include "command_buffer/client/cross/o3d_cmd_helper.h" namespace o3d { using command_buffer::CommandBufferEntry; -using command_buffer::CommandBufferHelper; +using command_buffer::O3DCmdHelper; using command_buffer::EffectHelper; using command_buffer::ResourceId; namespace effect_param = command_buffer::effect_param; @@ -54,7 +54,7 @@ namespace effect_param = command_buffer::effect_param; class ParamHandlerCB { public: virtual ~ParamHandlerCB() {} - virtual void SetValue(CommandBufferHelper *helper) = 0; + virtual void SetValue(O3DCmdHelper* helper) = 0; }; // Template implementation of ParamHandlerCB. @@ -69,7 +69,7 @@ class TypedParamHandlerCB : public ParamHandlerCB { // Sends the param value to the service. // This template definition only works for value types (floatn, matrix, int, // ..., but not textures or samplers). - virtual void SetValue(CommandBufferHelper *helper) { + virtual void SetValue(O3DCmdHelper* helper) { typename T::DataType value = param_->value(); helper->SetParamDataImmediate(id_, sizeof(value), &value); } @@ -91,7 +91,7 @@ class MatrixParamHandlerColumnsCB : public ParamHandlerCB { } // Sends the param value to the service. - virtual void SetValue(CommandBufferHelper *helper) { + virtual void SetValue(O3DCmdHelper* helper) { Matrix4 value = transpose(param_->value()); helper->SetParamDataImmediate(id_, sizeof(value), &value); } @@ -108,7 +108,7 @@ class SamplerParamHandlerCB : public ParamHandlerCB { } // Sends the param value to the service. - virtual void SetValue(CommandBufferHelper *helper) { + virtual void SetValue(O3DCmdHelper* helper) { SamplerCB *sampler = down_cast<SamplerCB *>(param_->value()); uint32 value; if (!sampler) { @@ -277,7 +277,7 @@ void ParamCacheCB::ClearHandlers() { handlers_.clear(); } -void ParamCacheCB::RunHandlers(CommandBufferHelper *helper) { +void ParamCacheCB::RunHandlers(O3DCmdHelper* helper) { for (unsigned int i = 0; i < handlers_.size(); ++i) { handlers_[i]->SetValue(helper); } diff --git a/o3d/core/cross/command_buffer/param_cache_cb.h b/o3d/core/cross/command_buffer/param_cache_cb.h index b8fd536..b96430c 100644 --- a/o3d/core/cross/command_buffer/param_cache_cb.h +++ b/o3d/core/cross/command_buffer/param_cache_cb.h @@ -59,7 +59,7 @@ class ParamCacheCB : public ParamCache { ParamObject* override); // Runs all the cached handlers. - void RunHandlers(command_buffer::CommandBufferHelper *helper); + void RunHandlers(command_buffer::O3DCmdHelper* helper); protected: // Validates platform specific information about the effect. diff --git a/o3d/core/cross/command_buffer/primitive_cb.cc b/o3d/core/cross/command_buffer/primitive_cb.cc index a451662..a5418d4 100644 --- a/o3d/core/cross/command_buffer/primitive_cb.cc +++ b/o3d/core/cross/command_buffer/primitive_cb.cc @@ -41,14 +41,14 @@ #include "core/cross/command_buffer/stream_bank_cb.h" #include "core/cross/error.h" #include "command_buffer/common/cross/gapi_interface.h" -#include "command_buffer/client/cross/cmd_buffer_helper.h" +#include "command_buffer/client/cross/o3d_cmd_helper.h" // TODO: add unit tests. namespace o3d { using command_buffer::ResourceId; -using command_buffer::CommandBufferHelper; +using command_buffer::O3DCmdHelper; using command_buffer::CommandBufferEntry; using command_buffer::GAPIInterface; using command_buffer::kInvalidResource; @@ -128,7 +128,7 @@ void PrimitiveCB::PlatformSpecificRender(Renderer* renderer, stream_bank_cb->BindStreamsForRendering(); - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); // Sets current effect. // TODO: cache current effect ? diff --git a/o3d/core/cross/command_buffer/render_surface_cb.cc b/o3d/core/cross/command_buffer/render_surface_cb.cc index df90b49..2b66d98 100644 --- a/o3d/core/cross/command_buffer/render_surface_cb.cc +++ b/o3d/core/cross/command_buffer/render_surface_cb.cc @@ -31,13 +31,13 @@ #include "core/cross/command_buffer/render_surface_cb.h" -#include "command_buffer/client/cross/cmd_buffer_helper.h" +#include "command_buffer/client/cross/o3d_cmd_helper.h" namespace o3d { using command_buffer::ResourceId; using command_buffer::CommandBufferEntry; -using command_buffer::CommandBufferHelper; +using command_buffer::O3DCmdHelper; RenderSurfaceCB::RenderSurfaceCB(ServiceLocator *service_locator, int width, @@ -57,7 +57,7 @@ RenderSurfaceCB::RenderSurfaceCB(ServiceLocator *service_locator, ResourceId id = renderer_->render_surface_ids().AllocateID(); resource_id_ = id; - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->CreateRenderSurface( id, reinterpret_cast<uint32>(texture->GetTextureHandle()), @@ -71,7 +71,7 @@ RenderSurfaceCB::~RenderSurfaceCB() { void RenderSurfaceCB::Destroy() { // This should never be called during rendering. if (resource_id_ != command_buffer::kInvalidResource) { - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->DestroyRenderSurface(resource_id_); renderer_->render_surface_ids().FreeID(resource_id_); resource_id_ = command_buffer::kInvalidResource; @@ -91,13 +91,13 @@ RenderDepthStencilSurfaceCB::RenderDepthStencilSurfaceCB( DCHECK(renderer); ResourceId id = renderer_->depth_surface_ids().AllocateID(); resource_id_ = id; - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->CreateDepthSurface(id, width, height); } void RenderDepthStencilSurfaceCB::Destroy() { if (resource_id_ != command_buffer::kInvalidResource) { - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->DestroyDepthSurface(resource_id_); renderer_->depth_surface_ids().FreeID(resource_id_); resource_id_ = command_buffer::kInvalidResource; diff --git a/o3d/core/cross/command_buffer/renderer_cb.cc b/o3d/core/cross/command_buffer/renderer_cb.cc index 4db474f..985bc74 100644 --- a/o3d/core/cross/command_buffer/renderer_cb.cc +++ b/o3d/core/cross/command_buffer/renderer_cb.cc @@ -34,7 +34,7 @@ #include "core/cross/precompile.h" -#include "command_buffer/client/cross/cmd_buffer_helper.h" +#include "command_buffer/client/cross/o3d_cmd_helper.h" #include "command_buffer/client/cross/fenced_allocator.h" #include "command_buffer/common/cross/gapi_interface.h" #include "core/cross/command_buffer/buffer_cb.h" @@ -57,7 +57,7 @@ namespace o3d { using command_buffer::GAPIInterface; -using command_buffer::CommandBufferHelper; +using command_buffer::O3DCmdHelper; using gpu_plugin::CommandBuffer; using gpu_plugin::GPUProcessor; using gpu_plugin::NPBrowser; @@ -291,8 +291,8 @@ Renderer::InitStatus RendererCB::InitPlatformSpecific( command_buffer_ = display_platform.command_buffer(); DCHECK(command_buffer_.Get()); - // Create and initialize a CommandBufferHelper. - helper_ = new CommandBufferHelper(npp_, command_buffer_); + // Create and initialize a O3DCmdHelper. + helper_ = new O3DCmdHelper(npp_, command_buffer_); if (!helper_->Initialize()) { Destroy(); return INITIALIZATION_ERROR; diff --git a/o3d/core/cross/command_buffer/renderer_cb.h b/o3d/core/cross/command_buffer/renderer_cb.h index 5668c21..76aad8b 100644 --- a/o3d/core/cross/command_buffer/renderer_cb.h +++ b/o3d/core/cross/command_buffer/renderer_cb.h @@ -46,7 +46,7 @@ namespace o3d { namespace command_buffer { -class CommandBufferHelper; +class O3DCmdHelper; class BufferSyncInterface; class FencedAllocatorWrapper; } // namespace command_buffer @@ -162,7 +162,7 @@ class RendererCB : public Renderer { IdAllocator &depth_surface_ids() { return depth_surface_ids_; } // Gets the command buffer helper. - command_buffer::CommandBufferHelper *helper() const { return helper_; } + command_buffer::O3DCmdHelper *helper() const { return helper_; } // Gets the registered ID of the transfer shared memory. int32 transfer_shm_id() const { return transfer_shm_id_; } @@ -260,7 +260,7 @@ class RendererCB : public Renderer { void *transfer_shm_address_; NPP npp_; gpu_plugin::NPObjectPointer<NPObject> command_buffer_; - command_buffer::CommandBufferHelper *helper_; + command_buffer::O3DCmdHelper *helper_; FencedAllocatorWrapper *allocator_; IdAllocator vertex_buffer_ids_; diff --git a/o3d/core/cross/command_buffer/sampler_cb.cc b/o3d/core/cross/command_buffer/sampler_cb.cc index a327595..25c945b 100644 --- a/o3d/core/cross/command_buffer/sampler_cb.cc +++ b/o3d/core/cross/command_buffer/sampler_cb.cc @@ -37,12 +37,12 @@ #include "core/cross/command_buffer/sampler_cb.h" #include "core/cross/command_buffer/renderer_cb.h" #include "command_buffer/common/cross/cmd_buffer_format.h" -#include "command_buffer/client/cross/cmd_buffer_helper.h" +#include "command_buffer/client/cross/o3d_cmd_helper.h" namespace o3d { using command_buffer::CommandBufferEntry; -using command_buffer::CommandBufferHelper; +using command_buffer::O3DCmdHelper; using command_buffer::ResourceId; namespace sampler = command_buffer::sampler; @@ -94,7 +94,7 @@ SamplerCB::~SamplerCB() { } void SamplerCB::SetTextureAndStates() { - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); sampler::AddressingMode address_mode_u_cb = AddressModeToCB(address_mode_u()); sampler::AddressingMode address_mode_v_cb = AddressModeToCB(address_mode_v()); sampler::AddressingMode address_mode_w_cb = AddressModeToCB(address_mode_w()); diff --git a/o3d/core/cross/command_buffer/stream_bank_cb.cc b/o3d/core/cross/command_buffer/stream_bank_cb.cc index ade0c4a..86997da 100644 --- a/o3d/core/cross/command_buffer/stream_bank_cb.cc +++ b/o3d/core/cross/command_buffer/stream_bank_cb.cc @@ -40,14 +40,14 @@ #include "core/cross/command_buffer/effect_cb.h" #include "core/cross/command_buffer/stream_bank_cb.h" #include "command_buffer/common/cross/gapi_interface.h" -#include "command_buffer/client/cross/cmd_buffer_helper.h" +#include "command_buffer/client/cross/o3d_cmd_helper.h" // TODO: add unit tests. namespace o3d { using command_buffer::ResourceId; -using command_buffer::CommandBufferHelper; +using command_buffer::O3DCmdHelper; using command_buffer::CommandBufferEntry; using command_buffer::GAPIInterface; using command_buffer::kInvalidResource; @@ -146,7 +146,7 @@ void StreamBankCB::OnUpdateStreams() { void StreamBankCB::CreateVertexStruct() { DCHECK_EQ(kInvalidResource, vertex_struct_id_); vertex_struct_id_ = renderer_->vertex_structs_ids().AllocateID(); - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->CreateVertexStruct(vertex_struct_id_, vertex_stream_params_.size()); for (unsigned int i = 0; i < vertex_stream_params_.size(); ++i) { const Stream &stream = vertex_stream_params_[i]->stream(); @@ -181,7 +181,7 @@ void StreamBankCB::CreateVertexStruct() { // Destroys the vertex struct resource on the service side. void StreamBankCB::DestroyVertexStruct() { if (vertex_struct_id_ != kInvalidResource) { - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->DestroyVertexStruct(vertex_struct_id_); renderer_->vertex_structs_ids().FreeID(vertex_struct_id_); vertex_struct_id_ = kInvalidResource; @@ -191,7 +191,7 @@ void StreamBankCB::DestroyVertexStruct() { void StreamBankCB::BindStreamsForRendering() { if (vertex_struct_id_ == kInvalidResource) CreateVertexStruct(); - CommandBufferHelper *helper = renderer_->helper(); + O3DCmdHelper* helper = renderer_->helper(); helper->SetVertexStruct(vertex_struct_id_); } diff --git a/o3d/core/cross/command_buffer/texture_cb.cc b/o3d/core/cross/command_buffer/texture_cb.cc index 3b6b32d..0ef1ee4 100644 --- a/o3d/core/cross/command_buffer/texture_cb.cc +++ b/o3d/core/cross/command_buffer/texture_cb.cc @@ -40,13 +40,13 @@ #include "command_buffer/common/cross/cmd_buffer_format.h" #include "command_buffer/common/cross/resource.h" -#include "command_buffer/client/cross/cmd_buffer_helper.h" +#include "command_buffer/client/cross/o3d_cmd_helper.h" #include "command_buffer/client/cross/fenced_allocator.h" namespace o3d { using command_buffer::CommandBufferEntry; -using command_buffer::CommandBufferHelper; +using command_buffer::O3DCmdHelper; using command_buffer::FencedAllocatorWrapper; using command_buffer::ResourceId; namespace texture = command_buffer::texture; @@ -135,7 +135,7 @@ void SetTextureData(RendererCB *renderer, size_t mip_size, unsigned char* mip_data) { FencedAllocatorWrapper *allocator = renderer->allocator(); - CommandBufferHelper *helper = renderer->helper(); + O3DCmdHelper* helper = renderer->helper(); helper->SetTextureData( texture_id, x, y, z, @@ -157,7 +157,7 @@ void UpdateResourceFromBitmap(RendererCB *renderer, const Bitmap &bitmap) { DCHECK(bitmap.image_data()); FencedAllocatorWrapper *allocator = renderer->allocator(); - CommandBufferHelper *helper = renderer->helper(); + O3DCmdHelper* helper = renderer->helper(); unsigned int mip_width = std::max(1U, bitmap.width() >> level); unsigned int mip_height = std::max(1U, bitmap.height() >> level); unsigned char *mip_data = bitmap.GetMipData(level); @@ -192,7 +192,7 @@ void CopyBackResourceToBitmap(RendererCB *renderer, const Bitmap &bitmap) { DCHECK(bitmap.image_data()); FencedAllocatorWrapper *allocator = renderer->allocator(); - CommandBufferHelper *helper = renderer->helper(); + O3DCmdHelper* helper = renderer->helper(); unsigned int mip_width = std::max(1U, bitmap.width() >> level); unsigned int mip_height = std::max(1U, bitmap.height() >> level); size_t mip_size = diff --git a/o3d/core/cross/gl/buffer_gl.h b/o3d/core/cross/gl/buffer_gl.h index e2f287c..69d34a1 100644 --- a/o3d/core/cross/gl/buffer_gl.h +++ b/o3d/core/cross/gl/buffer_gl.h @@ -37,6 +37,7 @@ #define O3D_CORE_CROSS_GL_BUFFER_GL_H_ #include "core/cross/buffer.h" +#include "core/cross/gl/gl_headers.h" namespace o3d { diff --git a/o3d/core/cross/gl/effect_gl.cc b/o3d/core/cross/gl/effect_gl.cc index a161d3e..4a61e37 100644 --- a/o3d/core/cross/gl/effect_gl.cc +++ b/o3d/core/cross/gl/effect_gl.cc @@ -41,7 +41,6 @@ #pragma warning(disable : 4311) #endif -#include "Cg/cgGL.h" #include <sstream> #include "base/cross/std_functional.h" #include "core/cross/semantic_manager.h" diff --git a/o3d/core/cross/gl/effect_gl.h b/o3d/core/cross/gl/effect_gl.h index 3273055..1d9b81f 100644 --- a/o3d/core/cross/gl/effect_gl.h +++ b/o3d/core/cross/gl/effect_gl.h @@ -45,6 +45,7 @@ #include <utility> #include <vector> #include <map> +#include "core/cross/gl/gl_headers.h" #include "core/cross/effect.h" #include "core/cross/gl/utils_gl.h" diff --git a/o3d/core/cross/gl/gl_headers.h b/o3d/core/cross/gl/gl_headers.h new file mode 100644 index 0000000..e800997 --- /dev/null +++ b/o3d/core/cross/gl/gl_headers.h @@ -0,0 +1,43 @@ +/*
+ * Copyright 2009, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef O3D_CORE_CROSS_GL_GL_HEADERS_H_
+#define O3D_CORE_CROSS_GL_GL_HEADERS_H_
+
+#include <GL/glew.h>
+#if defined(OS_WIN)
+#include <GL/wglew.h>
+#endif
+#include <Cg/cg.h>
+#include <Cg/cgGL.h>
+
+#endif // O3D_CORE_CROSS_GL_GL_HEADERS_H_
+
diff --git a/o3d/core/cross/gl/param_cache_gl.h b/o3d/core/cross/gl/param_cache_gl.h index bfd9aea..52731cd 100644 --- a/o3d/core/cross/gl/param_cache_gl.h +++ b/o3d/core/cross/gl/param_cache_gl.h @@ -36,6 +36,7 @@ #define O3D_CORE_CROSS_GL_PARAM_CACHE_GL_H_ #include <map> +#include "core/cross/gl/gl_headers.h" #include "core/cross/param_cache.h" #include "core/cross/gl/effect_gl.h" diff --git a/o3d/core/cross/gl/render_surface_gl.h b/o3d/core/cross/gl/render_surface_gl.h index 56f9544..593b7994 100644 --- a/o3d/core/cross/gl/render_surface_gl.h +++ b/o3d/core/cross/gl/render_surface_gl.h @@ -36,6 +36,7 @@ #ifndef O3D_CORE_CROSS_GL_RENDER_SURFACE_GL_H_ #define O3D_CORE_CROSS_GL_RENDER_SURFACE_GL_H_ +#include "core/cross/gl/gl_headers.h" #include "core/cross/render_surface.h" #include "core/cross/texture.h" diff --git a/o3d/core/cross/gl/renderer_gl.h b/o3d/core/cross/gl/renderer_gl.h index de2a8cb..25e0290 100644 --- a/o3d/core/cross/gl/renderer_gl.h +++ b/o3d/core/cross/gl/renderer_gl.h @@ -37,7 +37,7 @@ #ifndef O3D_CORE_CROSS_GL_RENDERER_GL_H_ #define O3D_CORE_CROSS_GL_RENDERER_GL_H_ -#include <Cg/cg.h> +#include "core/cross/gl/gl_headers.h" #include <build/build_config.h> #include "core/cross/renderer.h" #include "core/cross/renderer_platform.h" diff --git a/o3d/core/cross/gl/sampler_gl.cc b/o3d/core/cross/gl/sampler_gl.cc index 9e432ba2..ab95b05 100644 --- a/o3d/core/cross/gl/sampler_gl.cc +++ b/o3d/core/cross/gl/sampler_gl.cc @@ -32,7 +32,7 @@ // This file contains the implementation for SamplerGL. -// Precompiled header comes before everything else. +#include "core/cross/gl/gl_headers.h" #include "core/cross/error.h" #include "core/cross/gl/renderer_gl.h" #include "core/cross/gl/sampler_gl.h" diff --git a/o3d/core/cross/gl/texture_gl.cc b/o3d/core/cross/gl/texture_gl.cc index 9b4ea7fe4..c168f41 100644 --- a/o3d/core/cross/gl/texture_gl.cc +++ b/o3d/core/cross/gl/texture_gl.cc @@ -33,6 +33,7 @@ // Implementations of the abstract Texture2D and TextureCUBE classes using // the OpenGL graphics API. +#include "core/cross/gl/gl_headers.h" #include "core/cross/error.h" #include "core/cross/types.h" #include "core/cross/pointer_utils.h" diff --git a/o3d/core/cross/gl/texture_gl.h b/o3d/core/cross/gl/texture_gl.h index 3a74b85..579dc07 100644 --- a/o3d/core/cross/gl/texture_gl.h +++ b/o3d/core/cross/gl/texture_gl.h @@ -44,12 +44,6 @@ #pragma warning(disable : 4311) #endif -//#ifdef OS_MACOSX -//#include <OpenGL/gl.h> -//#else -//#include <GL/gl.h> -//#endif - #include "core/cross/bitmap.h" #include "core/cross/texture.h" #include "core/cross/types.h" diff --git a/o3d/core/cross/gl/utils_gl.cc b/o3d/core/cross/gl/utils_gl.cc index 2dd938b..f75abc6 100644 --- a/o3d/core/cross/gl/utils_gl.cc +++ b/o3d/core/cross/gl/utils_gl.cc @@ -33,6 +33,7 @@ #include "core/cross/stream.h" #include "core/cross/types.h" #include "core/cross/gl/utils_gl.h" +#include "core/cross/gl/gl_headers.h" // Required OpenGL extensions: // GL_ARB_vertex_buffer_object diff --git a/o3d/core/cross/precompile.h b/o3d/core/cross/precompile.h index 3e11e99..8a99389 100644 --- a/o3d/core/cross/precompile.h +++ b/o3d/core/cross/precompile.h @@ -40,24 +40,8 @@ #if defined(OS_WIN) #include <windows.h> - -#if defined(RENDERER_D3D9) -#include <d3d9.h> -#include <d3dx9.h> -#endif - #endif // defined(OS_WIN) -#if defined(RENDERER_GL) -#include <GL/glew.h> -#if defined(OS_WIN) -#include <GL/wglew.h> -#endif - -#include <Cg/cg.h> -#include <Cg/cgGL.h> -#endif // defined(RENDERER_GL) - #include <assert.h> #include <algorithm> #include <map> diff --git a/o3d/core/cross/renderer_platform.h b/o3d/core/cross/renderer_platform.h index df54972..f512d9a 100644 --- a/o3d/core/cross/renderer_platform.h +++ b/o3d/core/cross/renderer_platform.h @@ -39,11 +39,14 @@ #include <build/build_config.h> #if defined(OS_MACOSX) +#include "core/cross/gl/gl_headers.h" #include <OpenGL/OpenGL.h> #include <AGL/agl.h> #elif defined(OS_LINUX) +#include "core/cross/gl/gl_headers.h" #include <GL/glx.h> #elif defined(OS_WIN) && defined(RENDERER_GL) +#include "core/cross/gl/gl_headers.h" #include <gl/GL.h> #endif |