mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2025-01-11 00:50:10 +00:00
Removed mutex implementation.
We added this to support earlier versions of hbr, but it is no longer needed.
This commit is contained in:
parent
e4afec5388
commit
2a12b21ab2
@ -104,5 +104,3 @@ if(MAYA_FOUND AND (NOT APPLE))
|
||||
add_subdirectory(mayaPtexViewer)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(mutex)
|
||||
|
@ -57,8 +57,6 @@
|
||||
#include <D3D11.h>
|
||||
#include <D3Dcompiler.h>
|
||||
|
||||
#include "../../regression/common/mutex.h" // XXX: Fixme
|
||||
|
||||
#include <osd/error.h>
|
||||
#include <osd/vertex.h>
|
||||
#include <osd/d3d11DrawContext.h>
|
||||
|
@ -124,17 +124,13 @@ a particular purpose and non-infringement.
|
||||
//
|
||||
// ### OpenSubdiv Includes
|
||||
|
||||
// The mutex header provides a cross platform mutex implementation; the vertex
|
||||
// and mesh headers provide abstract representations of verts and meshes; the
|
||||
// The vertex and mesh headers provide abstract representations
|
||||
// of verts and meshes; the
|
||||
// element array buffer provides an abstract representation of an index buffer;
|
||||
// and finally, the cpu dispatcher is how subdivision work is dispatched to the
|
||||
// CPU.
|
||||
//
|
||||
|
||||
|
||||
// XXX: Fixme
|
||||
#include "../../regression/common/mutex.h"
|
||||
|
||||
#include <far/meshFactory.h>
|
||||
|
||||
#include <osd/vertex.h>
|
||||
|
@ -57,8 +57,6 @@
|
||||
#ifndef EXAMPLES_MAYAVIEWER_HBRUTIL_H_
|
||||
#define EXAMPLES_MAYAVIEWER_HBRUTIL_H_
|
||||
|
||||
#include "../../regression/common/mutex.h" // XXX
|
||||
|
||||
#include <far/meshFactory.h> // need to define HBR_ADAPTIVE
|
||||
#include <hbr/mesh.h>
|
||||
#include <osd/vertex.h>
|
||||
|
@ -57,8 +57,6 @@
|
||||
#ifndef EXAMPLES_MAYAPTEXVIEWER_OSDPTEXMESHDATA_H_
|
||||
#define EXAMPLES_MAYAPTEXVIEWER_OSDPTEXMESHDATA_H_
|
||||
|
||||
#include "../../regression/common/mutex.h" // XXX
|
||||
|
||||
#include <far/meshFactory.h>
|
||||
#include <osd/error.h>
|
||||
#include <osd/vertex.h>
|
||||
|
@ -57,8 +57,6 @@
|
||||
#ifndef EXAMPLES_MAYAVIEWER_HBRUTIL_H_
|
||||
#define EXAMPLES_MAYAVIEWER_HBRUTIL_H_
|
||||
|
||||
#include "../../regression/common/mutex.h" // XXX
|
||||
|
||||
#include <far/meshFactory.h> // need to define HBR_ADAPTIVE
|
||||
#include <hbr/mesh.h>
|
||||
#include <osd/vertex.h>
|
||||
|
@ -57,8 +57,6 @@
|
||||
#ifndef EXAMPLES_MAYAVIEWER_OSDMESHDATA_H_
|
||||
#define EXAMPLES_MAYAVIEWER_OSDMESHDATA_H_
|
||||
|
||||
#include "../../regression/common/mutex.h" // XXX
|
||||
|
||||
#include <osd/error.h>
|
||||
#include <osd/vertex.h>
|
||||
#include <osd/glMesh.h>
|
||||
|
@ -1,59 +0,0 @@
|
||||
#
|
||||
# Copyright (C) Pixar. All rights reserved.
|
||||
#
|
||||
# This license governs use of the accompanying software. If you
|
||||
# use the software, you accept this license. If you do not accept
|
||||
# the license, do not use the software.
|
||||
#
|
||||
# 1. Definitions
|
||||
# The terms "reproduce," "reproduction," "derivative works," and
|
||||
# "distribution" have the same meaning here as under U.S.
|
||||
# copyright law. A "contribution" is the original software, or
|
||||
# any additions or changes to the software.
|
||||
# A "contributor" is any person or entity that distributes its
|
||||
# contribution under this license.
|
||||
# "Licensed patents" are a contributor's patent claims that read
|
||||
# directly on its contribution.
|
||||
#
|
||||
# 2. Grant of Rights
|
||||
# (A) Copyright Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free copyright license to reproduce its contribution,
|
||||
# prepare derivative works of its contribution, and distribute
|
||||
# its contribution or any derivative works that you create.
|
||||
# (B) Patent Grant- Subject to the terms of this license,
|
||||
# including the license conditions and limitations in section 3,
|
||||
# each contributor grants you a non-exclusive, worldwide,
|
||||
# royalty-free license under its licensed patents to make, have
|
||||
# made, use, sell, offer for sale, import, and/or otherwise
|
||||
# dispose of its contribution in the software or derivative works
|
||||
# of the contribution in the software.
|
||||
#
|
||||
# 3. Conditions and Limitations
|
||||
# (A) No Trademark License- This license does not grant you
|
||||
# rights to use any contributor's name, logo, or trademarks.
|
||||
# (B) If you bring a patent claim against any contributor over
|
||||
# patents that you claim are infringed by the software, your
|
||||
# patent license from such contributor to the software ends
|
||||
# automatically.
|
||||
# (C) If you distribute any portion of the software, you must
|
||||
# retain all copyright, patent, trademark, and attribution
|
||||
# notices that are present in the software.
|
||||
# (D) If you distribute any portion of the software in source
|
||||
# code form, you may do so only under this license by including a
|
||||
# complete copy of this license with your distribution. If you
|
||||
# distribute any portion of the software in compiled or object
|
||||
# code form, you may only do so under a license that complies
|
||||
# with this license.
|
||||
# (E) The software is licensed "as-is." You bear the risk of
|
||||
# using it. The contributors give no express warranties,
|
||||
# guarantees or conditions. You may have additional consumer
|
||||
# rights under your local laws which this license cannot change.
|
||||
# To the extent permitted under your local laws, the contributors
|
||||
# exclude the implied warranties of merchantability, fitness for
|
||||
# a particular purpose and non-infringement.
|
||||
#
|
||||
|
||||
add_library(example_mutex mutex.cpp mutex.h)
|
||||
|
@ -1,59 +0,0 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
|
||||
#include "mutex.h"
|
||||
|
@ -1,140 +0,0 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
|
||||
#ifndef MUTEX_H
|
||||
#define MUTEX_H
|
||||
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
class Mutex {
|
||||
public:
|
||||
|
||||
Mutex(int spincount=0) {
|
||||
if (spincount)
|
||||
InitializeCriticalSectionAndSpinCount(&_cs, spincount);
|
||||
else
|
||||
InitializeCriticalSection(&_cs);
|
||||
}
|
||||
|
||||
void Lock() {
|
||||
EnterCriticalSection(&_cs);
|
||||
}
|
||||
|
||||
bool Try() {
|
||||
return TryEnterCriticalSection(&_cs)!=0;
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
LeaveCriticalSection(&_cs);
|
||||
}
|
||||
|
||||
private:
|
||||
Mutex(Mutex const &);
|
||||
Mutex & operator=(Mutex const &);
|
||||
|
||||
CRITICAL_SECTION _cs;
|
||||
};
|
||||
|
||||
#elif defined(__APPLE__) or defined(__linux)
|
||||
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
|
||||
class Mutex {
|
||||
public:
|
||||
|
||||
Mutex(int spincount=0) : _spincount(spincount) {
|
||||
assert( pthread_mutex_init(&_mutex,NULL) );
|
||||
}
|
||||
|
||||
~Mutex() {
|
||||
assert( pthread_mutex_destroy(&_mutex)==0 );
|
||||
}
|
||||
|
||||
void Lock() {
|
||||
if (_spincount) {
|
||||
int spincount = _spincount;
|
||||
while (spincount--)
|
||||
if (pthread_mutex_trylock(&_mutex) == 0)
|
||||
return;
|
||||
|
||||
}
|
||||
assert( pthread_mutex_lock(&_mutex)==0 );
|
||||
}
|
||||
|
||||
bool Try() {
|
||||
return (pthread_mutex_trylock(&_mutex) == 0);
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
assert(pthread_mutex_unlock(&_mutex)==0);
|
||||
}
|
||||
|
||||
private:
|
||||
Mutex(Mutex const &);
|
||||
Mutex & operator=(Mutex const &);
|
||||
|
||||
pthread_mutex_t _mutex;
|
||||
const int _spincount;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // MUTEX_H
|
@ -124,17 +124,13 @@ a particular purpose and non-infringement.
|
||||
//
|
||||
// ### OpenSubdiv Includes
|
||||
|
||||
// The mutex header provides a cross platform mutex implementation; the vertex
|
||||
// and mesh headers provide abstract representations of verts and meshes; the
|
||||
// The vertex and mesh headers provide abstract representations
|
||||
// of verts and meshes; the
|
||||
// element array buffer provides an abstract representation of an index buffer;
|
||||
// and finally, the cpu dispatcher is how subdivision work is dispatched to the
|
||||
// CPU.
|
||||
//
|
||||
|
||||
|
||||
// XXX: Fixme
|
||||
#include "../../regression/common/mutex.h"
|
||||
|
||||
#include <far/meshFactory.h>
|
||||
|
||||
#include <osd/vertex.h>
|
||||
|
@ -124,16 +124,13 @@ a particular purpose and non-infringement.
|
||||
//
|
||||
// ### OpenSubdiv Includes
|
||||
|
||||
// The mutex header provides a cross platform mutex implementation; the vertex
|
||||
// and mesh headers provide abstract representations of verts and meshes; the
|
||||
// The vertex and mesh headers provide abstract representations
|
||||
// of verts and meshes; the
|
||||
// element array buffer provides an abstract representation of an index buffer;
|
||||
// and finally, the cpu dispatcher is how subdivision work is dispatched to the
|
||||
// CPU.
|
||||
//
|
||||
|
||||
|
||||
#include <osd/mutex.h>
|
||||
|
||||
#include <osd/vertex.h>
|
||||
#include <osd/mesh.h>
|
||||
#include <osd/elementArrayBuffer.h>
|
||||
|
@ -57,7 +57,6 @@
|
||||
|
||||
#include <Python.h>
|
||||
#include <numpy/arrayobject.h>
|
||||
#include <common/mutex.h>
|
||||
#include <far/meshFactory.h>
|
||||
#include <osd/vertex.h>
|
||||
#include <osd/cpuComputeContext.h>
|
||||
|
@ -1,83 +0,0 @@
|
||||
//
|
||||
// Copyright (C) Pixar. All rights reserved.
|
||||
//
|
||||
// This license governs use of the accompanying software. If you
|
||||
// use the software, you accept this license. If you do not accept
|
||||
// the license, do not use the software.
|
||||
//
|
||||
// 1. Definitions
|
||||
// The terms "reproduce," "reproduction," "derivative works," and
|
||||
// "distribution" have the same meaning here as under U.S.
|
||||
// copyright law. A "contribution" is the original software, or
|
||||
// any additions or changes to the software.
|
||||
// A "contributor" is any person or entity that distributes its
|
||||
// contribution under this license.
|
||||
// "Licensed patents" are a contributor's patent claims that read
|
||||
// directly on its contribution.
|
||||
//
|
||||
// 2. Grant of Rights
|
||||
// (A) Copyright Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free copyright license to reproduce its contribution,
|
||||
// prepare derivative works of its contribution, and distribute
|
||||
// its contribution or any derivative works that you create.
|
||||
// (B) Patent Grant- Subject to the terms of this license,
|
||||
// including the license conditions and limitations in section 3,
|
||||
// each contributor grants you a non-exclusive, worldwide,
|
||||
// royalty-free license under its licensed patents to make, have
|
||||
// made, use, sell, offer for sale, import, and/or otherwise
|
||||
// dispose of its contribution in the software or derivative works
|
||||
// of the contribution in the software.
|
||||
//
|
||||
// 3. Conditions and Limitations
|
||||
// (A) No Trademark License- This license does not grant you
|
||||
// rights to use any contributor's name, logo, or trademarks.
|
||||
// (B) If you bring a patent claim against any contributor over
|
||||
// patents that you claim are infringed by the software, your
|
||||
// patent license from such contributor to the software ends
|
||||
// automatically.
|
||||
// (C) If you distribute any portion of the software, you must
|
||||
// retain all copyright, patent, trademark, and attribution
|
||||
// notices that are present in the software.
|
||||
// (D) If you distribute any portion of the software in source
|
||||
// code form, you may do so only under this license by including a
|
||||
// complete copy of this license with your distribution. If you
|
||||
// distribute any portion of the software in compiled or object
|
||||
// code form, you may only do so under a license that complies
|
||||
// with this license.
|
||||
// (E) The software is licensed "as-is." You bear the risk of
|
||||
// using it. The contributors give no express warranties,
|
||||
// guarantees or conditions. You may have additional consumer
|
||||
// rights under your local laws which this license cannot change.
|
||||
// To the extent permitted under your local laws, the contributors
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
|
||||
#ifndef MUTEX_H
|
||||
#define MUTEX_H
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
// XXXX manuelk : for now we don't actually need this mutex
|
||||
// but we will eventually implement a cross-platform one.
|
||||
|
||||
class Mutex {
|
||||
public:
|
||||
|
||||
void Lock() { };
|
||||
|
||||
void Unlock() { };
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif // OSD_MUTEX_H
|
@ -57,8 +57,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../common/mutex.h"
|
||||
|
||||
#include <far/meshFactory.h>
|
||||
#include <far/dispatcher.h>
|
||||
|
||||
|
@ -59,8 +59,6 @@
|
||||
#include <typeinfo>
|
||||
#include <iostream>
|
||||
|
||||
#include "../common/mutex.h"
|
||||
|
||||
#include <hbr/mesh.h>
|
||||
#include <hbr/face.h>
|
||||
#include <hbr/vertex.h>
|
||||
|
@ -57,8 +57,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../common/mutex.h"
|
||||
|
||||
#include <hbr/mesh.h>
|
||||
#include <hbr/face.h>
|
||||
#include <hbr/vertex.h>
|
||||
|
@ -79,8 +79,6 @@
|
||||
#include <stdio.h>
|
||||
#include <cassert>
|
||||
|
||||
#include "../common/mutex.h"
|
||||
|
||||
#include <far/meshFactory.h>
|
||||
|
||||
#include <osd/vertex.h>
|
||||
|
Loading…
Reference in New Issue
Block a user